/* ==========================================================================
   Hero — cinematic image sequence that plays like a video
   Default (no JS / reduced motion / low-end): one screen tall, static poster.
   .is-enhanced (js/hero.js): tall pinned track; footage loops and follows
   scroll, the copy fades out so the footage takes over the screen.
   ========================================================================== */
.hero {
  --hero-length: 300vh;
  --progress: 0;
  position: relative;
  height: 100vh;
  height: 100svh;
  background: #0B0A09;
  color: var(--color-cream);
}

.hero.is-enhanced {
  height: var(--hero-length);
}

.hero__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* --- Media layers ------------------------------------------------------- */
.hero__media {
  position: absolute;
  inset: 0;
  transform: scale(calc(1.08 - var(--progress) * 0.08));
  transform-origin: 65% 45%;
}

.hero__poster,
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep in sync with SEQUENCES.*.focusX in js/hero.js (subject sits right of center) */
  object-position: 65% 50%;
}

@media (orientation: portrait) {
  .hero__poster img {
    object-position: 50% 50%;
  }
}

.hero__canvas {
  visibility: hidden;
}

.hero.is-ready .hero__canvas {
  visibility: visible;
}

.hero.is-ready .hero__poster {
  visibility: hidden;
}

/* Darkens only the edge the copy sits on; fades back as the copy leaves */
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 7, 6, 0.85) 0%, rgba(8, 7, 6, 0.6) 30%, rgba(8, 7, 6, 0) 58%),
    linear-gradient(0deg, rgba(8, 7, 6, 0.55) 0%, rgba(8, 7, 6, 0) 32%),
    linear-gradient(180deg, rgba(8, 7, 6, 0.5) 0%, rgba(8, 7, 6, 0) 22%);
  opacity: clamp(0.3, calc(1 - var(--progress) * 2), 1);
}

/* --- Copy --------------------------------------------------------------- */
.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: var(--header-h);
  padding-bottom: 3rem;
  opacity: clamp(0, calc(1 - var(--progress) * 3.5), 1);
  transform: translate3d(0, calc(var(--progress) * -140px), 0);
}

.hero.is-text-out .hero__content {
  visibility: hidden;
}

.hero__copy {
  max-width: 560px;
  animation: heroCopyIn 1.1s var(--ease-out-expo) 0.2s both;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.hero__eyebrow::before {
  content: "";
  width: 40px;
  height: 1px;
  background: currentColor;
}

.hero__title {
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  font-size: clamp(2.6rem, 1.3rem + 4.3vw, 5.1rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--color-cream);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
  text-wrap: balance;
}

.hero__title .accent {
  color: var(--color-gold);
}

.hero__subtitle {
  max-width: 44ch;
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
  font-size: clamp(0.95rem, 0.88rem + 0.35vw, 1.1rem);
  color: rgba(245, 241, 232, 0.8);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero__actions .btn {
  flex: 1 1 auto;
}

@keyframes heroCopyIn {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Scroll hint -------------------------------------------------------- */
.hero__scroll-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(1rem, 3vh, 2rem);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-cream);
  opacity: calc(1 - var(--progress) * 6);
  pointer-events: none;
}

.hero:not(.is-enhanced) .hero__scroll-hint {
  display: none;
}

.hero__scroll-line {
  width: 1px;
  height: 32px;
  background: linear-gradient(var(--color-gold), transparent);
  transform-origin: top;
  animation: scrollLine 1.8s var(--ease-out-expo) infinite;
}

@keyframes scrollLine {
  0% {
    opacity: 1;
    transform: scaleY(0);
  }
  70% {
    opacity: 1;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform: scaleY(1);
  }
}

/* --- Mobile: copy anchored to the bottom -------------------------------- */
@media (max-width: 767px) {
  .hero {
    --hero-length: 250vh;
  }

  .hero__scrim {
    background:
      linear-gradient(0deg, rgba(8, 7, 6, 0.92) 0%, rgba(8, 7, 6, 0.7) 34%, rgba(8, 7, 6, 0) 62%),
      linear-gradient(180deg, rgba(8, 7, 6, 0.5) 0%, rgba(8, 7, 6, 0) 20%);
  }

  .hero__content {
    align-items: flex-end;
    padding-bottom: clamp(4.5rem, 11vh, 6rem);
  }

  .hero__eyebrow {
    margin-bottom: 1rem;
  }

  .hero__title {
    font-size: clamp(2.3rem, 1.5rem + 4vw, 3rem);
  }

  .hero__actions .btn {
    flex: 1 1 100%;
  }
}

/* --- Short portrait phones (e.g. 320x568) ------------------------------- */
@media (max-width: 767px) and (max-height: 640px) {
  .hero__content {
    padding-bottom: 1.25rem;
  }

  .hero__eyebrow {
    display: none;
  }

  .hero__title {
    margin-bottom: 0.6rem;
    font-size: 1.95rem;
  }

  .hero__subtitle {
    margin-bottom: 1rem;
    font-size: 0.875rem;
  }

  .hero__actions {
    gap: 0.5rem;
  }

  .hero__actions .btn {
    min-height: 44px;
    padding: 0.6rem 1.25rem;
  }

  .hero__scroll-hint {
    display: none;
  }
}

/* --- Short landscape screens (phones rotated) --------------------------- */
@media (orientation: landscape) and (max-height: 500px) {
  .hero__content {
    padding-bottom: 0.75rem;
  }

  .hero__copy {
    max-width: 440px;
  }

  .hero__eyebrow {
    display: none;
  }

  .hero__title {
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
  }

  .hero__subtitle {
    margin-bottom: 0.9rem;
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .hero__actions .btn {
    min-height: 44px;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
  }

  .hero__scroll-hint {
    display: none;
  }
}
