/* ==========================================================================
   MERIDIAN DESIGN SYSTEM (v1.5.0) — POLESTAR SHOOTING BRAKE 360° SHOWCASE
   Single-Ink Multi-Surface · Geist 3-Voice · Pure Plotter SVG · Motion Gate
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("./assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Serif";
  src: url("./assets/fonts/GeistSerifVF.woff2") format("woff2-variations"),
       url("./assets/fonts/GeistSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("./assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. PRIMITIVES, TYPOGRAPHY, RADII & MOTION TOKENS
   -------------------------------------------------------------------------- */
:root {
  --ds-font-display: "Geist Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ds-font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ds-font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Dual-Radius Grammar */
  --ds-radius-none: 0px;
  --ds-radius-plate: 4px;
  --ds-radius-squircle: 8px;
  --ds-radius-card: 12px;
  --ds-radius-pill: 9999px;

  /* Official Meridian Curves */
  --ds-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ds-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ds-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ds-ease-snappy: cubic-bezier(0.85, 0, 0, 1);
  --ds-ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);

  --ds-duration-press: 120ms;
  --ds-duration-fast: 160ms;
  --ds-duration-base: 220ms;
  --ds-duration-drawer: 380ms;
  --ds-duration-reveal: 560ms;

  --ds-press-scale: 0.97;
  --ds-enter-scale: 0.96;

  /* Contained Organic & Swedish Gold Signal Accents */
  --ds-organic-olive: #5E6E47;
  --ds-organic-sky: #477085;
  --ds-organic-coral: #B55A42;
  --ds-organic-ochre: #9A7134;
  --ds-organic-slate: #56606E;
  --ds-swedish-gold: #D4A024;

  /* Paper Grain Controls */
  --ds-paper-texture: none;
  --ds-paper-opacity: 0.9;
  --ds-grain-multiplier: 0.85;
  --ds-grain-opacity: 1;

  /* Layout Measure */
  --topbar-h: 56px;
  --stage-pad-x: clamp(16px, 3vw, 36px);
  --stage-pad-y: clamp(16px, 2.5vh, 28px);
}

/* --------------------------------------------------------------------------
   2. SINGLE-INK MULTI-SURFACE ENGINE (5 Curated Surfaces)
   -------------------------------------------------------------------------- */
:root,
[data-surface="ivory"] {
  color-scheme: light;
  --ds-bg: #FAF9F5;
  --ds-surface-1: #F5F4ED;
  --ds-surface-2: #E8E6DC;
  --ds-surface-3: #DEDCD1;
  --ds-highlight: #FFFFFF;
  --ds-fg: #141413;
  --ds-fg-secondary: #30302E;
  --ds-fg-muted: #5E5D59;
  --ds-fg-subtle: #787770;
  --ds-paper-opacity: calc(1 * var(--ds-grain-multiplier));
}

[data-surface="paper"] {
  color-scheme: light;
  --ds-bg: #FFFFFF;
  --ds-surface-1: #F8F8F6;
  --ds-surface-2: #EDEDEA;
  --ds-surface-3: #E0E0DC;
  --ds-highlight: #FFFFFF;
  --ds-fg: #0A0A0A;
  --ds-fg-secondary: #242424;
  --ds-fg-muted: #595959;
  --ds-fg-subtle: #737373;
  --ds-paper-opacity: calc(0.75 * var(--ds-grain-multiplier));
}

[data-surface="mist"] {
  color-scheme: light;
  --ds-bg: #C5D4CE;
  --ds-surface-1: #B9C9C2;
  --ds-surface-2: #A8B9B2;
  --ds-surface-3: #96A8A0;
  --ds-highlight: #E8F0EC;
  --ds-fg: #141816;
  --ds-fg-secondary: #242E2A;
  --ds-fg-muted: #3E4E48;
  --ds-fg-subtle: #506258;
  --ds-paper-opacity: calc(0.9 * var(--ds-grain-multiplier));
}

[data-surface="slate"] {
  color-scheme: light;
  --ds-bg: #B5BFC9;
  --ds-surface-1: #A9B3BD;
  --ds-surface-2: #98A2AC;
  --ds-surface-3: #86909A;
  --ds-highlight: #E6EBEF;
  --ds-fg: #141618;
  --ds-fg-secondary: #24282C;
  --ds-fg-muted: #3E464E;
  --ds-fg-subtle: #505860;
  --ds-paper-opacity: calc(0.95 * var(--ds-grain-multiplier));
}

[data-surface="terracotta"] {
  color-scheme: light;
  --ds-bg: #EDBB99;
  --ds-surface-1: #E4B08D;
  --ds-surface-2: #D6A17E;
  --ds-surface-3: #C8926E;
  --ds-highlight: #FBF0E6;
  --ds-fg: #171614;
  --ds-fg-secondary: #2E2824;
  --ds-fg-muted: #56473E;
  --ds-fg-subtle: #6E5C50;
  --ds-paper-opacity: calc(0.92 * var(--ds-grain-multiplier));
}

[data-surface="obsidian"] {
  color-scheme: dark;
  --ds-bg: #0E0E0D;
  --ds-surface-1: #171715;
  --ds-surface-2: #222220;
  --ds-surface-3: #2E2E2B;
  --ds-highlight: #2C2C29;
  --ds-fg: #FAF9F5;
  --ds-fg-secondary: #DEDCD4;
  --ds-fg-muted: #A1A098;
  --ds-fg-subtle: #787770;
  --ds-swedish-gold: #E4B43C;
  --ds-paper-opacity: calc(0.88 * var(--ds-grain-multiplier));
}

:root,
[data-surface] {
  --ds-bg-tint-subtle: color-mix(in srgb, var(--ds-fg) 4.5%, var(--ds-bg));
  --ds-bg-tint-muted: color-mix(in srgb, var(--ds-fg) 8.5%, var(--ds-bg));
  --ds-bg-tint-active: color-mix(in srgb, var(--ds-fg) 12%, var(--ds-bg));
  --ds-rule: color-mix(in srgb, var(--ds-fg) 9%, transparent);
  --ds-rule-strong: color-mix(in srgb, var(--ds-fg) 14%, transparent);
  --ds-border: color-mix(in srgb, var(--ds-fg) 9%, transparent);
  --ds-border-strong: color-mix(in srgb, var(--ds-fg) 16%, transparent);
  --ds-chrome-bg: color-mix(in srgb, var(--ds-bg) 82%, transparent);
  --ds-card-bg: color-mix(in srgb, var(--ds-bg) 90%, transparent);
  --ds-shadow-focus: 0 0 0 1px var(--ds-bg), 0 0 0 2px color-mix(in srgb, var(--ds-fg) 38%, transparent);
}

/* --------------------------------------------------------------------------
   3. BASELINE, SCROLLBARS & PAPER GRAIN LAYER
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--ds-bg);
  color: var(--ds-fg);
  font-family: var(--ds-font-sans);
  font-size: 15px;
  line-height: 1.54;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  transition: background-color var(--ds-duration-base) var(--ds-ease-out),
              color var(--ds-duration-base) var(--ds-ease-out);
}

button, a, [role="button"], [role="tab"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  font-family: inherit;
  color: inherit;
}

button {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ds-shadow-focus);
}

.ds-tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

@supports (-moz-appearance: none) {
  .drawer-scroll {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ds-fg) 22%, transparent) transparent;
  }
}

.drawer-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}
.drawer-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.drawer-scroll::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--ds-fg) 26%, transparent);
  background-clip: padding-box;
  border: solid transparent;
  border-width: 0 4px 0 2px;
  min-height: 24px;
}

.ds-paper-grain-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 95;
  display: block;
  mix-blend-mode: normal;
  opacity: calc(var(--ds-paper-opacity) * var(--ds-grain-opacity, 1));
}

html[data-surface="obsidian"] .ds-paper-grain-layer {
  filter: invert(1);
  opacity: calc(var(--ds-paper-opacity) * var(--ds-grain-opacity, 1) * 0.92);
}

/* Page Enter Veil */
.ds-page-veil {
  position: fixed;
  inset: 0;
  z-index: 120;
  background-color: var(--ds-bg);
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--ds-duration-reveal) var(--ds-ease-editorial);
}

html[data-page-ready="true"] .ds-page-veil {
  opacity: 0;
}

.ds-page-enter {
  transform: scale(var(--ds-enter-scale));
  opacity: 0;
  transition: transform var(--ds-duration-reveal) var(--ds-ease-editorial),
              opacity var(--ds-duration-reveal) var(--ds-ease-editorial);
}

html[data-page-ready="true"] .ds-page-enter {
  transform: scale(1);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   4. VIEWPORT-LOCKED SHELL (Strict 100dvh × 100vw, Zero Overflow)
   -------------------------------------------------------------------------- */
.app-shell {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) auto;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--ds-rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ds-rule) 1px, transparent 1px);
  background-size: clamp(64px, 8vw, 112px) clamp(64px, 8vw, 112px);
  background-position: center center;
  opacity: 0.34;
  mask-image: radial-gradient(ellipse 76% 68% at 50% 52%, rgba(0, 0, 0, 0.9) 0%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse 76% 68% at 50% 52%, rgba(0, 0, 0, 0.9) 0%, transparent 92%);
  z-index: 0;
}

/* --------------------------------------------------------------------------
   5. TOPBAR CHROME & CLIP-PATH SEGMENTED TABS
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 30;
  min-width: 0;
  max-width: 100%;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 var(--stage-pad-x);
  background-color: var(--ds-chrome-bg);
  border-bottom: 1px solid var(--ds-rule);
}

@media (min-width: 720px) {
  .topbar {
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
  }
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-star {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--ds-fg);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
  min-width: 0;
}

.brand-title {
  font-family: var(--ds-font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ds-fg);
  white-space: nowrap;
}

.brand-sub {
  font-family: var(--ds-font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
  white-space: nowrap;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Meridian Clip-Path Seamless Tabs */
.ds-cliptabs {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-bg-tint-subtle);
}

.ds-cliptabs-track,
.ds-cliptabs-overlay {
  display: flex;
  align-items: center;
  gap: 2px;
}

.ds-cliptabs-overlay {
  position: absolute;
  inset: 3px;
  background-color: var(--ds-fg);
  color: var(--ds-bg);
  border-radius: var(--ds-radius-pill);
  pointer-events: none;
  clip-path: inset(0 var(--clip-r, 50%) 0 var(--clip-l, 0%) round 9999px);
  transition: clip-path var(--ds-duration-base) var(--ds-ease-in-out);
}

.ds-cliptab-btn,
.ds-cliptab-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--ds-radius-pill);
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ds-cliptab-btn {
  color: var(--ds-fg-muted);
  transition: color var(--ds-duration-fast) var(--ds-ease-out),
              transform var(--ds-duration-press) var(--ds-ease-out);
}

.ds-cliptab-btn:active {
  transform: scale(var(--ds-press-scale));
}

.ds-cliptab-ghost {
  color: var(--ds-bg);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.surface-strip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-border);
  background-color: var(--ds-bg-tint-subtle);
}

.surface-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: var(--ds-radius-pill);
  border: 1px solid color-mix(in srgb, var(--ds-fg) 24%, transparent);
  background-color: var(--swatch, #FAF9F5);
  transition: transform var(--ds-duration-fast) var(--ds-ease-out),
              border-color var(--ds-duration-fast) var(--ds-ease-out);
}

.surface-dot[aria-pressed="true"] {
  transform: scale(1.14);
  border-color: var(--ds-fg);
  box-shadow: 0 0 0 1px var(--ds-bg), 0 0 0 2px var(--ds-fg);
}

.surface-dot:active {
  transform: scale(var(--ds-press-scale));
}

.btn-archive {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--ds-radius-squircle);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-bg-tint-subtle);
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out),
              border-color var(--ds-duration-fast) var(--ds-ease-out),
              transform var(--ds-duration-press) var(--ds-ease-out);
}

.btn-archive:active {
  transform: scale(var(--ds-press-scale));
}

.ds-burger {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-radius-squircle);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-bg-tint-subtle);
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out),
              transform var(--ds-duration-press) var(--ds-ease-out);
}

.ds-burger:active {
  transform: scale(var(--ds-press-scale));
}

.ds-burger-lines {
  position: relative;
  width: 18px;
  height: 12px;
  display: block;
}

.ds-burger-lines span {
  position: absolute;
  left: 0;
  width: 18px;
  height: 1.5px;
  background-color: var(--ds-fg);
  border-radius: 1px;
  transition: transform var(--ds-duration-base) var(--ds-ease-out),
              opacity var(--ds-duration-fast) var(--ds-ease-out);
}

.ds-burger-lines span:nth-child(1) { top: 0; }
.ds-burger-lines span:nth-child(2) { top: 5.25px; }
.ds-burger-lines span:nth-child(3) { top: 10.5px; }

.ds-burger[aria-expanded="true"] .ds-burger-lines span:nth-child(1) {
  transform: translateY(5.25px) rotate(45deg);
}
.ds-burger[aria-expanded="true"] .ds-burger-lines span:nth-child(2) {
  opacity: 0;
}
.ds-burger[aria-expanded="true"] .ds-burger-lines span:nth-child(3) {
  transform: translateY(-5.25px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   6. MAIN 360° STAGE & PURE-LINE MERIDIAN PLOTTER SVG LAYER
   -------------------------------------------------------------------------- */
.stage-wrap {
  position: relative;
  z-index: 10;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#car-stage {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#car-stage[data-dragging="true"] {
  cursor: grabbing;
}

.stage-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

/* Pure Single-Ink Plotter Grammar (Exact Meridian 81k Globe Discipline) */
[data-plotter] {
  --plotter-ink: var(--ds-fg);
  color: var(--plotter-ink);
  stroke: var(--plotter-ink);
}

[data-plotter] path,
[data-plotter] line,
[data-plotter] circle,
[data-plotter] polyline {
  vector-effect: non-scaling-stroke;
}

[data-plotter] [data-plotter-role="primary"],
[data-plotter] [data-plotter-role="section"] {
  stroke-width: 1.25;
  opacity: 1;
  stroke-dasharray: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-plotter] [data-plotter-role="section"] {
  stroke-width: 1.45;
}

[data-plotter] [data-plotter-role="secondary"],
[data-plotter] [data-plotter-role="dimension"],
[data-plotter] [data-plotter-role="leader"] {
  stroke-width: 1;
  opacity: 0.36;
  stroke-dasharray: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-plotter] [data-plotter-role="guide"] {
  stroke-width: 1;
  opacity: 0.16;
  stroke-dasharray: none;
}

[data-plotter] [data-plotter-role="centerline"] {
  stroke-width: 1;
  opacity: 0.16;
  stroke-dasharray: 8 3 1 3;
}

[data-plotter] [data-plotter-role="hidden"],
[data-plotter] [data-plotter-role="proposed"] {
  stroke-width: 1;
  opacity: 0.24;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
}

[data-plotter] [data-plotter-role="transfer"] {
  stroke-width: 1.1;
  opacity: 0.42;
  stroke-dasharray: 4 6;
}

.svg-caliper-stroke {
  stroke: var(--ds-swedish-gold);
  stroke-width: 1.4;
  opacity: 0.92;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-led-front,
.svg-led-rear {
  stroke: var(--ds-fg);
  stroke-width: 1.75;
  opacity: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: svgLedPulse 3.4s var(--ds-ease-out) infinite;
}

.svg-led-rear {
  stroke: var(--ds-organic-coral);
  stroke-width: 1.7;
}

.svg-plate-text {
  font-family: var(--ds-font-sans);
  font-weight: 500;
  letter-spacing: 0.02em;
  fill: var(--ds-fg);
  stroke: none;
}

.svg-airflow-stream {
  fill: none;
  stroke: var(--ds-fg);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-dasharray: 16 14;
  opacity: 0.36;
  animation: svgFlowStream 2.4s linear infinite;
}

.svg-leader-path {
  fill: none;
  stroke: var(--ds-fg);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.72;
  transition: stroke-dashoffset 380ms var(--ds-ease-editorial),
              opacity 220ms var(--ds-ease-out);
}

.svg-reticle-ring {
  fill: none;
  stroke: var(--ds-fg);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: svgReticlePulse 2.6s var(--ds-ease-out) infinite;
}

.svg-reticle-gold {
  fill: var(--ds-swedish-gold);
  stroke: var(--ds-bg);
  stroke-width: 1.5;
}

.svg-orbit-arc {
  fill: none;
  stroke: var(--ds-fg);
  stroke-width: 1.3;
  opacity: 0.5;
}

.svg-dim-label {
  font-family: var(--ds-font-mono);
  font-size: 10.5px;
  font-weight: 400;
  fill: var(--ds-fg);
  stroke: none;
  opacity: 0.68;
  font-variant-numeric: tabular-nums;
}

@keyframes svgFlowStream {
  from { stroke-dashoffset: 60; }
  to { stroke-dashoffset: 0; }
}

@keyframes svgLedPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.66; }
}

@keyframes svgReticlePulse {
  0% {
    transform: scale(0.96);
    opacity: 0.72;
  }
  70% {
    transform: scale(1.62);
    opacity: 0;
  }
  100% {
    transform: scale(1.62);
    opacity: 0;
  }
}

/* Interactive Hotspot Pins Layer */
.stage-pins {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.hotspot-pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
  border-radius: var(--ds-radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  border: 1px solid color-mix(in srgb, var(--ds-fg) 34%, transparent);
  background-color: color-mix(in srgb, var(--ds-bg) 90%, transparent);
  color: var(--ds-fg);
  pointer-events: auto;
  transition: transform var(--ds-duration-fast) var(--ds-ease-out),
              opacity var(--ds-duration-fast) var(--ds-ease-out),
              background-color var(--ds-duration-fast) var(--ds-ease-out),
              color var(--ds-duration-fast) var(--ds-ease-out),
              border-color var(--ds-duration-fast) var(--ds-ease-out);
}

.hotspot-pin[data-active="true"] {
  background-color: var(--ds-fg);
  color: var(--ds-bg);
  border-color: var(--ds-fg);
}

.hotspot-pin[data-back="true"] {
  opacity: 0.24;
  pointer-events: none;
}

/* Top-Left Editorial Hero Lockup (Calibrated Line-Height & Margins) */
.hero-editorial {
  position: absolute;
  top: var(--stage-pad-y);
  left: var(--stage-pad-x);
  z-index: 8;
  max-width: min(460px, 42vw);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
  margin-bottom: 12px;
}

.hero-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--ds-radius-pill);
  background-color: var(--ds-swedish-gold);
  flex-shrink: 0;
}

.hero-title {
  margin: 0 0 14px 0;
  font-family: var(--ds-font-display);
  font-weight: 400;
  font-synthesis-weight: none;
  font-size: clamp(1.75rem, 3.1vw, 3.1rem);
  line-height: 1.14;
  letter-spacing: -0.022em;
  color: var(--ds-fg);
}

.hero-sub {
  margin: 0;
  font-family: var(--ds-font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  letter-spacing: -0.006em;
  color: var(--ds-fg-muted);
  max-width: 44ch;
}

/* Top-Right Telemetry & 1:1 Locked Mini-Radar SVG */
.hud-telemetry {
  position: absolute;
  top: var(--stage-pad-y);
  right: var(--stage-pad-x);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--ds-radius-card);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-card-bg);
  pointer-events: none;
}

.telemetry-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.telemetry-deg {
  font-family: var(--ds-font-display);
  font-weight: 400;
  font-synthesis-weight: none;
  font-size: 1.75rem;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ds-fg);
}

.telemetry-sector {
  font-family: var(--ds-font-mono);
  font-size: 0.625rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
}

.radar-frame {
  width: 58px;
  height: 58px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

.drag-cue {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-border);
  background-color: var(--ds-card-bg);
  font-family: var(--ds-font-mono);
  font-size: 0.65rem;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
  pointer-events: none;
  opacity: 0.88;
  transition: opacity var(--ds-duration-base) var(--ds-ease-out),
              transform var(--ds-duration-base) var(--ds-ease-out);
}

.drag-cue[data-hidden="true"] {
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
}

/* --------------------------------------------------------------------------
   7. DESKTOP FLOATING CALLOUT CARDS (Generous Title / Subtitle Spacing)
   -------------------------------------------------------------------------- */
.stage-callouts {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.callout-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 268px;
  padding: 16px 18px;
  border-radius: var(--ds-radius-card);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-card-bg);
  pointer-events: auto;
  opacity: 0;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0) scale(var(--ds-enter-scale));
  transition: opacity var(--ds-duration-base) var(--ds-ease-out),
              transform var(--ds-duration-base) var(--ds-ease-editorial),
              border-color var(--ds-duration-fast) var(--ds-ease-out);
}

.callout-card[data-visible="true"] {
  opacity: 1;
  transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0) scale(1);
}

.callout-card[data-primary="true"] {
  border-color: color-mix(in srgb, var(--ds-fg) 28%, transparent);
}

.callout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.callout-index {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ds-font-mono);
  font-size: 0.65rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
}

.callout-index-bar {
  width: 14px;
  height: 1.5px;
  background-color: var(--ds-swedish-gold);
}

.callout-spec {
  font-family: var(--ds-font-mono);
  font-size: 0.625rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--ds-fg-subtle);
  padding: 2px 7px;
  border-radius: var(--ds-radius-plate);
  background-color: var(--ds-bg-tint-subtle);
  border: 1px solid var(--ds-rule);
}

.callout-title {
  margin: 0 0 8px 0;
  font-family: var(--ds-font-display);
  font-weight: 400;
  font-synthesis-weight: none;
  font-size: 1.09375rem;
  line-height: 1.24;
  letter-spacing: -0.014em;
  color: var(--ds-fg);
}

.callout-desc {
  margin: 0;
  font-family: var(--ds-font-sans);
  font-size: 0.8125rem;
  line-height: 1.56;
  color: var(--ds-fg-muted);
}

/* --------------------------------------------------------------------------
   8. MOBILE DOCKED CAPTION DECK (Visible below 900px)
   -------------------------------------------------------------------------- */
.mobile-caption-deck {
  display: none;
  min-width: 0;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   9. BOTTOM INSTRUMENT DOCK (Strict Width Containment)
   -------------------------------------------------------------------------- */
.bottom-dock {
  position: relative;
  z-index: 25;
  min-width: 0;
  max-width: 100%;
  padding: 9px var(--stage-pad-x) 11px;
  background-color: var(--ds-chrome-bg);
  border-top: 1px solid var(--ds-rule);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dock-top-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.dock-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: var(--ds-radius-squircle);
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-bg-tint-subtle);
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ds-fg);
  white-space: nowrap;
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out),
              border-color var(--ds-duration-fast) var(--ds-ease-out),
              transform var(--ds-duration-press) var(--ds-ease-out);
}

.icon-btn[aria-pressed="true"] {
  background-color: var(--ds-fg);
  color: var(--ds-bg);
  border-color: var(--ds-fg);
}

.icon-btn:active {
  transform: scale(var(--ds-press-scale));
}

.azimuth-scrubber {
  position: relative;
  min-width: 0;
  height: 34px;
  display: flex;
  align-items: center;
  cursor: ew-resize;
  touch-action: none;
  padding: 0 4px;
  border-radius: var(--ds-radius-squircle);
  border: 1px solid var(--ds-rule);
  background-color: var(--ds-bg-tint-subtle);
  overflow: hidden;
}

.azimuth-svg {
  width: 100%;
  max-width: 720px;
  height: 26px;
  margin: 0 auto;
  display: block;
}

.milestone-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.milestone-rail::-webkit-scrollbar {
  display: none;
}

.milestone-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--ds-radius-pill);
  border: 1px solid var(--ds-border);
  background-color: transparent;
  font-family: var(--ds-font-sans);
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--ds-fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--ds-duration-fast) var(--ds-ease-out),
              border-color var(--ds-duration-fast) var(--ds-ease-out),
              color var(--ds-duration-fast) var(--ds-ease-out),
              transform var(--ds-duration-press) var(--ds-ease-out);
}

.milestone-pill .pill-num {
  font-family: var(--ds-font-mono);
  font-size: 0.625rem;
  opacity: 0.65;
}

.milestone-pill[aria-current="true"] {
  background-color: var(--ds-fg);
  color: var(--ds-bg);
  border-color: var(--ds-fg);
}

.milestone-pill[aria-current="true"] .pill-num {
  opacity: 0.85;
}

.milestone-pill:active {
  transform: scale(var(--ds-press-scale));
}

/* --------------------------------------------------------------------------
   10. REFERENCE ARCHIVE DRAWER (Dim-Only Backdrop, No Backdrop Blur)
   -------------------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(20, 16, 12, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ds-duration-drawer) var(--ds-ease-drawer);
}

.drawer-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.archive-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  width: min(440px, 92vw);
  background-color: var(--ds-bg);
  border-left: 1px solid var(--ds-border-strong);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--ds-duration-drawer) var(--ds-ease-drawer);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.archive-drawer[data-open="true"] {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ds-rule);
}

.drawer-title-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.drawer-title {
  margin: 0;
  font-family: var(--ds-font-display);
  font-weight: 400;
  font-synthesis-weight: none;
  font-size: 1.25rem;
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.drawer-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.drawer-section-label {
  font-family: var(--ds-font-mono);
  font-size: 0.65rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
  margin-bottom: 12px;
}

.drawer-mobile-controls {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ds-rule);
}

.drawer-plate {
  border: 1px solid var(--ds-border-strong);
  border-radius: var(--ds-radius-plate);
  overflow: hidden;
  background-color: var(--ds-bg-tint-subtle);
}

.drawer-plate img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.drawer-plate-cap {
  padding: 11px 14px;
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--ds-fg-muted);
  border-top: 1px solid var(--ds-rule);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.spec-ledger {
  border-top: 1px solid var(--ds-rule);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ds-rule);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.spec-k {
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ds-fg-muted);
}

.spec-v {
  font-family: var(--ds-font-mono);
  font-size: 0.78125rem;
  color: var(--ds-fg);
  text-align: right;
}

/* --------------------------------------------------------------------------
   11. FINE-POINTER HOVER RULES (Strict Touch Discipline)
   -------------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .ds-cliptab-btn:hover {
    color: var(--ds-fg);
  }
  .surface-dot:hover {
    transform: scale(1.16);
  }
  .btn-archive:hover,
  .ds-burger:hover,
  .icon-btn:hover {
    background-color: var(--ds-bg-tint-muted);
    border-color: var(--ds-border-strong);
  }
  .icon-btn[aria-pressed="true"]:hover {
    background-color: color-mix(in srgb, var(--ds-fg) 88%, var(--ds-bg));
  }
  .milestone-pill:hover {
    background-color: var(--ds-bg-tint-subtle);
    border-color: var(--ds-border-strong);
    color: var(--ds-fg);
  }
  .milestone-pill[aria-current="true"]:hover {
    background-color: var(--ds-fg);
    color: var(--ds-bg);
  }
  .hotspot-pin:hover {
    transform: translate3d(var(--px, 0px), var(--py, 0px), 0) scale(1.14);
    border-color: var(--ds-fg);
  }
  .callout-card:hover {
    border-color: color-mix(in srgb, var(--ds-fg) 32%, transparent);
  }
}

/* --------------------------------------------------------------------------
   12. MOBILE & TABLET RESPONSIVE LAYOUT (< 900px) — Zero Overflow 100dvh
   -------------------------------------------------------------------------- */
@media (max-width: 899px) {
  :root {
    --topbar-h: 50px;
    --stage-pad-x: 12px;
    --stage-pad-y: 10px;
  }

  .brand-sub,
  .topbar-surfaces,
  .btn-archive,
  .stage-callouts,
  .hero-sub,
  .dock-btn-label,
  .milestone-rail {
    display: none;
  }

  .brand-title {
    font-size: 0.8125rem;
  }

  .ds-cliptab-btn,
  .ds-cliptab-ghost {
    height: 28px;
    padding: 0 9px;
    font-size: 0.625rem;
  }

  .hero-editorial {
    max-width: calc(100% - 128px);
  }

  .hero-eyebrow {
    font-size: 0.6rem;
    line-height: 1.35;
    margin-bottom: 6px;
  }

  .hero-title {
    font-size: clamp(1.1rem, 4.4vw, 1.55rem);
    line-height: 1.18;
    margin: 0 0 4px 0;
  }

  .hud-telemetry {
    padding: 6px 9px;
    gap: 8px;
    border-radius: var(--ds-radius-squircle);
  }

  .telemetry-deg {
    font-size: 1.15rem;
    line-height: 1.05;
  }

  .telemetry-sector {
    display: none;
  }

  .radar-frame {
    width: 34px;
    height: 34px;
  }

  .drag-cue {
    bottom: 6px;
    font-size: 0.6rem;
    padding: 4px 10px;
  }

  .bottom-dock {
    padding: 8px 12px 10px;
    gap: 8px;
  }

  .mobile-caption-deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--ds-radius-card);
    border: 1px solid var(--ds-border-strong);
    background-color: var(--ds-bg-tint-subtle);
  }

  .mobile-cap-body {
    min-width: 0;
  }

  .mobile-cap-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
  }

  .mobile-cap-idx {
    font-family: var(--ds-font-mono);
    font-size: 0.625rem;
    line-height: 1.3;
    letter-spacing: 0.08em;
    color: var(--ds-fg-muted);
  }

  .mobile-cap-spec {
    font-family: var(--ds-font-mono);
    font-size: 0.6rem;
    line-height: 1.3;
    color: var(--ds-fg-subtle);
    padding: 1px 5px;
    border-radius: var(--ds-radius-plate);
    border: 1px solid var(--ds-rule);
    white-space: nowrap;
  }

  .mobile-cap-title {
    margin: 0 0 4px 0;
    font-family: var(--ds-font-display);
    font-weight: 400;
    font-synthesis-weight: none;
    font-size: 0.96875rem;
    line-height: 1.24;
    letter-spacing: -0.012em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-cap-desc {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.46;
    color: var(--ds-fg-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mobile-cap-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .mobile-step-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-squircle);
    border: 1px solid var(--ds-border-strong);
    background-color: var(--ds-bg);
    transition: transform var(--ds-duration-press) var(--ds-ease-out),
                background-color var(--ds-duration-fast) var(--ds-ease-out);
  }

  .mobile-step-btn:active {
    transform: scale(var(--ds-press-scale));
    background-color: var(--ds-bg-tint-muted);
  }

  .dock-top-row {
    gap: 8px;
  }

  .icon-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
  }

  .drawer-mobile-controls {
    display: flex;
  }
}

@media (min-width: 900px) {
  #btn-burger {
    display: none;
  }
}

@media (max-height: 700px) and (max-width: 899px) {
  .hero-eyebrow { display: none; }
  .hero-title { font-size: 1.12rem; line-height: 1.16; }
  .mobile-caption-deck { padding: 8px 10px; }
  .mobile-cap-desc { -webkit-line-clamp: 1; }
  .bottom-dock { padding: 6px 12px 8px; gap: 6px; }
}

/* --------------------------------------------------------------------------
   13. REDUCED MOTION & TRANSPARENCY RESPECT
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --ds-press-scale: 1;
    --ds-enter-scale: 1;
    --ds-duration-drawer: 180ms;
    --ds-duration-reveal: 200ms;
  }
  .svg-airflow-stream,
  .svg-reticle-ring,
  .svg-led-front,
  .svg-led-rear {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  :root, [data-surface] {
    --ds-chrome-bg: var(--ds-bg);
    --ds-card-bg: var(--ds-bg);
  }
}
