/* ==========================================================================
   EVENT HERO
   A diorama built from the event's three uploaded layers (sky, land, car),
   held sticky while the vehicle lineup rises over it like a curtain.
   Stacking, back to front:
     sky (0) → land (2) → title (3) → car (4) → scrim/shade (5) → panel (6)
   The title sits between land and car so the car climbs over it on scroll;
   the countdown and CTA live in the panel, which nothing ever covers.
   Each `.ev-hero__layer` is driven by the scroll timeline; its child
   `.ev-hero__rig` takes the intro and pointer parallax (see event-hero.js).
   Without JS the static composition below is the final frame.
   ========================================================================== */

/* Pull the stage up under the floating nav by exactly the nav's height, so
   the curtain starts flush with the bottom of the screen. */
main:has(.ev-hero-shell) { margin-top: -66px; }
@media (max-width: 768px) {
  main:has(.ev-hero-shell) { margin-top: -52px; }
}

.ev-hero-shell {
  position: relative;
  z-index: 0;
  background: #08111f;
}

.ev-hero {
  --ev-ink: 8 17 31;
  --ev-gutter: clamp(20px, 4vw, 56px);

  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: #08111f;
  font-family: 'Vazirmatn', sans-serif;
}

/* Not a stacking context on purpose: its layers interleave with the title. */
.ev-hero__stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ev-hero__layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: transform;
}
.ev-hero__layer[data-layer="sky"] { z-index: 0; transform-origin: 50% 40%; }
.ev-hero__layer[data-layer="land"] { z-index: 2; }
.ev-hero__layer[data-layer="car"] { z-index: 4; transform-origin: 50% 100%; }

/* Overscan so pointer parallax never exposes a layer's edge. */
.ev-hero__rig {
  position: absolute;
  inset: -24px;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  object-fit: cover;
}

/* Sky-only dusk: deepens the top of the photo for the nav and headline
   without dimming the car. */
.ev-hero__dusk {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgb(var(--ev-ink) / 62%) 0%, rgb(var(--ev-ink) / 18%) 34%, transparent 55%),
    linear-gradient(270deg, rgb(var(--ev-ink) / 45%) 0%, transparent 45%);
}

/* No artwork uploaded: a quiet brand field instead of a broken image. */
.ev-hero__no-banner {
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 80% 10%, rgb(51 181 182 / 22%), transparent 70%),
    radial-gradient(50% 45% at 15% 90%, rgb(250 168 49 / 14%), transparent 70%),
    linear-gradient(180deg, #08111f, #20334e);
}

/* Legibility for the panel at the foot of the frame, over the car layer. */
.ev-hero__scrim,
.ev-hero__shade,
.ev-hero__grain {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.ev-hero__scrim {
  background: linear-gradient(0deg, rgb(var(--ev-ink) / 88%) 0%, rgb(var(--ev-ink) / 55%) 18%, transparent 38%);
}
.ev-hero__shade { background: #08111f; opacity: 0; }
.ev-hero__grain {
  opacity: 0.08;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---- Headline (between land and car) ---------------------------------- */
.ev-hero__title-wrap {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.ev-hero__heading {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(104px, 14vh, 150px) var(--ev-gutter) 0;
}

.ev-hero__status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 2px 12px rgb(var(--ev-ink) / 70%);
}
.ev-hero__status > span { width: 32px; height: 2px; background: #faa831; }
.ev-hero[data-status="ongoing"] .ev-hero__status > span { background: #33b5b6; }
.ev-hero[data-status="ended"] .ev-hero__status > span,
.ev-hero[data-status="inactive"] .ev-hero__status > span { background: rgb(255 255 255 / 55%); }

/* Same colour sweep as the home headline, so the two heroes read as one
   family. A text-shadow would show through the clipped glyphs, hence the
   drop-shadow filter. Sized to sit in the sky band above the car at rest;
   the car only climbs over it once the page scrolls. */
.ev-hero__name {
  max-width: 22ch;
  margin: 0;
  font-family: 'Lalezar', 'Vazirmatn', sans-serif;
  font-weight: 400;
  font-size: clamp(3rem, 5.6vw, 5.75rem);
  line-height: 1.2;
  text-wrap: balance;
  background: linear-gradient(90deg, var(--brand-amber, #faa831), #e0e0e0, var(--brand-turquoise, #33b5b6));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgb(var(--ev-ink) / 60%));
  animation: ev-hero-title-sweep 5s ease infinite;
}
@keyframes ev-hero-title-sweep {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ---- Panel (always on top) --------------------------------------------- */
.ev-hero__panel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.ev-hero__panel-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--ev-gutter) clamp(28px, 6vh, 56px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  pointer-events: auto;
}

.ev-hero__countdown { min-width: 0; }

.ev-hero__countdown-label,
.ev-hero__note {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
  color: rgb(255 255 255 / 82%);
}
.ev-hero__note { margin: 0; max-width: 56ch; }
.ev-hero__note a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #faa831;
  text-underline-offset: 6px;
}

.ev-hero__countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgb(255 255 255 / 28%);
}

.ev-hero__unit {
  min-width: 0;
  padding: 14px 0 0;
  padding-inline: 0 clamp(20px, 2.6vw, 36px);
}
.ev-hero__unit + .ev-hero__unit {
  padding-inline-start: clamp(16px, 2vw, 28px);
  border-inline-start: 1px solid rgb(255 255 255 / 16%);
}

.ev-hero__num {
  display: block;
  font-family: 'Lalezar', 'Vazirmatn', sans-serif;
  font-size: clamp(2.4rem, 4.2vw, 3.75rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ev-hero__unit-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: rgb(255 255 255 / 70%);
}

.ev-hero__cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 28px;
  min-height: 54px;
  padding: 14px 22px;
  border: 1px solid #20334e;
  border-radius: 10px;
  background: #20334e;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.ev-hero__cta:hover { background: #2c4569; border-color: #33b5b6; }
.ev-hero__cta:focus-visible { outline: 2px solid #faa831; outline-offset: 3px; }
.ev-hero__cta svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform 0.2s ease; }
.ev-hero__cta:hover svg { transform: translateY(3px); }

/* event-hero.js composes the entrance; until it does, only the sky shows. */
.ev-hero[data-intro="pending"] .ev-hero__layer:not([data-layer="sky"]),
.ev-hero[data-intro="pending"] .ev-hero__title-wrap,
.ev-hero[data-intro="pending"] .ev-hero__panel { visibility: hidden; }

/* ---- Curtain ----------------------------------------------------------- */
.ev-hero-spacer { height: 100svh; pointer-events: none; }

.ev-curtain {
  position: relative;
  isolation: isolate;
  z-index: 1;
  margin-top: -100svh;
  background: var(--bg);
  box-shadow: 0 -30px 70px rgba(13, 29, 46, 0.35);
}
.ev-curtain .card { animation: none; }

/* ---- Small screens ----------------------------------------------------- */
@media (max-width: 767px) {
  .ev-hero { min-height: 520px; }
  .ev-hero__heading { padding-top: 104px; }
  .ev-hero__name { font-size: clamp(2.6rem, 12vw, 3.6rem); }
  .ev-hero__status { font-size: 13px; }
  .ev-hero__dusk {
    background: linear-gradient(180deg, rgb(var(--ev-ink) / 70%) 0%, rgb(var(--ev-ink) / 28%) 32%, transparent 52%);
  }
  .ev-hero__scrim {
    background: linear-gradient(0deg, rgb(var(--ev-ink) / 92%) 0%, rgb(var(--ev-ink) / 65%) 26%, transparent 48%);
  }
  .ev-hero__panel-inner { flex-direction: column; align-items: stretch; gap: 20px; }
  .ev-hero__countdown-label { font-size: 14px; margin-bottom: 10px; }
  .ev-hero__unit { padding-inline-end: 12px; }
  .ev-hero__unit + .ev-hero__unit { padding-inline-start: 12px; }
  .ev-hero__num { font-size: clamp(2rem, 10vw, 2.6rem); }
  .ev-hero__unit-label { font-size: 12px; }
  .ev-hero__cta { justify-content: space-between; }
}

/* Portrait phones repaint the drop shadow every frame of the sweep; the
   dusk gradient already carries the contrast. */
@media (orientation: portrait) {
  .ev-hero__name { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ev-hero { position: relative; }
  .ev-hero-spacer { display: none; }
  .ev-curtain { margin-top: 0; }
  .ev-hero__name { animation: none; }
  .ev-hero__cta svg { transition: none; }
}
