/* MotorLedger, the Apple OS treatment: design tokens. Plan: design/glass/PLAN.md. Research: research/liquid/b1-b4.
   Light and dark follow the device; data-theme on <html> forces one (board toggle only). */

:root {
  color-scheme: light dark;

  /* type: real SF on Apple devices (nothing downloaded), Inter elsewhere; Figtree only for the wordmark */
  --font: -apple-system, BlinkMacSystemFont, "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-brand: "Figtree", var(--font);

  /* colour, light */
  --bg: #FFFFFF; --bg-2: #F5F5F7; --bg-3: #EBEBEF; --elev: #FFFFFF;
  --ink: #0A0B0D; --ink-2: #5E6067; --ink-3: #8A8C93;
  --line: rgb(0 0 0 / .08); --line-2: rgb(0 0 0 / .16);
  --seg-ring: transparent; /* the chosen segment's hairline: none in light, where the white thumb stands off its grey track */
  --accent: #243A5F; --accent-fill: #243A5F; --accent-fill-hover: #1B2D4A; --on-accent: #FFFFFF;
  --pos: #0A5A34; --pos-bg: #DCF4E6; --neu: #4F5763; --neu-bg: #E9EBEF;
  --vt: #0A0B0D; --vt-ink: #F5F5F7; --vt-ink-2: #A9ABB2; --vt-line: rgb(255 255 255 / .14); --vt-pos: #86E3AE;
  --select: rgb(36 58 95 / .16);
  --chart-band: rgb(36 58 95 / .07);

  /* glass (tier rules in glass.css) */
  --g-rgb: 255 255 255;
  --g-solid: #FFFFFF; --g-solid-bar: #F7F7F9;
  --g-ring: rgb(0 0 0 / .08);
  --g-rim: rgb(255 255 255 / .7);
  --g-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .07);
  --g-shadow-lg: 0 2px 6px rgb(0 0 0 / .05), 0 22px 60px rgb(0 0 0 / .16);
  --a-bar: .76; --a-panel: .84; --a-sheet: .92;
  /* text inside glass: 4.5:1 over ANY backdrop (pure black behind the tint is the worst case; tests/contrast.py) */
  --g-ink-2: #43454B; --g-ink-3: #43454B; --g-accent: #243A5F;
  --scrim: rgb(10 11 13 / .26);

  /* type scale: size / line-height, weight, tracking (PLAN section 5) */
  --t-display: 700 64px/1 var(--font);   --tr-display: -0.035em;
  --t-large: 700 48px/1.08 var(--font);  --tr-large: -0.03em;
  --t-title: 700 32px/1.12 var(--font);  --tr-title: -0.025em;
  --t-title3: 650 22px/1.27 var(--font); --tr-title3: -0.015em;
  --t-head: 600 17px/1.3 var(--font);    --tr-head: -0.01em;
  --t-body: 400 17px/1.53 var(--font);   --tr-body: -0.012em;
  --t-callout: 400 15px/1.34 var(--font); --tr-callout: -0.008em;
  --t-foot: 500 13px/1.38 var(--font);
  --t-cap: 400 12px/1.34 var(--font);
  --t-num: 700 56px/1 var(--font);       --tr-num: -0.035em;

  /* shape and space */
  --r-stage: 40px; --r-tile: 24px; --r-panel: 24px; --r-sheet: 28px; --r-pop: 18px; --r-field: 12px;
  /* 1,120: the showcase's widest (the photos are 960px), so photo, titles and sections share one left edge */
  --wrap: 1120px; --gutter: 24px; --gap: 12px;
  --nav-h: 56px; --nav-top: 24px;

  /* motion: Apple springs as linear() curves (b2 tokens.py, max error 0.2%). Shape depends on bounce only;
     each use pairs a curve with its settle time (perceptual duration x the factor in the comment). */
  --ease-spring-0: linear(0, 0.003 0.8%, 0.016 2.1%, 0.039 3.3%, 0.079 5%, 0.114 6.2%, 0.167 7.9%, 0.363 13.8%, 0.455 16.7%, 0.551 20%, 0.634 23.3%, 0.705 26.7%, 0.764 30%, 0.818 33.8%, 0.86 37.5%, 0.9 42.1%, 0.931 47.1%, 0.954 52.5%, 0.972 58.8%, 0.983 65.4%, 0.991 73.8%, 1); /* x1.47 */
  --ease-spring-10: linear(0, 0.005 1.2%, 0.019 2.5%, 0.049 4.2%, 0.089 5.8%, 0.174 8.8%, 0.391 15.4%, 0.494 18.8%, 0.587 22.1%, 0.669 25.4%, 0.738 28.7%, 0.796 32.1%, 0.844 35.4%, 0.886 39.2%, 0.922 43.3%, 0.95 47.9%, 0.972 53.3%, 0.987 59.2%, 0.995 65.8%, 1 73.8%, 1); /* x1.333 */
  --ease-spring-15: linear(0, 0.006 1.2%, 0.021 2.5%, 0.054 4.2%, 0.098 5.8%, 0.19 8.8%, 0.411 15%, 0.522 18.3%, 0.622 21.7%, 0.697 24.6%, 0.763 27.5%, 0.824 30.8%, 0.873 34.2%, 0.912 37.5%, 0.947 41.7%, 0.971 45.8%, 0.988 50.4%, 1 55.8%, 1.005 61.3%, 1.006 67.9%, 1); /* x1.393 */
  --ease-spring-30: linear(0, 0.008 1.2%, 0.029 2.5%, 0.062 3.8%, 0.119 5.4%, 0.169 6.7%, 0.223 7.9%, 0.475 13.3%, 0.586 15.8%, 0.654 17.5%, 0.701 18.8%, 0.786 21.2%, 0.857 23.8%, 0.887 25%, 0.923 26.7%, 0.965 29.2%, 1.002 32.1%, 1.022 34.6%, 1.036 37.1%, 1.044 40%, 1.046 42.9%, 1.041 47.9%, 1.012 62.5%, 1.003 70.4%, 0.998 82.1%, 1); /* x1.637 */
  --d-press-in: 221ms; --d-press-out: 488ms; --d-hover: 368ms;
  --d-menu-open: 488ms; --d-menu-close: 368ms; --d-pop: 400ms;
  --d-panel: 661ms; --d-sheet: 735ms; --d-page: 588ms; --d-morph: 735ms; --d-number: 735ms; --d-dock: 514ms; --d-fade: 294ms;
}

/* colour, dark: the device asks (unless the board forced light), or the board forces dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #111113; --bg-3: #1C1C1E; --elev: #1C1C1E;
    --ink: #F5F5F7; --ink-2: #A1A1A8; --ink-3: #6E7077;
    --line: rgb(255 255 255 / .10); --line-2: rgb(255 255 255 / .18);
    --seg-ring: rgb(255 255 255 / .18); /* --elev and --bg-3 are both #1C1C1E here, so the thumb needs a ring to show */
    --accent: #8FB0E6; --accent-fill: #3B5B92; --accent-fill-hover: #476BA5; --on-accent: #FFFFFF;
    --pos: #5EE29A; --pos-bg: #0E2A1A; --neu: #B4BAC4; --neu-bg: #23262C;
    --vt: #1C1C1E; --vt-ink: #F5F5F7; --vt-ink-2: #A1A1A8; --vt-line: rgb(255 255 255 / .12); --vt-pos: #7FE5AE;
    --select: rgb(143 176 230 / .26); --chart-band: rgb(143 176 230 / .09);
    --g-rgb: 30 30 32; --g-solid: #1C1C1E; --g-solid-bar: #161618;
    --g-ring: rgb(255 255 255 / .11); --g-rim: rgb(255 255 255 / .08);
    --g-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 8px 26px rgb(0 0 0 / .45);
    --g-shadow-lg: 0 2px 8px rgb(0 0 0 / .5), 0 24px 70px rgb(0 0 0 / .6);
    --a-bar: .76; --a-panel: .8; --a-sheet: .9;
    --g-ink-2: #D8D8DD; --g-ink-3: #D8D8DD; --g-accent: #D2E0F6;
    --scrim: rgb(0 0 0 / .52);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #111113; --bg-3: #1C1C1E; --elev: #1C1C1E;
  --ink: #F5F5F7; --ink-2: #A1A1A8; --ink-3: #6E7077;
  --line: rgb(255 255 255 / .10); --line-2: rgb(255 255 255 / .18);
  --seg-ring: rgb(255 255 255 / .18);
  --accent: #8FB0E6; --accent-fill: #3B5B92; --accent-fill-hover: #476BA5; --on-accent: #FFFFFF;
  --pos: #5EE29A; --pos-bg: #0E2A1A; --neu: #B4BAC4; --neu-bg: #23262C;
  --vt: #1C1C1E; --vt-ink: #F5F5F7; --vt-ink-2: #A1A1A8; --vt-line: rgb(255 255 255 / .12); --vt-pos: #7FE5AE;
  --select: rgb(143 176 230 / .26); --chart-band: rgb(143 176 230 / .09);
  --g-rgb: 30 30 32; --g-solid: #1C1C1E; --g-solid-bar: #161618;
  --g-ring: rgb(255 255 255 / .11); --g-rim: rgb(255 255 255 / .08);
  --g-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 8px 26px rgb(0 0 0 / .45);
  --g-shadow-lg: 0 2px 8px rgb(0 0 0 / .5), 0 24px 70px rgb(0 0 0 / .6);
  --a-bar: .76; --a-panel: .8; --a-sheet: .9;
  --g-ink-2: #D8D8DD; --g-ink-3: #D8D8DD; --g-accent: #D2E0F6;
  --scrim: rgb(0 0 0 / .52);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (max-width: 720px) {
  :root {
    --t-display: 700 40px/1.05 var(--font);
    --t-large: 700 34px/1.12 var(--font);
    --t-title: 700 26px/1.15 var(--font);
    --t-title3: 650 20px/1.25 var(--font);
    --t-num: 700 44px/1 var(--font);
    --r-stage: 28px; --gutter: 16px; --nav-top: 8px; --nav-h: 52px;
  }
}
