/* ==========================================================================
   ZygApp Spotlight — module styles.

   Lifted verbatim from the approved prototype. Everything is namespaced under
   .zsp so it cannot collide with the market page's existing styles.

   Two rules here are load-bearing and must not be "tidied":
   - the docked player's 400px width floor (YouTube needs a 200x200 minimum
     viewport and recommends 480x270 for 16:9; below that the controls break)
   - no docking at all below a 520px viewport, for the same reason
   ========================================================================== */

/* ============================================================
   ZYGAPP SPOTLIGHT — drop-in module for /market/
   Zero dependencies. No webfonts. No build step.
   Swap the tokens below to match the live market page theme.
   ============================================================ */

.zsp {
  /* --- tokens: edit these to match zygapp.com --- */
  --zsp-ink:      #08090B;
  --zsp-surface:  #12151A;
  --zsp-raise:    #1A1F26;
  --zsp-line:     #242A33;
  --zsp-text:     #EDF1F5;
  --zsp-muted:    #7E8B99;
  --zsp-cyan:     #00C2CB;
  --zsp-magenta:  #E8407A;

  --zsp-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --zsp-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --zsp-gap: clamp(16px, 2.5vw, 28px);

  background: var(--zsp-ink);
  color: var(--zsp-text);
  font-family: var(--zsp-sans);
  /* Vertical padding deliberately smaller than horizontal. This module used to
     use the same generous clamp on both axes, which on a laptop pushed the
     first market products entirely below the fold. */
  padding: clamp(20px, 2.4vw, 32px) clamp(16px, 4vw, 48px);
  container-type: inline-size;
}

.zsp *, .zsp *::before, .zsp *::after { box-sizing: border-box; }

/* --- signature: SMPTE colour bars as the section rule --- */
.zsp-bars {
  display: flex;
  height: 4px;
  margin-bottom: 18px;
  overflow: hidden;
}
.zsp-bars span { flex: 1; }
.zsp-bars span:nth-child(1) { background: #C0C0C0; }
.zsp-bars span:nth-child(2) { background: #C0C000; }
.zsp-bars span:nth-child(3) { background: #00C0C0; }
.zsp-bars span:nth-child(4) { background: #00C000; }
.zsp-bars span:nth-child(5) { background: #C000C0; }
.zsp-bars span:nth-child(6) { background: #C00000; }
.zsp-bars span:nth-child(7) { background: #0000C0; }

/* --- slate strip --- */
.zsp-slate {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  font-family: var(--zsp-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--zsp-muted);
  margin-bottom: var(--zsp-gap);
}
.zsp-slate b { color: var(--zsp-text); font-weight: 600; }
.zsp-slate .zsp-sep { color: var(--zsp-line); }
.zsp-live { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--zsp-cyan); }
.zsp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--zsp-cyan);
  animation: zsp-pulse 2.4s ease-in-out infinite;
}
@keyframes zsp-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* --- layout --- */
.zsp-main {
  display: grid;
  /* 1.45fr rather than 1.9fr: the rail now carries the gear cards as well as
     the creator panel, so it needs real width. The player stays dominant but
     stops being the only thing on screen. */
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: var(--zsp-gap);
  align-items: start;
}
@container (max-width: 880px) {
  .zsp-main { grid-template-columns: 1fr; }
}

/* --- the rail: creator panel + the gear from this feature -----------------
   Products sit BESIDE the player, not below it. /market/ has to read as a
   market at first glance: a visitor who lands on a full-bleed video player
   has no way of knowing they are in a shop. */
.zsp-rail {
  display: flex;
  flex-direction: column;
  gap: calc(var(--zsp-gap) * 0.8);
  min-width: 0;
  min-height: 0;          /* lets the card list shrink instead of pushing out */
}
.zsp-rail .zsp-gear { margin-top: 0; min-height: 0; }
/* An empty gear block still contributes its flex gap. Collapse it. */
.zsp-rail .zsp-gear:not(:has(.zsp-card)) { display: none; }

@container (min-width: 881px) {
  /* One card per row — in the rail these are a list, not a grid.
     The cap is an explicit length, NOT a percentage: the rail is a grid item
     whose row height is derived from its own content, so a percentage
     max-height there is circular and resolves to none. Two cards' worth is
     enough to show /market/ is a market; the rest scroll in place rather than
     stretching the module down the page. */
  .zsp-rail .zsp-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* --- player facade: click to play, so the view actually counts --- */
.zsp-slot {
  position: relative;
  aspect-ratio: 16 / 9;
}
.zsp-stage {
  position: absolute;
  inset: 0;
  background: var(--zsp-surface);
  border: 1px solid var(--zsp-line);
  overflow: hidden;
}
.zsp-stage iframe { width: 100%; height: 100%; border: 0; display: block; }

/* --- docked state: same node, repositioned. The iframe never moves in
       the DOM, so playback survives.
       Width floor is 400px: YouTube requires an embedded player viewport
       of at least 200x200, and recommends 480x270 for 16:9. Below that
       the controls break. On narrow screens we don't dock at all. --- */
.zsp-stage.is-docked {
  position: fixed;
  inset: auto 20px 20px auto;
  width: clamp(400px, 32vw, 460px);
  aspect-ratio: 16 / 9;
  z-index: 60;
  border-color: var(--zsp-cyan);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.62);
  animation: zsp-dock 220ms ease both;
}
@keyframes zsp-dock {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.zsp-dockbar { display: none; }
.zsp-stage.is-docked .zsp-dockbar {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: linear-gradient(180deg, rgba(8,9,11,0.92), rgba(8,9,11,0));
  font-family: var(--zsp-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zsp-muted);
  pointer-events: none;
}
.zsp-dockbar button {
  pointer-events: auto;
  margin-left: auto;
  background: rgba(8,9,11,0.8);
  border: 1px solid var(--zsp-line);
  color: var(--zsp-text);
  font: inherit;
  padding: 3px 7px;
  cursor: pointer;
}
.zsp-dockbar button:hover { border-color: var(--zsp-cyan); color: var(--zsp-cyan); }
.zsp-dockbar button:focus-visible { outline: 2px solid var(--zsp-cyan); outline-offset: 2px; }

@media (max-width: 520px) {
  /* Too narrow to dock without breaking the player's minimum viewport.
     The video simply scrolls away, which is the honest behaviour here. */
  .zsp-stage.is-docked {
    position: absolute;
    inset: 0;
    width: auto;
    box-shadow: none;
    border-color: var(--zsp-line);
    animation: none;
  }
  .zsp-stage.is-docked .zsp-dockbar { display: none; }
}

.zsp-facade {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; margin: 0;
  border: 0; cursor: pointer;
  background: var(--zsp-surface) center/cover no-repeat;
  display: block;
}
.zsp-facade::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,9,11,0) 40%, rgba(8,9,11,0.85) 100%);
}
.zsp-play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(8,9,11,0.7);
  border: 1px solid rgba(237,241,245,0.4);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}
.zsp-play svg { width: 22px; height: 22px; fill: var(--zsp-text); margin-left: 3px; }
.zsp-facade:hover .zsp-play,
.zsp-facade:focus-visible .zsp-play {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--zsp-cyan);
  border-color: var(--zsp-cyan);
}
.zsp-facade:hover .zsp-play svg,
.zsp-facade:focus-visible .zsp-play svg { fill: var(--zsp-ink); }
.zsp-facade:focus-visible { outline: 2px solid var(--zsp-cyan); outline-offset: 3px; }

.zsp-stage-tc {
  position: absolute; left: 12px; bottom: 12px; z-index: 2;
  font-family: var(--zsp-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--zsp-text);
  background: rgba(8,9,11,0.72);
  border: 1px solid var(--zsp-line);
  padding: 4px 8px;
}

/* --- creator panel --- */
.zsp-panel {
  border: 1px solid var(--zsp-line);
  background: var(--zsp-surface);
  padding: clamp(18px, 2.4vw, 26px);
}
.zsp-eyebrow {
  font-family: var(--zsp-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--zsp-magenta);
  margin: 0 0 10px;
}
.zsp-name {
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 750;
  margin: 0 0 6px;
}
.zsp-handle {
  font-family: var(--zsp-mono);
  font-size: 12px;
  color: var(--zsp-muted);
  margin: 0 0 16px;
}
.zsp-note {
  font-size: 15px;
  line-height: 1.6;
  color: #C3CDD7;
  margin: 0 0 20px;
}
.zsp-note strong { color: var(--zsp-text); font-weight: 600; }

.zsp-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--zsp-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--zsp-ink);
  background: var(--zsp-text);
  padding: 11px 16px;
  transition: background 160ms ease, color 160ms ease;
}
.zsp-btn:hover, .zsp-btn:focus-visible { background: var(--zsp-cyan); }
.zsp-btn:focus-visible { outline: 2px solid var(--zsp-cyan); outline-offset: 3px; }

/* --- gear rail --- */
.zsp-gear { margin-top: calc(var(--zsp-gap) * 1.4); }
.zsp-gear-head {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--zsp-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--zsp-muted);
  margin-bottom: 14px;
}
.zsp-gear-head::after {
  content: ""; flex: 1; height: 1px; background: var(--zsp-line);
}
.zsp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.zsp-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--zsp-surface);
  border: 1px solid var(--zsp-line);
  padding: 14px 15px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.zsp-card:hover, .zsp-card:focus-visible {
  border-color: var(--zsp-cyan);
  background: var(--zsp-raise);
  transform: translateY(-2px);
}
.zsp-card:focus-visible { outline: 2px solid var(--zsp-cyan); outline-offset: 2px; }
.zsp-card-kind {
  font-family: var(--zsp-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--zsp-muted);
  margin: 0 0 7px;
}
.zsp-card-name { font-size: 14px; line-height: 1.35; font-weight: 600; margin: 0 0 9px; }
.zsp-card-go { font-family: var(--zsp-mono); font-size: 11px; color: var(--zsp-cyan); }

/* --- upcoming filmstrip --- */
.zsp-strip { margin-top: var(--zsp-gap); }

/* --- keep the module from filling a phone screen -------------------------
   Stacked on mobile the player, panel, gear and archive add up to more than a
   viewport, which is the exact problem this layout work exists to fix. Cap the
   two lists rather than hiding anything: everything is still reachable, it
   just scrolls inside its own box instead of pushing the market off-screen. */
@container (max-width: 880px) {
  .zsp-rail { gap: calc(var(--zsp-gap) * 0.75); }
  .zsp-cards { max-height: 200px; overflow-y: auto; scrollbar-width: thin; }
  .zsp-strip { margin-top: calc(var(--zsp-gap) * 0.75); }
}
.zsp-frames {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}
/* The archive is a way back to older features, not a gallery. It was 183px
   tall — enough, stacked under the player and the rail, to push the module past
   a laptop viewport on its own. Smaller frames, same content, same scrolling. */
.zsp-frame {
  flex: 0 0 116px;
  background: none; border: 1px solid var(--zsp-line);
  padding: 0; cursor: pointer; text-align: left;
  color: inherit;
  transition: border-color 160ms ease;
}
.zsp-frame:hover, .zsp-frame:focus-visible { border-color: var(--zsp-cyan); }
.zsp-frame:focus-visible { outline: 2px solid var(--zsp-cyan); outline-offset: 2px; }
.zsp-frame[aria-current="true"] { border-color: var(--zsp-magenta); }
.zsp-frame img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.zsp-frame-meta { padding: 6px 8px 7px; }
.zsp-frame-roll {
  font-family: var(--zsp-mono); font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--zsp-muted); margin: 0 0 4px;
}
.zsp-frame-name { font-size: 11.5px; font-weight: 600; line-height: 1.25; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden; }

/* --- disclosure --- */
.zsp-disclosure {
  margin-top: var(--zsp-gap);
  padding-top: 14px;
  border-top: 1px solid var(--zsp-line);
  font-size: 12px;
  line-height: 1.6;
  color: var(--zsp-muted);
}

@media (prefers-reduced-motion: reduce) {
  .zsp *, .zsp *::before, .zsp *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Share control ──────────────────────────────────────────────────────────
   Markup and behaviour are shared with the blog (community/_share_button.html
   + js/share.js); only the colours are local, set through the two custom
   properties share.css reads. */
.zsp-share-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.zsp-share .zyg-share-btn {
  --zyg-share-accent: var(--zsp-cyan, #00d4ff);
  --zyg-share-line: rgba(0, 212, 255, 0.32);
  color: var(--zsp-cyan, #00d4ff);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
}
.zsp-share .zyg-share-btn:hover {
  background: rgba(0, 212, 255, 0.12);
}
