/* dp-home-discover.css — the homepage's headset film (views/partials/home-lbe-discover.ejs)
 * and its Discover wall (views/partials/home-lbe-wall.ejs), both driven by
 * public/js/dp-home-discover.js.
 *
 * The film is one sticky stage: the headset scrubs with the scroll to the flash,
 * cuts to the arcade, and fades its last frame to violet while the next section
 * scrolls up over it. JS writes --dpd-glow (0..1 flash) and --dpd-film (0..1 film
 * opacity) on it.
 *
 * Wall cards copy the iOS Discover page (DiscoverFeedView.DiscoverPage): 9:16
 * clip, a bottom scrim, avatar + name, the view count with an eye, and the
 * game's 2:3 title card. No pills, no badges. */

.dpd {
  --dpd-glow: 0;
  position: relative;
  height: 620vh;
  /* The film's opening frames are mostly empty violet, so it starts pinning while the hero's bottom is still
     leaving the screen (the old homepage's .lp-scene--frames). .hl-hero stacks over it. The headset's strap starts
     16.5% down the first frame on a landscape screen, so more overlap than this cuts it off. */
  margin-top: -15vh;
  /* The next section scrolls up over the film's held last frame, so no empty violet follows it. */
  margin-bottom: -100svh;
  background: var(--lp-violet, #6a40f0);
}

.dpd__sticky {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  isolation: isolate;
}

/* ── the film ─────────────────────────────────────────────────────── */
.dpd__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: var(--dpd-film, 1);
  -webkit-mask-image: radial-gradient(120% 110% at 50% 50%, #000 55%, transparent 100%);
          mask-image: radial-gradient(120% 110% at 50% 50%, #000 55%, transparent 100%);
}
/* The arcade film runs edge to edge: no vignette, no fade at its foot. */
.dpd.is-second .dpd__canvas { -webkit-mask-image: none; mask-image: none; }
.dpd.is-second .dpd__sticky::after { display: none; }
/* The flash: a white core that swells with the flash. */
.dpd__glow {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(closest-side at 50% 50%, rgba(255, 255, 255, 0.95), rgba(236, 226, 255, 0.55) 45%, rgba(106, 64, 240, 0) 100%);
  transform: scale(calc(0.6 + var(--dpd-glow) * 1.4));
  opacity: var(--dpd-glow);
}
.dpd__burst { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }

.dpd__captions {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 11vh;
  text-align: center; padding: 0 var(--lp-gutter, 16px); pointer-events: none;
}
.dpd__caption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 0 var(--lp-gutter, 16px);
  font-family: var(--lp-display, 'Zalando Sans Expanded', system-ui, sans-serif); font-weight: 800;
  font-size: clamp(28px, 4.6vw, 60px); line-height: 1.05; letter-spacing: -0.01em; text-wrap: balance;
  color: #fff; opacity: 0; transform: translateY(20px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  text-shadow: 0 6px 30px rgba(27, 11, 74, 0.45);
}
.dpd__caption.is-on { opacity: 1; transform: none; }
/* A fade into the page violet under the captions (the frames' lower edge). */
.dpd__sticky::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 30%; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, var(--lp-violet, #6a40f0) 8%, rgba(106, 64, 240, 0));
}

/* ── the wall ─────────────────────────────────────────────────────── */
.dpw { --dpd-card-h: min(62svh, 600px); padding: clamp(56px, 8vw, 96px) 0; }
.dpw[hidden] { display: none; }
.dpd__wall { display: flex; flex-direction: column; gap: clamp(14px, 2.6svh, 28px); }

.dpd__head { text-align: center; }
.dpd__title { text-wrap: balance; }
.dpd__sub {
  margin: 10px auto 0; max-width: 34em; font-size: clamp(15px, 1.35vw, 19px);
  color: var(--lp-ink-2, rgba(255, 255, 255, 0.82)); text-wrap: balance;
}

.dpd__track {
  display: flex; gap: clamp(10px, 1.1vw, 16px);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  /* Room under the row for the cards' shadows (overflow clips them). */
  padding: 6px var(--lp-gutter, 16px) 44px;
  margin-bottom: -30px;
  scrollbar-width: none; -ms-overflow-style: none;
  cursor: grab; outline: none;
  /* Mouse drag-to-scroll must not select names or start a native image drag. */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--lp-gutter, 16px), #000 calc(100% - var(--lp-gutter, 16px)), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 var(--lp-gutter, 16px), #000 calc(100% - var(--lp-gutter, 16px)), transparent);
}
.dpd__track::-webkit-scrollbar { display: none; }
.dpd__track img { -webkit-user-drag: none; }
.dpd__track.is-dragging { cursor: grabbing; }
.dpd__track.is-dragging .dpd-card { pointer-events: none; }
.dpd__track:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); border-radius: 14px; }

/* No clips to show (empty pool, or the API is unreachable): no section at all. */
.dpw.is-empty { display: none; }

/* ── one card (the app's Discover page, small) ──────────────────────── */
.dpd-card {
  position: relative; flex: none;
  height: var(--dpd-card-h); aspect-ratio: 9 / 16;
  border-radius: 14px; overflow: hidden;
  background: #120634;
  box-shadow: 0 18px 40px rgba(27, 11, 74, 0.35);
  container-type: inline-size;
  /* The cards rise in when the wall scrolls into view: --i staggers them. */
  opacity: 0; transform: translateY(18px) scale(0.94);
  transition: opacity 0.5s ease calc(var(--i, 0) * 60ms), transform 0.6s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 60ms);
}
.dpw.is-open .dpd-card, .dpd-card.is-late { opacity: 1; transform: none; }
.dpd-card--ghost .dpd-card__media {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
}

.dpd-card__media { position: absolute; inset: 0; }
.dpd-card__poster, .dpd-card__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.dpd-card__poster { background: linear-gradient(160deg, #7d58f7, #2a1180); }
.dpd-card__video { opacity: 0; transition: opacity 0.35s ease; }
.dpd-card__video[data-dpv="playing"] { opacity: 1; }
.dpd-card__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.62) 100%);
}

.dpd-card__info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 clamp(9px, 5cqw, 14px) clamp(10px, 5cqw, 14px);
  display: flex; flex-direction: column; align-items: flex-start; gap: clamp(5px, 2.6cqw, 8px);
  color: #fff;
}
.dpd-card__by { display: flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0; }
.dpd-card__avatar {
  flex: none; width: clamp(20px, 9cqw, 28px); height: clamp(20px, 9cqw, 28px); border-radius: 50%;
  object-fit: cover; background: #7d58f7;
  display: inline-flex; align-items: center; justify-content: center;
  font: 800 clamp(10px, 4.4cqw, 13px)/1 var(--lp-body, 'DM Sans', system-ui, sans-serif); color: #fff;
}
.dpd-card__name {
  font: 700 clamp(13px, 5.6cqw, 16px)/1.15 var(--lp-body, 'DM Sans', system-ui, sans-serif);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.dpd-card__meta {
  display: flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0;
  font: 500 clamp(11px, 4.6cqw, 13px)/1.2 var(--lp-body, 'DM Sans', system-ui, sans-serif);
}
.dpd-card__park { color: rgba(255, 255, 255, 0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dpd-card__views {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums;
}
.dpd-card__views svg { width: 1.05em; height: 1.05em; }
.dpd-card__views.is-bumped span { animation: dpd-bump 0.6s ease; }
@keyframes dpd-bump { 0% { color: #fff; transform: translateY(0); } 30% { color: #ffe27a; transform: translateY(-2px); } 100% { transform: none; } }

/* The game's title card (2:3), the app's DiscoverTitleCards: tap = the game. */
.dpd-card__title {
  appearance: none; border: 0; padding: 0; margin: 2px 0 0; cursor: pointer;
  width: 30cqw; min-width: 64px; max-width: 108px; aspect-ratio: 2 / 3;
  border-radius: 8px; overflow: hidden; position: relative; display: block;
  background: linear-gradient(160deg, #7d58f7, #3a16a8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none; color: #fff;
}
.dpd-card__title:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
.dpd-card__title:active { transform: scale(0.97); }
.dpd-card__title:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.dpd-card__title img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.dpd-card__title .dpd-card__logo { inset: auto 0 6% 0; margin: 0 auto; width: 88%; height: auto; max-height: 45%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.85)) drop-shadow(0 4px 6px rgba(10, 2, 40, 0.6)); } /* the homepage title row's .lp-card__logo, smaller */
.dpd-card__title .dpd-card__tname {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  font: 800 11px/1.1 var(--lp-display, system-ui, sans-serif); text-align: center;
}

/* ── phones ───────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* The phone's sticky "Start free" dock covers the bottom ~84px: the row
   * sits above it and the cards take whatever height is left. */
  .dpd { height: 570vh; }
  .dpw { --dpd-card-h: clamp(260px, calc(100svh - 240px), 440px); }
  .dpd__wall { padding-bottom: 84px; gap: 14px; }
  .dpd__sub { font-size: 14px; margin-top: 8px; }
  .dpd__caption { font-size: clamp(26px, 8vw, 40px); }
  .dpd-card { border-radius: 12px; }
}
@media (max-height: 600px) {
  .dpw { --dpd-card-h: clamp(220px, calc(100svh - 200px), 440px); }
  .dpd__sub { display: none; }
}

/* ── reduced motion: no film ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dpd { display: none; }
  .dpd-card { opacity: 1; transform: none; transition: none; }
}

/* No count yet: nothing to brag about, so no eye and no zero. */
.dpd-card__views[data-views="0"] { display: none; }
