/* ==========================================================================
   SEEYOUSOON SUPER-APP — DESIGN TOKENS
   The surface staircases (Wave 10 contract C3): deep obsidian is the default (the website's ink, #050510), and
   html[data-apple-theme="light"] (js/core/theme.js, «Ljus», or «Automatisk» on a light phone) turns every token below to
   paper. Every older name (--ink, --glass-*, --ds-surface*, --map-bg, the liquid glass's --lg-*) reads the staircase, so
   a rule written with any of them follows the theme. css/theme-light.css does the same for the designs' own colours.
   ========================================================================== */

:root,
html[data-apple-theme="dark"] {
  color-scheme: dark;
  /* C3: obsidian, darkest to highest */
  --sys-canvas: #050510;
  --sys-base: #090B10;
  --sys-raised: #0C0E14;
  --sys-raised-2: #12141C;
  --sys-raised-3: #181B25;
  --sys-glass: rgba(9, 11, 16, 0.78);
  --sys-glass-strong: rgba(12, 14, 20, 0.92);
  --sys-hairline: rgba(255, 255, 255, 0.08);
  --sys-edge: rgba(255, 255, 255, 0.12);
  --sys-label: #F8FAFC;
  --sys-label-2: rgba(235, 235, 245, 0.64);
  --sys-label-3: rgba(235, 235, 245, 0.36);
  --sys-accent: #A855F7;
  --sys-accent-ink: #C4B5FD;
  /* what the theme-dependent names below are made of: a film over a surface, and the shadow under one */
  --sys-film: rgba(255, 255, 255, 0.06);
  --sys-film-strong: rgba(255, 255, 255, 0.1);
  --sys-specular: rgba(255, 255, 255, 0.06);
  --sys-shadow: rgba(0, 0, 0, 0.5);
  --sys-scrim: rgba(5, 5, 16, 0.6);
}

html[data-apple-theme="light"] {
  /* «only»: a phone browser that darkens light pages by itself (Chrome's auto-darken, Samsung Internet's night mode)
     leaves the paper as drawn, since the app has its own dark (owner 2026-10-31: «Ljus» came out grey over a white map).
     The property is inherited and a bare «light» on a part opens that part to the browser again, so every sheet that
     says light for its own part says «only light» (tests/unit/theme-light.test.mjs) */
  color-scheme: only light;
  /* C3: paper. Round 47 (owner: «the boxes run into each other in light»): the page a soft grey a phone's grouped lists use,
     so a white card stands off it (ΔE 5) as dark's lighter card stands off obsidian; a box inside a card the tint
     (raised-2, ΔE 4 from the card), the well in that the deeper grey (raised-3). css/theme-light.css nests them */
  --sys-canvas: #F3F2EF;
  --sys-base: #F1F0EC;
  --sys-raised: #FFFFFF;
  --sys-raised-2: #F4F3F0;
  --sys-raised-3: #E8E6E1;
  --sys-glass: rgba(255, 255, 255, 0.82);
  --sys-glass-strong: rgba(255, 255, 255, 0.94);
  --sys-hairline: rgba(5, 5, 16, 0.08);
  --sys-edge: rgba(5, 5, 16, 0.12);
  --sys-label: #050510;
  /* both read 4.5:1 or more on every light surface, the well and a fill over the page too (WCAG AA); at .72 and .44 the
     second read 4.49 on the page and the third 2.4 */
  --sys-label-2: rgba(60, 60, 67, 0.84);
  --sys-label-3: rgba(60, 60, 67, 0.78);
  --sys-accent: #8B3FD9;
  --sys-accent-ink: #6D28D9;
  --sys-film: rgba(118, 118, 128, 0.12);
  --sys-film-strong: rgba(118, 118, 128, 0.18);
  --sys-specular: rgba(255, 255, 255, 0.68);
  --sys-shadow: rgba(5, 5, 16, 0.12);
  --sys-scrim: rgba(5, 5, 16, 0.32);
  /* the status colours a sheet draws as text (E1's «Drop-in-kö», a «Live» dot's line) as well as a dot or a tint: the
     neon of dark read 2.2:1 on white (#10B981), these 4.5:1 and more, on their own tint too */
  --kr-green: #065F46;
  --ok: #065F46;
  --amber: #B45309;
  --live: #B45309;
  --err: #B91C1C;
  --rose: #BE123C;
  --hue-skonhet: #BE185D;
}

/* the moving flow's date field says a bare light for its picker in its generated sheets (css/stitch/moving/*.css) */
html[data-apple-theme="light"] .sys-mov-date-input.sys-mov-date-input { color-scheme: only light; }

:root {
  /* the canvas and its text (older names) */
  --ink: var(--sys-canvas);
  --ink-2: var(--sys-raised);
  --ink-3: var(--sys-raised-2);
  --paper: var(--sys-label);
  --paper-dim: var(--sys-label);
  --paper-muted: var(--sys-label-2);

  /* Vivid Neon Palette & Brand Accents */
  --primary: #8B5CF6;
  --primary-hi: #A855F7;
  --purple: #A855F7;
  --purple-glow: rgba(168, 85, 247, 0.45);
  --indigo: #6366F1;
  --indigo-glow: rgba(99, 102, 241, 0.45);
  --blue: #3B82F6;
  --blue-glow: rgba(59, 130, 246, 0.45);
  --cyan: #06B6D4;
  --cyan-glow: rgba(6, 182, 212, 0.45);
  --kr-green: #10B981;
  --kr-green-glow: rgba(16, 185, 129, 0.45);
  --amber: #F59E0B;
  --amber-glow: rgba(245, 158, 11, 0.45);
  --rose: #F43F5E;
  --rose-glow: rgba(244, 63, 94, 0.45);

  /* glass and its edges (older names), on the staircase */
  --glass-bg: var(--sys-glass);
  --glass-bg-elevated: var(--sys-glass-strong);
  --glass-surface: var(--sys-glass);
  --glass-card-bg: linear-gradient(145deg, var(--sys-film-strong) 0%, var(--sys-film) 100%);
  --glass-card-hover: linear-gradient(145deg, var(--sys-film-strong) 0%, var(--sys-film-strong) 100%);
  --glass-header-bg: linear-gradient(135deg, var(--sys-glass-strong) 0%, var(--sys-glass) 100%);
  --glass-border: var(--sys-edge);
  --glass-border-hi: rgba(168, 85, 247, 0.55);
  --glass-border-amber: rgba(245, 158, 11, 0.45);
  --glass-border-cyan: rgba(6, 182, 212, 0.45);
  --glass-border-green: rgba(16, 185, 129, 0.45);
  --glass-input-bg: var(--sys-raised-2);

  /* Dynamic Specular Edge Gradients */
  --glass-rim: linear-gradient(90deg, var(--sys-film), var(--sys-edge), var(--sys-film));
  --glass-rim-neon: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.6), rgba(99, 102, 241, 0.8), rgba(6, 182, 212, 0.6), transparent);

  /* Shadows & Inner Specular Glow */
  --shadow-sheet: 0 -24px 64px var(--sys-shadow), 0 0 1px var(--sys-edge);
  --shadow-card: 0 12px 32px var(--sys-shadow), inset 0 1px 1px var(--sys-film-strong);
  --shadow-luxe: 0 16px 44px var(--sys-shadow), inset 0 1px 1.5px var(--sys-film-strong);
  --shadow-float: 0 16px 40px var(--sys-shadow), 0 0 28px rgba(139, 92, 246, 0.28);

  /* Typography */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --font-arabic: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Geometry & Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-pill: 9999px;

  /* Apple HIG 8pt Grid & Micro-Typography Floor Constants (Wave 11) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --type-floor-caption2: 0.6875rem;
  --type-floor-caption1: 0.71875rem;
  --type-floor-leading-tight: 1.35;
  --type-floor-leading-snug: 1.38;
  --type-floor-tracking-cap: 0.08em;

  /* Layout Constants (Swipe Gesture Maintained 100%) */
  --sheet-collapsed: 18vh;
  --sheet-half: 52vh;
  --sheet-expanded: calc(100dvh - (var(--safe-top) + 84px));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Z-Index Hierarchy */
  --z-map: 1;
  --z-map-controls: 10;
  --z-sheet: 30;
  --z-topbar: 40;
  --z-modal: 60;
  --z-toast: 100001;
  --z-offline: 100002;

  /* ===== Service Spectrum ===== */
  --hue-taxi: #8B5CF6;
  --hue-mat: #F97316;
  --hue-skonhet: #EC4899;
  --hue-stad: #14B8A6;
  --hue-flytt: #6366F1;
  --hue-biltvatt: #06B6D4;
  --hue-hantverk: #EAB308;
  --hue-shopping: #84CC16;
  --hue-resor: #38BDF8;

  /* ===== Semantic Status ===== */
  --ok: #10B981;
  --live: #F59E0B;
  --err: #EF4444;

  /* ===== Glass Stack (from DESIGN.md Elevation & Depth) ===== */
  /* Canvas — Ground Floor */
  --glass-canvas: var(--sys-base);
  --glass-canvas-aurora: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.12), transparent 70%);

  /* Glass Level 1 — Structural Surfaces */
  --glass-l1-bg: var(--sys-glass);
  --glass-l1-blur: 16px;
  --glass-l1-border: var(--sys-hairline);

  /* Glass Level 2 — Floating Cards, Navbars */
  --glass-l2-bg: var(--sys-glass);
  --glass-l2-blur: 24px;
  --glass-l2-border: rgba(168, 85, 247, 0.18);

  /* Glass Level 3 — Dialogs, Overlays */
  --glass-l3-bg: var(--sys-glass-strong);
  --glass-l3-blur: 32px;
  --glass-l3-border: rgba(192, 132, 252, 0.3);

  /* Specular & Neon Glow */
  --glass-specular-top: inset 0 1px 0 0 var(--sys-specular, var(--sys-film));
  --glass-neon-active: 0 0 20px -2px rgba(139, 92, 246, 0.45), 0 0 40px -4px rgba(124, 58, 237, 0.25);

  /* ===== Design System Surface Palette (on the staircase) ===== */
  --ds-surface: var(--sys-raised);
  --ds-surface-dim: var(--sys-raised);
  --ds-surface-bright: var(--sys-raised-3);
  --ds-surface-lowest: var(--sys-base);
  --ds-surface-low: var(--sys-raised-2);
  --ds-surface-container: var(--sys-raised-2);
  --ds-surface-high: var(--sys-raised-3);
  --ds-surface-highest: var(--sys-raised-3);
  --ds-on-surface: var(--sys-label);
  --ds-on-surface-variant: var(--sys-label-2);
  --ds-outline: var(--sys-label-3);
  --ds-outline-variant: var(--sys-edge);

  /* ===== Active Service Hue (derived via data-service) ===== */
  --hue: var(--hue-taxi);

  /* ===== The map's own colours (js/map/map.js follows the theme with its tiles) ===== */
  --map-bg: var(--sys-base);
  --map-streets: var(--sys-raised-3);
  --map-water: var(--sys-raised-2);
  --map-parks: var(--sys-raised);
  --map-labels: var(--sys-label-3);
}

/* The liquid glass's names (css/apple-liquid-glass.css, B1 and B2) on the same staircases. «html:root» and
   «html[data-apple-theme]» outrank that file's «:root» and «[data-apple-theme]», so its navy canvas (--lg-canvas) and
   its surfaces read obsidian in dark and paper in light; its accents, shadows and motion stay its own. */
html:root,
html[data-apple-theme="dark"],
html[data-apple-theme="light"] {
  --lg-canvas: var(--sys-base);
  --lg-surface: var(--sys-glass);
  --lg-surface-elevated: var(--sys-glass-strong);
  --lg-surface-sheet: var(--sys-glass-strong);
  --lg-surface-card: var(--sys-glass);
  --lg-surface-inset: var(--sys-raised-2);
  --lg-surface-pill: var(--sys-glass);
  --lg-surface-input: var(--sys-raised-2);
  --lg-drawer-bg: var(--sys-glass-strong);
  --lg-border: var(--sys-edge);
  --lg-hairline: var(--sys-hairline);
  --lg-ink: var(--sys-label);
  --lg-ink-secondary: var(--sys-label-2);
  --lg-row-hover: var(--sys-film);
}

/* === Service hue derivation via data-service attribute === */
[data-service="taxi"]     { --hue: var(--hue-taxi); }
[data-service="mat"]      { --hue: var(--hue-mat); }
[data-service="skonhet"]  { --hue: var(--hue-skonhet); }
[data-service="stad"]     { --hue: var(--hue-stad); }
[data-service="flytt"]    { --hue: var(--hue-flytt); }
[data-service="biltvatt"] { --hue: var(--hue-biltvatt); }
[data-service="hantverk"] { --hue: var(--hue-hantverk); }
[data-service="shopping"] { --hue: var(--hue-shopping); }
[data-service="resor"]    { --hue: var(--hue-resor); }
