/* spooky — restrained modern, subtle X-Files signals (TASKS H-01).
   Original CSS only; no imagery. Palette audited in tools/audit_colors.py:
   every text pair ≥ 7.4:1 on its background (WCAG AA, and AAA for body). */

:root {
  --bg: #111417;
  --bg-raised: #1a2019;
  --fg: #f1f5f2;
  --fg-soft: #cbd6cf;
  --fg-muted: #9aa8a0;
  --border: #26302b;
  --accent: #7fd4a0;
  --link: #8fc7ff;
  --contested: #f2b84b;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

a {
  color: var(--link);
}

/* Keyboard navigation (H-04): one visible, consistent focus style. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Screen-reader-only content (H-05). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.site-header,
main,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 36px 0 6px;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-mark {
  width: 52px;
  height: 52px;
  flex: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  font-weight: 750;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 760px;
  color: var(--fg-soft);
  line-height: 1.55;
}

.site-nav {
  display: flex;
  gap: 18px;
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--border);
}

.nav-link {
  color: var(--fg-soft);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.chart-section {
  padding-top: 12px;
}

/* One row of controls above the list: pager, search, toggle, active filters. */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.season-pager {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pager-button {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.pager-button:hover:not(:disabled) {
  border-color: var(--accent);
}

.pager-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager-label {
  min-width: 12ch;
  text-align: center;
  font-weight: 600;
}

.search-input {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  min-width: 200px;
}

.search-input::placeholder {
  color: var(--fg-muted);
}

.filter-chip {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #dce7e0;
}

.clear-filter {
  font-size: 0.9rem;
}

.contested-toggle {
  color: var(--fg-soft);
  font-size: 0.95rem;
}

.contested-toggle input {
  accent-color: var(--contested);
  width: 16px;
  height: 16px;
}

.explorer {
  margin-top: 8px;
}

.table-wrap {
  min-width: 0;
}

/* The episode information sits below the list, full width. */
.detail-below {
  margin-top: 20px;
}

.detail-panel {
  border-top: 1px solid #2c3832;
  padding-top: 18px;
  max-width: 860px;
}

.status-badge {
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  vertical-align: middle;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.status-badge.status-human-reviewed {
  color: var(--accent);
  border-color: var(--accent);
}

.status-badge.status-ai-drafted {
  color: var(--contested);
  border-color: var(--contested);
}

.detail-panel h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.episode-position,
.review-status {
  color: var(--fg-muted);
}

.logline {
  line-height: 1.55;
}

dt {
  color: var(--fg-muted);
  margin-top: 12px;
}

dd {
  margin-left: 0;
}

.detail-links {
  display: flex;
  gap: 14px;
  margin-top: 16px;
}

.source-breakdown {
  border-top: 1px solid #2c3832;
  margin-top: 18px;
  padding-top: 12px;
}

.source-breakdown h3 {
  margin: 0;
  font-size: 1rem;
}

.contested-badge {
  color: var(--contested);
  font-weight: 600;
}

.category-badge {
  color: var(--fg-soft);
}

/* The films card (G-03). */
.films-card {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.films-card h2 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}

.films-note {
  color: var(--fg-muted);
  max-width: 680px;
  margin-top: 4px;
}

.films-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.film-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
}

.film-badges {
  display: inline-flex;
  gap: 12px;
  color: var(--fg-muted);
}

.film-links {
  display: inline-flex;
  gap: 14px;
}

/* The /about view (H-08). */
.about-section {
  max-width: 760px;
  padding-top: 20px;
  line-height: 1.6;
}

.about-section h2 {
  font-size: 1.6rem;
  margin: 0 0 12px;
}

.about-section h3 {
  margin: 26px 0 8px;
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.about-section li {
  margin-bottom: 10px;
}

.site-footer {
  margin-top: 48px;
  padding: 24px 0 36px;
  color: #aeb9b2;
  font-size: 0.86rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}

/* Responsive (H-03): usable at 375px with no horizontal body scroll. */
@media (max-width: 820px) {
  .search-input {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding-top: 20px;
  }

  .site-mark {
    width: 40px;
    height: 40px;
  }

  .site-header,
  main,
  .site-footer {
    width: calc(100% - 24px);
  }
}
