/* ==========================================================================
   HNMovies — Criterion Cinema × Hacker News Editorial Design System
   Zero build-step, WCAG AA contrast in both Dark Theater & Light Archival modes
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-canvas: #0c0b0a;
  --bg-surface: #151311;
  --bg-elevated: #1d1a17;
  --bg-subtle: #25211d;
  --bg-backdrop-glass: rgba(12, 11, 10, 0.86);

  --ink-primary: #f4efe6;
  --ink-secondary: #c5bba9;
  --ink-muted: #9a8f7f;
  --ink-on-accent: #ffffff;

  --border-subtle: rgba(244, 239, 230, 0.09);
  --border-default: rgba(244, 239, 230, 0.15);
  --border-strong: rgba(244, 239, 230, 0.28);

  --accent-hn: #ff6600;
  --accent-hn-hover: #ff7a21;
  --accent-hn-soft: rgba(255, 102, 0, 0.14);
  --accent-gold: #e4b656;
  --accent-gold-soft: rgba(228, 182, 86, 0.14);
  --accent-like: #f0544f;

  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.72);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.36);
}

[data-theme="light"] {
  --bg-canvas: #f6f4ef;
  --bg-surface: #ffffff;
  --bg-elevated: #efece4;
  --bg-subtle: #e5e0d4;
  --bg-backdrop-glass: rgba(246, 244, 239, 0.9);

  --ink-primary: #161412;
  --ink-secondary: #433d36;
  --ink-muted: #5d554b;
  --ink-on-accent: #ffffff;

  --border-subtle: rgba(22, 20, 18, 0.09);
  --border-default: rgba(22, 20, 18, 0.15);
  --border-strong: rgba(22, 20, 18, 0.3);

  --accent-hn: #d44d00;
  --accent-hn-hover: #b84200;
  --accent-hn-soft: rgba(212, 77, 0, 0.1);
  --accent-gold: #8c6007;
  --accent-gold-soft: rgba(140, 96, 7, 0.11);
  --accent-like: #c93530;

  --shadow-modal: 0 24px 60px rgba(22, 20, 18, 0.22);
  --shadow-card: 0 2px 10px rgba(22, 20, 18, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.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;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 999;
  padding: 0.5rem 0.75rem;
  background: var(--accent-hn);
  color: var(--ink-on-accent);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

a {
  color: inherit;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-hn);
  outline-offset: 2px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 0.25rem;
}

/* ==========================================================================
   Site Masthead & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-backdrop-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.brand-monolith {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-hn);
  color: #ffffff;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  border-radius: 0.25rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.search-cluster {
  position: relative;
  flex: 1 1 420px;
  max-width: 480px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  color: var(--ink-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 2.25rem;
  padding: 0 2.75rem 0 2.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--ink-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

#search-input::placeholder {
  color: var(--ink-muted);
}

#search-input:focus {
  border-color: var(--accent-hn);
  outline: none;
}

.kbd-hint,
.icon-chip {
  position: absolute;
  right: 0.5rem;
}

.icon-chip {
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-ghost {
  height: 2.25rem;
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.btn-ghost:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  color: var(--ink-secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: none;
}

/* Primary Route Tabs */
.primary-nav {
  border-top: 1px solid var(--border-subtle);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  position: relative;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tab:hover {
  color: var(--ink-primary);
}

.nav-tab.active {
  color: var(--ink-primary);
  font-weight: 600;
  border-bottom-color: var(--accent-hn);
}

.nav-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 0.05rem 0.375rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  border: 1px solid var(--border-subtle);
}

.nav-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--accent-hn);
}

/* ==========================================================================
   Filter Deck (HN Vibes + Era + Format + Obscurity Slider)
   ========================================================================== */

.filter-deck {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.filter-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.vibe-scroll {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.125rem;
}

.vibe-scroll::-webkit-scrollbar {
  display: none;
}

.vibe-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-canvas);
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.14s ease;
}

.vibe-pill:hover {
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.vibe-pill.active {
  background: var(--accent-hn);
  border-color: var(--accent-hn);
  color: #ffffff;
}

.vibe-pill .vibe-cnt {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  opacity: 0.8;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.segmented-group {
  display: inline-flex;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  padding: 0.125rem;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--ink-primary);
  font-weight: 600;
}

.control-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.control-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.control-select {
  height: 1.875rem;
  padding: 0 0.5rem;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  font-size: 0.78rem;
  color: var(--ink-primary);
  cursor: pointer;
}

.gem-slider-wrap {
  margin-left: auto;
  background: var(--bg-canvas);
  border: 1px solid var(--border-default);
  border-radius: 0.375rem;
  padding: 0.25rem 0.625rem;
  gap: 0.625rem;
}

.mono-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--accent-gold);
  font-weight: 600;
}

#obscurity-slider {
  width: 6.5rem;
  accent-color: var(--accent-hn);
  cursor: pointer;
}

.btn-reset {
  border: 0;
  background: transparent;
  color: var(--accent-hn);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
}

.btn-reset:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Main Container, Telemetry Banner & Editorial Shelves
   ========================================================================== */

.main-container {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.archive-ledger {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-hn);
  border-radius: 0.375rem;
}

.ledger-headline {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink-primary);
}

.ledger-headline em {
  color: var(--accent-gold);
  font-style: italic;
}

.ledger-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.ledger-stats strong {
  color: var(--ink-primary);
  font-weight: 600;
}

/* View Header */
.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.view-header h1 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.view-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--ink-secondary);
  max-width: 68ch;
}

.view-meta-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Curated Shelf */
.curated-shelf {
  margin-bottom: 2.25rem;
}

.shelf-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.shelf-title-wrap h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.shelf-desc {
  margin: 0.125rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.shelf-more {
  border: 0;
  background: transparent;
  color: var(--accent-hn);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.25rem 0;
}

.shelf-more:hover {
  text-decoration: underline;
}

.shelf-scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(176px, 196px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

/* Poster Grid */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(182px, 1fr));
  gap: 1.125rem;
}

/* ==========================================================================
   Film Poster Card + Criterion Typographic Fallback Plate
   ========================================================================== */

.film-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.film-card:hover,
.film-card.kbd-selected {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.film-card.kbd-selected {
  outline: 2px solid var(--accent-hn);
  outline-offset: 2px;
}

.card-poster-btn {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  background: var(--bg-elevated);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.card-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.28s ease;
}

.film-card:hover .card-poster-img {
  transform: scale(1.025);
}

/* Bespoke Criterion-inspired Typographic Fallback Cover */
.criterion-fallback {
  width: 100%;
  height: 100%;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(165deg, rgba(255, 102, 0, 0.08) 0%, transparent 52%),
    var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.crit-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 0.375rem;
}

.crit-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-primary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.crit-foot {
  font-size: 0.72rem;
  color: var(--ink-secondary);
}

/* Badges overlaid on poster */
.poster-badges-top {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.rank-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.2rem;
  background: rgba(12, 11, 10, 0.84);
  color: #f4efe6;
  border: 1px solid rgba(244, 239, 230, 0.2);
}

.doc-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.38rem;
  border-radius: 0.2rem;
  background: rgba(255, 102, 0, 0.9);
  color: #ffffff;
}

/* Quick Like / Watchlist floating actions */
.card-quick-actions {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  z-index: 3;
}

.q-btn {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(244, 239, 230, 0.22);
  background: rgba(12, 11, 10, 0.82);
  color: #e6dfd3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.86;
  transition: opacity 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.q-btn:hover {
  opacity: 1;
  background: rgba(22, 20, 18, 0.96);
}

.q-btn.active-like {
  opacity: 1;
  color: #ff6b66;
  border-color: rgba(255, 107, 102, 0.55);
}

.q-btn.active-watch {
  opacity: 1;
  color: #ff8c3a;
  border-color: rgba(255, 140, 58, 0.6);
}

/* Card Body */
.card-body {
  padding: 0.625rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-title-link {
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  font-family: "Newsreader", Georgia, serif;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.24;
  color: var(--ink-primary);
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title-link:hover {
  color: var(--accent-hn);
}

.card-subline {
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-metrics {
  margin-top: auto;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.71rem;
  font-variant-numeric: tabular-nums;
}

.hn-metric {
  color: var(--accent-hn);
  font-weight: 600;
}

.imdb-metric {
  color: var(--accent-gold);
  font-weight: 500;
}

.card-reason {
  font-size: 0.7rem;
  color: var(--ink-secondary);
  background: var(--accent-hn-soft);
  padding: 0.2rem 0.4rem;
  border-radius: 0.2rem;
  line-height: 1.3;
}

.card-mini-spark {
  width: 100%;
  height: 18px;
  margin-top: 0.15rem;
}

.load-more-wrap {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.btn-primary {
  padding: 0.625rem 1.25rem;
  background: var(--accent-hn);
  color: #ffffff;
  border: 0;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hn-hover);
}

/* ==========================================================================
   Empty State & Loading Skeletons
   ========================================================================== */

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(182px, 1fr));
  gap: 1.125rem;
}

.skeleton-card {
  aspect-ratio: 2 / 3.55;
  border-radius: 0.375rem;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  max-width: 540px;
  margin: 2rem auto;
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.4rem;
}

.empty-state p {
  margin: 0 0 1.25rem;
  color: var(--ink-secondary);
  font-size: 0.9rem;
}

/* ==========================================================================
   Film Dossier Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 5, 5, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 920px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  margin: auto 0;
}

.dossier-hero {
  position: relative;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.dossier-backdrop-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 22%;
  opacity: 0.16;
  filter: blur(22px) saturate(1.1);
  transform: scale(1.1);
  pointer-events: none;
}

.dossier-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.125rem;
}

.dossier-spine {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dossier-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.dossier-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
}

.dossier-poster-wrap {
  width: 200px;
  aspect-ratio: 2 / 3;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
}

.dossier-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dossier-title {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.dossier-meta-line {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.dossier-synopsis {
  margin: 0.875rem 0;
  font-size: 0.92rem;
  color: var(--ink-primary);
  line-height: 1.58;
}

.dossier-credits {
  font-size: 0.8125rem;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dossier-credits strong {
  color: var(--ink-muted);
  font-weight: 500;
}

.dossier-vibes {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.vibe-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-hn-soft);
  color: var(--accent-hn);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.dossier-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-action {
  height: 2.25rem;
  padding: 0 0.85rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--ink-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.btn-action:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.btn-action.active-like {
  border-color: var(--accent-like);
  color: var(--accent-like);
}

.btn-action.active-watch {
  border-color: var(--accent-hn);
  color: var(--accent-hn);
}

/* Telemetry + 20-Year Sparkline Strip */
.dossier-telemetry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 1.6fr;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
}

.stat-cell {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.stat-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.stat-value.hn {
  color: var(--accent-hn);
}

.stat-value.gold {
  color: var(--accent-gold);
}

.spark-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.spark-svg {
  width: 100%;
  height: 36px;
  display: block;
}

/* Inline Trailer Box */
.trailer-drawer {
  background: #000000;
  border-bottom: 1px solid var(--border-subtle);
}

.trailer-ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.trailer-ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Verbatim HN Quotes Section */
.dossier-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.section-kicker {
  margin: 0 0 0.875rem;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-kicker span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-muted);
}

.quotes-stack {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.hn-quote-card {
  padding: 0.95rem 1.1rem;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent-hn);
  border-radius: 0.375rem;
}

.quote-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.quote-author {
  color: var(--accent-hn);
  font-weight: 600;
}

.quote-thread-link {
  color: var(--ink-secondary);
  text-decoration: none;
}

.quote-thread-link:hover {
  color: var(--accent-hn);
  text-decoration: underline;
}

.quote-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.58;
  color: var(--ink-primary);
  white-space: pre-line;
}

.spoiler-shield {
  position: relative;
}

.spoiler-shield.shielded .quote-text {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
}

.spoiler-btn {
  margin-top: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 0.25rem;
  color: var(--accent-gold);
  cursor: pointer;
}

/* Paired Films Strip */
.paired-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 0.75rem;
}

/* Methodology / About View */
.prose-article {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  padding: 2rem;
}

.prose-article h1 {
  margin-top: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.9rem;
}

.prose-article h2 {
  margin-top: 1.75rem;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.3rem;
}

.prose-article p,
.prose-article li {
  color: var(--ink-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
}

.prose-article code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  padding: 0.1rem 0.35rem;
  background: var(--bg-elevated);
  border-radius: 0.25rem;
  color: var(--ink-primary);
}

/* Shortcuts Modal */
.shortcuts-sheet {
  max-width: 460px;
  padding: 1.5rem;
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.shortcuts-header h2 {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.35rem;
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--ink-secondary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Responsive Breakpoints (1024px, 768px, 320px+)
   ========================================================================== */

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .search-cluster {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .gem-slider-wrap {
    margin-left: 0;
  }

  .dossier-telemetry {
    grid-template-columns: repeat(2, 1fr);
  }

  .spark-cell {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .shelf-scroller {
    grid-auto-columns: 150px;
    gap: 0.75rem;
  }

  .dossier-main {
    grid-template-columns: 1fr;
  }

  .dossier-poster-wrap {
    width: 140px;
  }

  .dossier-title {
    font-size: 1.55rem;
  }

  .btn-ghost span {
    display: none;
  }

  .btn-ghost {
    padding: 0 0.55rem;
  }

  .brand-sub {
    display: none;
  }

  .prose-article {
    padding: 1.25rem;
  }
}
