/* ==========================================================================
   The Film Examiner — Unified Obsidian & Silver-Nitrate Cinema Palace UI
   Shared tokens, responsive navigation, collection grids, galleries & booths
   ========================================================================== */

:root {
  --bg: #090b10;
  --bg-elevated: #0d111a;
  --card-bg: #121622;
  --card-hover: #171d2c;
  --border: #1e2638;
  --card-border: #1e2638;
  --gold: #f59e0b;
  --gold-bright: #fbbf24;
  --gold-dark: #d97706;
  --teal: #2dd4bf;
  --blue: #38bdf8;
  --green: #22c55e;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  background: radial-gradient(circle at top center, #111625 0%, var(--bg) 52%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.68;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--gold-bright);
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.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:focus {
  position: fixed;
  top: 10px;
  left: 10px;
  width: auto;
  height: auto;
  clip: auto;
  padding: 0.65rem 1rem;
  background: var(--gold);
  color: #090b10;
  font-weight: 800;
  border-radius: var(--radius-sm);
  z-index: 9999;
  text-decoration: none;
}

/* ── Global Header & Mobile Navigation Drawer ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(9, 11, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}

.site-brand-sub {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-left: 1px solid var(--border);
  padding-left: 0.65rem;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.15rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.18s ease;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--gold-bright);
}

.nav-toggle {
  display: none;
  background: var(--card-bg);
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── Main Layout Container ── */
.fe-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.fe-narrow {
  max-width: 1040px;
}

/* ── Buttons & Badges ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dark));
  color: #090b10;
}

.btn-ghost {
  background: #141a29;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.btn-sub {
  background: #192236;
  color: var(--text);
  border: 1px solid #2b3854;
}

.badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.68rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tag-gold, .badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.tag-green, .badge-pd {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.tag-blue, .badge-vault, .badge-aspect {
  background: rgba(56, 189, 248, 0.15);
  color: var(--blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-teal {
  background: rgba(45, 212, 191, 0.15);
  color: var(--teal);
  border: 1px solid rgba(45, 212, 191, 0.32);
}

/* ── Search Box & Sharded Autocomplete ── */
.fe-search-bar {
  position: relative;
  max-width: 720px;
  margin: 1.5rem auto 0;
}

.fe-search-input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  background: #0d111a;
  color: #fff;
  border: 1px solid #2b3854;
  font-size: 1rem;
  font-family: var(--font-body);
}

.fe-search-input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.fe-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #0e131e;
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.78);
  z-index: 250;
  max-height: 410px;
  overflow-y: auto;
  text-align: left;
}

.fe-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.fe-search-item:hover {
  background: #172034;
}

/* ── Sections, Grids & Cards ── */
.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 2.75rem 0 1.1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.section-header, .section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 1.25rem;
}

.fe-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.fe-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: var(--shadow-card);
}

.fe-card-media {
  position: relative;
  height: 225px;
  background: #07090f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fe-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fe-card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.fe-card-title {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.fe-card-meta {
  color: var(--text-muted);
  font-size: 0.84rem;
}

/* ── Tables Responsive Container ── */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

.table-scroll th {
  background: #171d2c;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.8px;
  text-align: left;
  padding: 0.85rem 1rem;
}

.table-scroll td {
  padding: 0.82rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* ── Gallery WIP Comparison Scrubber & Pill Toolbar ── */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0 1.5rem;
}

.filter-pill {
  background: #131927;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.42rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-pill[aria-pressed="true"] {
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold-bright);
  border-color: var(--gold);
}

.wip-compare {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #06080d;
  margin: 1.5rem 0;
}

.wip-compare-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 540px;
  overflow: hidden;
}

.wip-compare-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wip-overlay-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* ── Progressive Pepper Booth Viewport ── */
.pepper-booth-card {
  margin: 2rem 0;
  background: linear-gradient(145deg, #101524, #090b10);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.pepper-booth-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #05070c;
  border: 1px solid var(--border);
}

.pepper-booth-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pepper-booth-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9, 11, 16, 0.92), rgba(9, 11, 16, 0.25));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  gap: 0.65rem;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  background: #07090d;
  border-top: 1px solid var(--border);
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.85rem;
}

.site-footer-links a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 860px) {
  .site-header {
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
  }
  .site-brand-sub {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    gap: 0.75rem;
  }
  .site-nav.is-open {
    display: flex;
  }
  .fe-main {
    padding: 1.25rem 1rem 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .fe-card, .btn {
    transition: none;
  }
  .fe-card:hover, .btn:hover {
    transform: none;
  }
}
