.hero {
  --hero-gap: var(--frame-gap);
  --hero-radius: 2rem;
  --hero-offset: 0px;
  --hero-pad: clamp(1.5rem, 4.6vw, 4.75rem);
  --notch-r: calc(var(--hero-radius) * 0.75);
  --hero-accent: var(--accent);
  position: relative;
  padding: var(--hero-gap);
}

.hero--radius-small {
  --hero-radius: 1.25rem;
}

.hero--radius-large {
  --hero-radius: 2.5rem;
}

.hero--has-car {
  margin-bottom: clamp(3rem, 9vh, 6rem);
}

.hero__stage {
  position: relative;
}

.hero__frame {
  position: relative;
  height: calc(100svh - var(--hero-gap) * 2 - var(--hero-offset));
  min-height: 34rem;
  max-height: 72rem;
  overflow: hidden;
  isolation: isolate;
  background: #121212;
  border-radius: var(--hero-radius);
  touch-action: pan-y;
  user-select: none;
}

.hero__slides,
.hero__slide,
.hero__media,
.hero__dim,
.hero__shade {
  position: absolute;
  inset: 0;
}

.hero__slide {
  z-index: 0;
  overflow: hidden;
  visibility: hidden;
}

.hero__slide.is-active {
  z-index: 1;
  visibility: visible;
}

.hero__slide.is-under {
  z-index: 1;
  visibility: visible;
}

.hero__slide.is-over {
  z-index: 2;
  visibility: visible;
}

.hero__media {
  transform-origin: 50% 50%;
}

.hero__parallax {
  position: absolute;
  inset: -1rem;
}

.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 60% 50%;
  -webkit-user-drag: none;
}

.hero__dim {
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.hero__shade {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.42) 30%, rgba(0, 0, 0, 0.08) 58%, rgba(0, 0, 0, 0) 72%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0) 42%);
  pointer-events: none;
}

.hero__number {
  position: absolute;
  top: calc(var(--hero-pad) * 0.6);
  left: calc(var(--hero-pad) - 0.06em);
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(9rem, 21vw, 22rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
  line-height: 0.8;
  pointer-events: none;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.16);
}

.hero__content {
  position: absolute;
  bottom: var(--hero-pad);
  left: var(--hero-pad);
  z-index: 2;
  width: min(38.75rem, 100% - var(--hero-pad) * 2);
  color: #fff;
}

.hero__tag {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__tag-line {
  flex: none;
  width: 1.75rem;
  height: 2px;
  background: var(--slide-accent, var(--hero-accent));
  transform-origin: 0 50%;
}

.hero__title {
  margin-top: 1.1rem;
  font-size: clamp(2.6rem, 5.4vw, 5.5rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero__line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.hero__line-inner {
  display: inline-block;
  transform-origin: 0 100%;
}

.hero__text {
  max-width: 30rem;
  margin-top: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-body);
  line-height: 1.55;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 2rem;
  padding: 0.375rem 0.375rem 0.375rem 1.5rem;
  background: #fff;
  border-radius: 999px;
  color: #0e0e0e;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.hero__cta-icon {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  background: #0e0e0e;
  border-radius: 50%;
  color: #fff;
  transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.hero__cta-icon .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.hero__cta:hover .hero__cta-icon,
.hero__cta:focus-visible .hero__cta-icon {
  background: var(--slide-accent, var(--hero-accent));
  transform: rotate(-45deg);
}

.hero__cta:focus-visible,
.hero__arrow:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.hero__cta:focus-visible {
  outline-color: #fff;
}

.hero__rim {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100px;
  height: 100px;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}

.hero__rim circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.8);
}

/* Breakout car */

.hero__cars {
  position: absolute;
  right: clamp(10rem, 24vw, 28rem);
  bottom: calc(clamp(2.25rem, 7vh, 4.75rem) * -1);
  z-index: 3;
  width: min(46vw, 54rem);
  aspect-ratio: 2.4;
  pointer-events: none;
}

.hero__car {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.hero__car.is-active {
  opacity: 1;
}

.hero__car-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter: drop-shadow(0 1.75rem 1.5rem rgba(0, 0, 0, 0.22));
}

/* Notch */

.hero__notch {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.125rem 0 1.25rem;
  background: var(--bg);
  border-top-left-radius: var(--notch-r);
}

.hero__notch::before,
.hero__notch::after {
  content: "";
  position: absolute;
  width: var(--notch-r);
  height: var(--notch-r);
  background: radial-gradient(circle at 0 0, transparent calc(var(--notch-r) - 0.5px), var(--bg) var(--notch-r));
  pointer-events: none;
}

.hero__notch::before {
  right: 0;
  bottom: 100%;
}

.hero__notch::after {
  right: 100%;
  bottom: 0;
}

.hero__counter {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 4.25rem;
  padding-right: 0.25rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.hero__counter [data-hero-current] {
  color: var(--text);
  font-size: 1rem;
}

.hero__counter-sep {
  color: var(--bg-stroke);
}

.hero--no-counter .hero__counter {
  display: none;
}

.hero__arrow {
  display: inline-flex;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.hero__arrow .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.hero__arrow:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* Initial state before the script takes over */

.js:not(.is-reduced-motion) .hero:not(.is-ready) .hero__slide.is-active [data-hero-line] {
  transform: translateY(110%);
}

.js:not(.is-reduced-motion) .hero:not(.is-ready) .hero__slide.is-active :is([data-hero-tag], [data-hero-text], [data-hero-cta], [data-hero-number]) {
  opacity: 0;
}

.js:not(.is-reduced-motion) .hero:not(.is-ready) .hero__notch > * {
  opacity: 0;
}

.hero.is-animating .hero__slide.is-over,
.hero.is-animating .hero__slide.is-over .hero__media,
.hero.is-animating .hero__slide.is-under .hero__media {
  will-change: transform, clip-path;
}

/* Empty state for editors */

.hero-empty {
  display: grid;
  place-items: center;
  min-height: 40svh;
  margin: var(--frame-gap);
  border: 1px dashed var(--bg-stroke);
  border-radius: 1.5rem;
  color: var(--text-muted);
  font-size: var(--text-small);
}

.hero-empty a {
  color: var(--text);
}

/* Tablet */

@media (max-width: 1024px) {
  .hero__content {
    width: min(34rem, 100% - var(--hero-pad) * 2);
    bottom: calc(var(--hero-pad) + 4.5rem);
  }

  .hero__cars {
    right: 6vw;
    width: 56vw;
  }
}

/* Mobile */

@media (max-width: 720px) {
  .hero {
    --hero-radius: 1.25rem;
    --hero-pad: 1.25rem;
  }

  .hero--radius-small {
    --hero-radius: 0.875rem;
  }

  .hero__frame {
    min-height: 32rem;
  }

  .hero__shade {
    background:
      linear-gradient(0deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 38%, rgba(0, 0, 0, 0) 68%),
      linear-gradient(90deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 70%);
  }

  .hero__number {
    top: 1rem;
    font-size: clamp(6rem, 34vw, 9rem);
  }

  .hero__content {
    right: var(--hero-pad);
    bottom: 5.25rem;
    width: auto;
  }

  .hero--has-car .hero__content {
    bottom: 8.5rem;
  }

  .hero__title {
    margin-top: 0.85rem;
    font-size: clamp(2.15rem, 10.4vw, 3.25rem);
  }

  .hero__text {
    margin-top: 0.85rem;
    font-size: 0.95rem;
  }

  .hero__cta {
    margin-top: 1.4rem;
    padding-left: 1.25rem;
  }

  .hero__notch {
    gap: 0.5rem;
    padding: 0.625rem 0.5rem 0 0.75rem;
  }

  .hero__counter {
    display: none;
  }

  .hero__arrow {
    width: 2.75rem;
    height: 2.75rem;
  }

  .hero__cars {
    right: auto;
    left: 4vw;
    bottom: calc(clamp(1.5rem, 5vh, 2.5rem) * -1);
    width: 74vw;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hero__frame {
    min-height: 24rem;
  }

  .hero__number {
    display: none;
  }

  .hero__title {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
  }

  .hero__text {
    display: none;
  }

  .hero__content {
    bottom: var(--hero-pad);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__cta-icon,
  .hero__arrow {
    transition: none;
  }
}
