#lex-home-hero {
  --espresso: oklch(0.12 0.012 50);
  --gold: oklch(0.8 0.085 80);
  --gold-deep: oklch(0.64 0.09 70);
  --gold-light: oklch(0.92 0.05 88);
  --ivory: oklch(0.96 0.014 85);

  --gradient-gold: linear-gradient(
    110deg,
    var(--gold-deep) 0%,
    var(--gold) 30%,
    var(--gold-light) 50%,
    var(--gold) 70%,
    var(--gold-deep) 100%
  );
  --gradient-veil: linear-gradient(
    90deg,
    oklch(0.1 0.012 50 / 96%) 0%,
    oklch(0.1 0.012 50 / 82%) 32%,
    oklch(0.1 0.012 50 / 30%) 62%,
    oklch(0.1 0.012 50 / 5%) 100%
  );
  --gradient-floor: linear-gradient(0deg, oklch(0.1 0.012 50 / 68%) 0%, transparent 45%);
  --gradient-ceiling: linear-gradient(180deg, oklch(0.1 0.012 50 / 36%) 0%, transparent 100%);

  --ease-silk: cubic-bezier(0.22, 1, 0.36, 1);

  --hero-poster: url("../videos/home-hero/lounge-turn-poster.jpg");
  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-sans: "Jost", "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --bar: 64px;
  --hero-top-inset: 0px;
}

@media (min-width: 768px) {
  #lex-home-hero {
    --bar: 88px;
  }
}

#lex-home-hero .text-gold-gradient {
  background-image: var(--gradient-gold);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  animation: lex-home-hero-gold-shimmer 7s linear infinite;
}

/* Hero Container */
#lex-home-hero {
  position: relative;
  flex: 0 0 auto;
  isolation: isolate;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  width: 100%;
  background-color: var(--espresso);
  color: var(--ivory);
  --p: 0;
}

#lex-home-hero .hero-frame {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

#lex-home-hero.has-scrub {
  height: 300vh;
}

#lex-home-hero.has-scrub .hero-frame {
  height: calc(100svh - var(--hero-top-inset));
}

/* Video & Atmospheric Layers */
#lex-home-hero .hero-film {
  position: absolute;
  inset: 0;
  z-index: -20;
  container: lex-hero-film / size;
}

#lex-home-hero .animate-film-in {
  position: absolute;
  inset: 0;
  isolation: isolate;
  animation: lex-home-hero-scene-in 2.6s var(--ease-silk) 0.4s both;
}

#lex-home-hero .hero-picture {
  width: 100%;
  height: 100%;
}

#lex-home-hero .hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% center;
  display: block;
}

/* Keep the entire height of the 16:9 shot visible in wider frames. */
@container lex-hero-film (aspect-ratio > 16 / 9) {
  #lex-home-hero .animate-film-in::before {
    content: "";
    position: absolute;
    inset: -30px;
    z-index: -1;
    background: var(--hero-poster) center / cover no-repeat;
    filter: blur(18px);
  }

  #lex-home-hero .hero-picture {
    width: calc(100cqh * 16 / 9);
    margin-inline: auto;
    mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
  }
}

#lex-home-hero .hero-veil {
  position: absolute;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background-image: var(--gradient-veil);
  opacity: calc(1 - var(--p) * 0.3);
}

#lex-home-hero .bg-floor {
  position: absolute;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background-image: var(--gradient-floor);
}

#lex-home-hero .bg-ceiling {
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 14rem;
  z-index: -10;
  pointer-events: none;
  background-image: var(--gradient-ceiling);
}

#lex-home-hero .vignette {
  position: absolute;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background: radial-gradient(ellipse at 60% 45%, transparent 40%, oklch(0.08 0.01 50 / 80%) 100%);
}

#lex-home-hero .light-sweep {
  position: absolute;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  mix-blend-mode: screen;
  background: linear-gradient(
    105deg,
    transparent 30%,
    color-mix(in oklab, var(--gold-light) 12%, transparent) 48%,
    transparent 66%
  );
  animation: lex-home-hero-sweep 11s ease-in-out 2.5s infinite backwards;
}

#lex-home-hero .dust-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

#lex-home-hero .gold-dust {
  position: absolute;
  border-radius: 9999px;
  background: var(--gold-light);
  box-shadow: 0 0 6px 1px color-mix(in oklab, var(--gold) 70%, transparent);
  animation: lex-home-hero-dust var(--dur, 14s) linear var(--delay, 0s) infinite;
}

#lex-home-hero .film-grain {
  position: absolute;
  inset: -10%;
  z-index: 30;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><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.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: lex-home-hero-grain 0.9s steps(4) infinite;
}

#lex-home-hero .hero-handoff {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background-color: var(--espresso);
  opacity: clamp(0, calc((var(--p) - 0.92) * 5), 0.4);
}

/* Opening Title Section */
#lex-home-hero .hero-content {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  flex: 1;
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  #lex-home-hero .hero-content {
    padding-inline: 3rem;
  }
}

#lex-home-hero .hero-title-out {
  max-width: 56rem;
  opacity: clamp(0, calc(1 - (var(--p) - 0.18) * 8.3), 1);
  transform: translateY(calc(max(0, var(--p) - 0.1) * -300px));
  filter: blur(calc(max(0, var(--p) - 0.18) * 60px));
}

#lex-home-hero .kicker-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: lex-home-hero-fade-up 1.2s var(--ease-silk) 0.6s both;
}

@media (min-width: 768px) {
  #lex-home-hero .kicker-row {
    margin-bottom: 2rem;
  }
}

#lex-home-hero .gold-line {
  display: block;
  width: 3.5rem;
  height: 1px;
  background-color: var(--gold);
  transform-origin: left;
  animation: lex-home-hero-line-draw 1.6s cubic-bezier(0.77, 0, 0.18, 1) 0.7s both;
}

#lex-home-hero .kicker-text {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--gold);
}

@media (min-width: 768px) {
  #lex-home-hero .kicker-text {
    font-size: 0.68rem;
  }
}

#lex-home-hero .hero-headline {
  margin: 0;
  color: var(--ivory);
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 0.88;
  letter-spacing: -0.02em;
  text-transform: none;
}

#lex-home-hero .hero-headline .title-row-1 {
  display: flex;
  font-size: clamp(3.6rem, min(8.5vw, 15svh), 8.25rem);
  font-style: italic;
}

#lex-home-hero .hero-headline .title-row-2 {
  display: flex;
  font-size: clamp(3.75rem, min(10.5vw, 18.5svh), 10rem);
}

#lex-home-hero .char-in {
  display: inline-block;
  animation: lex-home-hero-char-in 1.2s var(--ease-silk) both;
}

/* Closing Line Narrative */
/* In flow below the title, so the title centres in the space above it. */
#lex-home-hero .closing-narrative-wrap {
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
  padding-bottom: calc(var(--bar) + 2.5rem);
  pointer-events: none;
}

@media (min-width: 768px) {
  #lex-home-hero .closing-narrative-wrap {
    padding-bottom: calc(var(--bar) + 3.5rem);
  }
}

#lex-home-hero .narrative-inner {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 768px) {
  #lex-home-hero .narrative-inner {
    padding-inline: 3rem;
  }
}

/* Rule + first beat arrive with the title; later beats are scroll-driven. */
#lex-home-hero .hero-line-in {
  max-width: 40rem;
  animation: lex-home-hero-fade-up 1s var(--ease-silk) 1.5s both;
}

/* Beats share one grid cell so the block keeps the tallest beat's height. */
#lex-home-hero .narrative-beats {
  display: grid;
}

#lex-home-hero .narrative-beat {
  --in: 0;
  --out: 2;
  grid-area: 1 / 1;
  align-self: start;
  opacity: min(
    clamp(0, calc((var(--p) - var(--in)) * 12.5), 1),
    clamp(0, calc((var(--out) + 0.06 - var(--p)) * 17), 1)
  );
  transform: translateY(calc(
    max(0, var(--in) + 0.08 - var(--p)) * 300px
    - max(0, var(--p) - var(--out)) * 200px
  ));
}

#lex-home-hero .narrative-rule {
  display: block;
  height: 1px;
  width: 100%;
  margin-bottom: 1.25rem;
  background: linear-gradient(90deg, oklch(0.8 0.085 80 / 70%) 0%, oklch(0.8 0.085 80 / 25%) 50%, transparent 100%);
}

#lex-home-hero .narrative-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.375rem, min(1rem + 1.6vw, 3.8svh), 2.125rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ivory);
  text-shadow: 0 1px 24px oklch(0.1 0.012 50 / 55%);
  text-wrap: pretty;
}

/* A shadow would show through the transparent fill of gradient text. */
#lex-home-hero .narrative-text .text-gold-gradient {
  text-shadow: none;
}

/* Bottom Bar */
#lex-home-hero .hero-footer-bar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  animation: lex-home-hero-fade-up 1.2s var(--ease-silk) 1.8s both;
}

#lex-home-hero .footer-bar-inner {
  max-width: 1440px;
  height: var(--bar);
  margin-inline: auto;
  padding-inline: 1.5rem 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  #lex-home-hero .footer-bar-inner {
    padding-inline-start: 3rem;
  }
}

#lex-home-hero .footer-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#lex-home-hero .footer-brand {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-style: italic;
  color: var(--gold);
}

#lex-home-hero .progress-track {
  position: relative;
  display: block;
  height: 1px;
  width: clamp(2rem, 12vw, 6rem);
  background-color: oklch(0.96 0.014 85 / 20%);
  overflow: hidden;
}

@media (min-width: 768px) {
  #lex-home-hero .progress-track {
    width: 10rem;
  }
}

#lex-home-hero .hero-progress {
  position: absolute;
  inset: 0;
  background-color: var(--gold);
  transform-origin: left;
  transform: scaleX(var(--p));
}

#lex-home-hero .footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  opacity: clamp(0, calc(1 - var(--p) * 4), 1);
}

#lex-home-hero .scroll-text {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: oklch(0.96 0.014 85 / 55%);
}

#lex-home-hero .scroll-line-track {
  position: relative;
  display: block;
  height: 2rem;
  width: 1px;
  background-color: oklch(0.96 0.014 85 / 20%);
  overflow: hidden;
}

#lex-home-hero .animate-float-dot {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 1px;
  height: 0.75rem;
  background-color: var(--gold);
  animation: lex-home-hero-scroll-dot 2.2s var(--ease-silk) infinite;
}

/* Keyframe Animations */
@keyframes lex-home-hero-scene-in {
  0% { opacity: 0; filter: blur(14px) brightness(0.5); }
  100% { opacity: 1; filter: blur(0) brightness(1); }
}

@keyframes lex-home-hero-char-in {
  0% { opacity: 0; filter: blur(16px); transform: translateY(0.25em) scale(1.08); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

@keyframes lex-home-hero-fade-up {
  0% { opacity: 0; transform: translateY(24px); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes lex-home-hero-line-draw {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

@keyframes lex-home-hero-gold-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -150% 0; }
}

@keyframes lex-home-hero-sweep {
  0% { transform: translateX(-100%); opacity: 0; }
  20% { opacity: 1; }
  60% { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(100%); opacity: 0; }
}

@keyframes lex-home-hero-dust {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  50% { opacity: 0.35; }
  90% { opacity: 0.8; }
  100% { transform: translate3d(var(--drift, 30px), -60vh, 0); opacity: 0; }
}

@keyframes lex-home-hero-grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-4%, 3%); }
  50% { transform: translate(3%, -4%); }
  75% { transform: translate(-3%, -2%); }
  100% { transform: translate(0, 0); }
}

@keyframes lex-home-hero-scroll-dot {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(28px); opacity: 0; }
}

#lex-home-hero:not(.has-scrub) .hero-frame {
  justify-content: center;
  min-height: min(75svh, 38rem);
  padding-block: var(--bar);
}

#lex-home-hero:not(.has-scrub) .hero-frame * {
  animation: none !important;
}

#lex-home-hero:not(.has-scrub) .hero-picture {
  background: var(--hero-poster) 72% center / cover no-repeat;
}

#lex-home-hero:not(.has-scrub) .hero-video {
  visibility: hidden;
}

#lex-home-hero:not(.has-scrub) .hero-content {
  flex: 0 0 auto;
}

#lex-home-hero:not(.has-scrub) .closing-narrative-wrap {
  margin-top: 1.5rem;
  padding-bottom: 0;
}

#lex-home-hero:not(.has-scrub) .hero-line-in,
#lex-home-hero:not(.has-scrub) .narrative-beat {
  opacity: 1;
  transform: none;
}

#lex-home-hero:not(.has-scrub) .narrative-beats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#lex-home-hero:not(.has-scrub) :is(.hero-footer-bar, .light-sweep) {
  display: none;
}

@media (max-height: 540px) {
  #lex-home-hero {
    --bar: 44px;
  }

  #lex-home-hero .hero-headline .title-row-1 {
    font-size: clamp(2.5rem, 9svh, 4rem);
  }

  #lex-home-hero .hero-headline .title-row-2 {
    font-size: clamp(3rem, 12svh, 5rem);
  }

  #lex-home-hero .closing-narrative-wrap {
    padding-bottom: calc(var(--bar) + 1rem);
  }

  #lex-home-hero .narrative-rule {
    margin-bottom: 0.75rem;
  }

  #lex-home-hero .narrative-text {
    font-size: 1.125rem;
  }
}
