/* GMXPlay rich surfaces on the journey L0 — Navy Luxe LIGHT (FOUNDATIONAL #1: no
   reverse type). EXTRACTED from the standalone app.css .gx-* surface styles (episode
   list, player, mini-bar, stickers, settings rows, Shelf light re-theme). The standalone
   .shell / .gx-appbar / .gx-tabbar frame + html,body pin are DROPPED — the L0 shell owns
   the frame. New here: the body-docked player dock (.gx-dock) that survives L0 nav. */

/* Palette scoped to our surfaces (self-contained; does not depend on kit vars). */
.gx-surface, .gx-dock {
  --ink: #14171f;
  --pearl: #fbf9e4;
  --navy: #122c4f;
  --card: #ffffff;
  --line: #e6e2c8;
  --muted: #5b5f52;         /* on pearl = 6.18:1 (>= AA 4.5) */
  --focus: var(--navy);
}
.gx-surface {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 12px 14px 16px;
}
.gx-surface-h { color: var(--navy); font-size: 17px; margin: 6px 2px 12px; }
.gx-loading { color: var(--muted); padding: 24px 4px; }
.gx-hint { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Reserve room at the bottom of the scroll region for the docked mini-bar while playing. */
body.gx-playing #l0-content { padding-bottom: 68px; }

/* ── Shows grid (Shelf primitive re-themed LIGHT via its --jny-* hook) ── */
.gx-grid { min-height: 20vh; }
.jny-shelf {
  --jny-surface-0: var(--pearl); --jny-surface-1: var(--card); --jny-surface-2: #f2eed8;
  --jny-ink: var(--ink); --jny-ink-dim: var(--muted); --jny-accent: var(--navy); --jny-border: var(--line);
  background: transparent;
}
.jny-shelf .shelf-body { padding: 4px 0 8px; }

/* Shelf GRID layout — RESTORED from the standalone lib/shelf.css (technical/dev/GMXPLAY/
   www/lib/shelf.css §grid). The retrofit dropped shelf.css, so the shows grid lost its
   grid-template-columns and collapsed to one ~360px cover per row. Mirror-not-invent
   (FOUNDATIONAL #2): same rules, colours inherited from the light --jny-* remap above.
   Operator 2026-08-15: small MULTI-COLUMN catalog, not fat columns / heavy scroll. */
.jny-shelf[data-layout="grid"] .shelf-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));  /* >=3 cols @390, ~114px art */
  gap: 10px;
}
.jny-shelf[data-layout="grid"] .shelf-item {
  background: var(--jny-surface-1, #fff);
  border: 1px solid var(--jny-border, #e6e2c8);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.jny-shelf[data-layout="grid"] .shelf-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
/* <picture> must not become a layout box, so the inner <img>.shelf-art stays the
   direct grid/flex child the art rules below target. */
.jny-shelf picture { display: contents; }
.jny-shelf[data-layout="grid"] .shelf-art {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;   /* the attr height="360" is only a hint; without this it wins over
                     aspect-ratio and the square cover renders in a portrait box */
  object-fit: cover;
  background: var(--jny-surface-2, #f2eed8);
  display: block;
}
.jny-shelf[data-layout="grid"] .shelf-art-ph {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; font-size: 32px; color: var(--jny-ink-dim, #5b5f52);
}
.jny-shelf[data-layout="grid"] .shelf-meta { padding: 8px 10px 10px; }
/* Narrow tiles: clamp the title to two lines so long show names don't get lost and
   tile bottoms stay aligned whether or not a title wraps (RYAN+ART 2026-08-15). */
.jny-shelf[data-layout="grid"] .shelf-title {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(2 * 1.3em);
}

/* ── Episode list ── */
.gx-eplist-back { background: none; border: none; color: var(--navy); font-size: 15px; padding: 12px 4px; min-height: 44px; cursor: pointer; }
.gx-eplist-head { display: flex; gap: 12px; align-items: center; margin: 8px 0 14px; }
.gx-eplist-art { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--line); }
.gx-eplist-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.gx-eplist-author { font-size: 13px; color: var(--muted); }
.gx-eperr { color: #8a2a17; padding: 10px 0; }
.gx-ep {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font-size: 15px; min-height: 56px;
  position: relative; overflow: hidden;
}
.gx-ep-title { flex: 1; }
.gx-ep-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.gx-ep-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.gx-ep-meter > i { display: block; height: 100%; background: var(--navy); }
.gx-ep-done { color: var(--navy); font-weight: 600; }

/* ── Player back-to-episodes control (mirrors .gx-eplist-back) ── */
.gx-player-back { background: none; border: none; color: var(--navy); font-size: 15px; padding: 12px 4px; min-height: 44px; cursor: pointer; display: block; }

/* ── Player panel (full now-playing) ── */
.gx-player { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.gx-now-art { width: 100%; max-width: 220px; aspect-ratio: 1; border-radius: 12px; object-fit: cover; display: block; margin: 0 auto 12px; background: var(--line); }
.gx-now-title { font-size: 17px; font-weight: 700; text-align: center; }
.gx-now-show { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 10px; }
.gx-now-scrub { display: flex; align-items: center; gap: 8px; }
.gx-scrub { flex: 1; accent-color: var(--navy); height: 44px; }
.gx-t-cur, .gx-t-dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gx-t-dur { background: none; border: none; cursor: pointer; padding: 6px 2px; min-height: 44px; }
.gx-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; align-items: center; }
.gx-controls-2 { margin-top: 8px; }
.gx-controls button { background: var(--pearl); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 14px; cursor: pointer; min-height: 44px; min-width: 44px; }
.gx-controls button:disabled { opacity: .4; cursor: default; }
.gx-pp { background: var(--navy) !important; color: var(--pearl) !important; border-color: var(--navy) !important; font-weight: 600; min-width: 72px; }
.gx-sleep-status { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.gx-audio { display: none; }

/* ── Body-docked player dock: mini-bar always visible while playing; panel parked
      (hidden) here until the Player view borrows it. Centered to the phone frame. ── */
.gx-dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 50; pointer-events: none; }
.gx-dock > .gx-panel-host { display: none; }       /* parked = hidden; shown once moved into the view */
.gx-dock .gx-mini-host { pointer-events: auto; }
.gx-panel-host { pointer-events: auto; }
.gx-mini { display: flex; align-items: center; gap: 10px; background: var(--card); border-top: 1px solid var(--line); padding: 6px 10px; box-shadow: 0 -2px 12px rgba(0,0,0,.12); }
.gx-mini-open { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; background: none; border: none; text-align: left; cursor: pointer; padding: 6px 4px; min-height: 44px; color: var(--ink); }
.gx-mini-art { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.gx-mini-meta { display: flex; flex-direction: column; min-width: 0; }
.gx-mini-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-mini-show { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-mini-pp { flex: none; background: var(--navy); color: var(--pearl); border: none; border-radius: 50%; width: 44px; height: 44px; font-size: 15px; cursor: pointer; }

/* ── Sticker grid ── */
.gx-sticker-head { color: var(--navy); font-weight: 700; margin: 6px 2px 12px; }
.gx-sticker-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px; }
.gx-sticker { margin: 0; text-align: center; }
.gx-sticker-img { width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 3px solid var(--line); background: var(--line); }
.gx-sticker.is-locked.gx-sticker--coverfb .gx-sticker-img { filter: grayscale(1) opacity(0.5); }
.gx-sticker.is-earned .gx-sticker-img { border-color: var(--navy); }
.gx-sticker-cap { font-size: 11px; color: var(--muted); margin-top: 5px; }
.gx-sticker.is-locked .gx-sticker-cap::before { content: "\1F512\00A0"; }
.gx-sticker.is-earned .gx-sticker-cap::before { content: "\2713\00A0"; }
.gx-sticker.is-earned .gx-sticker-cap { color: var(--navy); font-weight: 600; }

/* ── Settings rows (per-show after-played in the episode drawer) ── */
.gx-set-row { margin: 0 0 14px; }
.gx-set-label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.gx-set-select { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 15px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.gx-show-set .gx-set-label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Focus-visible ring on our interactives (WCAG 2.4.7) */
.gx-surface a:focus-visible, .gx-surface button:focus-visible,
.gx-surface input:focus-visible, .gx-surface select:focus-visible,
.gx-dock button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ── ART near-zero-text audit (2026-08-23): spinner / retry / empty glyphs replace prose ── */
.gx-spinner {
  display: inline-block; width: 20px; height: 20px; vertical-align: middle;
  border: 2px solid var(--line, #dcd8c6); border-top-color: var(--navy, #1f3a5f);
  border-radius: 50%; animation: gx-spin 0.8s linear infinite;
}
@keyframes gx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gx-spinner { animation-duration: 2s; } }

.gx-errbox { display: flex; align-items: center; gap: 12px; padding: 20px 4px; }
.gx-err-ico { font-size: 24px; }
.gx-retry {
  min-height: 44px; padding: 0 20px; font: inherit; font-weight: 700; font-size: 15px;
  background: var(--navy, #1f3a5f); color: var(--pearl, #fbf9e4);
  border: none; border-radius: 12px; cursor: pointer;
}
.gx-retry:focus-visible { outline: 3px solid var(--navy-2, #2f5680); outline-offset: 2px; }

.gx-empty { text-align: center; padding: 40px 12px; color: var(--muted, #63676f); }
.gx-empty-ico { font-size: 44px; opacity: 0.4; line-height: 1; }
.gx-empty-play {
  display: inline-flex; align-items: center; justify-content: center;
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid var(--muted, #63676f); font-size: 38px; opacity: 0.35;
}
.gx-empty-cap { margin-top: 12px; font-size: 15px; font-weight: 600; }
