/* ============================================================
   VIWANDA AUTOMOTIVE - Design tokens
   Art direction: "Bay Light"
   Gold = the marque  |  Red = the signal  |  Amber = light, never pigment
   Ramps generated in OKLab from anchors sampled out of the client's own
   material. Every value below is audited; see tools/tokens_calc.py.
   ============================================================ */

/* ---------- fallback faces, tuned to the web fonts ----------
   On a slow connection the page paints in a system font and swaps to
   Archivo and Inter when they land. Plain Arial runs 5% narrower than
   Inter, so ledes re-wrapped on the swap, page heads changed height and
   everything under them moved: layout shift, which Google ranks on
   (tools/qa/vitals.js). These faces are Arial (Roboto on Android) scaled
   to the web fonts' own widths and line metrics, measured in the browser
   on this site's copy, so the swap changes the letters and not the lines.
   Plex Mono and Courier New already match, so the mono needs none. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("ArialMT"), local("Roboto"), local("Helvetica");
  font-weight: 100 900;
  size-adjust: 105.13%; ascent-override: 92.26%; descent-override: 22.83%; line-gap-override: 0%;
}
@font-face {
  font-family: "Archivo Fallback";
  src: local("Arial"), local("ArialMT"), local("Roboto"), local("Helvetica");
  font-weight: 100 900;
  size-adjust: 98.14%; ascent-override: 89.67%; descent-override: 21.40%; line-gap-override: 0%;
}

:root {

  /* ---------- 1. GOLD - the marque ----------
     From #DBA850, sampled off the workshop frontage and the Viwanda Ultra
     storefront. The two businesses share this accent.                      */
  --gold-50:   #FFF2C5;
  --gold-100:  #FFE7BA;
  --gold-200:  #FFD078;
  --gold-300:  #F0BC65;   /* dark-theme accent      11.53 on ink */
  --gold-400:  #DEAB53;
  --gold-500:  #DBA850;   /* BRAND                   9.28 on ink */
  --gold-600:  #B38224;
  --gold-700:  #956600;   /* light-theme accent      4.80 on paper */
  --gold-800:  #724500;
  --gold-900:  #522600;

  /* ---------- 2. RED - the signal ----------
     The 2023 brand red, unchanged. Used as a stroke, a mark or a button,
     never as a field.                                                       */
  --red-100:   #FFD0C5;
  --red-200:   #FFAC9D;
  --red-300:   #FF8474;
  --red-400:   #FF594B;   /* dark-theme text red     6.47 on ink */
  --red-500:   #E43028;
  --red-600:   #D31716;   /* BRAND - fills and marks only on dark (3.74) */
  --red-700:   #B30000;   /* light-theme text red    6.88 on paper */
  --red-800:   #8F0000;
  --red-900:   #670000;

  /* ---------- 3. GRAPHITE - the bay ----------
     Warm-cast, hue 58, very low chroma. Warm is the point: it matches
     tungsten bay lighting and separates this from a cool-grey template.     */
  --gr-0:      #FFFFFF;
  --gr-25:     #FDF9F6;
  --gr-50:     #F8F3F1;
  --gr-100:    #F0ECE9;
  --gr-200:    #E1DDDA;
  --gr-300:    #C9C5C2;
  --gr-400:    #A6A29F;
  --gr-500:    #868280;
  --gr-600:    #676461;
  --gr-700:    #4E4945;
  --gr-800:    #36312E;
  --gr-900:    #231F1C;
  --gr-950:    #130E0C;
  --gr-1000:   #080503;

  /* ---------- 4. AMBER - light, not pigment ----------
     Lamp pools, glows, the specular sweep. Amber is lighter and more
     chromatic than gold in OKLab, which is exactly how a light source
     differs from a painted surface. Never use it as a fill.                 */
  --amb-200:   #FFD05A;
  --amb-300:   #FFBE45;
  --amb-400:   #F2AE2F;
  --amb-500:   #E19E0F;

  /* ---------- 5. STEEL - the diagnostics register ----------
     Readouts, scan UI, spec tables. Traced from the 2023 deck's own navy
     rather than invented. It is what stops the site being only gold+red.    */
  --st-300:    #93C4EC;
  --st-400:    #74A4CB;
  --st-500:    #5786AB;
  --st-700:    #255476;
  --st-900:    #002B4B;

  /* ---------- 6. SEMANTIC - LIGHT (the default) ----------
     Paper, not screen. The photographs we have are small, so the page
     gives them air and lets them sit as plates on white, rather than
     asking them to fill a dark canvas they cannot fill.              */
  --bg:         #FFFFFF;
  --bg-sunk:    #FAF8F6;
  --surface:    #FFFFFF;
  --surface-2:  #F6F3F0;
  --surface-3:  #EFEAE6;

  --text:       #17130F;
  --text-2:     #4E4642;
  --text-3:     #786E68;

  --border:     #E7E1DC;
  --border-2:   #D3CAC3;
  --logo-ink:   brightness(0);   /* client marks are single-tone knockouts */

  --accent:     var(--gold-700);    /* text gold, 4.80 on white */
  --accent-2:   var(--gold-800);    /* hover,     7.81 */
  --accent-fill:var(--gold-500);    /* rules and fills only, never text */
  --on-accent:  #17130F;

  --signal:     var(--red-700);     /* 6.88 */
  --signal-fill:var(--red-600);
  --on-signal:  #FFFFFF;

  --lamp:       var(--gold-600);
  --steel:      var(--st-700);
  --focus:      var(--gold-700);

  --shadow-1:   0 1px 2px rgba(23,19,15,.05);
  --shadow-2:   0 1px 2px rgba(23,19,15,.04), 0 10px 28px -14px rgba(23,19,15,.16);
  --shadow-3:   0 2px 4px rgba(23,19,15,.05), 0 24px 50px -24px rgba(23,19,15,.22);

  color-scheme: light;

  /* ---------- 7. TYPE ----------
     Archivo for display (the logo wordmark is outlined from it, so the
     headlines and the logo sit together). Inter for body. Plex Mono is the
     job-card register: registrations, part numbers, torque, hours.          */
  --font-display: Archivo, "Archivo Fallback", "Arial Narrow", Helvetica, sans-serif;
  --font-body:    Inter, "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* the one serif: an italic voice for the story of a job (home page only) */
  --font-serif:   "Instrument Serif", Georgia, "Times New Roman", serif;

  /* fluid modular scale, ~1.25 at small / ~1.33 at large. No breakpoints. */
  --step--2:  clamp(0.75rem, 0.72rem + 0.11vw, 0.8rem);   /* never under 12px on a phone */
  --step--1:  clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0:   clamp(1.00rem, 0.95rem + 0.24vw, 1.13rem);
  --step-1:   clamp(1.20rem, 1.12rem + 0.38vw, 1.41rem);
  --step-2:   clamp(1.44rem, 1.32rem + 0.59vw, 1.76rem);
  --step-3:   clamp(1.73rem, 1.55rem + 0.89vw, 2.20rem);
  --step-4:   clamp(2.07rem, 1.81rem + 1.31vw, 2.75rem);
  --step-5:   clamp(2.49rem, 2.11rem + 1.90vw, 3.43rem);
  --step-6:   clamp(2.99rem, 2.45rem + 2.70vw, 4.29rem);
  --step-7:   clamp(3.58rem, 2.83rem + 3.78vw, 5.36rem);
  --step-8:   clamp(4.30rem, 3.24rem + 5.26vw, 6.71rem);
  --step-9:   clamp(5.16rem, 3.70rem + 7.28vw, 8.38rem);

  --lh-tight:   1.08;
  --lh-snug:    1.22;
  --lh-body:    1.62;
  --lh-loose:   1.75;

  --tr-display: -0.022em;   /* lighter weight needs less negative tracking */
  --tr-tight:   -0.012em;
  --tr-normal:  0;
  --tr-mono:     0.055em;   /* mono runs open */
  --tr-label:    0.14em;    /* uppercase labels */

  /* ---------- 8. SPACE ---------- */
  --sp-1:  0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
  --sp-5:  1.5rem;   --sp-6: 2rem;     --sp-7: 3rem;     --sp-8: 4rem;
  --sp-9:  6rem;     --sp-10: 8rem;
  --gutter:   clamp(1.25rem, 5vw, 3rem);
  --section-y: clamp(5rem, 11vw, 10.5rem);

  /* ---------- 9. GEOMETRY ----------
     Near-square. The livery is stencilled and signwritten, not rounded, and
     square corners separate this from Spann Tyres' 22px-radius system.      */
  --r-sm: 2px;  --r-md: 3px;  --r-lg: 4px;  --r-pill: 999px;
  --maxw:       1240px;
  --maxw-text:  68ch;
  --hairline:   1px;

  /* ---------- 10. MOTION ----------
     Every module honours prefers-reduced-motion; see js/motion.js.          */
  --ease:        cubic-bezier(.22, .75, .25, 1);
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --dur-1: 120ms;  --dur-2: 220ms;  --dur-3: 380ms;
  --dur-4: 620ms;  --dur-5: 900ms;
  --stagger: 40ms;

  --z-base: 0; --z-raised: 10; --z-sticky: 100; --z-header: 200;
  --z-drawer: 300; --z-modal: 400; --z-toast: 500;
}

/* ============================================================
   DARK THEME
   An option, not the default. A token swap and nothing else.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #0B0A09;
    --bg-sunk:    #121010;
    --surface:    #1A1716;
    --surface-2:  #241F1D;
    --surface-3:  #322B27;

    --text:       #F2EEEB;
    --text-2:     var(--gr-400);
    --text-3:     var(--gr-500);

    --border:     #2B2522;
    --border-2:   #3D3531;
    --logo-ink:   brightness(0) invert(1);   /* client marks are single-tone knockouts */

    --accent:     var(--gold-500);
    --accent-2:   var(--gold-300);
    --accent-fill:var(--gold-500);
    --on-accent:  #0B0A09;

    --signal:     var(--red-400);
    --signal-fill:var(--red-600);
    --on-signal:  #FFFFFF;

    --lamp:       var(--amb-300);
    --steel:      var(--st-400);
    --focus:      var(--gold-300);

    --shadow-1:   0 1px 2px rgba(0,0,0,.44);
    --shadow-2:   0 2px 4px rgba(0,0,0,.40), 0 10px 24px -12px rgba(0,0,0,.72);
    --shadow-3:   0 4px 8px rgba(0,0,0,.40), 0 22px 48px -22px rgba(0,0,0,.85);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:         #0B0A09;
  --bg-sunk:    #121010;
  --surface:    #1A1716;
  --surface-2:  #241F1D;
  --surface-3:  #322B27;

  --text:       #F2EEEB;
  --text-2:     var(--gr-400);
  --text-3:     var(--gr-500);

  --border:     #2B2522;
  --border-2:   #3D3531;
  --logo-ink:   brightness(0) invert(1);   /* client marks are single-tone knockouts */

  --accent:     var(--gold-500);
  --accent-2:   var(--gold-300);
  --accent-fill:var(--gold-500);
  --on-accent:  #0B0A09;

  --signal:     var(--red-400);
  --signal-fill:var(--red-600);
  --on-signal:  #FFFFFF;

  --lamp:       var(--amb-300);
  --steel:      var(--st-400);
  --focus:      var(--gold-300);

  --shadow-1:   0 1px 2px rgba(0,0,0,.44);
  --shadow-2:   0 2px 4px rgba(0,0,0,.40), 0 10px 24px -12px rgba(0,0,0,.72);
  --shadow-3:   0 4px 8px rgba(0,0,0,.40), 0 22px 48px -22px rgba(0,0,0,.85);

  color-scheme: dark;
}
