/* Atlas — user documentation theme for MkDocs Material.
   Mirrors the Atlas web app (Willbanks Logistics): Tailwind Slate + Blue palette,
   Space Grotesk headings + IBM Plex Sans body, blue-600 accent, soft rounded surfaces.
   Palette: Slate-900 #0f172a, Slate-800 #1e293b, Blue-600 #2563eb (accent),
   Blue-400 #60a5fa, Sky #38bdf8, Cyan #0e7490. */

/* Fonts — same families the Atlas app loads, via Google Fonts (google's privacy-friendly
   css2 endpoint; no analytics). Space Grotesk = display/headings, IBM Plex Sans = body. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --atlas-slate-950: #020617;
  --atlas-slate-900: #0f172a;
  --atlas-slate-800: #1e293b;
  --atlas-slate-700: #334155;
  --atlas-slate-500: #64748b;
  --atlas-slate-300: #cbd5e1;
  --atlas-slate-100: #f1f5f9;
  --atlas-blue-700: #1d4ed8;
  --atlas-blue-600: #2563eb;
  --atlas-blue-400: #60a5fa;
  --atlas-sky: #38bdf8;
  --atlas-cyan: #0e7490;

  --md-code-hl-color: color-mix(in srgb, var(--atlas-blue-600) 30%, transparent);
}

/* Light scheme */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: var(--atlas-slate-800);
  --md-primary-fg-color--dark: var(--atlas-slate-900);
  --md-accent-fg-color: var(--atlas-blue-600);
  --md-typeset-a-color: var(--atlas-blue-700);
}

/* Dark scheme — Slate-950 canvas; lighter blue for links/accent so they don't
   vibrate on dark (Material dark-theme guidance); 87% white body text. */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: var(--atlas-slate-800);
  --md-accent-fg-color: var(--atlas-blue-400);
  --md-default-bg-color: var(--atlas-slate-950);
  --md-default-fg-color: rgba(255, 255, 255, 0.87);
  --md-typeset-a-color: var(--atlas-blue-400);
  --md-code-bg-color: #0b1220;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography: app font stack + comfortable reading scale */
body,
.md-typeset {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, Arial, sans-serif;
}

.md-typeset {
  line-height: 1.7;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-header__title,
.md-tabs__link {
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
}

.md-typeset h1 {
  color: var(--atlas-slate-900);
  font-weight: 700;
  letter-spacing: -0.02em;
}

[data-md-color-scheme="slate"] .md-typeset h1 {
  color: rgba(255, 255, 255, 0.95);
}

.md-typeset h2 {
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid color-mix(in srgb, var(--atlas-slate-500) 30%, transparent);
  padding-bottom: 0.3rem;
}

.md-typeset h3 {
  font-weight: 600;
}

/* Lead paragraph: the "role · last-updated" line under each H1 */
.md-typeset h1 + p:not(:has(img)),
.md-typeset h1 + p:has(img) + p {
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
}

/* Measure cap: prose at ~70ch; code, tables and grids exempt */
.md-typeset > p,
.md-typeset > ul:not(.atlas-exempt),
.md-typeset > ol,
.md-typeset > blockquote,
.md-typeset .admonition p {
  max-width: 72ch;
}

/* Tables: slate header band, subtle row striping */
.md-typeset table:not([class]) th {
  background-color: var(--atlas-slate-800);
  color: #ffffff;
}

.md-typeset table:not([class]) tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--atlas-slate-100) 55%, transparent);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.03);
}

/* ---------- Hero, cards, tabs, polish ---------- */

/* Hero on the landing page */
.atlas-hero {
  border-left: 4px solid var(--atlas-blue-600);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.atlas-tagline {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--atlas-slate-900);
  margin-bottom: 0.4rem;
}

[data-md-color-scheme="slate"] .atlas-tagline {
  color: #ffffff;
}

/* Native Material grid cards, Atlas-themed. Structure comes from the theme;
   we only colour it, so it survives theme updates. */
.md-typeset .grid.cards > ul > li {
  border: 1px solid color-mix(in srgb, var(--atlas-slate-500) 32%, transparent);
  border-radius: 12px;
  color: #4a5461;
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li {
  color: #cbd5e1;
}

.md-typeset .grid.cards > ul > li img {
  display: block;
  margin: 0 auto 0.4rem;
}

.md-typeset .grid.cards > ul > li > p {
  text-align: left;
}

.md-typeset .grid.cards strong a {
  color: var(--atlas-slate-900);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards strong a {
  color: rgba(255, 255, 255, 0.95);
}

/* Whole-card click: stretch the title link over the card */
.md-typeset .grid.cards > ul > li {
  position: relative;
}

.md-typeset .grid.cards strong a::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Hover lift (respects reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .md-typeset .grid.cards > ul > li {
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  }

  .md-typeset .grid.cards > ul > li:hover {
    border-color: var(--atlas-blue-600);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px color-mix(in srgb, var(--atlas-slate-900) 18%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .grid.cards > ul > li:hover {
    border-color: var(--atlas-blue-600);
  }
}

/* Navigation tabs: blue active indicator */
.md-tabs__link--active {
  border-bottom: 3px solid var(--atlas-blue-400);
  font-weight: 700;
}

.md-tabs__link:hover {
  color: #ffffff;
}

/* One-line top bar via CSS grid (desktop): logo left · tabs centred · controls right.
   Below 76.25em it falls back to the untouched Material default (drawer + logo left). */
@media screen and (min-width: 76.25em) {
  .md-header {
    display: grid;
    grid-template-columns:
      minmax(10%, 30%)      /* 1: logo zone, left */
      minmax(0, 1fr)        /* 2: nav tabs, centred */
      max-content           /* 3: theme toggle */
      minmax(0, 12rem)      /* 4: search */
      max-content;          /* 5: repo link */
    column-gap: 0.6rem;
    align-items: center;
  }

  .md-header__inner {
    display: contents;
  }

  .md-header__title {
    display: none;
  }

  .md-header__button.md-logo {
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
    margin: 0 0 0 0.6rem;
  }

  .md-header__button.md-logo img {
    height: 1.7rem;
    width: auto;
  }

  .md-tabs {
    grid-row: 1;
    grid-column: 2;
    justify-self: center;
    position: static;
    width: auto;
    max-width: 100%;
    background-color: transparent;
    overflow: hidden;
    white-space: nowrap;
  }

  .md-header__option {
    grid-row: 1;
    grid-column: 3;
  }

  .md-search {
    grid-row: 1;
    grid-column: 4;
  }

  .md-header__source {
    grid-row: 1;
    grid-column: 5;
    justify-self: end;
    margin-right: 0.6rem;
    width: auto;
  }

  .md-tabs__item {
    height: 3rem;
    display: inline-flex;
    align-items: center;
  }

  .md-tabs__link {
    margin-top: 0;
    line-height: 3rem;
  }

  .md-progress {
    position: absolute;
    grid-column: 1 / -1;
  }
}

/* Section icons on standard pages: breathing room + size cap on small screens */
.md-typeset img[src*="img/section/"] {
  margin: 0 0 1rem 1.25rem;
}

@media (max-width: 600px) {
  .md-typeset img[src*="img/section/"] {
    float: none !important;
    display: block;
    margin: 0 auto 1rem;
  }
}

/* Admonitions in Atlas colours */
.md-typeset .admonition.note,
.md-typeset details.note {
  border-color: var(--atlas-blue-600);
}

.md-typeset .note > .admonition-title,
.md-typeset .note > summary {
  background-color: color-mix(in srgb, var(--atlas-blue-600) 12%, transparent);
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-color: var(--atlas-cyan);
}

.md-typeset .tip > .admonition-title,
.md-typeset .tip > summary {
  background-color: color-mix(in srgb, var(--atlas-cyan) 14%, transparent);
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-color: #f59e0b;
}

.md-typeset .warning > .admonition-title,
.md-typeset .warning > summary {
  background-color: color-mix(in srgb, #f59e0b 14%, transparent);
}

.md-typeset .admonition.danger,
.md-typeset details.danger {
  border-color: #dc2626;
}

.md-typeset .danger > .admonition-title,
.md-typeset .danger > summary {
  background-color: color-mix(in srgb, #dc2626 12%, transparent);
}

/* Tables: rounded container + row hover */
.md-typeset table:not([class]) {
  border-radius: 8px;
  overflow: hidden;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: color-mix(in srgb, var(--atlas-blue-600) 8%, transparent);
}

/* Links: blue hover */
.md-typeset a:hover {
  color: var(--atlas-blue-600);
}

/* Blockquotes: blue accent */
.md-typeset blockquote {
  border-left: 3px solid var(--atlas-blue-600);
  color: inherit;
}

/* Inline "kbd"-style keys and status pills used in the guides */
.md-typeset kbd {
  border-radius: 6px;
}

.atlas-pill {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.atlas-pill--draft { background: color-mix(in srgb, var(--atlas-slate-500) 20%, transparent); color: var(--atlas-slate-700); }
.atlas-pill--approved { background: color-mix(in srgb, #16a34a 18%, transparent); color: #166534; }
.atlas-pill--locked { background: color-mix(in srgb, #dc2626 16%, transparent); color: #991b1b; }
.atlas-pill--otr { background: color-mix(in srgb, #7c3aed 16%, transparent); color: #6d28d9; }

[data-md-color-scheme="slate"] .atlas-pill--draft { color: var(--atlas-slate-300); }
[data-md-color-scheme="slate"] .atlas-pill--approved { color: #86efac; }
[data-md-color-scheme="slate"] .atlas-pill--locked { color: #fca5a5; }
[data-md-color-scheme="slate"] .atlas-pill--otr { color: #c4b5fd; }
