/* Explore — one card system, five sections.
 *
 * TOKENS: this sheet uses the OMNI SYSTEM tokens published by omni-tokens.css
 * (--surface, --surface-2, --line, --line-2, --text, --text-3, --violet,
 * --violet-2, --r-md, --shadow-card, --sans, --dur-1, --ease-out). It does NOT
 * scope itself under #omni-page and defines no colours of its own, so a token
 * change moves this page with the rest of the app.
 *
 * ACCENT INK vs FILL: --violet is the FILL role (white text on it clears AA at
 * 4.56:1); --violet-2 is the INK role (7.57:1 on --surface). Accent TEXT is
 * therefore always --violet-2 and never --violet, which would fail on surface.
 */

.xp-wrap { max-width: var(--col-wide, 1080px); margin: 0 auto; padding: 0 0 40px; }
.xp-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- search bar ---
   Sticky at the top of Explore. Not a nav item — a field that hands off to
   search.html. */
.xp-searchbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  padding: 10px 0; margin-bottom: 4px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent 100%);
}
.xp-searchbar input {
  flex: 1 1 auto; min-width: 0; min-height: 44px;
  padding: 10px 14px; border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-ctl); background: var(--surface);
  color: var(--text); font: 500 14px/1.2 var(--sans);
}
.xp-searchbar input::placeholder { color: var(--text-3); }
.xp-searchbar input:focus-visible,
.xp-searchgo:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.xp-searchgo {
  flex: 0 0 auto; min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: var(--r-pill, 999px);
  background: var(--violet); color: #fff;
  font: 700 13px/1 var(--sans); cursor: pointer;
}
.xp-searchgo:hover { filter: brightness(1.08); }

.xp-h1 { font: 800 26px/1.15 var(--display); color: var(--text); margin: 10px 2px 2px; letter-spacing: -.01em; }
.xp-lead { font: 500 13px/1.5 var(--sans); color: var(--text-3); margin: 0 2px 18px; }

/* ---------------------------------------------------------------- sections */
.xp-sec { margin: 0 0 30px; }
.xp-sec[hidden] { display: none; }        /* empty section hides ENTIRELY */
.xp-sec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.xp-sec-h {
  font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); margin: 0;
}
.xp-seeall {
  font: 600 12px/1 var(--sans); color: var(--violet-2); text-decoration: none;
  white-space: nowrap; padding: 6px 2px;
}
.xp-seeall:hover { text-decoration: underline; }
.xp-seeall:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: var(--r-xs, 6px); }

/* ------------------------------------------------------------------- rails ---
   Horizontal scroll with ~1.5 cards visible past the edge as the scroll cue
   (spec §1). Snap keeps the cut card from settling mid-gutter. */
.xp-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 160px;
  gap: 10px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
}
.xp-rail > * { scroll-snap-align: start; }
.xp-rail::-webkit-scrollbar { height: 6px; }
.xp-rail::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }

/* -------------------------------------------------------- the card system ---
   One frame, one interaction language, three card shapes on top of it. */
.xp-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  text-decoration: none; color: var(--text);
  transition: transform var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out),
              border-color var(--dur-1) var(--ease-out);
}
/* HOVER is pointer-only: on touch it would latch after a tap and leave a card
   stuck in the lifted state. */
@media (hover: hover) and (pointer: fine) {
  .xp-card:hover { transform: translateY(-2px); border-color: var(--line-hi); box-shadow: var(--shadow-pop); }
}
/* TAP: immediate pressed feedback, then navigate. Nothing critical is
   hover-only, so mobile loses no information (spec §3). */
.xp-card:active { transform: scale(.98); }
.xp-card:focus-visible,
.xp-chip:focus-visible,
.xp-tile:focus-visible,
.xp-follow:focus-visible,
.xp-track-play:focus-visible,
.xp-track-title:focus-visible,
.xp-track-artist:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .xp-card, .xp-tile, .xp-chip { transition: none; }
  .xp-card:hover, .xp-card:active, .xp-tile:active { transform: none; }
}

/* ---- creator card (trending people / new creators) ---- */
.xp-creator { align-items: center; text-align: center; padding: 16px 12px 12px; gap: 2px; }
.xp-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: 0 0 auto; display: block; }
.xp-av-lg { width: 56px; height: 56px; margin-bottom: 8px; }
.xp-av-xs { width: 22px; height: 22px; }
.xp-av-ph {
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  font: 800 16px/1 var(--sans);
}
.xp-av-lg.xp-av-ph { font-size: 22px; }
.xp-av-xs.xp-av-ph { font-size: 10px; }
.xp-creator-name {
  font: 700 14px/1.25 var(--sans); color: var(--text);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xp-creator-handle {
  font: 500 12px/1.3 var(--sans); color: var(--text-3);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xp-creator-stat { font: 500 11px/1.3 var(--sans); color: var(--text-3); margin-top: 2px; }
.xp-follow {
  margin-top: 10px; padding: 7px 16px; min-height: 32px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--violet);
  background: var(--violet-dim); color: var(--violet-2);
  font: 700 12px/1 var(--sans); text-decoration: none;
}
.xp-follow:hover { background: var(--violet); color: #fff; }
/* "New" pip — accent label, top-right (spec §2) */
.xp-pip {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 7px; border-radius: var(--r-pill, 999px);
  background: var(--teal-dim); color: var(--teal-2);
  font: 700 9px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
}

/* ---- track card ---- */
.xp-track { padding: 10px 10px 12px; gap: 3px; }
.xp-track-art {
  position: relative; aspect-ratio: 1 / 1; width: 100%;
  border-radius: var(--r-sm, 10px); overflow: hidden;
  background: var(--surface-3); margin-bottom: 8px;
  display: grid; place-items: center;
}
.xp-track-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xp-track-glyph { font-size: 26px; color: var(--text-3); }
/* Play overlay: hidden at rest on pointer devices, ALWAYS visible on touch —
   a hover-only control is unreachable on a phone (spec §3 mobile parity). */
.xp-track-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  border: 0; padding: 0; cursor: pointer;
  background: rgba(0,0,0,.42);
  color: #fff; font-size: 22px;
  opacity: 1;
  transition: opacity var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .xp-track-play { opacity: 0; }
  .xp-track-art:hover .xp-track-play,
  .xp-track-play:focus-visible { opacity: 1; }
}
.xp-track-tri { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.5); }
.xp-track-title {
  font: 700 13px/1.3 var(--sans); color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xp-track-title:hover { text-decoration: underline; }
.xp-track-artist {
  font: 500 12px/1.3 var(--sans); color: var(--violet-2); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xp-track-artist:hover { text-decoration: underline; }
.xp-track-plays { font: 500 11px/1.3 var(--sans); color: var(--text-3); margin-top: 2px; }

/* ---- tag chips ---- */
.xp-tagcloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; }
.xp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-2); background: var(--violet-dim);
  color: var(--violet-2); text-decoration: none;
  font: 600 13px/1 var(--sans);
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.xp-chip:hover { border-color: var(--violet); background: var(--surface-2); }
.xp-chip-count { color: var(--text-3); font-weight: 500; font-size: 11px; }

/* ---- post tiles (the browse-forever grid) ---- */
.xp-grid-posts {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.xp-tile {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; color: var(--text);
  aspect-ratio: 1 / 1;
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .xp-tile:hover { border-color: var(--line-hi); transform: translateY(-2px); }
  .xp-tile:hover .xp-tile-scrim { background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.85) 100%); }
  .xp-tile:hover .xp-tile-cap { -webkit-line-clamp: 3; }
}
.xp-tile:active { transform: scale(.98); }
.xp-tile .xp-post-media { position: absolute; inset: 0; margin: 0; border-radius: 0; }
.xp-tile-scrim {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; gap: 7px;
  padding: 10px;
  background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.78) 100%);
  transition: background var(--dur-1) var(--ease-out);
}
.xp-tile-cap {
  font: 500 12px/1.35 var(--sans); color: #fff;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
/* text-only post → typographic tile */
.xp-tile-text { background: var(--surface-2); }
.xp-tile-type { position: absolute; inset: 0; padding: 16px; display: flex; align-items: center; }
.xp-tile-type-line {
  font: 700 17px/1.35 var(--display); color: var(--text); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- post media inside a tile ---- */
.xp-post-media { position: relative; width: 100%; height: 100%; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; }
.xp-media-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xp-media-glyph { position: absolute; font-size: 26px; color: var(--text-4); }
.xp-media-img + .xp-media-glyph, .xp-post-media:not(.xp-media-noimg) .xp-media-glyph { opacity: 0; }
.xp-media-tags { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.xp-media-badge {
  padding: 3px 7px; border-radius: var(--r-xs, 6px);
  background: rgba(0,0,0,.62); color: #fff;
  font: 600 10px/1 var(--sans);
}

/* ------------------------------------------------------------ empty / error */
.xp-empty { display: flex; align-items: center; gap: 10px; padding: 18px 14px; color: var(--text-3); }
.xp-empty-mark { font-size: 18px; color: var(--text-4); }
.xp-empty-line { font: 500 13px/1.5 var(--sans); margin: 0; }
.xp-empty-link, .xp-retry {
  color: var(--violet-2); background: none; border: 0; padding: 0;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline;
}
.xp-retry:focus-visible, .xp-empty-link:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* --------------------------------------------------------------- cold state */
.xp-cold { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 16px; }
.xp-cold[hidden] { display: none; }
.xp-cold-h { font: 800 20px/1.2 var(--display); color: var(--text); margin: 0; }
.xp-cold-lead { font: 500 13px/1.5 var(--sans); color: var(--text-3); margin: 0 0 6px; max-width: 40ch; }
.xp-cold-card { width: 180px; }
.xp-cold-cta {
  margin-top: 4px; min-height: 44px; display: inline-flex; align-items: center;
  padding: 12px 22px; border-radius: var(--r-pill, 999px);
  background: var(--violet); color: #fff; text-decoration: none;
  font: 700 13px/1 var(--sans);
}
.xp-cold-cta:hover { filter: brightness(1.08); }
.xp-cold-cta:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ----------------------------------------------------------------- skeleton */
.xp-skel {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: xp-shimmer 1.4s ease-in-out infinite;
}
.xp-skel-creator, .xp-skel-track { height: 200px; }
.xp-skel-chip { height: 36px; width: 92px; border-radius: var(--r-pill, 999px); }
.xp-skel-tile { aspect-ratio: 1 / 1; }
@keyframes xp-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .xp-skel { animation: none; } }

/* -------------------------------------------------------------------- small */
@media (max-width: 640px) {
  .xp-grid-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xp-rail { grid-auto-columns: 148px; }
  .xp-h1 { font-size: 22px; }
}
