/* ============================================================
   components.css — individual UI components
   ============================================================ */

/* ---------- Icons ---------- */
.ico { width: 1.25em; height: 1.25em; fill: currentColor; }
.ico-heart { width: 1.25em; height: 1.25em; }

/* ============================================================
   GAME CARD  (shared by every row + hero)
   ============================================================ */
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 5 / 8;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--hairline-soft);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.card.is-hidden { display: none; }
.card:hover {
  transform: translateY(-4px);
  border-color: var(--hairline);
  box-shadow: 0 14px 36px rgba(0,0,0,.6), var(--glow-gold);
}
.card__img { width: 100%; height: 100%; object-fit: cover; }

.card__title {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 1.6em 0.7em 0.6em;
  font-size: var(--step-0);
  font-weight: 700; line-height: 1.15; text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.85));
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}

/* Control cluster (heart + info) */
.card__controls {
  position: absolute; inset: 0; pointer-events: none;
}
.card__fav, .card__info {
  position: absolute; top: 0.5rem;
  width: 2rem; height: 2rem;
  pointer-events: auto;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Drop-shadow keeps the white glyphs legible over bright card art. */
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.65));
  transition: transform 0.15s var(--ease), filter 0.2s;
}
.card__fav  { left: 0.5rem;  background-image: url("../hovers/Favorite.png"); }
.card__info { right: 0.5rem; background-image: url("../hovers/Info.png"); }
.card__fav.is-active { background-image: url("../hovers/Favorite Active.png"); }
.card__fav:hover, .card__info:hover {
  transform: scale(1.12);
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.8));
}

.card__fav.is-active { animation: pop 0.3s var(--ease); }
@keyframes pop { 0%{transform:scale(.7)} 60%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* Shrink the heart/info glyphs on small screens so they don't crowd the card. */
@media (max-width: 620px) {
  .card__fav, .card__info { width: 1.5rem; height: 1.5rem; top: 0.35rem; }
  .card__fav  { left: 0.35rem; }
  .card__info { right: 0.35rem; }
}

/* ---------- Card reveal layer (hover art + Play CTAs) ----------
   Desktop shows it on :hover; touch devices have no hover, so main.js
   toggles .is-active on tap (tap again / elsewhere to dismiss). */
.card--revealable { cursor: pointer; }

/* Keep controls + title painted above the darkened hover art (z-index:1). */
.card__controls { z-index: 4; }
.card__title { z-index: 2; }

.card__hover-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.card__actions {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.6rem; padding: 1rem;
  opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.card__play, .card__demo {
  display: block; width: 82%; max-width: 190px;
  transition: transform 0.15s var(--ease);
}
.card__play img, .card__demo img { width: 100%; height: auto; }
.card__play:hover, .card__demo:hover { transform: translateY(-1px) scale(1.03); }
.card__play:active, .card__demo:active { transform: scale(0.97); }

/* Shown state — on tap (all devices) and on hover (where supported). */
.card--revealable.is-active .card__hover-img { opacity: 1; }
.card--revealable.is-active .card__actions {
  opacity: 1; transform: none; pointer-events: auto;
}
@media (hover: hover) {
  .card--revealable:hover .card__hover-img { opacity: 1; }
  .card--revealable:hover .card__actions {
    opacity: 1; transform: none; pointer-events: auto;
  }
}

/* ============================================================
   HERO PEDESTALS
   ============================================================ */
.pedestal {
  display: grid; justify-items: center; align-content: end;
  scroll-snap-align: center;
  padding-top: 1rem;
}
.pedestal__card {
  width: 100%;
  max-width: 240px;
  z-index: 2;
  /* Rest position: lift the card so it appears to hover above the pedestal,
     seated a touch lower (+5px) so it sits closer to the base. */
  --card-lift: calc(-9% + 5px);
  transform: translateY(var(--card-lift));
}
/* On hover the card should rise UP from its rest — never dip down (the
   generic .card:hover translateY(-4px) would drop it, so override here). */
.pedestal__card:hover {
  transform: translateY(calc(var(--card-lift) - 10px));
}
.card--hero {
  aspect-ratio: 47 / 80;
  /* Deep, soft shadow cast down onto the pedestal to sell the float. */
  box-shadow: 0 30px 38px -8px rgba(0,0,0,.7), 0 10px 20px rgba(0,0,0,.5);
}
.pedestal__base {
  width: 122%;
  max-width: none;
  margin-top: -4%;
  /* The pedestal oval sits right-of-centre in the PNG (big shadow on the left),
     so nudge the image left to seat the card over the oval. */
  transform: translateX(-11%);
  filter: drop-shadow(0 20px 22px rgba(0,0,0,.65));
  z-index: 1;
}
/* Desktop: size cards from available viewport height so the hero fits one
   screen. Height drives width via the card's aspect-ratio. */
@media (min-width: 780px) {
  /* Clear separation between the logo and the card stage. */
  .hero__inner { gap: clamp(1.2rem, 4vh, 2.4rem); }
  /* Lift the logo a touch (transform keeps the stage layout unchanged). */
  .hero__logo { transform: translateY(clamp(-2.4rem, -4vh, -1rem)); }
  .hero__stage { gap: clamp(0.75rem, 2vw, 1.5rem); }
  .pedestal { flex: 0 1 auto; padding-top: 0; }
  .pedestal__card {
    height: min(50vh, 400px);
    width: auto;
    max-width: none;
  }
  /* Centre pedestal sits slightly forward (gentle lift so it clears the logo). */
  .pedestal:nth-child(2) { transform: translateY(-3%) scale(1.04); z-index: 3; }
  .pedestal:nth-child(2) .card--hero { box-shadow: 0 22px 50px rgba(0,0,0,.75), var(--glow-gold); }
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.searchbar__fav {
  flex: 0 0 auto;
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  color: var(--gold-3);
  background: var(--surface);
  position: relative;
  transition: box-shadow 0.2s;
}
.searchbar__fav:hover { box-shadow: var(--glow-gold); }
.searchbar__fav.has-favs::after {
  content: attr(data-count);
  position: absolute; top: -4px; right: -4px;
  min-width: 1.15rem; height: 1.15rem; padding: 0 3px;
  display: grid; place-items: center;
  font-size: 0.65rem; font-weight: 700; color: #2a1c05;
  background: var(--gradient-gold); border-radius: 999px;
}
.searchbar__fav.has-favs .ico-heart { fill: currentColor; }
.searchbar__fav .ico-heart { fill: none; stroke: currentColor; stroke-width: 1.6; }

.searchbar__field {
  flex: 1;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 1.1rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--gold-3);
}
.searchbar__field input {
  flex: 1; border: 0; background: none; outline: none;
  color: var(--text); font-size: var(--step-0);
}
.searchbar__field input::placeholder { color: var(--text-mute); }

/* ============================================================
   WINNERS TICKER
   ============================================================ */
.ticker__track {
  display: inline-flex; align-items: center; gap: 2.5rem;
  padding-block: 0.7rem;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll 38s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes ticker-scroll { to { transform: translateX(-50%); } }

.winner { display: inline-flex; align-items: baseline; gap: 0.5rem; font-size: var(--step--1); }
.winner strong { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.winner__user { color: var(--text-mute); }
.winner__amt { color: var(--gold-3); font-weight: 700; }
.winner:not(:last-child)::after {
  content: ""; width: 5px; height: 5px; margin-left: 2rem;
  border-radius: 50%; background: var(--gold-line); opacity: 0.5;
}

/* ============================================================
   PARTNERS
   ============================================================ */
.partners__list {
  will-change: transform;
  animation: partners-scroll 45s linear infinite;
}
.partners:hover .partners__list { animation-play-state: paused; }
@keyframes partners-scroll { to { transform: translateX(-50%); } }

.partners__item img {
  height: clamp(18px, 4vw, 26px); width: auto;
  object-fit: contain;
  filter: grayscale(1) brightness(1.6);
  opacity: 0.75;
  transition: opacity 0.25s, filter 0.25s;
}
.partners__item:hover img { opacity: 1; filter: grayscale(0) brightness(1); }
.partners__divider img { height: 22px; width: auto; opacity: 0.5; }

/* ============================================================
   DIAMOND ROAD — podium + XP track
   ============================================================ */
/* Nudge the diamonds + their reward caption downward together, without moving
   the background art or the XP line. transform (not margin) keeps everything
   else in place — tune --road-drop to taste. */
:root { --road-drop: 2rem; --road-diamond-drop: 3rem; }
.road__podium {
  position: relative;
  width: 100%;
  min-width: 0;                 /* let the scroll strip shrink, not stretch */
  margin: -0.5rem auto 0;
  transform: translateY(var(--road-diamond-drop));
}
/* Swipeable strip: diamonds snap to centre so you can drag between them.
   The gold railing is the floor curve already baked into the section
   background, so the diamonds simply sit along it. */
.road__diamonds {
  position: relative; z-index: 1;
  min-width: 0; max-width: 100%;
  list-style: none; margin: 0;
  /* 50% inline padding = runway so the first/last diamond can scroll to centre. */
  padding: 0 50%;
  display: flex; align-items: flex-end;
  gap: clamp(1.5rem, 7vw, 3.5rem);
  /* overflow-x:auto also clips vertical overflow, cropping the translated
     pedestals + their drop-shadow. Extend the scroll box downward with
     padding, then cancel the extra height so nothing below shifts. */
  padding-bottom: 2.5rem;
  margin-bottom: -2.5rem;
  overflow-x: auto;
  /* Native scroll-snap fires an instant, browser-controlled snap that feels
     jarring. Snapping is done in JS instead (main.js: a custom eased rAF scroll)
     so its duration + easing are tunable — keep this NONE. */
  scroll-snap-type: none;
  scroll-padding-inline: 50%;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.road__diamonds::-webkit-scrollbar { display: none; }
.road__diamonds.is-dragging { cursor: grabbing; scroll-snap-type: none; }

/* Every slot reserves the SAME (active-sized) footprint so a diamond growing
   to the centre "hero" size never reflows its neighbours — the strip offsets
   stay put, keeping centre-detection smooth while swiping. */
.road__slot {
  flex: 0 0 auto;
  width: clamp(120px, 34vw, 200px);
  scroll-snap-align: center;
  display: grid; justify-items: center; align-items: end;
}
.road__gemwrap {
  position: relative;
  container-type: inline-size;     /* lets the badge scale with the gem */
  line-height: 0;
  width: 100%;                     /* full (active) footprint; sides SCALE down */
  /* Seat on the gold line AND size in ONE transform, driven by scale() not
     width. Scaling is GPU-composited, so growing to the hero size never
     triggers layout/reflow (which, with the cqw-sized badge, was thrashing the
     UI on mobile while swiping). transform-origin keeps the pedestal base
     pinned to the line so the diamond grows upward, not outward from centre. */
  transform-origin: bottom center;
  transform: translateY(6%) scale(0.6);
  transition: transform 0.3s var(--ease);
  will-change: transform;
  backface-visibility: hidden;     /* rasterise the drop-shadow once, then composite */
}
/* The dark side art seats its pedestal higher than the gold hero when
   bottom-aligned, so drop the non-active diamonds a touch onto the line. */
.road__slot:not(.road__slot--active) .road__gemwrap { transform: translateY(11%) scale(0.6); }
/* Position seating — the vertical height belongs to the slot POSITION, not the
   diamond. Diamonds rotate through positions on swipe (classes toggled in
   main.js: --active = centre, --edge = two steps out). The gold line dips at the
   edges, so outer positions seat their diamond a touch lower. */
.road__slot--edge { transform: translateY(0.8rem); }
.road__gem {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.6));
  user-select: none; -webkit-user-drag: none;
}
/* The centred diamond is the glowing gold hero (JS swaps its image + class).
   scale(1) = full size; grows from the pedestal base (see .road__gemwrap). */
.road__slot--active .road__gemwrap { transform: translateY(6%) scale(1); z-index: 2; }

/* Level number, overlaid on the pedestal so it's correct for ANY level
   (the PNGs only bake in 1–3). Two tunings: the dark and gold art seat their
   pedestal badge at slightly different spots. */
.road__badge {
  position: absolute; left: 50%; top: 88%;   /* dark art: badge centre ~88% down */
  transform: translate(-50%, -50%);
  width: 20%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #3a3a3a 0%, #090909 78%);
  box-shadow: inset 0 0 0 1.5px rgba(210,170,75,.9), 0 1px 2px rgba(0,0,0,.6);
  color: #e9c869; font-weight: 800; line-height: 1; font-size: 11cqw;
  font-variant-numeric: tabular-nums;
}
/* gold hero art seats its badge lower + smaller in the frame */
.road__slot--active .road__badge { top: 92%; width: 16%; font-size: 8.5cqw; }

/* Reward caption for the active (centred) diamond: a small level line and the
   per-level reward name in gradient gold (.gold-text). Updated on swipe. */
.road__reward {
  display: grid; justify-items: center; gap: 0.1rem;
  margin-top: 0.4rem; line-height: 1.15;
  transform: translateY(var(--road-drop));   /* travel down with the diamonds */
}
.road__reward-level {
  font-size: var(--step--1); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
}
.road__reward-title {
  font-family: var(--font-display);
  font-size: var(--step-1); font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.road__xp { font-size: var(--step-0); color: var(--text-dim); margin-top: 0.5rem; transform: translateY(1rem); }
.road__xp .gold-text { font-weight: 700; }

/* ============================================================
   HOT GAMES banner
   ============================================================ */
.hot { position: relative; }
.hot__viewport {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  background: #171233;               /* forest-dark fallback behind the art */
}
.hot__slide { aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; background: none; }
.hot__slide[hidden] { display: none; }
/* The Book of Diamonds art carries transparent overflow at the top; crop to
   its opaque forest region so it fills the card edge-to-edge (dots stay pinned
   to the bottom). object-position favours the lower portion of the source. */
.hot__img { width: 100%; aspect-ratio: 10 / 3; object-fit: cover; object-position: center bottom; }
@media (max-width: 620px) { .hot__img { aspect-ratio: 8 / 3; object-position: center bottom; } }
.hot .card__fav, .hot .card__info { top: 0.8rem; }
.hot .card__fav { left: 0.8rem; }
.hot .card__info { right: 0.8rem; }

.hot__dots {
  position: absolute; left: 50%; bottom: 0.8rem; translate: -50% 0;
  display: flex; gap: 0.5rem;
}
.hot__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  transition: background 0.2s, width 0.2s;
}
.hot__dot.is-active { background: var(--gold-3); width: 20px; border-radius: 999px; }

/* ============================================================
   DIAMOND CLUB — throne + leaderboard
   ============================================================ */
.club__throne-btn {
  position: relative;
  display: grid;
  grid-template-rows: 1fr;           /* collapses to 0fr on reveal (see below) */
  width: min(680px, 100%);
  margin-block: -1.5rem -2rem;
  padding: 0; border: 0; background: none; cursor: pointer;
  overflow: hidden;
  transform: translateX(-8%);        /* base offset the pulse keyframes preserve */
  transition: grid-template-rows 0.5s var(--ease), opacity 0.4s var(--ease), margin 0.5s var(--ease);
  /* Gently pulses by default so it reads as clickable. */
  animation: club-pulse 2.4s ease-in-out infinite;
}
.club__throne { width: 100%; height: auto; min-height: 0; display: block; filter: drop-shadow(0 20px 40px rgba(0,0,0,.7)); }
@keyframes club-pulse {
  0%, 100% { transform: translateX(-8%) scale(1); }
  50%      { transform: translateX(-8%) scale(1.06); }
}
/* Reveal: the throne collapses its height and fades as the leaderboard expands
   into the same space — a smooth crossfade instead of an instant swap. */
.feature--club.is-revealed .club__throne-btn {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-block: 0;
  pointer-events: none;
  animation: none;
}

.leaderboard {
  width: 100%; max-width: 720px; margin-inline: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(20,17,22,.8), rgba(8,7,9,.9));
  overflow: hidden;
}
.leaderboard__head {
  position: relative;
  padding: 0.8rem;
  text-align: center;
  font-family: var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  font-size: var(--step-0); color: var(--gold-3);
  border-bottom: 1px solid var(--hairline);
}
.leaderboard__close {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--text-mute); border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.leaderboard__close:hover, .leaderboard__close:focus-visible {
  color: var(--gold-3); background: rgba(255,255,255,.06);
}
.leaderboard__table { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
.leaderboard__table th,
.leaderboard__table td { padding: 0.7rem 1.1rem; text-align: left; }
.leaderboard__table th { color: var(--text-mute); font-weight: 500; font-size: var(--step--1); }
.leaderboard__table .num { text-align: right; }
.leaderboard__table tbody tr { border-top: 1px solid var(--hairline-soft); }
.leaderboard__table td.num { color: var(--gold-3); font-weight: 700; }
.lb-rank { color: var(--gold-3); font-weight: 700; margin-right: 0.3rem; }

/* ---- Reveal: lines draw the table into place when the throne is clicked ----
   The frame itself fades/expands via .club__detail (layout.css); here we add the
   detail: 1. the header rule draws from the centre outward, 2. the column labels
   fade in, 3. each row's divider grows to full width as its text fades —
   staggered top to bottom via the inline --i index. */
.feature--club.is-revealed .leaderboard__head {
  border-bottom-color: transparent;      /* redrawn by the growing line below */
  background-image: linear-gradient(var(--gold-line), var(--gold-line));
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 0% 1px;
  animation: lb-hrule 0.5s var(--ease) 0.15s forwards;
}
@keyframes lb-hrule { to { background-size: 100% 1px; } }
.feature--club.is-revealed .leaderboard__table thead th {
  animation: lb-fade 0.4s var(--ease) 0.4s both;
}
.feature--club.is-revealed .leaderboard__table tbody tr {
  border-top-color: transparent;         /* redrawn by the growing line below */
}
.feature--club.is-revealed .leaderboard__table tbody td {
  background-image: linear-gradient(rgba(212,175,90,.45), rgba(212,175,90,.45));
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 0% 1px;
  animation: lb-row 0.5s var(--ease) calc(var(--i, 0) * 0.09s + 0.5s) both;
}
@keyframes lb-row {
  from { opacity: 0; background-size: 0% 1px; }
  to   { opacity: 1; background-size: 100% 1px; }
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .feature--club.is-revealed .leaderboard,
  .feature--club.is-revealed .leaderboard__head,
  .feature--club.is-revealed .leaderboard__table thead th,
  .feature--club.is-revealed .leaderboard__table tbody td { animation: none; }
  .feature--club.is-revealed .leaderboard__head { background-size: 100% 1px; }
  .feature--club.is-revealed .leaderboard__table tbody td { background-size: 100% 1px; }
}

/* ============================================================
   INFO MODAL
   ============================================================ */
.modal {
  width: min(360px, 92vw);
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.8);
  overflow: hidden;
}
.modal::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in 0.25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } }
.modal__img { width: 100%; aspect-ratio: 5/6; object-fit: cover; }
.modal__title {
  padding: 1rem 1.2rem 0;
  font-family: var(--font-display); font-size: var(--step-1);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.modal__actions { display: flex; gap: 0.6rem; padding: 1rem 1.2rem 1.4rem; }
.modal__close {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: 50%; color: #fff; background: rgba(0,0,0,.45);
}
.modal__close:hover { background: rgba(0,0,0,.7); }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* The winners + logos marquees are intentionally exempt: they keep
     scrolling even under prefers-reduced-motion (forced by request).
     !important re-asserts the animation the universal rule above kills. */
  .ticker__track {
    animation: ticker-scroll 38s linear infinite !important;
  }
  .partners__list {
    animation: partners-scroll 45s linear infinite !important;
  }
  /* The throne keeps pulsing so it still reads as clickable (forced by request). */
  .feature--club:not(.is-revealed) .club__throne-btn {
    animation: club-pulse 2.4s ease-in-out infinite !important;
  }
}
