/* ============================================
   Hero — dark stage
   route-network background · particle canvas ·
   glowing horizon · staggered copy · 3D emblem
   Theme-aware via --hx-* custom props.
   ============================================ */
.hero--cinematic {
  /* dark (default) — night road */
  --hx-bg0: #0E1114;
  --hx-bg1: #12161B;
  --hx-bg2: #161C23;
  --hx-neb1: rgba(0, 87, 184, 0.18);
  --hx-neb2: rgba(255, 213, 0, 0.05);
  --hx-neb3: rgba(14, 24, 36, 0.5);
  --hx-text: #fff;
  --hx-text-soft: rgba(255, 255, 255, 0.78);
  --hx-text-dim: rgba(255, 255, 255, 0.62);
  --hx-eyebrow: rgba(255, 255, 255, 0.75);
  --hx-road-asphalt: #1B222B;
  --hx-road-edge: rgba(255, 255, 255, 0.42);
  --hx-road-dash: rgba(255, 255, 255, 0.68);
  --hx-pulse: #FFD500;
  --hx-tree: #2E7D46;
  --hx-tree-d: #226237;
  --hx-tree-ring: rgba(0, 0, 0, 0.3);
  --hx-hz-soft: rgba(255, 213, 0, 0.14);
  --hx-hz-mid: rgba(255, 213, 0, 0.42);
  --hx-hz-bright: rgba(255, 213, 0, 0.68);
  --hx-hz-shadow: rgba(255, 184, 0, 0.3);
  --hx-hz-glow: rgba(255, 196, 0, 0.14);
  --hx-aura1: rgba(0, 87, 184, 0.3);
  --hx-aura2: rgba(61, 125, 216, 0.16);
  --hx-btn2-border: rgba(255, 255, 255, 0.28);
  --hx-btn2-bg: rgba(255, 255, 255, 0.05);
  --hx-btn2-border-h: rgba(255, 255, 255, 0.6);
  --hx-btn2-bg-h: rgba(255, 255, 255, 0.12);

  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  padding: 0;
  isolation: isolate;
  background:
    linear-gradient(180deg, transparent 90%, var(--color-bg-primary) 100%),
    radial-gradient(58% 44% at 74% 42%, var(--hx-neb1) 0%, transparent 70%),
    radial-gradient(42% 34% at 20% 28%, var(--hx-neb2) 0%, transparent 72%),
    radial-gradient(120% 62% at 50% 110%, var(--hx-neb3) 0%, transparent 62%),
    linear-gradient(180deg, var(--hx-bg0) 0%, var(--hx-bg1) 55%, var(--hx-bg2) 100%);
}

/* light — concrete day */
[data-theme="light"] .hero--cinematic {
  --hx-bg0: #D9E0E7;
  --hx-bg1: #D3DBE3;
  --hx-bg2: #CDD6DF;
  --hx-neb1: rgba(0, 87, 184, 0.08);
  --hx-neb2: rgba(255, 213, 0, 0.08);
  --hx-neb3: rgba(0, 87, 184, 0.06);
  --hx-text: #10151B;
  --hx-text-soft: rgba(16, 21, 27, 0.74);
  --hx-text-dim: rgba(16, 21, 27, 0.55);
  --hx-eyebrow: rgba(16, 21, 27, 0.66);
  --hx-road-asphalt: #6E7987;
  --hx-road-edge: rgba(255, 255, 255, 0.9);
  --hx-road-dash: rgba(255, 255, 255, 0.95);
  --hx-pulse: #FFD500;
  --hx-tree: #3E9A5C;
  --hx-tree-d: #2F7F4A;
  --hx-tree-ring: rgba(0, 0, 0, 0.18);
  --hx-hz-soft: rgba(0, 87, 184, 0.14);
  --hx-hz-mid: rgba(0, 87, 184, 0.38);
  --hx-hz-bright: rgba(0, 87, 184, 0.55);
  --hx-hz-shadow: rgba(0, 87, 184, 0.2);
  --hx-hz-glow: rgba(0, 87, 184, 0.12);
  --hx-aura1: rgba(0, 87, 184, 0.16);
  --hx-aura2: rgba(61, 125, 216, 0.1);
  --hx-btn2-border: rgba(16, 21, 27, 0.22);
  --hx-btn2-bg: rgba(255, 255, 255, 0.45);
  --hx-btn2-border-h: rgba(16, 21, 27, 0.45);
  --hx-btn2-bg-h: rgba(255, 255, 255, 0.8);
}

/* ── Stage layers (behind content) ── */
.hero-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* road network converging on the emblem hub —
   real-road layers: asphalt, inset edge lines, dashed centre */
.stage-routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: stage-in 1.6s ease 0.25s forwards;
}
.stage-routes use { fill: none; }
.r-asphalt use { stroke: var(--hx-road-asphalt); stroke-width: 14; stroke-linecap: round; }
.r-edge use    { stroke: var(--hx-road-edge);    stroke-width: 10; stroke-linecap: round; }
.r-inner use   { stroke: var(--hx-road-asphalt); stroke-width: 7;  stroke-linecap: round; }
.r-dash use    { stroke: var(--hx-road-dash);    stroke-width: 1.6; stroke-dasharray: 10 8; }
.route-cars use { filter: drop-shadow(0 1.5px 2.5px rgba(0, 0, 0, 0.45)); }

.stage-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* glowing horizon under the emblem */
.stage-horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(30% - 1px);
  height: 2px;
  background: linear-gradient(90deg,
    transparent 4%,
    var(--hx-hz-soft) 30%,
    var(--hx-hz-mid) 58%,
    var(--hx-hz-bright) 74%,
    var(--hx-hz-soft) 92%,
    transparent 100%);
  box-shadow: 0 0 26px 3px var(--hx-hz-shadow);
  opacity: 0;
  animation:
    stage-in 1.4s ease 0.35s forwards,
    horizon-pulse 5.5s ease-in-out 2s infinite;
}
.stage-horizon::after {
  content: '';
  position: absolute;
  left: 30%;
  right: 2%;
  bottom: 0;
  height: 130px;
  background: radial-gradient(58% 100% at 62% 100%, var(--hx-hz-glow) 0%, transparent 75%);
}
@keyframes stage-in { to { opacity: 1; } }
@keyframes horizon-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ── Content grid: copy | emblem, stats along the bottom ── */
.hero-grid {
  --hero-inset: clamp(24px, 6vw, 88px);
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "copy  visual"
    "stats stats";
  column-gap: clamp(24px, 4vw, 64px);
  padding: calc(var(--header-height) + 16px) var(--hero-inset) 0;
}

/* ── Left copy ── */
.hero-copy {
  grid-area: copy;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(18px, 2.6vh, 30px);
  max-width: 640px;
  min-width: 0;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--hx-eyebrow);
  opacity: 0;
  animation: hero-fade-up 0.9s ease 0.05s forwards;
}
.hero-eyebrow::before {
  content: '';
  flex-shrink: 0;
  width: 22px;
  height: 2px;
  background: var(--color-brand-yellow);
}
[data-theme="light"] .hero-eyebrow::before { background: var(--color-accent-blue); }

.hero-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
}

.hero--cinematic .hero-title {
  font-size: clamp(36px, 4.5vw, 66px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0;
  min-height: 0;
  max-width: 100%;
  color: var(--hx-text);
  -webkit-text-fill-color: var(--hx-text);
  background: none;
  text-align: left;
}
.title-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.title-line > span {
  display: block;
  transform: translateY(115%);
  animation: hero-line-up 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.title-line:nth-child(1) > span { animation-delay: 0.15s; }
.title-line:nth-child(2) > span { animation-delay: 0.3s; }
@keyframes hero-line-up { to { transform: translateY(0); } }

.hero--cinematic .hero-description {
  color: var(--hx-text-soft);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  max-width: 40ch;
  margin: 0;
  opacity: 0;
  animation: hero-fade-up 0.9s ease 0.5s forwards;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  opacity: 0;
  animation: hero-fade-up 0.9s ease 0.65s forwards;
}
.hero--cinematic .btn {
  padding: 14px 28px;
  font-size: var(--font-size-sm);
}
.hero--cinematic .btn-secondary {
  color: var(--hx-text);
  border-color: var(--hx-btn2-border);
  background: var(--hx-btn2-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero--cinematic .btn-secondary:hover {
  border-color: var(--hx-btn2-border-h);
  background: var(--hx-btn2-bg-h);
}

@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Right: 3D emblem centerpiece ── */
.hero-visual {
  grid-area: visual;
  align-self: center;
  justify-self: center;
  position: relative;
  width: 100%;
  max-width: 560px;
  height: min(56vh, 560px);
  min-width: 0;
}

/* glow burst behind the emblem */
.visual-aura {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(120%, 620px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.7);
  border-radius: 50%;
  background: radial-gradient(closest-side,
    var(--hx-aura1) 0%,
    var(--hx-aura2) 42%,
    transparent 72%);
  filter: blur(8px);
  opacity: 0;
  animation:
    aura-in 1.3s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards,
    aura-breathe 7s ease-in-out 2.4s infinite;
}
@keyframes aura-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
}
@keyframes aura-breathe {
  0%, 100% { opacity: 0.9; }
  50%      { opacity: 0.6; }
}

.logo3d {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.logo3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Stats along the bottom ── */
.hero-stats {
  grid-area: stats;
  display: flex;
  gap: clamp(32px, 6vw, 84px);
  padding: 18px 0 44px;
}
.hero-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--hx-text);
  opacity: 0;
  animation: hero-fade-up 0.9s ease forwards;
}
.hero-chip:nth-child(1) { animation-delay: 0.8s; }
.hero-chip:nth-child(2) { animation-delay: 0.92s; }
.hero-chip:nth-child(3) { animation-delay: 1.04s; }
.hero-chip .chip-v {
  font-family: var(--font-family-head);
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-chip .chip-k {
  font-family: var(--font-family);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-text-dim);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  /* small screens: no road scene, no 3D emblem — copy first, compact hero */
  .stage-routes { display: none; }
  .hero-visual { display: none; }
  .hero--cinematic { min-height: auto; }
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "copy" "stats";
    min-height: auto;
    padding: calc(var(--header-height) + 24px) 20px 8px;
    row-gap: clamp(28px, 5vh, 44px);
  }
  .hero-copy { max-width: none; }
  .hero-visual { height: min(44vh, 380px); max-width: 420px; }
  .hero-stats { flex-wrap: wrap; gap: 24px 40px; padding-bottom: 36px; }
  .stage-routes { opacity: 0; animation-name: stage-in-soft; }
  .stage-horizon { bottom: calc(22% - 1px); }
}
@keyframes stage-in-soft { to { opacity: 0.55; } }

/* ── Reduced motion: everything static & visible (last — wins the cascade) ── */
@media (prefers-reduced-motion: reduce) {
  .stage-routes,
  .stage-horizon,
  .visual-aura,
  .hero-eyebrow,
  .title-line > span,
  .hero--cinematic .hero-description,
  .hero-cta,
  .hero-chip {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .route-cars { display: none; }
  .tl-r, .tl-g { animation: none; }
  .visual-aura { transform: translate(-50%, -50%); }
}
