/*
 * Styles for the Worker-rendered pages (worker/render.ts) and 404.html. Plain CSS so the Worker
 * doesn't depend on Vite's hashed bundle; tokens mirror src/index.css.
 */
:root {
  --bg: #19191b;
  --surface: #232326;
  --surface-2: #2c2c30;
  --line: #2f2f34;
  --fg: #f5f5f6;
  --fg-muted: #a3a3ab;
  --fg-subtle: #6c6c75;
  --accent: #8fe3d0;
  --accent-fg: #8fe3d0;
  --accent-ink: #0b2621;
  --accent-soft: #8fe3d024;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f3f5;
    --surface: #ffffff;
    --surface-2: #ebebee;
    --line: #e4e4e8;
    --fg: #131315;
    --fg-muted: #66666e;
    --fg-subtle: #9d9da5;
    --accent: #9fe8d8;
    --accent-fg: #1e9a82;
    --accent-soft: #1e9a821a;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2 { font-family: var(--display); letter-spacing: -0.03em; line-height: 1.05; }
h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 800; margin: 0 0 12px; }
h2 { font-size: 26px; font-weight: 700; margin: 48px 0 16px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px max(16px, calc((100vw - 1160px) / 2));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px);
}
.top nav { display: flex; align-items: center; gap: 20px; font-size: 14px; font-weight: 600; }
.top nav a:not(.button) { text-decoration: none; color: var(--fg-muted); }
.top nav a:not(.button):hover { color: var(--fg); }
.wordmark { font: 800 28px/1 var(--display); letter-spacing: -0.04em; text-decoration: none; }
.wordmark span { color: var(--accent-fg); }

.button {
  display: inline-block; border-radius: 999px; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.button.ghost { background: var(--surface-2); color: var(--fg); }

main { padding-top: 24px; padding-bottom: 32px; }
.crumbs { font-size: 14px; color: var(--fg-muted); margin-bottom: 20px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); }
.years { color: var(--fg-subtle); font-weight: 700; }
.lede { color: var(--fg-muted); font-size: 18px; max-width: 640px; margin: 0 0 24px; }

.hero { display: flex; gap: 32px; align-items: flex-start; }
.poster { width: 210px; height: auto; flex: none; border-radius: 14px; box-shadow: 0 16px 40px -12px #0009; }
.facts { color: var(--fg-muted); font-weight: 500; margin: 0 0 12px; }
.status {
  display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-fg); font-size: 13px; font-weight: 600;
}
.summary { max-width: 680px; margin: 0 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.seasons, .cast { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.seasons { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.seasons li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; color: var(--fg-muted); }
.seasons b { color: var(--fg); }
.cast { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cast li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--fg-muted); }
.cast b { color: var(--fg); }
.cast img, .avatar-blank { width: 56px; height: 56px; flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-2); }

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px 16px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.grid img, .poster-blank { width: 100%; aspect-ratio: 210 / 295; height: auto; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.grid .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.grid .year { font-size: 13px; color: var(--fg-subtle); }
.grid a:hover .name { color: var(--accent-fg); }
.more { margin-top: 20px; font-weight: 600; }
.more a { color: var(--accent-fg); text-decoration: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chips a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; text-decoration: none; }
.chips a[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; color: var(--fg-muted); font-size: 14px; }
.pager a { font-weight: 600; color: var(--accent-fg); text-decoration: none; }

.cta { margin-top: 56px; padding: 32px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.cta h2 { margin-top: 0; }
.cta p { color: var(--fg-muted); max-width: 520px; margin: 0 auto 20px; }

.foot { padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--line); color: var(--fg-muted); font-size: 14px; }
.foot .genres { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot .genres a, .foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }
.credit { color: var(--fg-subtle); }
.credit a { text-decoration: underline; }

.missing { text-align: center; padding: 15vh 0; }
.missing p { color: var(--fg-muted); font-size: 18px; margin: 0 0 24px; }

@media (max-width: 640px) {
  .top nav a:not(.button) { display: none; }
  .hero { flex-direction: column; gap: 20px; }
  .poster { width: 150px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px; }
  .cta { padding: 24px 16px; }
}
