/* ============================================================================
   mobile-cards.css — phone card system
   Design reference: JioHotstar mobile (16:9 tiles in rails, poster rails, art
   with a bottom scrim, pill badges, snap carousels with a peek of the next
   card). None of their classes or markup is reused; this restyles the cards
   the app already renders.

   Scope: phones and small tablets only. Desktop is untouched — every rule
   with a visual side effect lives behind the max-width query below.
   ========================================================================== */

/* -- tokens ---------------------------------------------------------------- */
:root {
  --mc-radius: 14px;
  --mc-radius-sm: 10px;
  --mc-gap: 11px;
  --mc-edge: 16px;
  --mc-scrim: linear-gradient(
    to top,
    rgba(4, 5, 9, 0.92) 0%,
    rgba(4, 5, 9, 0.72) 34%,
    rgba(4, 5, 9, 0.18) 62%,
    rgba(4, 5, 9, 0) 82%
  );
  --mc-pill-bg: rgba(10, 11, 16, 0.72);
  --mc-pill-border: rgba(255, 255, 255, 0.16);
}

@media (max-width: 820px) {
  /* ---------------------------------------------------------------- rails -- */
  /* Every home rail is <h1> followed by a track. The track becomes a
     momentum-scrolling snap strip that shows a sliver of the next card. */
  .style_HomeListAll__eRwnM {
    padding-block: 0.15rem 0.35rem;
    contain: paint;
  }

  .style_HomeListAll__eRwnM > h1 {
    padding: 0 var(--mc-edge);
    margin-bottom: 0.15rem;
    font-size: 1.3rem;
    letter-spacing: -0.018em;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* The old ‹› chevrons are desktop affordances; on a touch strip they are
     dead weight and sit on top of the first card. */
  .style_HomeListAll__eRwnM > h1 > div {
    display: none;
  }

  .style_HomeListSection__BKDhh,
  .style_RecommendationListSection__HCH4V {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--mc-gap) * 2)) / 3.15);
    gap: var(--mc-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--mc-edge);
    padding: 6px var(--mc-edge) 18px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* the right edge fades so the peek reads as "there is more" */
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  }

  .style_HomeListSection__BKDhh::-webkit-scrollbar,
  .style_RecommendationListSection__HCH4V::-webkit-scrollbar {
    display: none;
  }

  /* --------------------------------------------------------------- cards -- */
  .prime-movie-card,
  .style_MovieCardSmall__3alU4 {
    scroll-snap-align: start;
    /* Touch has no hover: the lift that plays on desktop reads as a jump
       glitch here. Replace it with a press-in. */
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.16s ease;
    transform: none;
    will-change: auto;
  }

  .prime-movie-card:hover,
  .style_MovieCardSmall__3alU4:hover {
    transform: none;
    z-index: auto;
  }

  .prime-movie-card:active,
  .style_MovieCardSmall__3alU4:active {
    transform: scale(0.965);
    transition-duration: 0.1s;
    opacity: 0.92;
  }

  .prime-card-poster {
    border-radius: var(--mc-radius);
    aspect-ratio: 2 / 3;
    isolation: isolate;
    background: linear-gradient(160deg, #1a1c22 0%, #0d0f14 100%);
    box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.9),
                0 0 0 1px rgba(255, 255, 255, 0.045) inset;
    overflow: hidden;
  }

  .prime-card-poster img,
  .prime-card-poster .style_img__o9kL4 {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }

  /* Bottom scrim: keeps the title readable over bright key art without
     washing the whole poster out. */
  .prime-card-poster::before {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 62%;
    background: var(--mc-scrim);
    z-index: 2;
    pointer-events: none;
    opacity: 0.9;
  }

  /* The gradient border ring stays, but it is a hover affordance — kill it. */
  .prime-card-poster::after {
    display: none;
  }

  /* Rating chip, top-right, translucent like the reference masthead chips. */
  .prime-card-badge {
    top: 0.4rem;
    right: 0.4rem;
    padding: 0.16rem 0.42rem;
    border-radius: 7px;
    font-size: 0.66rem;
    letter-spacing: 0.01em;
    background: rgba(8, 9, 13, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f4e9c9;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  }

  /* Bottom-left status pill (NEW / LIVE / TODAY). Injected by cards.js. */
  .prime-card-pill {
    position: absolute;
    left: 0.4rem;
    bottom: 0.4rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.46rem;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(100deg, #ff2f7a 0%, #b424ff 100%);
    box-shadow: 0 3px 10px rgba(180, 36, 255, 0.35);
    pointer-events: none;
    white-space: nowrap;
  }

  .prime-card-pill.is-live {
    background: linear-gradient(100deg, #ff3b30 0%, #ff6a00 100%);
    box-shadow: 0 3px 10px rgba(255, 59, 48, 0.38);
  }

  .prime-card-pill.is-live::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.85);
    animation: mc-live-pulse 1.9s ease-out infinite;
  }

  /* Hover play overlay is a desktop mouse affordance. */
  .prime-card-hover-play {
    display: none;
  }

  /* Title block under the art: two lines max, tighter than desktop. */
  .prime-card-meta {
    padding-top: 0.42rem;
  }

  .prime-card-title {
    font-size: 0.78rem;
    line-height: 1.22;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.94);
  }

  .prime-card-sub-row {
    margin-top: 0.18rem;
    gap: 0.3rem;
    font-size: 0.64rem;
    opacity: 0.62;
  }

  .prime-card-type-tag {
    display: none; /* redundant with the year on a 3-up tile */
  }

  /* ------------------------------------------- continue-watching (16:9) -- */
  /* These tiles carry a progress bar under the art. On desktop the bar is a
     thin line; on a phone it becomes the whole point, so it gets weight. */
  .style_watchlistItems__wOohX {
    position: relative;
    scroll-snap-align: start;
  }

  .style_watchlistItems__wOohX .prime-card-poster {
    aspect-ratio: 16 / 9;
    border-radius: var(--mc-radius-sm);
  }

  .style_watchlistItems__wOohX .prime-card-poster::before {
    height: 46%;
    opacity: 0.55;
  }

  /* Track behind the bar. The bar element itself carries an inline width
     (set when progress is saved), so it is the fill, not the track. */
  .style_watchlistItems__wOohX .prime-card-poster::after {
    content: "";
    display: block;
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    z-index: 3;
    pointer-events: none;
  }

  .style_watchProgress__N5twP {
    position: absolute;
    left: 8px;
    bottom: 8px;
    height: 3px;
    max-width: calc(100% - 16px);
    border-radius: 999px;
    background: linear-gradient(90deg, #7aa2ff 0%, #c58bff 100%);
    box-shadow: 0 0 10px rgba(150, 120, 255, 0.45);
    z-index: 4;
  }

  .style_bookmarkTvData__WESP9 {
    font-size: 0.68rem;
    margin-top: 0.3rem;
    opacity: 0.72;
  }

  /* ------------------------------------------------------------- headers -- */
  /* Section titles sit tighter against their rails, like the reference. */
  .style_HomeListAll__eRwnM + .style_HomeListAll__eRwnM {
    margin-top: 0.55rem;
  }

  /* -------------------------------------------------------- interaction -- */
  /* Nothing on a phone should animate on hover; only on touch. */
  @media (hover: none) {
    .prime-movie-card:hover .prime-card-poster,
    .style_MovieCardSmall__3alU4:hover .prime-card-poster {
      box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.9),
                  0 0 0 1px rgba(255, 255, 255, 0.045) inset;
    }
    .prime-movie-card:hover .prime-card-title,
    .style_MovieCardSmall__3alU4:hover .prime-card-title {
      color: rgba(255, 255, 255, 0.94);
    }
    .prime-movie-card:hover .prime-card-badge,
    .style_MovieCardSmall__3alU4:hover .prime-card-badge {
      transform: none;
    }
  }
}

/* ------------------------------------------------------------- keyframes -- */
@keyframes mc-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.85); }
  70% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Respect the OS setting: no pulse, no press scale. Scoped to phones so the
   desktop card animations are untouched. */
@media (max-width: 820px) and (prefers-reduced-motion: reduce) {
  .prime-card-pill.is-live::before { animation: none; }
  .prime-movie-card,
  .style_MovieCardSmall__3alU4 {
    transition: none;
  }
  .prime-movie-card:active,
  .style_MovieCardSmall__3alU4:active {
    transform: none;
  }
}
