/* MobiLab Brand — MkDocs Material Overrides
   Colors, typography, and component styles aligned with the MobiLab brand guide. */

/* ── @font-face declarations — served from brand/fonts via symlink ── */

@font-face { font-family: 'Aeonik'; src: url('fonts/aeonik-regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aeonik'; src: url('fonts/aeonik-medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aeonik'; src: url('fonts/aeonik-semibold.otf') format('opentype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aeonik'; src: url('fonts/aeonik-bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }

@font-face { font-family: 'Inter'; src: url('fonts/Inter-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }

/* ── CSS Variables ── */

:root {
  /* Main colors */
  --ml-white: #FFFFFF;
  --ml-dark-blue: #192832;
  --ml-light-grey: #D8DCDE;
  --ml-teal: #114961;

  /* Font colors */
  --ml-text-primary: #192832;
  --ml-text-subtitle: #3D627B;

  /* Container backgrounds */
  --ml-container-light: #F2F2F2;
  --ml-container-mid: #D9D9D9;
  --ml-container-blue-light: #E2EBF1;
  --ml-container-blue-mid: #B6CCDB;

  /* Highlight colors */
  --ml-green: #00A89D;
  --ml-blue: #2E7EF2;
  --ml-purple: #4653A3;

  /* Status colors */
  --ml-status-positive: #74C877;
  --ml-status-warning: #FBBB33;
  --ml-status-negative: #ED4E38;

  /* The two brand roles that land as text, in the value each scheme needs. On a
     light surface neither corporate hex reaches WCAG AA at body size — contrast
     is a luminance property, so only a darker ink gets there — and these carry
     the same hue and saturation at the lightness legibility needs, sized against
     the *darkest* light surface each lands on rather than against white, since an
     ink tuned on white still fails inside an admonition. Both light values are
     recorded in brand/brand-guide.md, so decks and documents keep the corporate
     theme. The dark scheme retunes them below: there the corporate hex already
     clears AA, so these are the text role, not a light-only variant, and every
     rule that paints Accent 1 or a link reads them rather than --ml-green /
     --ml-blue, which keep one meaning — the canonical palette — in both schemes. */
  --ml-green-text: #00756D;   /* Accent 1 as text — 4.62:1 worst light surface */
  --ml-blue-text: #0E62DD;    /* Hyperlink / Accent 2 — 4.56:1 worst light surface */

  /* The tip admonition's title follows Accent 1; the dark scheme retunes it. */
  --ml-tip-title: var(--ml-green-text);

  /* Typography stacks */
  --ml-font-heading: 'Aeonik', 'Outfit', 'DM Sans', Arial, sans-serif;
  --ml-font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* MkDocs Material theme integration */
  --md-primary-fg-color: #192832;
  --md-primary-fg-color--light: #114961;
  --md-primary-fg-color--dark: #192832;
  --md-accent-fg-color: #00A89D;
  --md-accent-fg-color--transparent: rgba(0, 168, 157, 0.1);
  --md-typeset-a-color: var(--ml-blue-text);
}

/* Override MkDocs Material scheme-level variables (higher specificity than :root).
   Material paints its accent token on whatever component asks for it — inline code
   inside a hovered or focused link, the heading permalink, a search hit, the
   back-to-top label on its accent fill — so the light scheme hands the accent the
   text-role ink here, on <body>, and every consumer inside inherits it, including
   components no rule in this file names. The exceptions are the surfaces that are
   *dark* inside a light page; they name themselves in the next rule. */
[data-md-color-scheme="default"] {
  --md-typeset-a-color: var(--ml-blue-text);
  --md-accent-fg-color: var(--ml-green-text);
}

/* Dark surfaces inside the light page: the corporate hex measures 5.10:1 on
   --ml-dark-blue where the text-role ink measures 2.71:1, under the 3:1 WCAG
   1.4.11 floor for a focus indicator, so these keep Accent 1 as it is. Scoped to
   the header *button* rather than the header, because Material nests the search
   overlay inside <header> and its hit highlighting is a light-surface consumer.
   The footer carries no accent consumer until navigation.footer is enabled; it is
   named so that one arrives correct. */
[data-md-color-scheme="default"] .md-header__button,
[data-md-color-scheme="default"] .md-footer,
[data-md-color-scheme="default"] .md-typeset pre > code {
  --md-accent-fg-color: var(--ml-green);
}

/* The dark scheme retunes the brand tokens rather than the rules that use them:
   the token values below are the dark-scheme counterparts of the light ones, so
   every rule further down this file follows the scheme with no scheme-specific
   copy. Tokens that are already dark-scheme-safe (--ml-dark-blue, --ml-white,
   --ml-green) keep their brand values, and a token no rule below consumes is
   not retuned here — a dark value with no consumer is dead code that reads as
   a fix. Each ink clears WCAG AA (4.5:1) against the surface it lands on. */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #192832;
  --md-accent-fg-color: #08E8DE;
  --md-typeset-a-color: var(--ml-blue-text);

  --ml-green-text: #00A89D;        /* Accent 1 as text — the corporate hex, 5.4:1 */
  --ml-blue-text: #5A9EF7;         /* link ink — 5.9:1 */

  --ml-text-primary: #E3E9ED;      /* body + headings — 13.1:1 on the slate page */
  --ml-teal: #7BB4CC;              /* link hover, admonition titles — 7.1:1 */
  --ml-light-grey: #3B444D;        /* table cell rules */
  --ml-container-light: #262B33;   /* inline code, striped rows */
  --ml-container-blue-light: #1E2C38;  /* admonition body, row hover */
  --ml-status-negative: #FF7A66;   /* warning / danger ink — 6.5:1 */
  --ml-tip-title: #3FD3C6;         /* tip title + icon — 8.7:1 */
}

/* ── Header & Navigation ── */

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

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

/* ── Typography ── */

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-family: var(--ml-font-heading);
  color: var(--ml-text-primary);
  font-weight: 600;
}

.md-typeset h1 { font-size: 2rem; line-height: 1.2; }
.md-typeset h2 { font-size: 1.6rem; line-height: 1.2; }
.md-typeset h3 { font-size: 1.25rem; line-height: 1.3; }

.md-typeset {
  font-family: var(--ml-font-body);
  color: var(--ml-text-primary);
  line-height: 1.5;
}

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

/* Keyboard focus takes the hover ink rather than Material's accent: a focus ring
   is held, not passed through, and the two states diverging is its own defect. */
.md-typeset a:hover,
.md-typeset a:focus {
  color: var(--ml-teal);
}

/* Active nav — MobiLab green accent */
.md-nav__link--active,
.md-nav__link:is([aria-current]) {
  color: var(--ml-green-text) !important;
  font-weight: 600;
}

/* Nav hover and keyboard focus, stated rather than inherited: the light scheme's
   accent already resolves to this same ink, but the dark scheme's does not, and in
   the sidebar the hovered row sitting beside the active one is what makes the two
   agreeing worth naming. --ml-green-text carries both — Accent 1's text value in
   light, the corporate hex in dark — so hover, focus, and active match in either
   scheme. Material pairs the [href] and [for] variants: both, or the section-toggle
   rows drift from the link rows next to them. */
.md-nav__link[href]:hover,
.md-nav__link[href]:focus,
.md-nav__link[for]:hover,
.md-nav__link[for]:focus {
  color: var(--ml-green-text);
}

/* ── Tables ── */

.md-typeset__table {
  display: block;
  overflow-x: auto;
}

.md-typeset table:not([class]) {
  border: none;
  font-family: var(--ml-font-body);
}

.md-typeset table:not([class]) thead {
  background-color: var(--ml-dark-blue);
}

.md-typeset table:not([class]) th {
  color: var(--ml-white);
  font-weight: 600;
  border-bottom: none;
  padding: 0.75rem 1rem;
}

.md-typeset table:not([class]) td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ml-light-grey);
}

.md-typeset table:not([class]) tbody tr:nth-child(even) {
  background-color: var(--ml-container-light);
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--ml-container-blue-light);
}

/* ── Admonitions ── */

.md-typeset .admonition,
.md-typeset details {
  border: none !important;
  border-left: 3px solid var(--ml-teal) !important;
  background: var(--ml-container-blue-light);
  box-shadow: none;
  font-family: var(--ml-font-body);
}

.md-typeset .admonition .admonition-title,
.md-typeset details summary {
  background: transparent;
  font-family: var(--ml-font-heading);
  font-weight: 600;
  color: var(--ml-teal);
  border: none;
}

.md-typeset .admonition .admonition-title::before,
.md-typeset details summary::before {
  color: var(--ml-teal);
}

/* Note type — deep teal */
.md-typeset .admonition.note,
.md-typeset details.note {
  border-left-color: var(--ml-teal) !important;
}

.md-typeset .admonition.note .admonition-title,
.md-typeset details.note summary {
  color: var(--ml-teal);
}

/* Warning type — red */
.md-typeset .admonition.warning,
.md-typeset .admonition.danger,
.md-typeset details.warning,
.md-typeset details.danger {
  border-left-color: var(--ml-status-negative) !important;
  background: #ED4E3810;
}

.md-typeset .admonition.warning .admonition-title,
.md-typeset .admonition.danger .admonition-title,
.md-typeset details.warning summary,
.md-typeset details.danger summary {
  color: var(--ml-status-negative);
}

.md-typeset .admonition.warning .admonition-title::before,
.md-typeset .admonition.danger .admonition-title::before {
  color: var(--ml-status-negative);
}

/* Tip type — MobiLab green */
.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-left-color: var(--ml-green-text) !important;
  background: #00A89D10;
}

.md-typeset .admonition.tip .admonition-title,
.md-typeset details.tip summary {
  color: var(--ml-tip-title);
}

.md-typeset .admonition.tip .admonition-title::before {
  color: var(--ml-tip-title);
}

/* ── Code blocks ── */

/* The fenced-code surface is brand dark blue in both schemes, so the syntax
   palette is tuned once — to that surface — instead of per scheme. Material's
   own highlight colors assume Material's own code background: on this one the
   light-scheme inks (near-black at 54% alpha) vanish and the dark-scheme inks
   (near-white at 56% alpha) wash out. A markdown fence is the worst case, since
   the markdown lexer marks headings, emphasis, and strong text as *generic*
   tokens — one whole block then rides on a single ink.
   Every ink below clears WCAG AA (4.5:1) on the surface, the dimmest at 6.9:1.

   The palette is declared *on the fence element*, not on :root or a scheme,
   because these are Material's tokens and components outside the fence read
   them: --md-code-bg-color paints the fence's own title header
   (`.highlight span.filename`) and its line-number gutter
   (`.highlighttable .linenos`), which keep the page's ink and so must keep the
   page's background; --md-code-fg-color is bound to --md-mermaid-edge-color on
   `:root > *` and read by Material's mermaid init, so a global value hands
   near-white arrows to a diagram on a white page. Custom properties inherit,
   so declaring them here reaches the code text and every highlight span inside
   the fence — and nothing else. */
.md-typeset pre > code {
  --md-code-bg-color: var(--ml-dark-blue);
  --md-code-fg-color: #DCE4EA;

  /* Line highlight (`hl_lines`): the wash behind the line is
     --md-code-hl-color--light, while --md-code-hl-color is only the 2px inset
     marker — so both are set, the wash dark enough to keep even the dimmest ink
     above (4.89:1) and the marker left solid. */
  --md-code-hl-color--light: #24405C;
  --md-code-hl-color: #5A9EF7;
  --md-code-hl-comment-color: #9FB2BF;
  --md-code-hl-generic-color: #DCE4EA;
  --md-code-hl-variable-color: #DCE4EA;
  --md-code-hl-name-color: #DCE4EA;
  --md-code-hl-punctuation-color: #C3CFD8;
  --md-code-hl-operator-color: #C3CFD8;
  --md-code-hl-keyword-color: #7FB2F0;
  --md-code-hl-string-color: #3ED0C4;
  --md-code-hl-number-color: #FFA98F;
  --md-code-hl-special-color: #F79EC0;
  --md-code-hl-function-color: #DFA8EC;
  --md-code-hl-constant-color: #B4A9F0;

  background: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
}

/* Inline code is a chip on the page surface, not the dark code surface, so it
   keeps the container token (which follows the scheme); the fence block above
   is the more specific selector, so `pre > code` keeps the dark surface. */
.md-typeset code {
  background: var(--ml-container-light);
  color: var(--ml-text-primary);
  border-radius: 3px;
  font-size: 0.85em;
}

/* ── Task lists ── */

.md-typeset .task-list-indicator::before {
  color: var(--ml-green-text);
}

/* ── Footer ── */

.md-footer {
  background-color: var(--ml-dark-blue);
}
