/* Subscription feed — page-local styling, on the shared chassis tokens.
   Organised the way stream/, repos/ and web-games/ are: the shared stylesheet
   carries the chassis, each page carries only what is its own. */

.subs-main { padding: 0 0 24px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- controls ---------- */

.subs-scope { margin-bottom: 12px; }

.subs-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.subs-control-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
}
/* Disconnect throws away an import that costs a sign-in to redo, so it does not
   get to look like the two controls beside it that only cost a request. */
.subs-control-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-faint);
  box-shadow: none;
}
.subs-control-quiet:hover {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: transparent;
  color: var(--danger);
  box-shadow: none;
}

/* ---------- state notice ---------- */

.subs-state {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--well);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
}
.subs-state-title {
  margin: 0 0 6px;
  font-family: var(--font-legend);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.subs-state-note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 68ch;
}
.subs-state-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.subs-state-actions:empty { display: none; }
.subs-state-btn { height: 34px; padding: 0 14px; font-size: 11px; letter-spacing: 0.1em; }

.subs-note { margin: 0; padding: 8px 0; font-size: 0.82rem; color: var(--text-faint); }

/* ---------- grid ---------- */

/* auto-fill rather than a fixed count: the cards keep a readable width and the
   row simply holds as many as fit, from six down to one. */
.subs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.subs-grid:empty { display: none; }

.subs-card {
  /* It is a button, so the shared button styling has to be undone first — most
     of all `white-space: nowrap` and `line-height: 1`, which between them stop
     the title wrapping at all and leave it clipped mid-word by the next card. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* Grid stretches every card to the tallest in its row, and the shared button
     rule centres content on the main axis — which, in a column, is vertical. So
     a card with a one-line title had its whole contents sink to the middle of
     the box while a two-line neighbour rode higher, and the thumbnails in a row
     stopped lining up. They start at the top, whatever the title does. */
  justify-content: flex-start;
  gap: 0;
  height: auto;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  line-height: inherit;
  min-width: 0;
}
.subs-card:hover { background: transparent; box-shadow: none; transform: none; }

.subs-card-shot {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--well);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.subs-card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Resting a stop down, so hovering reads as the screen coming up to full
     brightness rather than as a highlight being painted on top of it. */
  filter: brightness(0.92) saturate(0.96);
  transition: filter 0.2s var(--ease);
}
.subs-card:hover .subs-card-shot { border-color: var(--accent-border); }
.subs-card:hover .subs-card-shot img { filter: brightness(1.04) saturate(1.04); }
.subs-card:focus-visible { outline: none; }
.subs-card:focus-visible .subs-card-shot {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.subs-card:focus-visible .subs-card-shot img { filter: brightness(1.04) saturate(1.04); }

/* The filament the header bezel already uses to mean "this panel is powered"
   (header::after), at card scale. Hovering a tile lights it; the tile that is
   actually playing keeps it lit. No lift and no scale — the games page settled
   that argument for this site, and a thumbnail that grows on hover would shove
   its neighbours' baselines around anyway. */
.subs-card-shot::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 0.18s var(--ease), transform 0.26s var(--ease);
  pointer-events: none;
}
.subs-card:hover .subs-card-shot::after,
.subs-card:focus-visible .subs-card-shot::after,
.subs-card.is-playing .subs-card-shot::after { opacity: 1; transform: scaleX(1); }

.subs-card.is-playing .subs-card-shot {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}
.subs-card.is-playing .subs-card-shot img { filter: brightness(1) saturate(1); }

/* Which tile is playing is a status, and this console annunciates statuses with
   a lamp. The dark ring is what keeps it readable on a bright thumbnail — the
   same problem the game tile kickers had. */
.subs-card.is-playing .subs-card-shot::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 11, 16, 0.72), 0 0 9px var(--accent-glow), 0 0 2px var(--accent);
  animation: lamp-strike 0.55s var(--ease) both, lamp-breathe 3.4s var(--ease) 0.55s infinite;
}

/* a stamped readout over the art, so it stays legible on any thumbnail */
.subs-card-duration {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: rgba(8, 11, 16, 0.86);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.subs-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  /* two lines, then ellipsis — a ragged card grid is worse than a clipped title */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.subs-card:hover .subs-card-title { color: var(--accent-strong); }

.subs-card-channel {
  margin-top: 4px;
  font-family: var(--font-legend);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subs-card-age {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- load more ---------- */

/* The foot of the list rather than another control: it sits under a rule, away
   from the three buttons at the top of the panel that all cost a request. This
   one only draws cards that are already here. */
.subs-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
/* The chassis gives every button and this row a display value of its own, and an
   author declaration beats the browser's [hidden] rule whatever its specificity.
   Anything hidden by attribute inside the panel has to say so again here. */
.subs-more[hidden], .subs-panel button[hidden] { display: none; }
.subs-more-btn { height: 34px; padding: 0 18px; font-size: 11px; letter-spacing: 0.1em; }
.subs-more-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* ---------- player ---------- */

/* Bounded by height rather than width. At full page width a 16:9 frame is about
   750px tall, which puts every card below the fold — you would click a video and
   lose the feed you were reading. Capping the width to whatever keeps the frame
   under ~62vh holds a true 16:9 and leaves the first row of cards in view. */
.subs-player {
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: calc(62vh * 16 / 9);
  margin-inline: auto;
}
.subs-player-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--well);
}
.subs-player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.subs-player-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
}
.subs-player-meta { flex: 1 1 260px; min-width: 0; }
.subs-player-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.subs-player-channel {
  margin: 3px 0 0;
  font-family: var(--font-legend);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.subs-player-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.subs-player-btn { height: 32px; padding: 0 12px; font-size: 11px; letter-spacing: 0.1em; }

/* ---------- corner player ----------
   Scrolling past the video parks it in the corner so the feed stays browsable.
   Position only: the iframe is never touched, because moving one in the DOM
   reloads it and the video would restart on every scroll past. */
.subs-player-expand { display: none; }

body.subs-pip .subs-player {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: min(360px, calc(100vw - 28px));
  max-width: none;
  margin: 0;
  border-color: var(--border-strong);
  /* lifted clear of the chassis, unlike every panel seated in the flow */
  box-shadow: var(--shadow-lg);
  animation: pip-dock 0.22s var(--ease) both;
}
@keyframes pip-dock {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

body.subs-pip .subs-player-bar { padding: 8px 10px; gap: 8px; }
body.subs-pip .subs-player-meta { flex: 1 1 auto; }
body.subs-pip .subs-player-title {
  font-size: 0.78rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* At this size the bar holds one line of title and two controls. The channel,
   theater mode and the YouTube link are all a scroll away. */
body.subs-pip .subs-player-channel,
body.subs-pip #subs-player-theater,
body.subs-pip #subs-player-open { display: none; }
body.subs-pip .subs-player-expand { display: inline-flex; }
body.subs-pip .subs-player-btn { height: 28px; padding: 0 10px; font-size: 10px; }

@media (max-width: 560px) {
  body.subs-pip .subs-player { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  body.subs-pip .subs-player { animation: none !important; }
}

/* ---------- theater mode ----------
   A class on the body and nothing else, so the iframe is never touched. Rebuilding
   it to go fullscreen would restart the video from zero every time you toggled. */
body.subs-theater-mode { background: #05070a; padding: 0; overflow: hidden; }
body.subs-theater-mode > .page {
  margin: 0;
  padding: 0;
  width: 100vw !important;
  max-width: none !important;
  min-height: 0;
  height: 100dvh;
}
body.subs-theater-mode > .page > header,
body.subs-theater-mode > .page > .site-footer,
body.subs-theater-mode .subs-panel { display: none; }
body.subs-theater-mode .subs-main { padding: 0; gap: 0; }

body.subs-theater-mode .subs-player {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100vw;
  max-width: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: #05070a;
  box-shadow: none;
}
/* Letterboxed rather than stretched: bounded by whichever of the two viewport
   axes runs out first, so the frame keeps 16:9 on any window shape. */
body.subs-theater-mode .subs-player-frame {
  width: min(100vw, calc(100dvh * 16 / 9));
  height: auto;
  max-height: 100dvh;
  background: transparent;
}
body.subs-theater-mode .subs-player-bar { display: none; }

/* The site-wide reduced-motion rule clamps durations with `*`, which does not
   match pseudo-elements — which is why the panel lamps in styles.css are named
   there one by one. The card lamp is a pseudo-element too, and its breathing is
   an infinite loop, so it has to be named here or it never stops. */
@media (prefers-reduced-motion: reduce) {
  .subs-card.is-playing .subs-card-shot::before { animation: none !important; }
  .subs-card-shot::after { transition: none !important; }
  .subs-card-shot img { transition: none !important; }
}

@media (max-width: 560px) {
  /* 140 rather than 150: at a 390px viewport the grid is 308px wide, and two
     150px tracks plus the gap need 312 — so the single most common phone width
     was the one that dropped to a single column while 414px kept two. */
  .subs-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  /* Two lines clear a title in a 250px card and truncate six of eight in a
     148px one. The card is taller here anyway; the room is free. */
  .subs-card-title { -webkit-line-clamp: 3; }
  .subs-player-actions { width: 100%; }
  .subs-player-actions > * { flex: 1 1 0; justify-content: center; }
}
