/* ==========================================================================
   WatchOrder - design tokens
   Warm, dark cinema palette; brass gold + teal as two functional accents
   (gold = primary/recommended, teal = secondary/alternative), rather than
   a single decorative accent on a neutral dark background.
   ========================================================================== */

:root {
  --bg: #17120f;
  --surface: #221b17;
  --surface-2: #2b221d;
  --text: #ede6de;
  --text-muted: #b6a99b;
  --border: #3a2f28;
  --gold: #c99a3f;
  --gold-strong: #e0b563;
  --gold-text-on-surface: #e7c374;
  --teal: #4a8478;
  --teal-strong: #64a596;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --radius-sm: 4px;
  --radius-md: 8px;
  --font-display: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container-w: 1160px;
}

html[data-theme="light"] {
  --bg: #f7f3ee;
  --surface: #ffffff;
  --surface-2: #f0e9e0;
  --text: #241d17;
  --text-muted: #6b5d50;
  --border: #e3d9cb;
  --gold: #9c6f18;
  --gold-strong: #7a5711;
  --gold-text-on-surface: #7a5711;
  --teal: #2c655a;
  --teal-strong: #1f4d44;
  --shadow: 0 1px 3px rgba(30, 20, 10, 0.12);
}

@media (prefers-color-scheme: light) {
  html[data-theme="auto"] { color-scheme: light; }
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--text);
}

h1 { font-size: clamp(1.9rem, 1.5rem + 1.8vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem); margin-top: 2.2em; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--gold-text-on-surface); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--gold-strong); }
img { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0; top: -100%; background: var(--gold);
  color: #1a1512; padding: 0.6em 1em; z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.header-inner, .footer-inner, main, .footer-bottom {
  max-width: var(--container-w);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

main { padding-top: 2rem; padding-bottom: 4rem; min-height: 60vh; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.logo .logo-accent { color: var(--gold); }

.main-nav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
}
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); }

.search-form {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.search-form input {
  border: none; background: transparent; color: var(--text);
  padding: 0.45em 0.6em; width: 12rem; font-family: var(--font-body); font-size: 0.9rem;
}
.search-form input:focus { outline: none; }
.search-form button {
  background: transparent; border: none; color: var(--text-muted);
  padding: 0 0.6em; cursor: pointer; display: flex; align-items: center;
}
.search-form button:hover { color: var(--gold); }

.theme-toggle, .nav-toggle {
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); width: 2.1rem; height: 2.1rem; display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex-shrink: 0;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.nav-toggle { display: none; }
.mobile-nav {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem 1rem;
}
.mobile-nav a { color: var(--text-muted); text-decoration: none; padding: 0.6em 0; }
.mobile-nav.is-open { display: flex; }

@media (max-width: 860px) {
  .main-nav, .search-form { display: none; }
  .nav-toggle { display: flex; }
  .header-inner { gap: 0.75rem; }
  .header-inner .logo { flex: 1; }
}

/* ==========================================================================
   Hero (homepage)
   ========================================================================== */

.hero {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.hero-text { flex: 1; min-width: 0; }
.hero-text p { color: var(--text-muted); font-size: 1.05rem; }

.search-form-hero, .search-form-full .search-input-row {
  display: flex; gap: 0.5rem; max-width: 30rem; margin-top: 1.5rem;
}
.search-form-hero input, .search-input-row input {
  flex: 1; padding: 0.7em 0.9em; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--font-body); font-size: 1rem;
}
.search-form-hero button, .search-page button {
  padding: 0.7em 1.2em; border-radius: var(--radius-sm); border: none;
  background: var(--gold); color: #1a1512; font-weight: 700; cursor: pointer;
}
.search-form-hero button:hover { background: var(--gold-strong); }

.hero-sequence {
  display: flex; align-items: center; flex-shrink: 0;
}
.seq-dot {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px solid var(--gold);
  color: var(--gold); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; flex-shrink: 0;
}
.seq-line { width: 2rem; height: 2px; background: var(--border); }

@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: stretch; }
  .hero-sequence { display: none; }
}

/* ==========================================================================
   Category tiles (homepage)
   ========================================================================== */

.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 3.5rem;
}
.category-tile {
  display: flex; flex-direction: column; gap: 0.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem; text-decoration: none; color: var(--text);
}
.category-tile:hover { border-color: var(--gold); }
.category-tile-label { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.category-tile-count { color: var(--text-muted); font-size: 0.85rem; }

.section-heading-row { display: flex; align-items: baseline; justify-content: space-between; }

/* ==========================================================================
   Card grid
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden;
}
.card:hover { border-color: var(--gold); }
.card-media { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); overflow: hidden; }
.card-media .poster { width: 100%; height: 100%; object-fit: cover; }
.card-flag {
  position: absolute; top: 0.5rem; right: 0.5rem; background: var(--gold); color: #1a1512;
  font-size: 0.72rem; font-weight: 700; padding: 0.2em 0.6em; border-radius: 999px;
}
.card-body { padding: 0.85rem 1rem 1.1rem; }
.card-eyebrow { font-size: 0.78rem; color: var(--text-muted); }
.card-body h3 { font-size: 1.02rem; margin: 0.25em 0 0.35em; }
.card-body p { font-size: 0.9rem; color: var(--text-muted); margin: 0; max-width: none; }

.empty-state { color: var(--text-muted); padding: 2rem 0; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  font-size: 0.92rem;
}
.pagination a { text-decoration: none; color: var(--text); }
.pagination .disabled { color: var(--text-muted); opacity: 0.5; }
.pagination .page-status { color: var(--text-muted); }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem;
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--gold-text-on-surface); }
.breadcrumbs [aria-current="page"] { color: var(--text); }
.crumb-sep { margin: 0 0.5em; opacity: 0.5; }

/* ==========================================================================
   Listing pages
   ========================================================================== */

.listing-header { margin-bottom: 0.5rem; }
.listing-intro { color: var(--text-muted); }
.listing-count { color: var(--text-muted); font-size: 0.85rem; }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-block; font-size: 0.78rem; padding: 0.25em 0.7em; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  margin-right: 0.4em; font-family: var(--font-body); font-weight: 500;
}
.badge-gold { background: rgba(201, 154, 63, 0.16); border-color: var(--gold); color: var(--gold-text-on-surface); }
.badge-live { background: rgba(74, 132, 120, 0.18); border-color: var(--teal); color: var(--teal-strong); }

/* ==========================================================================
   Guide (post) page
   ========================================================================== */

.guide-hero {
  display: flex; gap: 2rem; margin-bottom: 1.5rem; padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.guide-hero .poster {
  width: 306px; flex-shrink: 0; border-radius: var(--radius-md); box-shadow: var(--shadow);
  aspect-ratio: 2 / 3; object-fit: cover; background: var(--surface-2);
}
.guide-meta { min-width: 0; }
.guide-badges { margin-bottom: 0.6rem; }
.guide-summary { color: var(--text-muted); font-size: 1.05rem; }
.guide-updated { color: var(--text-muted); font-size: 0.82rem; }

@media (max-width: 640px) {
  .guide-hero { flex-direction: column; }
  .guide-hero .poster { max-width: 306px; }
}

.order-toc {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem;
}
.order-toc a {
  text-decoration: none; font-size: 0.88rem; padding: 0.4em 0.9em; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted);
}
.order-toc a:hover { color: var(--text); border-color: var(--gold); }

.watch-order {
  border-left: 3px solid var(--border); padding-left: 1.25rem; margin: 2.5rem 0;
}
.watch-order.accent-gold { border-left-color: var(--gold); }
.watch-order.accent-teal { border-left-color: var(--teal); }

.watch-order-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.watch-order-heading h2 { margin-top: 0; }
.order-progress {
  font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}

.order-group-heading {
  font-family: var(--font-display); font-size: 1rem; color: var(--text-muted);
  margin: 1.5em 0 0.5em; text-transform: none;
}

.order-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.order-list li {
  display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.order-list li:last-child { border-bottom: none; }
.watched-check {
  margin-top: 0.35rem; width: 1.05rem; height: 1.05rem; flex-shrink: 0; cursor: pointer;
  accent-color: var(--gold);
}
.order-num {
  font-family: var(--font-display); font-weight: 700; color: var(--gold-text-on-surface);
  min-width: 1.6rem; text-align: right; flex-shrink: 0; font-size: 1.05rem;
}
.order-info { display: flex; flex-direction: column; min-width: 0; }
.order-title { font-weight: 600; }
.order-meta { color: var(--text-muted); font-size: 0.85rem; }
.order-note { color: var(--text-muted); font-size: 0.85rem; font-style: italic; margin-top: 0.15em; }

.order-list li.is-watched { opacity: 0.55; }
.order-list li.is-watched .order-title { text-decoration: line-through; }

.guide-description, .guide-notes { max-width: 68ch; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2rem 0; }
.tag-pill {
  text-decoration: none; font-size: 0.85rem; padding: 0.35em 0.85em; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.tag-pill:hover { color: var(--text); border-color: var(--gold); }
.tag-pill-lg { font-size: 0.95rem; padding: 0.5em 1em; }
.tag-pill-lg span { color: var(--text-muted); margin-left: 0.35em; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }

.related-guides { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }

.correction-link { font-size: 0.85rem; }
.correction-link a { color: var(--text-muted); }
.correction-link a:hover { color: var(--gold-text-on-surface); }

/* ==========================================================================
   Search page
   ========================================================================== */

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.filter-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 0.4em 1em; border-radius: 999px; cursor: pointer; font-family: var(--font-body); font-size: 0.88rem;
}
.filter-chip.is-active { border-color: var(--gold); color: var(--gold-text-on-surface); background: rgba(201, 154, 63, 0.1); }
.search-status { color: var(--text-muted); font-size: 0.88rem; min-height: 1.4em; }

/* ==========================================================================
   Prose pages (about, 404)
   ========================================================================== */

.prose-page { max-width: 68ch; }
.error-page { text-align: left; padding: 3rem 0; }
.button-link {
  display: inline-block; margin-top: 1.25rem; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); padding: 0.55em 1.2em; border-radius: var(--radius-sm);
}
.button-link:hover { border-color: var(--gold); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--border); margin-top: 4rem; padding-top: 2.5rem; }
.footer-inner { display: flex; gap: 3rem; flex-wrap: wrap; padding-bottom: 2rem; }
.footer-col { min-width: 160px; }
.footer-col h2 { font-size: 0.85rem; text-transform: none; color: var(--text-muted); margin-bottom: 0.6em; font-family: var(--font-body); font-weight: 600; }
.footer-col a { display: block; color: var(--text-muted); text-decoration: none; padding: 0.2em 0; font-size: 0.92rem; }
.footer-col a:hover { color: var(--text); }
.footer-col p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.5em; }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 1.25rem; padding-bottom: 2rem;
  color: var(--text-muted); font-size: 0.8rem;
}
.footer-bottom p { margin: 0.2em 0; max-width: none; }

/* ==========================================================================
   Back to top
   ========================================================================== */

.back-to-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem; width: 2.6rem; height: 2.6rem;
  border-radius: 50%; background: var(--gold); color: #1a1512; border: none; cursor: pointer;
  display: none; align-items: center; justify-content: center; box-shadow: var(--shadow); z-index: 30;
}
.back-to-top.is-visible { display: flex; }

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .site-header, .site-footer, .back-to-top, .order-toc, .search-form, .theme-toggle, .nav-toggle { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}
