/* Greybox Phase 4 — homepage shelves + content cards.
 * Consumes Phase 1 tokens (css/tokens.css). No red, no neon, no clutter.
 * Amber accent used sparingly (rating star, in-list state, focus ring via
 * the global :focus-visible rule). Vanilla CSS, no library. */

#grid .card { width: 100%; content-visibility: auto; contain-intrinsic-size: auto 357px; }

/* ---------------- home glass slab (faint frosted lens) ----------------
 * Home screen only: #home-sections is populated by the home route and
 * cleared everywhere else, so no other route and never the hero get it
 * (the hero also paints ABOVE <main>, and both layers feather out at the
 * top edge before they could reach the hero's bottom fade).
 * Two layers, both behind the shelves (z-index -1, pointer-events none):
 *  - ::before = the glass: slight blur + saturate on the page backdrop
 *    (body glass layer + main dissolve) under a faint white sheen.
 *  - ::after  = the lens: a soft centered zone of deeper blur + glow just
 *    under the hero, feathered radially AND by the same top fade, so the
 *    dissolve tail smears like through a lens with no edge anywhere.
 * Everything fades out at the bottom too — no hard line before the footer.
 * Full-bleed to the viewport: .gx-page is the centered --gx-content-max
 * column (--gx-gutter pad + auto margins, see style.css) so the gutter is
 * fluid.
 * calc(50% - 50vw) bleeds the tint from the centered content box out to the
 * viewport edge at any width/gutter (html,body overflow-x: clip absorbs the
 * scrollbar rounding). */
#home-sections:not(:empty)::before,
#home-sections:not(:empty)::after {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  pointer-events: none;
}
#home-sections:not(:empty)::before {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.028) 34%, rgba(255, 255, 255, 0.018) 100%);
  /* Perf: deliberately NO backdrop-filter. This tint spans the ENTIRE
   * home shelf zone full-bleed, and its backdrop (the fixed body glass
   * layer) shifts on every scroll frame — the pair of full-height blurs
   * below used to be re-rendered per frame across the whole page, which
   * was the #1 scroll-jank source on budget Android GPUs. The backdrop is
   * already the blurred ambient poster, so the gradient carries the look
   * with zero per-frame cost (same reasoning as tokens.css body::before). */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 110px, #000 calc(100% - 150px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 110px, #000 calc(100% - 150px), transparent 100%);
}
#home-sections:not(:empty)::after {
  background: radial-gradient(46% 420px at 50% 170px,
    rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02) 55%, transparent 78%);
  /* No backdrop-filter either — see ::before above. */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0, #000 110px),
    radial-gradient(46% 420px at 50% 170px, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 78%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 0, #000 110px),
    radial-gradient(46% 420px at 50% 170px, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 78%);
  mask-composite: intersect;
}

/* ---------------- entrance (Aetho .rise-in port) ----------------
 * Sections + cards cascade in with a spring settle; stagger comes from
 * nth-child delays below so a freshly rendered rail reads as one wave.
 * The `to` keyframe deliberately omits `transform`: with fill-mode both,
 * a `to { transform: none }` would keep overriding :hover/:active lifts
 * for the element's whole lifetime (animations outrank normal rules). */
@keyframes gx-rise-in {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; }
}

/* ---------------- section header ---------------- */

.gx-shelf {
  margin-top: var(--gx-shelf-space);
  min-width: 0;
  /* Lag-free scrolling: the browser skips layout/paint for offscreen
   * shelves entirely (huge win with 8-10 shelves). The intrinsic-size
   * estimate keeps the scrollbar stable before a shelf renders. */
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
  animation: gx-rise-in 0.6s var(--gx-ease-spring) backwards;
}
.gx-shelf:first-child { margin-top: 2rem; }

.gx-shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  gap: 1rem;
  margin-bottom: var(--gx-shelf-head-space);
  min-width: 0;
}

.gx-shelf-titles { flex: 1 1 auto; min-width: 0; }

.gx-shelf-title,
#section-title {
  font-size: clamp(1.1rem, 1.6vw, 1.34rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55);
  margin: 0;
}

.gx-shelf-desc {
  margin: 0.25rem 0 0;
  font-size: 0.83rem;
  color: var(--gx-text-dim);
  max-width: 46rem;
}

/* Explore all: one compact glass pill, secondary to the title —
 * Aetho .rail-see-all port (neutral, no accent, springs up 1px on hover). */
.gx-viewall {
  flex: none;
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--gx-text-dim);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.72rem;
  border-radius: var(--gx-radius-pill);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--gx-glass-line);
  transition: transform 250ms var(--gx-ease-spring), color var(--gx-transition),
    border-color var(--gx-transition), background var(--gx-transition);
}

.gx-viewall .gx-viewall-arrow {
  display: inline-block;
  color: currentColor;
  transition: transform var(--gx-transition);
}

.gx-viewall:hover {
  color: #fff;
  border-color: rgba(var(--gx-hero-tint), 0.55);
  background: rgba(var(--gx-hero-tint), 0.16);
  transform: translateY(-1px);
}
.gx-viewall:hover .gx-viewall-arrow { transform: translateX(3px); }

.gx-viewall:focus-visible {
  outline: 2px solid var(--gx-accent);
  outline-offset: 2px;
}

/* ---------------- shelf carousel ---------------- */

.gx-shelf-viewport {
  position: relative;
  margin: 0;
  min-width: 0;
  /* Shelf edge-hairline fix: the track's scrollport (its padding box) extends
   * 0.15rem past this box on each side via the track's negative margins, so
   * live card paint reached past the edge-fade line (::before/::after end
   * exactly here) and read as a bright vertical strip. Bounding this box
   * terminates content exactly where the fades terminate. Track scrolling,
   * arrows (inside this box), fades, and card paint are otherwise untouched. */
  overflow: hidden;
}

.gx-shelf-track {
  display: flex;
  /* 1rem (16px) gap: consistent card rhythm on desktop (12px on mobile).
   * No CSS scroll-behavior here on purpose: arrow buttons request smooth
   * scrolling explicitly in js/shelves.js, while wheel/trackpad/touch use
   * the browser's native (instant) path so shelf movement never feels like
   * it is fighting an animation. */
  gap: var(--gx-shelf-gap);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.35rem 0.15rem 0.9rem;
  margin: 0 -0.15rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}

.gx-shelf-track::-webkit-scrollbar { display: none; }

/* Drag-to-scroll itself is unchanged (mouse drag on the tracks, swipe on
 * touch), but the grab/grabbing cursors on .gx-shelf-track, .gx-eps-rail and
 * #m-cast are gone: the OS hand glyph reads as a heavy black cursor over the
 * cast row and was reported as a bug. A custom cursor can return later as an
 * asset instead of a system keyword. */

/* Active drag state (class toggled by js/shelves.js, removed on release):
 * snap would fight 1:1 pointer tracking on the episode rail, and text
 * selection / native image drag must not take over mid-swipe. Scoped to
 * the dragged track only — the rest of the page is unaffected. */
.gx-dragging {
  scroll-snap-type: none !important;
  user-select: none;
  -webkit-user-select: none;
}
.gx-dragging img { -webkit-user-drag: none; }

.gx-shelf-track > .card {
  flex: 0 0 auto;
  /* Substantial, scannable cards: ~168–188px on desktop (more cards fit on
   * wide screens instead of growing enormous), shrinking fluidly below that
   * with a firm minimum so mobile cards never turn tiny. Wide (backdrop)
   * shelves widen this via the vars overridden on [data-layout="backdrop"]. */
  width: clamp(var(--gx-card-min), calc(var(--gx-card-vw) * 1vw), var(--gx-card-max));
}

/* Whisper-quiet edge fades, only while there is more to see */
.gx-shelf-viewport::before,
.gx-shelf-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0.9rem;
  width: 2.2rem;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--gx-transition);
}

.gx-shelf-viewport::before {
  left: 0;
  background: linear-gradient(to right, rgba(11, 13, 18, 0.7), transparent);
}

.gx-shelf-viewport::after {
  right: 0;
  background: linear-gradient(to left, rgba(11, 13, 18, 0.7), transparent);
}

.gx-shelf-viewport[data-overflow="true"]:not([data-at-start="true"])::before { opacity: 1; }
.gx-shelf-viewport[data-overflow="true"]:not([data-at-end="true"])::after { opacity: 1; }

/* Glass disc arrows — Aetho .rail-slider-arrow port (44px, frosted,
 * bright hairline; hover fills the disc with white). */
.gx-shelf-btn {
  position: absolute;
  top: 36%;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--gx-text);
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: var(--gx-blur-glass);
  -webkit-backdrop-filter: var(--gx-blur-glass);
  border: 1px solid var(--gx-glass-line-bright);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--gx-transition), background var(--gx-transition),
    transform 250ms var(--gx-ease-spring);
}

.gx-shelf-btn svg { width: 1.05rem; height: 1.05rem; }

.gx-shelf-btn[data-dir="prev"] { left: 8px; }
.gx-shelf-btn[data-dir="next"] { right: 8px; }

.gx-shelf-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.gx-shelf-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--gx-accent);
  outline-offset: 2px;
}

.gx-shelf-btn:disabled { opacity: 0.25; cursor: default; }

.gx-shelf-viewport:hover .gx-shelf-btn,
.gx-shelf-viewport:focus-within .gx-shelf-btn {
  opacity: 1;
}

.gx-shelf-viewport:hover .gx-shelf-btn:disabled,
.gx-shelf-viewport:focus-within .gx-shelf-btn:disabled {
  opacity: 0.25;
}

.gx-shelf-viewport[data-overflow="false"] .gx-shelf-btn { display: none; }

@media (hover: none) {
  .gx-shelf-viewport .gx-shelf-btn { display: none; }
}

/* ---------------- cards (Aetho .poster-card port) ----------------
 * Frosted card shell: subtle white fill + hairline that brightens on hover,
 * spring lift (-8px / 1.02) with the deep 0 18px 40px shadow, and a
 * staggered rise-in so a fresh rail cascades in. */
.gx-card {
  background: var(--gx-card-bg);
  border: 1px solid var(--gx-glass-line);
  border-radius: var(--gx-radius-card);
  overflow: hidden;
  cursor: pointer;
  min-width: 0;
  contain: layout style;
  /* Depth before motion: a two-tier contact shadow (tight edge + wide
   * ambient pool) plus a specular top edge, so the shell reads as a card
   * with real thickness sitting on the surface from the moment it paints. */
  box-shadow: var(--gx-shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: gx-rise-in 0.55s var(--gx-ease-spring) backwards;
  transition: transform 320ms var(--gx-ease-spring), box-shadow 320ms ease,
    border-color 280ms ease, background 280ms ease;
}

.gx-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: var(--gx-card-bg-hover);
  border-color: var(--gx-glass-line-bright);
  /* Deeper, wider pool + a hairline rim and a low bloom both tinted by the
   * CURRENT hero accent (--gx-hero-tint): the lifted card catches the
   * room's light instead of floating over a flat grey. */
  box-shadow: var(--gx-shadow-card-hover),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(var(--gx-hero-tint), 0.26),
    0 30px 64px -34px rgba(var(--gx-hero-tint), 0.75);
}

/* Touch/keyboard press feedback: a smaller lift, same cheap transform, no
 * layout change, never relies on hover (touch devices get this instead). */
.gx-card:active { transform: translateY(-4px) scale(1.01); }

.gx-card:focus-visible {
  outline: none;
  transform: translateY(-8px) scale(1.02);
  border-color: #fff;
  box-shadow: var(--gx-shadow-lift), 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.gx-card-media {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  /* Card shell owns the radius + hairline now: media sits flush inside it,
   * keeping the same layered pre-poster glass base as before. */
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.42), transparent 32%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent 30%),
    var(--gx-surface);
  background-clip: padding-box;
  isolation: isolate;
  box-shadow: none;
}

/* Sheen sweep (Aetho .poster-media specular): a diagonal highlight that
 * travels across the artwork once per hover — pure transform, GPU cheap. */
.gx-card-media::after {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 2;
  pointer-events: none;
  background: var(--gx-glass-sheen);
  transform: translateX(-85%);
  transition: transform 0.9s var(--gx-ease-cinema);
}

.gx-card:hover .gx-card-media::after { transform: translateX(85%); }

.gx-card-media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  /* Fast fade-in over the shimmer surface: posters pop in smoothly instead
   * of flashing dark empty boxes. Opacity-only (GPU cheap, no layout). */
  opacity: 0;
  transition: opacity 320ms ease, transform 0.9s var(--gx-ease-cinema), filter 0.4s ease;
}

.gx-card-media img.is-loaded { opacity: 1; }

.gx-card:hover .gx-card-media img { transform: scale(1.08); filter: brightness(1.08); }

/* Shimmer: lightweight static gradient only on LOADING cards. Once the
 * image loads, the pseudo-element is removed entirely — no infinite
 * animation, no compositor layers on loaded cards. */
.gx-card-media::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  z-index: 0;
}

.gx-card-media:has(> img.is-loaded)::before,
.gx-card-media.is-done::before {
  display: none;
}

/* ---------------- Continue Watching (resume shelf) ----------------
 * Eyebrow above the shelf title, a "Clear history" action pill in the
 * header, and a Netflix-style progress bar across the bottom of each
 * resumable card (js/pages.js homeSectionHeader / js/components.js card).
 * Bars are per-card and static — no animation, no layout reads. */
.gx-shelf-eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gx-accent);
}

.gx-cw-clear {
  cursor: pointer;
  font-family: inherit;
}

.gx-cw-clear:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.gx-card-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3; /* above the artwork + sheen (z-index 2), below hover lift */
  height: 3px;
  background: rgba(255, 255, 255, 0.26);
}

.gx-card-progress span {
  display: block;
  height: 100%;
  background: var(--gx-accent);
  border-radius: 0 2px 2px 0;
}

.gx-card-rating {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 3;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gx-text);
  /* Solid surface, deliberately NO backdrop-filter: a backdrop blur on every
   * card's pills (~3 per card × 100+ cards) forces expensive backdrop
   * recomputation on each scroll frame. The darker fill reads the same over
   * poster art without the per-frame cost. */
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  /* Static lift only — depth without any blur/animation cost. */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.gx-card-rating .gx-star { color: var(--gx-accent-strong); }

.gx-card-badge {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 3;
  max-width: calc(100% - 3.25rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gx-accent-strong);
  /* Solid surface, no backdrop-filter (see .gx-card-rating). */
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--gx-accent-border);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
}

/* Custom-tag badges stack below the override badge (never over it):
 * static flow inside an absolute wrapper, dimmer treatment. */
.gx-card-tagbadges {
  position: absolute;
  left: 0.5rem;
  top: 2.15rem;
  z-index: 3;
  display: grid;
  gap: 0.25rem;
  justify-items: start;
  max-width: calc(100% - 1rem);
}
.gx-card-badge.gx-card-tagbadge {
  position: static;
  max-width: 100%;
  color: var(--gx-text-dim);
  border-color: var(--gx-border-faint);
}

/* Section "Card tag" (Admin section editor → Display): the operator's own
 * badge, painted on EVERY card of that shelf (js/components.js
 * sectionBadgeHTML via js/pages.js shelfCardItems()). Reads as branding,
 * not metadata: gradient preset, uppercase, soft glow. No position rules —
 * prime spot inherits .gx-card-badge's absolute geometry, stacked spot
 * keeps .gx-card-tagbadge's static flow (colours below outrank it). */
.gx-card-badge.gx-card-secbadge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.18rem 0.6rem;
}
.gx-card-badge.gx-card-secbadge--gold {
  color: #16110a;
  background: linear-gradient(135deg, #f9dfa0, #d8a945);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 3px 10px rgba(216, 169, 69, 0.4);
}
.gx-card-badge.gx-card-secbadge--crimson {
  color: #fff;
  background: linear-gradient(135deg, #e6524b, #9e1218);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 10px rgba(190, 30, 40, 0.4);
}
.gx-card-badge.gx-card-secbadge--emerald {
  color: #06231a;
  background: linear-gradient(135deg, #6fe0b0, #21a37a);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 3px 10px rgba(33, 163, 122, 0.38);
}
.gx-card-badge.gx-card-secbadge--glass {
  color: #f2f3f7;
  background: rgba(24, 27, 33, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.gx-card-list {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 3;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--gx-text-dim);
  /* Solid surface, no backdrop-filter (see .gx-card-rating). */
  background: rgba(8, 8, 12, 0.72);
  border: 1px solid var(--gx-glass-line-bright);
  border-radius: 999px;
  cursor: pointer;
  /* Static lift only — depth without any blur/animation cost. */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: color var(--gx-transition), border-color var(--gx-transition), background var(--gx-transition);
}

.gx-card-list:hover {
  /* Glyph keeps its resting colour (no flip to white); feedback comes from
     the slightly deeper surface + the icon rotate below. */
  color: var(--gx-text-dim);
  background: rgba(8, 8, 12, 0.9);
  border-color: var(--gx-glass-line-bright);
}

.gx-card-list.is-in-list {
  color: var(--gx-accent-strong);
  border-color: var(--gx-accent-border);
}

/* Card metadata block sits inside the frosted shell (Aetho .poster-details):
 * padded, fixed-height lines so shelves stay perfectly even. */
.gx-card-body { padding: 0.6rem 0.72rem 0.7rem; min-width: 0; }

/* Fixed metadata geometry: title and sub each occupy exactly one line of a
 * fixed height, so the metadata block is a constant ~2.68rem on every card.
 * A long title truncates with an ellipsis, a missing year still leaves the
 * "Movie"/"TV" line — no card ever changes size when posters, metadata, or
 * fonts finish loading, and shelves stay perfectly even. */
.gx-card-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  height: var(--gx-card-title-h);
  color: var(--gx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gx-card-sub {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
  height: var(--gx-card-sub-h);
  color: var(--gx-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Desktop cards drop the metadata block (title + "year · Movie/TV"): the
 * poster alone carries the card on wide layouts, phones keep the text
 * labels (a touch device has no hover tooltip to reveal them). Markup is
 * untouched — display:none keeps .font-semibold in the DOM for the My
 * List title capture in js/app.js. Split matches the navbar's 859/860
 * mobile/desktop breakpoint. */
@media (min-width: 860px) {
  .gx-card-body { display: none; }
}

/* Rise-in stagger (Aetho: 40ms per card across the first five) */
.gx-shelf-track > .card:nth-child(2) { animation-delay: 40ms; }
.gx-shelf-track > .card:nth-child(3) { animation-delay: 80ms; }
.gx-shelf-track > .card:nth-child(4) { animation-delay: 120ms; }
.gx-shelf-track > .card:nth-child(5) { animation-delay: 160ms; }
.gx-shelf-track > .card:nth-child(n + 6) { animation-delay: 200ms; }

/* ---------------- tabs (replaces old red tab styling) ---------------- */

#tabs { gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

/* Genre pills (Aetho .genre-pill port): frosted pill, springs 1px on hover,
 * active = solid white on black. */
.gx-tab {
  appearance: none;
  border: 1px solid var(--gx-glass-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--gx-text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 250ms var(--gx-ease-spring), background var(--gx-transition),
    color var(--gx-transition), border-color var(--gx-transition);
}

.gx-tab:hover {
  color: var(--gx-text);
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--gx-glass-line-bright);
  transform: translateY(-1px);
}

.gx-tab.active {
  color: #000;
  font-weight: 700;
  background: #fff;
  border-color: #fff;
  box-shadow: 0 2px 14px rgba(255, 255, 255, 0.3);
}

/* ---------------- skeletons (frosted card shells, Aetho .skeleton) ---------------- */

.gx-sk {
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--gx-glass-line);
  border-radius: var(--gx-radius-card);
  overflow: hidden;
}

.gx-shelf-track > .gx-sk { flex: 0 0 auto; width: clamp(var(--gx-card-min), calc(var(--gx-card-vw) * 1vw), var(--gx-card-max)); }

.gx-sk-media {
  aspect-ratio: 2/3;
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent 30%),
    var(--gx-surface);
}

.gx-sk-bar {
  height: 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  margin: 0.6rem 0.72rem 0;
}

.gx-sk-bar.short { width: 45%; }

.gx-sk-media,
.gx-sk-bar {
  position: relative;
  overflow: hidden;
}

.gx-sk-media::after,
.gx-sk-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.11), transparent);
  animation: gx-sk-shimmer 1.4s ease-in-out infinite;
}

@keyframes gx-sk-shimmer { 100% { transform: translateX(100%); } }

/* ---------------- empty states ---------------- */

.gx-empty {
  color: var(--gx-text-dim);
  font-size: 0.9rem;
  padding: 2.5rem 1rem;
  text-align: center;
}

/* ---------------- mobile ---------------- */

@media (max-width: 640px) {
  .gx-shelf { margin-top: var(--gx-shelf-space-mobile); }
  .gx-shelf-track { gap: var(--gx-shelf-gap-mobile); }
  .gx-shelf-title,
  #section-title { font-size: 1.1rem; }
  .gx-viewall { font-size: 0.78rem; padding: 0.45rem 0.8rem; }
  .gx-card-body { padding: 0.55rem 0.6rem 0.6rem; }
}

/* Touch devices: no hover transforms (wastes GPU compositing on every
 * shelf card during scroll). Touch already gets :active feedback. */
@media (hover: none) {
  .gx-card:hover { transform: none; }
  .gx-card:hover .gx-card-media img { transform: none; filter: none; }
  .gx-card:hover .gx-card-media::after { transform: translateX(-85%); }
}

/* ---------------- shelf windowing placeholders ---------------- */

/* Lightweight slot placeholders that maintain scrollWidth while only
 * visible + small-buffer cards are real DOM. Each placeholder has the
 * exact same flex/width/height as a real card so the track's total
 * scrollWidth is identical whether a slot holds a placeholder or a card. */
.gx-shelf-ph {
  flex: 0 0 auto;
  width: clamp(var(--gx-card-min), calc(var(--gx-card-vw) * 1vw), var(--gx-card-max));
  aspect-ratio: 2/3;
  /* Visually invisible — same background as the shelf track so no flash. */
  background: transparent;
}

/* ---------------- wide (backdrop) shelves ----------------
 * Admin section editor → "Card orientation: Horizontal still (16:9)".
 * js/pages.js stamps data-layout on the shelf and card_layout on its item
 * copies. Width consumers (track cards, skeletons, placeholders) and
 * js/pages.js cardGeometry() all read these same three vars, so the track's
 * scrollWidth stays identical whichever slots hold placeholders. Placeholder
 * / skeleton media stay SHORTER than the real wide card (16:9 media + title
 * body), never taller, so replacing them never stretches the track. */
.gx-shelf[data-layout='backdrop'] {
  --gx-card-min: 250px;
  --gx-card-max: 430px;
  --gx-card-vw: 24;
}

.gx-card--wide .gx-card-media,
.gx-card--wide .gx-card-media img,
.gx-shelf[data-layout='backdrop'] .gx-sk-media,
.gx-shelf[data-layout='backdrop'] .gx-shelf-ph {
  aspect-ratio: 16/9;
}

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .gx-card,
  .gx-card-media,
  .gx-card-media img,
  .gx-card-media::before,
  .gx-card-media::after,
  .gx-viewall,
  .gx-viewall .gx-viewall-arrow,
  .gx-tab,
  .gx-card-list,
  .gx-shelf-btn,
  .gx-shelf-viewport::before,
  .gx-shelf-viewport::after {
    transition: none;
  }

  .gx-card:hover { transform: none; }
  .gx-card:active { transform: none; }
  .gx-card:focus-visible { transform: none; }
  .gx-card:hover .gx-card-media img { transform: none; filter: none; }
  .gx-card-media img { opacity: 1; }
  .gx-card-media::before { animation: none; opacity: 0; }
  .gx-card-media::after { transform: translateX(-85%); }
  .gx-shelf { content-visibility: visible; animation: none; }
  .gx-shelf-track { scroll-behavior: auto; }

  .gx-sk-media::after,
  .gx-sk-bar::after { animation: none; }
}


/* Card add-to-list: thin plus in the corner circle, rotates on hover,
 * becomes an accent check while the title is in My List. */
.gx-card-list .gx-ico {
  width: 15px;
  height: 15px;
  transition: transform 320ms cubic-bezier(.22, 1, .36, 1);
}
.gx-card-list:not(.is-in-list):hover .gx-ico { transform: rotate(90deg); }

