/* Moondog brand tokens, version 1.1, 21 October 2026.
   Source of truth: brand/BRAND.md. Adopted by the landing page and the product prototype v2.
   Light first. Dark via the OS setting unless the page forces a theme with data-theme.
   A `.md-night` block (the landing page's night chapter) is dark inside a light page. */

:root {
  /* 1. Palette: fixed values, never themed ------------------------------------------- */
  --md-ink: #0E0D11;          /* type, symbol, night ground */
  --md-paper: #F6F2E7;        /* day ground, family surfaces, print stock reference */
  --md-vellum: #FBF9F3;       /* cards and report pages on paper */
  --md-white: #FFFFFF;        /* product working surfaces only */
  --md-slate: #4A463F;        /* body text on paper (8.4:1) */
  --md-stone: #6E6A60;        /* secondary text on paper (4.8:1), labels, index numbers */
  --md-rule: #D8D2C3;         /* hairlines on paper, the visible grid */
  --md-graphite: #1A1920;     /* raised surfaces on night */
  --md-night-rule: #34323B;   /* hairlines on night */
  --md-mist: #A9A397;         /* secondary text on night (7.7:1) */
  --md-bronze: #9A6F2C;       /* approval metal on paper: seal art, graphics only (4.0:1) */
  --md-bronze-text: #83601F;  /* approval words on paper (5.1:1) */
  --md-champagne: #D4B68C;    /* approval metal and words on night (10.0:1) */
  --md-alert: #9B2C2C;        /* the four true stops only, never approval, never a figure's sign */
  --md-alert-night: #E37C7C;
  --md-focus: #2F5FA7;
  --md-focus-night: #9DB8E8;

  /* 1b. Night and light extension (BRAND.md 3.5, 3.6). Fixed values, graphics and generated scenes only.
     Warm night: every sky starts at ink and goes no bluer than Nocturne. Never a surface for product UI. */
  --md-x-nocturne: #111632;     /* bluest ground allowed, bottom of a sky */
  --md-x-twilight: #1B2148;     /* raised surface on night blue, graphics only */
  --md-x-rule: #2A3052;         /* hairlines on night blue, table rules, callout borders */
  --md-x-dusk: #272050;         /* glow only, 8% opacity or less, bottom third of a sky. Never a fill */
  --md-x-moonlight: #E6E8EE;    /* display type and the lit face of a generated moon (14.5:1 on Nocturne) */
  --md-x-moon-warm: #E9DCC3;    /* lit facets of a generated moon: moonlight toward champagne. Illustration, not metal */
  --md-x-silver: #B3B9C9;       /* body text on night blue (9.0:1 on Nocturne) */
  --md-x-haze: #8C93A8;         /* labels and mono on night blue, 12px and up (5.05:1 on Twilight, the floor) */
  /* Refraction, light only, inner (warm) to outer (cool). Never a fill, text, or within 24px of a figure.
     Never on the seal or in the logo. Stop 1 is amber rose, not red. */
  --md-x-r1: #D98A6A;  --md-x-r2: #EFA35C;  --md-x-r3: #F2E2A0;
  --md-x-r4: #CFEDE4;  --md-x-r5: #86BFEA;  --md-x-r6: #7D7AE6;
  --md-x-orbit-alpha: .7;       /* orbit hairlines: 1px, stops 2, 4 and 5 across the three rings */
  --md-x-sky: linear-gradient(180deg, var(--md-ink) 0%, var(--md-ink) 30%, var(--md-x-nocturne) 100%);

  /* channel forms for rgb(var(--x) / alpha) */
  --md-ink-rgb: 14 13 17;
  --md-paper-rgb: 246 242 231;
  --md-champagne-rgb: 212 182 140;

  /* 2. Semantic, light (default) ----------------------------------------------------- */
  --md-bg: var(--md-paper);
  --md-bg-raised: var(--md-vellum);
  --md-surface: var(--md-white);
  --md-fg: var(--md-ink);
  --md-fg-2: var(--md-slate);
  --md-fg-3: var(--md-stone);
  --md-line: var(--md-rule);
  --md-line-strong: #C4BCAA;
  --md-logo: var(--md-ink);
  --md-approval: var(--md-bronze);
  --md-approval-text: var(--md-bronze-text);
  --md-on-primary: var(--md-paper);
  --md-primary: var(--md-ink);
  --md-primary-hover: #2A2731;
  --md-alert-fg: var(--md-alert);
  --md-focus-ring: var(--md-focus);
  --md-halo-glow: rgb(var(--md-paper-rgb) / 0);   /* the soft glow behind the giant moon exists on night only. The seal never glows */
  color-scheme: light;

  /* 3. Type ------------------------------------------------------------------------ */
  --md-font-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-font-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --md-font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --md-features-sans: "cv05", "cv08", "tnum";   /* clear l, I and 1, tabular figures */

  /* site and print scale (fluid between 390px and 1440px) */
  --md-text-hero: clamp(2.75rem, 1.55rem + 4.9vw, 6rem);      /* 44 to 96 */
  --md-text-h1: clamp(2.25rem, 1.5rem + 3.1vw, 4rem);         /* 36 to 64 */
  --md-text-h2: clamp(1.875rem, 1.4rem + 1.95vw, 3rem);       /* 30 to 48 */
  --md-text-h3: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);     /* 22 to 28 */
  --md-text-lede: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); /* 18 to 21 */
  --md-text-body: 1.0625rem;  /* 17 */
  --md-text-ui: 0.9375rem;    /* 15 */
  --md-text-small: 0.8125rem; /* 13 */
  --md-text-label: 0.75rem;   /* 12, uppercase labels */
  --md-text-index: 0.75rem;   /* 12, mono index numbers */
  --md-figure-hero: clamp(2.5rem, 1.9rem + 2.4vw, 4rem);

  --md-weight-display: 500;   /* Inter Tight */
  --md-weight-heading: 500;
  --md-weight-body: 400;
  --md-weight-strong: 600;
  --md-weight-serif: 300;     /* Newsreader Light for the family voice at display sizes */

  --md-track-hero: -0.035em;
  --md-track-heading: -0.022em;
  --md-track-figure: -0.025em;
  --md-track-label: 0.08em;
  --md-leading-hero: 0.98;
  --md-leading-heading: 1.08;
  --md-leading-body: 1.55;
  --md-leading-ui: 1.45;

  /* 4. Space: 4px base, 8px rhythm ------------------------------------------------- */
  --md-s-1: 4px;  --md-s-2: 8px;  --md-s-3: 12px; --md-s-4: 16px; --md-s-5: 24px;
  --md-s-6: 32px; --md-s-7: 48px; --md-s-8: 64px; --md-s-9: 96px; --md-s-10: 128px; --md-s-11: 160px;
  --md-section-y: clamp(80px, 6rem + 4vw, 160px);

  /* 5. Grid ------------------------------------------------------------------------ */
  --md-cols: 12;
  --md-gutter: clamp(16px, 1rem + 0.6vw, 24px);
  --md-margin: clamp(16px, 4.5vw, 72px);
  --md-max: 1280px;
  --md-measure: 64ch;
  --md-measure-letter: 34em;   /* the family's letter, Newsreader */

  /* 6. Shape ----------------------------------------------------------------------- */
  --md-hairline: 1px;
  --md-r-xs: 4px; --md-r-sm: 6px; --md-r-md: 10px; --md-r-lg: 16px;   /* no pill buttons */
  --md-shadow-float: 0 12px 32px -8px rgb(var(--md-ink-rgb) / .16), 0 2px 6px rgb(var(--md-ink-rgb) / .06);

  /* 7. Motion ---------------------------------------------------------------------- */
  --md-ease: cubic-bezier(.2, 0, 0, 1);          /* standard, enter */
  --md-ease-exit: cubic-bezier(.4, 0, 1, 1);
  --md-ease-in-out: cubic-bezier(.45, 0, .55, 1);
  --md-dur-hover: 120ms;
  --md-dur-ui: 200ms;
  --md-dur-panel: 320ms;
  --md-dur-reveal: 600ms;     /* text and frames entering on scroll */
  --md-dur-logo: 900ms;       /* moon, cut, step */
  --md-dur-seal: 540ms;       /* the sliver steps home on approval, once, 32px and up only */
  --md-parallax-max: 60px;    /* largest travel of any layer */
  --md-reveal-shift: 16px;

  /* 8. Logo geometry, for CSS-drawn uses (hero crop, loaders) ---------------------- */
  --md-logo-cut: 0.7;         /* cut face at 7/10 r */
  --md-logo-step: 0.3;        /* sliver width = gap = step = 3/10 r */
}

/* Dark theme: OS setting, unless forced light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-bg: var(--md-ink);
    --md-bg-raised: var(--md-graphite);
    --md-surface: #16151A;
    --md-fg: var(--md-paper);
    --md-fg-2: #CFC9BC;
    --md-fg-3: var(--md-mist);
    --md-line: var(--md-night-rule);
    --md-line-strong: #4A4853;
    --md-logo: var(--md-paper);
    --md-approval: var(--md-champagne);
    --md-approval-text: var(--md-champagne);
    --md-on-primary: var(--md-ink);
    --md-primary: var(--md-paper);
    --md-primary-hover: #E2DCCD;
    --md-alert-fg: var(--md-alert-night);
    --md-focus-ring: var(--md-focus-night);
    --md-halo-glow: rgb(var(--md-champagne-rgb) / .10);
    color-scheme: dark;
  }
}
:root[data-theme="dark"],
.md-night {
  --md-bg: var(--md-ink);
  --md-bg-raised: var(--md-graphite);
  --md-surface: #16151A;
  --md-fg: var(--md-paper);
  --md-fg-2: #CFC9BC;
  --md-fg-3: var(--md-mist);
  --md-line: var(--md-night-rule);
  --md-line-strong: #4A4853;
  --md-logo: var(--md-paper);
  --md-approval: var(--md-champagne);
  --md-approval-text: var(--md-champagne);
  --md-on-primary: var(--md-ink);
  --md-primary: var(--md-paper);
  --md-primary-hover: #E2DCCD;
  --md-alert-fg: var(--md-alert-night);
  --md-focus-ring: var(--md-focus-night);
  --md-halo-glow: rgb(var(--md-champagne-rgb) / .10);
  color-scheme: dark;
}
.md-night { background: var(--md-bg); color: var(--md-fg); }
/* The night chapter with a generated sky behind it. First paint is this gradient, the scene arrives after. */
.md-sky { background: var(--md-ink); background-image: var(--md-x-sky); color: var(--md-fg); }

@media (prefers-reduced-motion: reduce) {
  :root { --md-parallax-max: 0px; --md-reveal-shift: 0px; --md-dur-reveal: 0ms; --md-dur-logo: 0ms; --md-dur-seal: 0ms; }
}

/* 9. Recipes: the few classes both the site and the product share ---------------------- */
.md-label { font: 500 var(--md-text-label)/1.3 var(--md-font-sans); letter-spacing: var(--md-track-label); text-transform: uppercase; color: var(--md-fg-3); }
.md-index { font: 400 var(--md-text-index)/1 var(--md-font-mono); color: var(--md-fg-3); font-variant-numeric: tabular-nums; }
.md-figure { font-family: var(--md-font-sans); font-weight: 400; letter-spacing: var(--md-track-figure); font-variant-numeric: tabular-nums lining-nums; }
.md-figure .unit { font-size: .6em; margin-left: .08em; color: var(--md-fg-2); }
.md-display { font-family: var(--md-font-display); font-weight: var(--md-weight-display); letter-spacing: var(--md-track-hero); line-height: var(--md-leading-hero); }
.md-voice { font-family: var(--md-font-serif); font-weight: var(--md-weight-serif); font-optical-sizing: auto; }
.md-seal { display: inline-flex; align-items: center; gap: .5em; color: var(--md-approval-text); }   /* the seal image, centred on the cap height, then the word. Never without the word */
.md-seal > img, .md-seal > svg { flex: none; display: block; }
.md-rule { border: 0; border-top: var(--md-hairline) solid var(--md-line); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--md-focus-ring); outline-offset: 2px; }

/* 10. Bridge to prototype v2 (assets/css/extra.css holds RGB channels).
   v2 already matches on: canvas #F8F6F1 (workspace), paper #F6F2E7 (family and site), ink #0E0D11 (dark canvas),
   seal light #83601F = --md-bronze-text, seal dark #D4B68C = --md-champagne.
   Two edits adopt the brand:
     --c-seal-ornament: 154 111 44;   (was 160 122 58, now --md-bronze)
     the orbit mark in assets/img/orbit.svg is retired, use brand/logo/symbol-mono.svg (inherits currentColor).
   Fonts: add "Inter Tight:wght@400..600" to the existing Google Fonts request for site headlines. */
