/* Stories hero prototype — mobile only (< 768px). Desktop keeps the staging hero untouched. */

.twl-stories,
.twl-stories__caption {
  display: none;
}

@media (max-width: 767px) {
  .twl-hero-track.twl-has-stories,
  .twl-hero-track.twl-has-stories.is-static,
  .twl-hero-track.twl-has-stories.is-reduced {
    height: 100svh;
  }

  .twl-has-stories .twl-hero-pin {
    position: relative;
    height: 100svh;
  }

  .twl-has-stories .twl-hero-media,
  .twl-has-stories .twl-hero-shade {
    display: none;
  }

  .twl-stories {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    overflow: hidden;
    background: #000;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .twl-stories::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgb(0 0 0 / 0.7) 0%,
      rgb(0 0 0 / 0) 24%,
      rgb(0 0 0 / 0) 42%,
      rgb(0 0 0 / 0.78) 70%,
      #000 100%
    );
  }

  .twl-stories__slides {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .twl-stories__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
  }

  .twl-stories__slide.is-active {
    opacity: 1;
    z-index: 1;
    pointer-events: auto;
  }

  .twl-stories__slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--pos, 50% 50%);
    transform-origin: var(--origin, 50% 50%);
    transform: scale(1.06);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* Ken Burns is driven by JS (transform each frame). CSS keyframe + var() is unreliable on iOS. */

  /* Progress bars + account row sit under the fixed header. */
  .twl-stories__bars {
    position: absolute;
    top: calc(4rem + 0.6rem);
    left: 1rem;
    right: 1rem;
    z-index: 2;
    display: flex;
    gap: 4px;
  }

  .twl-stories__bar {
    position: relative;
    flex: 1;
    height: 2.5px;
    overflow: hidden;
    border-radius: 2px;
    background: rgb(255 255 255 / 0.28);
  }

  .twl-stories__fill {
    position: absolute;
    inset: 0;
    background: #f5f5f0;
    transform: scaleX(0);
    transform-origin: left center;
  }

  .twl-stories__head {
    position: absolute;
    top: calc(4rem + 1.35rem);
    left: 1rem;
    right: 0.5rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .twl-stories__avatar {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex: none;
    overflow: hidden;
    border: 1.5px solid #c2db21;
    border-radius: 999px;
    background: #000;
  }

  .twl-stories__avatar img {
    width: 82%;
    height: auto;
    object-fit: contain;
  }

  .twl-stories__who {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.15;
  }

  .twl-stories__handle {
    font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f5f5f0;
  }

  .twl-stories__tag {
    font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
    color: rgb(245 245 240 / 0.7);
  }

  .twl-stories__toggle {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #f5f5f0;
    cursor: pointer;
  }

  .twl-stories__icon-play,
  .twl-stories.is-user-paused .twl-stories__icon-pause {
    display: none;
  }

  .twl-stories.is-user-paused .twl-stories__icon-play {
    display: block;
  }

  .twl-stories__zone {
    position: absolute;
    top: calc(4rem + 4.25rem);
    bottom: 0;
    z-index: 2;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
  }

  .twl-stories__zone--prev {
    left: 0;
    width: 33%;
  }

  .twl-stories__zone--next {
    right: 0;
    width: 67%;
  }

  .twl-stories__zone:focus-visible {
    outline: 2px solid #c2db21;
    outline-offset: -4px;
  }

  /* Copy docks at the bottom, above the tap zones; only links take taps. */
  .twl-has-stories .twl-hero-copy {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    height: auto;
    padding-top: 0;
    padding-bottom: calc(1.75rem + env(safe-area-inset-bottom));
    pointer-events: none;
  }

  .twl-has-stories .twl-hero-copy a,
  .twl-has-stories .twl-hero-copy button {
    pointer-events: auto;
  }

  .twl-has-stories .twl-hero-copy__inner {
    padding-top: 0;
  }

  .twl-has-stories .twl-hero-actions {
    margin: 1.25rem 0 0;
    padding: 0;
    background: transparent;
  }

  .twl-has-stories .twl-hero-kicker,
  .twl-has-stories .twl-hero-lede {
    display: none;
  }

  .twl-has-stories .twl-hero-title {
    margin-top: 0.6rem;
    font-size: 2.6rem;
  }

  .twl-stories__caption {
    display: block;
    margin: 0;
    font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    line-height: 1.4;
    text-transform: uppercase;
    color: #c2db21;
  }

  .twl-stories__caption.is-in,
  .twl-has-stories .twl-hero-title.is-in {
    animation: twl-stories-caption 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  @keyframes twl-stories-caption {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .twl-stories__slide {
    transition: none;
  }
}
