/* ==========================================================================
   CarCross AI — 2026 Mobility & Fintech Design System Tokens + 120fps GPU Scroll
   Inspired by Toss, HeyDealer & Tesla Telemetry HUD (@fork_coding 4 Laws)
   ========================================================================== */

:root {
  /* 1. Clean Mobility App Light Palette (Cool Slate & Pure White Squircles) */
  --bg-canvas: #F2F4F7;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F8FAFC;
  --bg-subtle: #EEF2F6;
  --bg-hud: #0B1120;

  --text-ink: #0F172A;
  --text-main: #0F172A;
  --text-sub: #475569;
  --text-mute: #94A3B8;

  --border-subtle: rgba(15, 23, 42, 0.07);
  --border-strong: rgba(15, 23, 42, 0.14);

  /* Semantic High-Contrast Accents */
  --accent-primary: #2563EB;
  --accent-primary-soft: #EFF6FF;
  --accent-emerald: #059669;
  --accent-emerald-soft: #ECFDF5;
  --accent-indigo: #4F46E5;
  --accent-indigo-soft: #EEF2FF;
  --accent-amber: #D97706;
  --accent-amber-soft: #FFFBEB;
  --accent-crimson: #E11D48;
  --accent-crimson-soft: #FFF1F2;

  /* 2. Typography Families */
  --font-sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  /* 3. @fork_coding Law 1: Modular Font Scale */
  --fs-xs: 12px;
  --fs-sm: 13.5px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  /* 4. @fork_coding Law 2: Inverse Letter Spacing */
  --ls-display: -0.03em;
  --ls-heading: -0.02em;
  --ls-body: -0.005em;
  --ls-badge: 0.04em;

  /* 5. @fork_coding Law 3: Inverse Line Height (Korean Body >= 1.65) */
  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-body: 1.65;

  /* 6. Font Weights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 800;

  /* 7. Modern Squircle Radii & Ambient Elevation */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
  --shadow-elevated: 0 20px 40px -12px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.05);
  --ease-glide: cubic-bezier(0.16, 1, 0.3, 1);
}

/* @fork_coding Law 4: Carbon Dark Mode with Halation Weight Compensation */
body.mode-theater {
  --bg-canvas: #090D16;
  --bg-surface: #111827;
  --bg-elevated: #1E293B;
  --bg-subtle: #0F172A;
  --bg-hud: #060911;

  --text-ink: #F8FAFC;
  --text-main: #F8FAFC;
  --text-sub: #CBD5E1;
  --text-mute: #64748B;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --accent-primary: #3B82F6;
  --accent-primary-soft: rgba(59, 130, 246, 0.15);
  --accent-emerald: #10B981;
  --accent-emerald-soft: rgba(16, 185, 129, 0.14);
  --accent-amber: #F59E0B;
  --accent-amber-soft: rgba(245, 158, 11, 0.14);
  --accent-crimson: #F43F5E;
  --accent-crimson-soft: rgba(244, 63, 94, 0.15);

  --fw-regular: 350;
  --fw-medium: 450;
  --fw-semibold: 550;
  --fw-bold: 650;
  --fw-black: 750;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

section[id], #reportRoot {
  scroll-margin-top: 84px;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  word-break: keep-all;
}

button, input {
  font: inherit;
  color: inherit;
}

/* ==========================================================================
   8. Zero-Jank GPU Scroll Progress & Floating Section Glider Rail
   ========================================================================== */

.scroll-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 90;
  background: transparent;
  pointer-events: none;
}

.scroll-progress-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #2563EB 0%, #38BDF8 55%, #10B981 100%);
  will-change: transform;
}

.scroll-rail-nav {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translate3d(0, -50%, 0);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 10px 8px;
  box-shadow: var(--shadow-card);
}

body.mode-theater .scroll-rail-nav {
  background: rgba(15, 23, 42, 0.92);
}

@media (max-width: 1260px) {
  .scroll-rail-nav { display: none; }
}

.scroll-rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
}

.scroll-rail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: transform 0.2s var(--ease-glide), background-color 0.2s ease;
}

.scroll-rail-btn:hover .scroll-rail-dot,
.scroll-rail-btn.active .scroll-rail-dot {
  transform: scale(1.45);
  background: var(--accent-primary);
}

.scroll-rail-label {
  position: absolute;
  right: 38px;
  white-space: nowrap;
  background: #0F172A;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  opacity: 0;
  transform: translate3d(6px, 0, 0);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s var(--ease-glide);
}

.scroll-rail-btn:hover .scroll-rail-label {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Fast, Featherlight GPU Reveal */
.scroll-slide-item {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 0.38s var(--ease-glide),
    transform 0.38s var(--ease-glide);
  will-change: opacity, transform;
}

.scroll-slide-item.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@keyframes panelSlideUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.slide-in-panel {
  animation: panelSlideUp 0.34s var(--ease-glide) both;
}
