/* videos.jhampton.io
   Four themes, all driven by the same tokens:
     crt      — the default. A photographed phosphor screen, videos as floppy
                disks. The only theme that also changes a card's shape, which is
                why it has a second block at the very bottom of this file.
     daylight — light, clean, a bit of colour and motion.
     midnight — same personality with the lights off.
     terminal — the original phosphor-green hacker look, kept intact.
   Everything between the token blocks and that last section is theme-agnostic. */

:root {
  /* Pinned to the theme, not to the OS. The <meta name="color-scheme"> in the
     head says "light dark" so the very first paint isn't a white flash for
     someone in dark mode — but once this lands, the browser must render its own
     surfaces (bare inputs, checkboxes, scrollbars) to match the theme that was
     actually chosen. Left to the OS, daylight rendered an unstyled input as
     white-on-white and its checkboxes as black blocks. */
  color-scheme: light;

  --bg: #f6f7fc;
  --bg-wash:
    radial-gradient(900px 500px at 12% -10%, #ffe3ec 0%, transparent 60%),
    radial-gradient(800px 460px at 92% 0%, #e2e8ff 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f0f2fa;
  --text: #17182b;
  --muted: #6b6f8a;
  --line: #e5e8f4;
  --line-strong: #cfd4e8;

  --c1: #7c5cff;
  --c2: #ff5d73;
  --c3: #ffab1f;
  --c4: #00bfa5;
  --c5: #2f9bff;
  --accent: var(--c1);
  --on-accent: #fff;
  --brand-gradient: none;          /* daylight brands in flat --accent */

  --ok: #0e9f6e;
  --warn: #b7791f;
  --danger: #e0344b;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 24, 43, .05), 0 10px 28px -14px rgba(23, 24, 43, .28);
  --shadow-lift: 0 2px 6px rgba(23, 24, 43, .07), 0 22px 44px -18px rgba(23, 24, 43, .35);
  --glass: rgba(246, 247, 252, .72);
  --skeleton: linear-gradient(100deg, transparent 20%, rgba(23, 24, 43, .055) 42%, transparent 64%);

  /* One motion vocabulary for the whole site. --ease is the workhorse: it
     leaves fast and settles slowly, which is what reads as "responsive" rather
     than "animated". Anything a finger or cursor is holding uses --dur-1 so it
     feels attached; anything the page does on its own gets --dur-2 or --dur-3. */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --dur-1: .12s;
  --dur-2: .22s;
  --dur-3: .34s;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --font-brand: var(--font);
  --brand-weight: 800;
  --letter: -0.01em;
}

/* CRT — a photograph of a phosphor screen, with the videos as floppy disks.
   The default theme.

   Black type, not white: the cropped phosphor averages #54b54b, which is 8.2:1
   against black and 2.6:1 against white. That is measured off the image, not
   guessed, and it is why every colour below is a dark one. A pale wash sits
   over the photo to lift its darkest corner, which on its own only reached
   4.6:1. */
[data-theme="crt"] {
  color-scheme: light;

  --bg: #54b54b;                     /* the phosphor's mean — browser chrome matches */
  /* The screen is painted by body::before, not here — see the note below it. */
  --bg-wash: none;
  --surface: rgba(241, 253, 239, .94);
  --surface-2: rgba(223, 244, 220, .94);
  --text: #06130a;
  /* Both of these are darker than they look like they need to be, and the wash
     above is stronger, because the phosphor is not one colour: its dark corner
     is #54924e even after the wash. At these values the body text clears 8.1:1
     over the average and 5.1:1 over that corner, and the secondary text clears
     7.2:1 and 4.5:1 — AA everywhere on the picture rather than only over the
     bright middle, which is what the first attempt managed. */
  --muted: #122013;
  --line: rgba(6, 40, 14, .22);
  --line-strong: rgba(6, 40, 14, .42);

  --c1: #0b3d20;
  --c2: #7c1d2b;
  --c3: #6b4a06;
  --c4: #0a4f45;
  --c5: #123f6b;
  --accent: #0b3d20;
  --on-accent: #e8ffe9;
  --brand-gradient: none;

  --ok: #0a5c2c;
  --warn: #6d4405;
  --danger: #8a1122;

  --shadow: 0 1px 2px rgba(2, 16, 5, .3), 0 12px 26px -14px rgba(2, 16, 5, .7);
  --shadow-lift: 0 3px 8px rgba(2, 16, 5, .35), 0 26px 46px -18px rgba(2, 16, 5, .85);
  --glass: rgba(214, 242, 210, .74);
  --skeleton: linear-gradient(100deg, transparent 20%, rgba(6, 40, 14, .1) 42%, transparent 64%);

  --radius: 12px;
  --radius-sm: 8px;
  --font: var(--font-mono);
  --font-brand: var(--font-mono);
  --brand-weight: 700;
  --letter: .01em;
}

/* The screen is a real fixed element, not `background-attachment: fixed`.
   That distinction is the whole ballgame on a phone: iOS Safari does not honour
   a fixed background attachment at all, and Android repaints every layer of it
   on each scroll frame — three layers, one of them a full-viewport image —
   which is enough to make the cards above it flicker and drop out. A fixed
   pseudo-element is composited once and never repainted while scrolling.

   z-index: -1 puts it above body's own background colour and below everything
   in the page, which is exactly where a screen belongs. */
/* body has to give up its own background colour for this to be visible at all:
   a negative-z-index child paints before any in-flow block background, so an
   opaque body would cover the screen entirely. html keeps --bg as the colour
   behind everything. */
[data-theme="crt"] body { background-color: transparent; }
[data-theme="crt"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(4, 22, 6, .16) 0 1px, transparent 1px 3px) 0 0 / auto repeat,
    linear-gradient(rgba(236, 255, 233, .22), rgba(236, 255, 233, .22)) center / cover no-repeat,
    url(/assets/crt-screen.png) center / cover no-repeat;
}

[data-theme="midnight"] {
  color-scheme: dark;

  --bg: #0e0f1d;
  --bg-wash:
    radial-gradient(900px 520px at 10% -12%, rgba(124, 92, 255, .28) 0%, transparent 60%),
    radial-gradient(760px 460px at 94% -4%, rgba(255, 93, 115, .20) 0%, transparent 58%);
  --surface: #191b2f;
  --surface-2: #21243c;
  --text: #ecebff;
  --muted: #9a9cc4;
  --line: #2a2d48;
  --line-strong: #3a3e63;

  --c1: #9d84ff;
  --c2: #ff7d8f;
  --c3: #ffc04d;
  --c4: #2fd9be;
  --c5: #62b4ff;
  --on-accent: #12132a;
  --brand-gradient: linear-gradient(135deg, #9d84ff, #ff7d8f 55%, #ffc04d);

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #ff6b81;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 34px -18px rgba(0, 0, 0, .9);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, .55), 0 26px 52px -20px rgba(0, 0, 0, .95);
  --glass: rgba(14, 15, 29, .72);
  --skeleton: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .06) 42%, transparent 64%);
}

[data-theme="terminal"] {
  color-scheme: dark;

  --bg: #050605;
  --bg-wash: none;
  --surface: #0b0f0c;
  --surface-2: #0f2419;
  --text: #d6e8dd;
  --muted: #2c8a5e;
  --line: #12331f;
  --line-strong: #185a3b;

  --c1: #35ff9e;
  --c2: #35ff9e;
  --c3: #ffcf5c;
  --c4: #57e5ff;
  --c5: #35ff9e;
  --accent: #35ff9e;
  --on-accent: #050605;
  --brand-gradient: none;

  --ok: #35ff9e;
  --warn: #ffcf5c;
  --danger: #ff5f6e;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: none;
  --shadow-lift: none;
  --glass: rgba(5, 6, 5, .88);
  --skeleton: linear-gradient(100deg, transparent 20%, rgba(53, 255, 158, .09) 42%, transparent 64%);

  --font: var(--font-mono);
  --font-brand: var(--font-mono);
  --brand-weight: 700;
  --letter: .04em;
}

* { box-sizing: border-box; }

/* .btn sets display, which would otherwise beat the UA rule for [hidden]. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  /* The sticky header would otherwise cover whatever an anchor jumps to. */
  scroll-padding-top: 76px;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(14px, .55vw + 12px, 16px);
  line-height: 1.55;
  letter-spacing: var(--letter);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: var(--bg-wash);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

/* One ring for everything focusable, and only for keyboard focus — a mouse
   user clicking a card should never see it. */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.wrap { width: min(1140px, 100%); margin: 0 auto; padding: 22px 18px 72px; }

/* ------------------------------------------------------------- header --- */

/* Full-bleed so the glass reaches the window edges; the contents still line up
   with the page below it. */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
}
.top-inner {
  width: min(1140px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
}
/* The frosted panel is a layer of its own so it can fade in on scroll without
   the header's contents fading with it. */
.top::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.7) blur(14px);
  backdrop-filter: saturate(1.7) blur(14px);
  border-bottom: 1px solid transparent;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-soft), border-color var(--dur-2) var(--ease-soft);
}
.top.is-stuck::after { opacity: 1; border-bottom-color: var(--line); }
/* .is-away is set on every screen (see chrome.js) but only means something
   where vertical space is actually scarce. */
@media (max-width: 900px) {
  .top { transition: transform var(--dur-2) var(--ease-soft); }
  .top.is-away { transform: translateY(-100%); }
}
[data-theme="terminal"] .top::after {
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.top-sentinel { height: 1px; margin-bottom: -1px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-brand); font-weight: var(--brand-weight); font-size: 1.05rem; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent);
  position: relative; flex: 0 0 auto;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: var(--on-accent);
  clip-path: polygon(38% 28%, 38% 72%, 72% 50%);
}
[data-theme="midnight"] .brand-mark { background: var(--brand-gradient); }
[data-theme="terminal"] .brand-mark { border-radius: 3px; }
.brand-text { color: var(--accent); }
[data-theme="midnight"] .brand-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="terminal"] .brand-text::after { content: "█"; margin-left: 2px; animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.top nav { display: flex; align-items: center; gap: 6px; }
.top nav > a {
  color: var(--muted);
  font-size: .88rem;
  padding: 7px 11px;
  border-radius: 999px;
  transition: color .15s, background .15s;
}
.top nav > a:hover { color: var(--text); background: var(--surface-2); }
.brand { transition: opacity var(--dur-1) var(--ease-soft); }
.brand:active { opacity: .7; }
.brand-mark { transition: transform var(--dur-2) var(--ease); }
.brand:hover .brand-mark { transform: scale(1.08) rotate(-4deg); }

/* --------------------------------------------------------- theme menu --- */

.theme-menu { position: relative; }
.theme-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: .88rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.theme-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
[data-theme="midnight"] .theme-dot { background: var(--brand-gradient); }

.theme-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 172px; margin: 0; padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
}
[data-theme="terminal"] .theme-list { box-shadow: 0 0 0 1px var(--line); }
.theme-list button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  font: inherit; font-size: .9rem; text-align: left;
  color: var(--text); background: none; border: 0; border-radius: 6px;
  padding: 8px 9px; cursor: pointer;
}
.theme-list button:hover { background: var(--surface-2); }
.theme-list .tick { margin-left: auto; opacity: 0; color: var(--accent); }
.theme-list button[aria-checked="true"] .tick { opacity: 1; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(128, 128, 128, .35); }
.swatch-crt { background: linear-gradient(135deg, #54b54b 45%, #17181a 45%); }
.swatch-daylight { background: linear-gradient(135deg, #fff 40%, #7c5cff 40%); }
.swatch-midnight { background: linear-gradient(135deg, #191b2f 40%, #9d84ff 40%, #ff7d8f); }
.swatch-terminal { background: linear-gradient(135deg, #050605 40%, #35ff9e 40%); }

/* ------------------------------------------------------------ catalog --- */

/* A long index shouldn't make the browser lay out and paint series nobody has
   scrolled to yet. The intrinsic size is a guess at one row of cards, which is
   all the scrollbar needs to stay honest. */
.series {
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}

.series { margin-bottom: 46px; --series-accent: var(--c1); }
.series:nth-of-type(5n+2) { --series-accent: var(--c2); }
.series:nth-of-type(5n+3) { --series-accent: var(--c4); }
.series:nth-of-type(5n+4) { --series-accent: var(--c3); }
.series:nth-of-type(5n+5) { --series-accent: var(--c5); }

.series > summary {
  display: flex; align-items: center; gap: 10px;
  list-style: none; cursor: pointer;
  padding: 4px 0; margin-bottom: 6px;
  border-radius: var(--radius-sm);
}
.series > summary::-webkit-details-marker { display: none; }
.series > summary:hover .chev { color: var(--text); }
.series > summary::before {
  content: ""; width: 8px; height: 22px; border-radius: 3px;
  background: var(--series-accent); flex: 0 0 auto;
  transition: height var(--dur-2) var(--ease);
}
.series > summary:hover::before { height: 26px; }
.series .chev { color: var(--muted); font-size: .8rem; transition: transform var(--dur-2) var(--ease); }
.series[open] .chev { transform: rotate(0deg); }
.series:not([open]) .chev { transform: rotate(-90deg); }
.series > summary h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.series > summary .count {
  color: var(--muted); font-size: .78rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px;
}
.series p.blurb { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease);
  /* --i is the card's place in its grid, set in the markup and capped there.
     The stagger is small on purpose: enough to read as a sweep, not so much
     that the last card feels late. */
  animation: rise .42s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--series-accent); }
.card:active { transform: translateY(-1px) scale(.995); transition-duration: var(--dur-1); }
.card.locked { opacity: .82; }
.card.locked:hover { opacity: 1; }

.thumb {
  position: relative; aspect-ratio: 16 / 9;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}

/* The blur-up placeholder. It is a 24px-wide JPEG scaled up 40×, so it needs no
   blur filter to look soft — but a little smoothing hides the pixel grid, and
   the slight overscale keeps the blur's soft edges off the frame. */
.thumb-blur {
  position: absolute; inset: 0; z-index: 0;
  background: center / cover no-repeat;
  filter: blur(14px) saturate(1.15);
  transform: scale(1.14);
}
/* Starts invisible only when scripting is there to reveal it — see chrome.js.
   Without JS the poster is simply visible from the start. */
.thumb-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease-soft);
}
.js .thumb-img { opacity: 0; }
.js .thumb-img.is-on { opacity: 1; }
.card:hover .thumb-img, .card:hover .thumb-blur { transform: scale(1.045); }
.card:hover .thumb-blur { transform: scale(1.19); }

/* ------------------------------------------------------- turned videos -- */

/* A rotated thumbnail can't simply be spun in place: turning a 16:9 box a
   quarter turn leaves it 9:16, and the corners of the frame come away empty. So
   the picture is first given the container's dimensions *swapped* — that is
   what the cq units are for, and why the frame becomes a query container — and
   only then turned, which lands it back over the box exactly.
   180° needs no swap, but it goes through the same centred model so one set of
   transform rules covers all three. Everything here is scoped to [data-rot], so
   the overwhelmingly common case of an upright video keeps the simpler
   inset-based layout above, untouched. */
.thumb[data-rot] { container-type: size; }
.thumb[data-rot] .thumb-img,
.thumb[data-rot] .thumb-blur {
  inset: auto; left: 50%; top: 50%;
  transform-origin: 50% 50%;
}
.thumb[data-rot="90"] .thumb-img,  .thumb[data-rot="270"] .thumb-img,
.thumb[data-rot="90"] .thumb-blur, .thumb[data-rot="270"] .thumb-blur {
  width: 100cqh; height: 100cqw;
}
.thumb[data-rot="180"] .thumb-img,
.thumb[data-rot="180"] .thumb-blur { width: 100cqw; height: 100cqh; }

.thumb[data-rot] .thumb-img  { transform: translate(-50%, -50%) rotate(var(--rot)); }
.thumb[data-rot] .thumb-blur { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.14); }
/* The hover zoom is re-stated rather than inherited: these transforms carry the
   rotation, and a bare scale() further down would drop it. */
.card:hover .thumb[data-rot] .thumb-img  { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.045); }
.card:hover .thumb[data-rot] .thumb-blur { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.19); }

.thumb .glyph { font-size: 1.7rem; opacity: .6; position: relative; z-index: 1; }

/* Play affordance: only on cards that actually play in place, and only where
   there's a cursor to hover with. */
.thumb-play {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(12, 12, 18, .58);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff;
  opacity: 0; transform: scale(.8);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
  pointer-events: none;
}
.thumb-play svg { width: 22px; height: 22px; margin-left: 2px; }
.card:hover .thumb-play { opacity: 1; transform: scale(1); }

.thumb .runtime {
  position: absolute; right: 9px; bottom: 9px; z-index: 2;
  background: rgba(10, 10, 20, .72); color: #fff;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border-radius: 7px; padding: 2px 7px;
  font-size: .75rem; font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.meta { padding: 12px 14px 14px; }
.meta .title { font-weight: 650; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.meta .sub {
  color: var(--muted); font-size: .85rem; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}
.badge.pub { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.lock { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.badge.hid { color: var(--muted); }
.badge.enc { color: var(--c1); border-color: color-mix(in srgb, var(--c1) 40%, transparent); background: color-mix(in srgb, var(--c1) 12%, transparent); }

/* ---------------------------------------------------- player + vault --- */

.player-note {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .88rem;
}
.linkish {
  font: inherit; color: var(--accent);
  background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline;
}

/* Every dialog on the site arrives the same way: a short rise with the backdrop
   fading in behind it. Modals that simply appear are the single easiest thing
   to get wrong, and the cheapest to get right. */
dialog[open] { animation: dlg-in .24s var(--ease) both; }
dialog::backdrop { animation: dlg-fade .2s var(--ease-soft) both; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes dlg-fade { from { opacity: 0; } }

.vault-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lift);
}
.vault-dialog::backdrop {
  background: rgba(8, 8, 20, .6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.vault-dialog h2 { margin: 0 0 6px; font-size: 1.05rem; }
.vault-dialog p { margin: 0 0 16px; }
.vault-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.vault-dialog .err:empty { display: none; }

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

.player {
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.player video { width: 100%; height: auto; display: block; max-height: 78vh; background: #000; }
h1.ep { margin: 0 0 5px; font-size: 1.4rem; font-weight: 750; }
.ep-sub { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.ep-desc { max-width: 68ch; }
.ep-next { color: var(--muted); font-size: .9rem; margin: 18px 0 0; }

/* -------------------------------------------------------------- login --- */

.gate {
  max-width: 400px; margin: 10vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 28px;
}
.gate h1 { margin: 0 0 6px; font-size: 1.15rem; }
.gate p { margin: 0 0 20px; color: var(--muted); font-size: .9rem; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
/* [type=search] was missing here, so the admin's search box was the one field
   on the site still wearing the browser's own chrome. */
/* input:not([type]) is here on purpose: an <input> with no type attribute is a
   text field, but no attribute selector matches it, so the series-title box in
   the manager was the one field taking none of this — including the colour. */
input[type=password], input[type=text], input[type=date], input[type=search],
input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text); font: inherit;
  transition: border-color var(--dur-2) var(--ease-soft), box-shadow var(--dur-2) var(--ease-soft);
}
/* Search only — a bare appearance:none here would take the dropdown arrow off
   every <select> on the site along with it. */
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Password fields carry a show/hide toggle (see assets/password.js). */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle:focus-visible {
  outline: none; color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.pw-toggle[aria-pressed="true"] { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  cursor: pointer;
  transition: filter var(--dur-2) var(--ease-soft), transform var(--dur-1) var(--ease),
              box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease-soft);
}
[data-theme="midnight"] .btn { background-image: var(--brand-gradient); }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); transition-duration: 60ms; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; background-image: none; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; background-image: none; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.err { color: var(--danger); font-size: .88rem; margin: 14px 0 0; }
.empty { color: var(--muted); }

/* --------------------------------------------------------- loading state -- */

/* A placeholder shaped like the thing that's coming, not a spinner. Used by the
   admin catalog while the first list call is in flight; the sweep is one
   transform, so it costs nothing to leave running. */
.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.skel::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--skeleton);
  transform: translateX(-100%);
  animation: skel-sweep 1.5s var(--ease-soft) infinite;
}
@keyframes skel-sweep { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  /* The reveal is a class the script adds, so it survives — but the sweep and
     the entrance are gone, and nothing may be left mid-fade. */
  .js .thumb-img { opacity: 1; }
  html { scroll-behavior: auto; }
}

/* ========================================================================
   Touch and small screens.

   Three things drive everything below: fingers need ~44px of target, hover
   doesn't exist so nothing may hide behind it, and iOS zooms any input whose
   text is under 16px. Safe-area insets keep content clear of notches and the
   home indicator.
   ======================================================================== */

button, a, summary, input, select, label { touch-action: manipulation; }
* { -webkit-tap-highlight-color: transparent; }

.wrap {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-bottom: max(72px, env(safe-area-inset-bottom));
}
.top-inner {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-top: max(18px, env(safe-area-inset-top));
}

/* No hover to reveal things — show them, and make them big enough to hit. */
@media (hover: none) {
  .theme-btn, .top nav > a { padding: 10px 14px; }
  /* Touch has no hover, so the lift and the zoom would only ever fire as a
     side-effect of tapping. The press state does the work instead. */
  .card:hover { transform: none; box-shadow: var(--shadow); border-color: var(--line); }
  .card:hover .thumb-img { transform: none; }
  .card:hover .thumb-blur { transform: scale(1.14); }
  .card:hover .thumb-play { opacity: 0; }
  .card:active { transform: scale(.98); transition-duration: var(--dur-1); }
  .series > summary { padding: 10px 0; }
}

@media (max-width: 720px) {
  html, body { font-size: 16px; }

  .top-inner { flex-wrap: wrap; gap: 6px 8px; padding-bottom: 10px; }
  .brand { font-size: 1rem; min-width: 0; flex: 1 1 auto; }
  .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top nav { gap: 2px; flex: 0 0 auto; }
  .top nav > a {
    font-size: .82rem; padding: 9px 10px;
    max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* Narrow enough that the nav needs its own line rather than fighting the
   wordmark for room. Nothing gets hidden — it just wraps. */
@media (max-width: 560px) {
  .top nav { width: 100%; justify-content: flex-end; }
  .theme-btn .label { display: none; }
  .theme-btn { padding: 9px 11px; }

  .wrap { padding-top: 8px; }
  .series { margin-bottom: 30px; }
  .series > summary h2 { font-size: 1.05rem; }

  /* One big card per row reads far better than two cramped ones. */
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .meta { padding: 12px 13px 14px; }
  .thumb .runtime { font-size: .8rem; padding: 3px 8px; }

  h1.ep { font-size: 1.2rem; }
  .ep-desc { font-size: .95rem; }

  .gate { margin-top: 6vh; padding: 24px 20px; }
}

@media (min-width: 721px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* 16px keeps iOS from zooming the page when a field takes focus. */
@media (max-width: 900px) {
  input[type=password], input[type=text], input[type=date], input[type=search],
  input[type=number], input:not([type]), select, textarea { font-size: 16px; padding: 12px 13px; }
  .btn { padding: 12px 18px; }
  .pw-toggle { width: 40px; height: 40px; }
  .pw-wrap input { padding-right: 52px; }
}

@media (max-width: 780px) {
  /* [open] matters — see the note in admin.css. */
  .vault-dialog[open] {
    width: 100%; max-width: 100%; height: 100dvh; margin: 0;
    border: 0; border-radius: 0;
    display: flex; flex-direction: column; justify-content: center;
    padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  }
  .vault-foot { margin-top: 22px; }
  .vault-foot .btn { flex: 1; justify-content: center; }
}

/* Landscape on a phone is mostly video — give the player the whole screen. */
@media (max-height: 500px) and (orientation: landscape) and (hover: none) {
  .top-inner { padding-top: 6px; padding-bottom: 6px; }
  .wrap { padding-top: 4px; }
}

/* ============================================================ CRT: disks === */

/* Only under [data-theme="crt"], and last in the file, so every rule it has to
   beat — the card's surface and border, the thumb's 16:9 box, the meta padding —
   loses on source order rather than on a specificity arms race.

   The geometry is measured off assets/disk2.jpg, which is 250x262: the white
   label runs x=25..222 and y=110..246, so it is inset 10% left, 11.2% right,
   42% top and 6.1% bottom. A little is given back at the top so the word INDEX
   printed on the sticker still shows. Swap the disk photo and these four
   numbers have to be measured again. */

[data-theme="crt"] .grid {
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 24px 18px;
  justify-items: center;
}

[data-theme="crt"] .card {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 250 / 262;
  /* so the label's type is a fraction of the disk, not one fixed size that
     only looks right at one column count */
  container-type: inline-size;
  background: url(/assets/disk2.jpg) center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  overflow: visible;
  /* box-shadow, not drop-shadow: the disk photo is an opaque JPEG, so a
     rectangular shadow is the same picture — and a filter on every card is a
     compositing layer each, which is real money on a phone for no gain. */
  box-shadow: 0 9px 16px rgba(2, 16, 5, .55);
  color: #0d0f0c;
}
[data-theme="crt"] .card:hover {
  transform: translateY(-6px) rotate(-.35deg);
  box-shadow: 0 16px 26px rgba(2, 16, 5, .7);
}
[data-theme="crt"] .card:active { transform: translateY(-2px) scale(.995); }
[data-theme="crt"] .card.locked { opacity: 1; }

[data-theme="crt"] .thumb {
  position: absolute;
  left: 10%; right: 11.2%;
  top: 46.2%; height: 30.4%;
  aspect-ratio: auto;
  border-bottom: 0;
  border-radius: 0;
  background: #0c0e0b;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3);
}
[data-theme="crt"] .thumb .glyph { font-size: 9cqw; }
[data-theme="crt"] .thumb .runtime {
  right: 3.5%; bottom: 5%;
  font-size: 3.6cqw; padding: 1% 2.4%;
  border-radius: 4px;
}
[data-theme="crt"] .thumb-play {
  width: 17cqw; height: 17cqw; margin: calc(-8.5cqw) 0 0 calc(-8.5cqw);
}
[data-theme="crt"] .thumb-play svg { width: 7cqw; height: 7cqw; }

[data-theme="crt"] .meta {
  position: absolute;
  left: 10%; right: 11.2%;
  top: 77.4%; bottom: 6.1%;
  padding: 1.4cqw 0 0;
  overflow: hidden;
}
[data-theme="crt"] .meta .title {
  flex-wrap: nowrap;
  gap: 1.5cqw;
  font-size: 6cqw;
  line-height: 1.16;
  font-weight: 700;
  color: #0d0f0c;
}
[data-theme="crt"] .meta .title .t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="crt"] .meta .sub {
  margin-top: .4cqw;
  font-size: 4.4cqw;
  color: #46563f;
}
/* The badges are printed-sticker sized here, and the ordinary "public" one is
   noise on a shelf where nearly everything is public. */
[data-theme="crt"] .meta .badge {
  font-size: 3.2cqw;
  padding: 0 1.6cqw;
  border-radius: 3px;
  flex: 0 0 auto;
}
[data-theme="crt"] .meta .badge.pub { display: none; }

/* A shelf reads better without a card-sized gap between the heading and it. */
[data-theme="crt"] .series > summary h2 { letter-spacing: .1em; text-transform: uppercase; }
[data-theme="crt"] .series { contain-intrinsic-size: auto 460px; }

@media (max-width: 720px) {
  [data-theme="crt"] .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px 14px; }
}
