/* Shared media-player card (Work, Side Quests, any future player): a QuickTime-style player drawn in our own
   OS 9 Platinum chrome. No traffic-light dots, no Apple branding. Semantic tokens only (--os-* in styles/os9.css).
   Markup comes from the shared templates src/partials/qt-card.html + qt-card-soon.html (a page's "cards" list):
   <a class="qt-card" href="…" data-qt-card>            ← live card: one link (or .qt-card.is-soon, a div)
     <span class="qt-bar">box · stripes · <span class="qt-title">Brand</span> · stripes · zoom · collapse</span>
     <span class="qt-screen">placeholders · <img class="qt-still"> · <video class="qt-video"> · <span class="qt-analog"></span>
     <span class="qt-controls" aria-hidden="true">play · scrub · volume</span>                         ← decorative
   </a>
   Behavior (hover video, touch, reduced motion, pausing the analog layer): components/player-cards.js
   Every screen gets the analog screen layer (bottom of this file) automatically. */

.qt-card {
  display: block;
  padding: 0 6px 6px;
  background: var(--os-face);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), var(--os-win-shadow);
  text-decoration: none;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

/* beat ".os-win__body a" (link color inside windows) */
.qt-card:link,
.qt-card:visited { color: var(--os-text); }

/* ---- Title bar: close box left, brand name centered, zoom + collapse right (all decorative) ---- */
.qt-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--os-titlebar-h);
}

.qt-stripes {
  flex: 1;
  min-width: 8px;
  height: 11px;
  background: repeating-linear-gradient(to bottom, var(--os-stripe-a) 0 1px, var(--os-stripe-b) 1px 2px);
}

.qt-title {
  margin: 0 6px;
  overflow: hidden;
  font-family: var(--font-chrome);
  font-size: var(--os-size);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qt-box {
  position: relative;
  flex: none;
  width: 13px;
  height: 13px;
  background: var(--os-face);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-lo), inset -1px -1px 0 var(--os-hi);
}

.qt-box--zoom::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 5px;
  height: 5px;
  border: 1px solid var(--os-outline);
}

.qt-box--collapse::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 3px;
  height: 3px;
  border-top: 1px solid var(--os-outline);
  border-bottom: 1px solid var(--os-outline);
}

/* ---- Screen: 16:9 black, recessed. Layers stack; only opacity changes (no layout shift) ---- */
.qt-screen {
  position: relative;
  display: block;
  container-type: inline-size; /* the placeholder wordmark scales with the screen */
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--os-screen);
  border: 1px solid var(--os-outline);
  box-shadow: -1px -1px 0 var(--os-lo), 1px 1px 0 var(--os-hi);
}

.qt-screen > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.qt-still,
.qt-video {
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Real still found (player-cards.js adds .has-still): it replaces the placeholder still */
.qt-card.has-still .qt-still { opacity: 1; }
.qt-card.has-still .qt-ph--still { opacity: 0; }

/* Playing: the video fades in over the still (or, with no video, the moving placeholder) */
.qt-card.is-playing.has-video .qt-video { opacity: 1; }
.qt-card.is-playing.no-video .qt-ph--play { opacity: 1; }
/* "hover": "still" cards (the card data list): no video file yet = just the real still, stronger analog layer, no stand-in */
.qt-card[data-hover="still"].has-still.no-video .qt-ph--play { opacity: 0; }

/* ---- Generated placeholders (no external requests) ---- */
.qt-ph {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  background: var(--fill);
  color: var(--on-fill);
  text-align: center;
  transition: opacity 0.2s ease;
}

.qt-ph__mark {                      /* placeholder wordmark: heading font */
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-synthesis: none;
  font-size: calc(clamp(1.75rem, 7cqi, 3rem) * var(--heading-scale));
  line-height: 1;
  letter-spacing: calc(0.02em + var(--heading-tracking));
  text-transform: uppercase;
}

.qt-ph__sub {
  font-family: var(--font-chrome);
  font-size: var(--os-size);
  opacity: 0.9;
}

.qt-ph--play {
  opacity: 0;
  overflow: hidden;
}


.qt-ph__tag {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-chrome);
  font-size: var(--os-size);
  letter-spacing: calc(0.08em + var(--chrome-tracking));
  text-transform: uppercase;
}


/* ---- Control bar (decorative): play button, scrub bar, volume slider ---- */
.qt-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.qt-play {
  position: relative;
  flex: none;
  width: 20px;
  height: 16px;
  background: var(--os-btn-face);
  border: 1px solid var(--os-outline);
  border-radius: var(--os-radius-btn);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo);
}

.qt-play::after {                  /* triangle */
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  border-left: 6px solid var(--os-text);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.qt-scrub,
.qt-vol {
  position: relative;
  height: 6px;
  background: var(--os-track);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-lo);
}

.qt-scrub { flex: 1; }
.qt-vol { flex: none; width: 44px; }

.qt-scrub i,
.qt-vol i {                        /* thumbs */
  position: absolute;
  top: -5px;
  width: 9px;
  height: 14px;
  background: var(--os-btn-face);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo);
}

.qt-scrub i { left: 0; }
.qt-vol i { left: 60%; }

/* ---- Live card states: raised on hover, pressed on click, focus ring ---- */
a.qt-card:hover,
a.qt-card.is-playing {
  transform: translate(-1px, -1px);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), 3px 3px 0 var(--os-lo);
}

a.qt-card:active {
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 0 var(--os-lo), inset -1px -1px 0 var(--os-hi);
}

a.qt-card:focus-visible {
  outline: 2px solid var(--os-focus);
  outline-offset: 3px;
}

/* ---- Coming soon: black screen with the stamp, no link, no hover ---- */
.qt-card.is-soon { cursor: default; }

.qt-card.is-soon .qt-screen {
  display: grid;
  place-items: center;
}

.qt-card.is-soon .qt-stamp {
  position: static;
  width: 58%;
  height: auto;
  transform: rotate(-4deg);
  filter: var(--sticker-filter);
}

@media (prefers-reduced-motion: reduce) {
  .qt-card,
  .qt-still,
  .qt-video,
  .qt-ph { transition: none; }
}

/* ==========================================================================
   Analog screen layer: part of EVERY media-player screen (.qt-analog, the last child of .qt-screen).
   The ORIGINAL Work-page animation (first built inside the "playing" placeholder): a slow diagonal light
   SWEEP plus faint SCANLINE BARS drifting down. It now sits above whatever the screen shows (video, still,
   placeholder, coming-soon stamp), below the chrome, and runs ALWAYS while the CRT effect is on (body.crt-on).
   - IDLE (no hover needed): clearly there, never hiding the content.
   - ACTIVE (hover, keyboard focus, playing, or in view on touch): stronger, and a bit faster (player-cards.js
     eases the playback rate, so nothing restarts or jumps).
   Tuning, on :root below: --analog-intensity (master), --analog-idle / --analog-active (layer opacity per level),
   --analog-active-speed (speed-up when active). The flicker / rolling band / jitter / static of the previous
   version were removed on purpose. Only transform and opacity animate; the keyframes are shared.
   player-cards.js pauses screens that are off-screen (.is-offscreen) and everything while the tab is hidden
   (html.analog-paused). The "PLAYING" label belongs to the placeholder, not to this layer.
   ========================================================================== */
:root {
  --analog-intensity: 1;      /* master: 0 = off, 1 = as designed */
  --analog-idle: 0.55;        /* idle layer opacity (x master): sweep ~12%, bars ~10% */
  --analog-active: 1;         /* hover / focus / playing (x master): ~1.8x idle */
  --analog-active-speed: 1.3; /* playback speed while active (1 = idle speed) */
}

.qt-analog {
  display: none;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  opacity: calc(var(--analog-idle) * var(--analog-intensity));
  transition: opacity 0.35s ease;
}

body.crt-on .qt-analog { display: block; }

.qt-card:hover .qt-analog,
.qt-card:focus-visible .qt-analog,
.qt-card.is-playing .qt-analog,
.qt-card.is-awake .qt-analog { opacity: min(1, calc(var(--analog-active) * var(--analog-intensity))); }

.qt-analog > i { position: absolute; }

.qt-analog__sweep {                /* slow diagonal light sweep */
  inset: 0 -60%;
  background: linear-gradient(100deg, transparent 35%, color-mix(in srgb, var(--on-fill) 22%, transparent) 50%, transparent 65%);
  transform: translateX(-40%);
  animation: qt-sweep 3.2s ease-in-out infinite;
}

.qt-analog__bars {                 /* faint scanline bars drifting down */
  inset: -40% 0;
  background: repeating-linear-gradient(to bottom, transparent 0 14px, color-mix(in srgb, var(--on-fill) 18%, transparent) 14px 18px, transparent 18px 40px);
  animation: qt-drift 4s linear infinite;
}

.qt-card:is(:hover, :focus-visible, .is-playing, .is-awake) .qt-analog > i { will-change: transform; }

/* Paused off-screen and while the tab is hidden; resumes where it left off */
.qt-card.is-offscreen .qt-analog > i,
html.analog-paused .qt-analog > i { animation-play-state: paused; }

@keyframes qt-sweep {
  from { transform: translateX(-40%); }
  to   { transform: translateX(40%); }
}

@keyframes qt-drift {
  from { transform: translateY(0); }
  to   { transform: translateY(40px); }
}

/* Reduced motion: nothing moves; the bars stay as a static, very faint scanline texture */
@media (prefers-reduced-motion: reduce) {
  .qt-analog > i { animation: none; }
  .qt-analog__sweep { display: none; }
}
