/* Sightline uses bundled, redistributable typefaces. */
/*
 * Sightline design tokens. Read styles/DESIGN_SYSTEM.md before adding or consuming tokens.
 *
 * Black/white product with Technical Sand neutrals and ONE light-blue accent used as punctuation
 * (selected tab, playhead, focus, active nav). Colour is reserved for meaning: live / aging /
 * stale / lost, sun, photo ship, crew colours. Every figure uses --font-mono with tabular numerals.
 *
 * Token names are a public contract: feature CSS consumes them. Add tokens; never rename or remove.
 *
 * Layers, back to front:
 *   --bg (page) → --bg-raised / --surface-1 (cards, panels) → --surface-2 (popovers, modals)
 *   → --surface-glass (floating map UI: blurred, translucent) → --surface-inverse (primary action)
 */
:root,
[data-theme='dark'] {
  color-scheme: dark;

  /* Technical Sand ramp (dark → light), the only neutrals in the product */
  --sand-950: #0b0b0a;
  --sand-900: #121210;
  --sand-850: #181816;
  --sand-800: #201f1c;
  --sand-700: #2c2a26;
  --sand-500: #5f5a52;
  --sand-400: #807a70;
  --sand-300: #a39d93;
  --sand-200: #cfc9bf;
  --sand-100: #e5e0d9;
  --sand-50: #f4f1ec;

  /* surfaces */
  --bg: #000000;
  --bg-raised: #0e0e0d;
  --bg-sunken: #000000;
  --bg-overlay: rgba(10, 10, 9, 0.86);
  --bg-hover: rgba(229, 224, 217, 0.06);
  --bg-active: rgba(229, 224, 217, 0.1);
  --bg-inverse: #ffffff;

  /* elevation surfaces (new) */
  --surface-0: var(--bg);
  --surface-1: var(--bg-raised);
  --surface-2: #151513;
  --surface-3: #1c1b19;
  --surface-sunken: #050505;
  --input-bg: #050505;
  --input-bg-focus: #000000;
  --surface-inverse: #ffffff;
  --surface-glass: rgba(14, 14, 13, 0.72);
  --surface-glass-strong: rgba(10, 10, 9, 0.88);
  --glass-blur: blur(18px) saturate(140%);
  --glass-border: rgba(229, 224, 217, 0.14);
  /* 1px light catch on the top edge of raised/glass surfaces */
  --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* ink */
  --fg: #ffffff;
  --fg-2: #e5e0d9;
  --fg-3: #a39d93;
  --fg-4: #5f5a52;
  --fg-inverse: #000000;

  /* rules */
  --rule: rgba(229, 224, 217, 0.1);
  --rule-2: rgba(229, 224, 217, 0.17);
  --rule-strong: rgba(229, 224, 217, 0.34);
  --focus: #ffffff;
  --accent: rgb(117, 225, 243);
  --accent-ink: rgb(117, 225, 243);
  /* accent fills: selected wash, glow */
  --accent-soft: rgba(117, 225, 243, 0.14);
  --accent-line: rgba(117, 225, 243, 0.55);

  /* state layers (new): paint over any surface */
  --state-hover: rgba(229, 224, 217, 0.06);
  --state-pressed: rgba(229, 224, 217, 0.12);
  --state-selected: rgba(229, 224, 217, 0.1);
  --state-disabled-opacity: 0.42;
  /* focus ring: accent ring with a knock-out gap so it reads on any surface */
  --focus-color: var(--accent);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus-color);

  /* meaning */
  --live: #3ddc84;
  --aging: #ffc53d;
  --stale: #ff8a3d;
  --lost: #ff4d4f;
  --alert: #ff4d4f;
  --sun: #ffb020;
  --photo-ship: #b69cff;
  --subject: #ffffff;
  --camera: #ffffff;

  --live-bg: rgba(61, 220, 132, 0.12);
  --aging-bg: rgba(255, 197, 61, 0.12);
  --stale-bg: rgba(255, 138, 61, 0.13);
  --lost-bg: rgba(255, 77, 79, 0.14);
  --sun-bg: rgba(255, 176, 32, 0.12);

  --shadow-1: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 24px 64px rgba(0, 0, 0, 0.6);
  /* (new) */
  --shadow-3: 0 0 0 1px rgba(229, 224, 217, 0.06), 0 32px 80px rgba(0, 0, 0, 0.72), 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glass: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-up: 0 -16px 48px rgba(0, 0, 0, 0.55);
  --scrim: rgba(0, 0, 0, 0.6);
  --hairline: 1px;
  --stroke-w: 1.5px;

  /* map */
  --map-bg: #050505;
}

[data-theme='daylight'] {
  color-scheme: light;

  --sand-950: #000000;
  --sand-900: #1e1c19;
  --sand-850: #2c2a26;
  --sand-800: #4a463f;
  --sand-700: #807a70;
  --sand-500: #a39d93;
  --sand-400: #c4bdb2;
  --sand-300: #d8d2c9;
  --sand-200: #e5e0d9;
  --sand-100: #ece8e2;
  --sand-50: #f8f6f2;

  --bg: #e5e0d9;
  --bg-raised: #f4f1ec;
  --bg-sunken: #d8d2c9;
  --bg-overlay: rgba(244, 241, 236, 0.95);
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-active: rgba(0, 0, 0, 0.1);
  --bg-inverse: #000000;

  --surface-0: var(--bg);
  --surface-1: var(--bg-raised);
  --surface-2: #faf8f5;
  --surface-3: #ffffff;
  --surface-sunken: #dcd6cd;
  /* editable fields read as paper on sand */
  --input-bg: #fbfaf8;
  --input-bg-focus: #ffffff;
  --surface-inverse: #000000;
  /* direct sun: glass stays nearly opaque so text never sits on busy map detail */
  --surface-glass: rgba(246, 243, 238, 0.94);
  --surface-glass-strong: rgba(248, 246, 242, 0.98);
  --glass-blur: blur(12px) saturate(120%);
  --glass-border: rgba(0, 0, 0, 0.55);
  --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --fg: #000000;
  --fg-2: #1e1c19;
  --fg-3: #4a463f;
  --fg-4: #807a70;
  --fg-inverse: #ffffff;

  --rule: rgba(0, 0, 0, 0.22);
  --rule-2: rgba(0, 0, 0, 0.4);
  --rule-strong: rgba(0, 0, 0, 0.85);
  --focus: #000000;
  /* light blue washes out on sand in direct sun: fills/rules keep the brand blue, ink uses a deep teal */
  --accent: rgb(117, 225, 243);
  --accent-ink: #0b6f80;
  --accent-soft: rgba(11, 111, 128, 0.12);
  --accent-line: #0b6f80;

  --state-hover: rgba(0, 0, 0, 0.05);
  --state-pressed: rgba(0, 0, 0, 0.12);
  --state-selected: rgba(0, 0, 0, 0.09);
  --state-disabled-opacity: 0.45;
  /* in sun the ring is black: maximum contrast beats brand colour */
  --focus-color: #000000;
  --focus-ring: 0 0 0 2px var(--bg-raised), 0 0 0 4.5px var(--focus-color);

  /* darker variants keep contrast in direct sun */
  --live: #00873e;
  --aging: #9a6a00;
  --stale: #c04a00;
  --lost: #d00018;
  --alert: #d00018;
  --sun: #b36b00;
  --photo-ship: #5b2fd6;
  --subject: #000000;
  --camera: #000000;

  --live-bg: rgba(0, 135, 62, 0.12);
  --aging-bg: rgba(154, 106, 0, 0.14);
  --stale-bg: rgba(192, 74, 0, 0.12);
  --lost-bg: rgba(208, 0, 24, 0.1);
  --sun-bg: rgba(179, 107, 0, 0.12);

  --shadow-1: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.12);
  --shadow-2: 0 0 0 1.5px #000, 0 24px 64px rgba(0, 0, 0, 0.25);
  --shadow-3: 0 0 0 1.5px #000, 0 28px 72px rgba(0, 0, 0, 0.28);
  --shadow-glass: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.14);
  --shadow-up: 0 -1.5px 0 #000, 0 -12px 40px rgba(0, 0, 0, 0.12);
  --scrim: rgba(30, 28, 25, 0.45);
  --hairline: 1.5px;
  --stroke-w: 2px;

  --map-bg: #ece8e2;
}

:root {
  /* ── type families ── */
  --font-ui: 'Archivo Variable', 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  /* Bundled Chakra Petch for titles. */
  --font-title: 'Chakra Petch', 'Archivo Variable', ui-sans-serif, sans-serif;
  /* Chakra Petch: eyebrows, labels, tabs (ALL CAPS, wide tracking) */
  --font-label: 'Chakra Petch', 'Archivo Variable', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* ── raw sizes (legacy, still the base of the scale) ── */
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-32: 32px;
  --fs-40: 40px;
  --fs-48: 48px;
  --fs-64: 64px;

  /* ── line-heights ── */
  --lh-none: 1;
  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-body: 1.45;
  --lh-loose: 1.6;

  /* ── tracking ── */
  --tr-tight: -0.02em;
  --tr-snug: -0.01em;
  --tr-normal: 0.005em;
  --tr-label: 0.12em; /* Chakra Petch caps: buttons, field labels, tabs */
  --tr-eyebrow: 0.2em; /* tiny caps above titles */
  --tr-title: 0.12em; /* Chakra Petch display titles (0.2em ≥ 768px) */
  --tr-mono: 0;

  /* ── semantic type roles: font shorthand + tracking. Use `font: var(--type-…)` ── */
  --type-display: 600 var(--fs-32) / var(--lh-tight) var(--font-title);
  --type-title: 600 var(--fs-20) / var(--lh-snug) var(--font-title);
  --type-heading: 600 var(--fs-16) / var(--lh-snug) var(--font-ui);
  --type-body: 400 var(--fs-14) / var(--lh-body) var(--font-ui);
  --type-body-sm: 400 var(--fs-13) / var(--lh-body) var(--font-ui);
  --type-caption: 400 var(--fs-12) / var(--lh-snug) var(--font-ui);
  --type-label: 600 var(--fs-11) / var(--lh-tight) var(--font-label);
  --type-eyebrow: 500 var(--fs-11) / var(--lh-tight) var(--font-label);
  --type-figure: 500 var(--fs-16) / var(--lh-none) var(--font-mono);
  --type-figure-lg: 400 var(--fs-24) / var(--lh-none) var(--font-mono);
  --type-figure-xl: 300 var(--fs-48) / var(--lh-none) var(--font-mono);

  /* ── spacing: 4px rhythm ── */
  --sp-0: 0;
  --sp-px: 1px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* ── radii ── */
  --r-1: 3px;
  --r-2: 6px;
  --r-3: 10px;
  --r-4: 14px;
  --r-5: 20px; /* sheets */
  --r-pill: 999px;

  /* ── control heights ── */
  --touch: 44px;
  --control-sm: 34px; /* visual height; hit area padded to 44 */
  --control-md: 44px;
  --control-lg: 52px;
  --control-xl: 64px;

  --topbar-h: 52px;
  --tabbar-h: 60px;
  --disclaimer-h: 34px;

  /* ── motion ── */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* sheet / drawer: fast start, long soft settle (iOS-like) */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  /* small overshoot for indicators and popovers */
  --ease-emphasized: cubic-bezier(0.34, 1.36, 0.64, 1);
  --dur-0: 80ms; /* press feedback */
  --dur-1: 120ms; /* hover, colour */
  --dur-2: 220ms; /* popovers, toasts, indicators (Live max: 200–250 ms) */
  --dur-3: 360ms; /* sheets, modals */
  --press-scale: 0.97;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --z-map-ui: 10;
  --z-sheet: 30;
  --z-topbar: 40;
  --z-modal: 80;
  --z-toast: 90;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-0: 0ms;
    --dur-1: 0ms;
    --dur-2: 0ms;
    --dur-3: 0ms;
    --press-scale: 1;
  }
}
