/*
 * Website look of the SmartManipulator-X documentation (mkdocs-material).
 *
 * Screen only: print.css styles the PDF manual, and every rule here that
 * could change the printed layout is inside @media screen. The banner and
 * the cards (overrides/main.html) exist only on the home page, which the
 * PDF does not use.
 */

/* ---------- Brand colors (palette "custom" in mkdocs.yml) ---------- */

:root,
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #2b3a9c;
  --md-primary-fg-color--light: #4f5fc4;
  --md-primary-fg-color--dark: #1a237e;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #0097b8;
  --md-accent-fg-color--transparent: rgba(0, 151, 184, 0.1);
  --smx-hero-from: #1a237e;
  --smx-hero-to: #0b5d84;
  --smx-card-bg: #ffffff;
  --smx-card-border: #e2e5ef;
  --smx-card-shadow: 0 1px 2px rgba(16, 24, 64, 0.06), 0 6px 18px rgba(16, 24, 64, 0.06);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #1d2566;
  --md-primary-fg-color--light: #3949ab;
  --md-primary-fg-color--dark: #121845;
  --md-primary-bg-color: #eef0ff;
  --md-accent-fg-color: #38d6f5;
  --md-accent-fg-color--transparent: rgba(56, 214, 245, 0.12);
  --md-typeset-a-color: #8fa3ff;
  --md-default-bg-color: #12141c;
  --smx-hero-from: #141a52;
  --smx-hero-to: #0a3d57;
  --smx-card-bg: #1a1d29;
  --smx-card-border: #2b2f40;
  --smx-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@media screen {
  /* ---------- Header, tabs ---------- */

  .md-header {
    background: linear-gradient(90deg, var(--md-primary-fg-color--dark), var(--md-primary-fg-color));
  }

  .md-tabs {
    background: var(--md-primary-fg-color);
  }

  .md-tabs__link {
    font-weight: 600;
    opacity: 0.8;
  }

  /* Material shows the tabs only from 1220 px; from 960 px they fit as well,
     so the sections stay visible in narrower windows (e.g. the VS Code
     browser) instead of only behind the menu button. */
  @media (min-width: 60em) and (max-width: 76.234375em) {
    .md-tabs {
      display: block;
    }
  }

  /* PDF button in the header (overrides/partials/header.html) */
  .md-header__button.smx-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0 0.2rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    color: var(--md-primary-bg-color);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 1;
    transition: background-color 125ms, border-color 125ms;
  }

  .md-header__button.smx-pdf-button svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
  }

  .md-header__button.smx-pdf-button:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.14);
  }

  /* ---------- Content ---------- */

  .md-typeset h1 {
    color: var(--md-default-fg-color);
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .md-typeset h2 {
    font-weight: 650;
    letter-spacing: -0.005em;
  }

  .md-typeset h2,
  .md-typeset h3 {
    color: var(--md-default-fg-color);
  }

  /* Tables: rounded frame, tinted header row */
  .md-typeset table:not([class]) {
    border: 1px solid var(--smx-card-border);
    border-radius: 0.4rem;
    box-shadow: none;
    font-size: 0.68rem;
  }

  .md-typeset table:not([class]) th {
    background: var(--md-accent-fg-color--transparent);
    color: var(--md-default-fg-color);
    font-weight: 650;
  }

  .md-typeset table:not([class]) tr:hover {
    background: var(--md-accent-fg-color--transparent);
    box-shadow: none;
  }

  /* Figures (tools/docs/hooks.py) and diagrams */
  .md-typeset figure.smx-figure img {
    border: 1px solid var(--smx-card-border);
    border-radius: 0.4rem;
    background: #fff;
  }

  .md-typeset .mermaid {
    padding: 0.8rem;
    border: 1px solid var(--smx-card-border);
    border-radius: 0.4rem;
    background: var(--smx-card-bg);
  }

  .md-typeset pre > code {
    border-radius: 0.4rem;
  }

  /* ---------- Home page banner (overrides/main.html) ---------- */

  .smx-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
      radial-gradient(circle at 85% 20%, rgba(56, 214, 245, 0.28), transparent 45%),
      linear-gradient(135deg, var(--smx-hero-from), var(--smx-hero-to));
  }

  /* fine grid pattern */
  .smx-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
  }

  .smx-hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 2.4rem;
    align-items: center;
    padding: 3.2rem 0.8rem 3.4rem;
  }

  .smx-hero__kicker {
    margin: 0 0 0.5rem;
    color: #8be9fd;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .smx-hero__title {
    margin: 0 0 0.8rem;
    color: #fff;
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .smx-hero__lead {
    max-width: 32rem;
    margin: 0 0 1.4rem;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .smx-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .md-typeset .smx-hero__button,
  .smx-hero__button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
  }

  .smx-hero__button svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
  }

  .smx-hero__button.md-button--primary {
    border-color: #fff;
    background: #fff;
    color: var(--md-primary-fg-color--dark);
  }

  .smx-hero__button.md-button--primary:hover {
    border-color: #8be9fd;
    background: #8be9fd;
    color: #0d1445;
  }

  .smx-hero__button--ghost {
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
  }

  .smx-hero__button--ghost:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .smx-hero__facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 1.8rem 0 0;
    padding: 0;
    list-style: none;
  }

  .smx-hero__facts li {
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
  }

  .smx-hero__facts strong {
    display: block;
    color: #fff;
    font-size: 0.8rem;
  }

  .smx-hero__facts span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.6rem;
  }

  .smx-hero__figure {
    margin: 0;
    padding: 0.7rem;
    border-radius: 0.8rem;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }

  .smx-hero__figure img {
    display: block;
    width: 100%;
    height: auto;
  }

  /* ---------- Home page section cards ---------- */

  /* width: .md-grid centers with auto margins, which in the flex column of
     .md-container would shrink the grid to four columns side by side. */
  .smx-cards {
    box-sizing: border-box;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
    gap: 0.9rem;
    margin-top: -1.6rem;
    padding: 0 0.8rem;
    position: relative;
  }

  .smx-card {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.1rem 0.9rem;
    border: 1px solid var(--smx-card-border);
    border-radius: 0.7rem;
    background: var(--smx-card-bg);
    box-shadow: var(--smx-card-shadow);
    transition: transform 150ms, box-shadow 150ms, border-color 150ms;
  }

  .smx-card:hover {
    transform: translateY(-2px);
    border-color: var(--md-accent-fg-color);
  }

  .smx-card__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .smx-card__icon {
    display: inline-flex;
    flex: none;
    padding: 0.4rem;
    border-radius: 0.5rem;
    background: var(--md-accent-fg-color--transparent);
    color: var(--md-accent-fg-color);
  }

  .smx-card__icon svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
  }

  .smx-card__title {
    margin: 0;
    color: var(--md-default-fg-color);
    font-size: 0.85rem;
    font-weight: 700;
  }

  .smx-card__text {
    margin: 0.6rem 0 0.4rem;
    color: var(--md-default-fg-color--light);
    font-size: 0.66rem;
    line-height: 1.5;
  }

  .smx-card__links {
    margin: 0;
    padding: 0.3rem 0 0;
    list-style: none;
    font-size: 0.7rem;
  }

  .smx-card__links li {
    border-top: 1px solid var(--smx-card-border);
  }

  .smx-card__links a {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    color: var(--md-typeset-a-color);
    font-weight: 500;
  }

  .smx-card__links a::after {
    content: "\2192";
    opacity: 0.5;
    transition: transform 150ms, opacity 150ms;
  }

  .smx-card__links a:hover::after {
    transform: translateX(3px);
    opacity: 1;
  }

  @media (max-width: 59.984375em) {
    .smx-hero__inner {
      grid-template-columns: 1fr;
      gap: 1.6rem;
      padding: 2.2rem 0.8rem 2.8rem;
    }

    .smx-hero__title {
      font-size: 1.9rem;
    }

    .smx-hero__facts {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* the PDF button stays reachable from the banner; keep the header tidy */
    .md-header__button.smx-pdf-button span {
      display: none;
    }
  }
}
