/* macguffans shared styles */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #2e2117;
  --text: #f4ede4;
  --muted: #8a8178;
  --accent: #c9a96b;
  --accent-hover: #d4b87a;
  --card: #3a2b1f;
  --border: #4a3a2b;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

button {
  font-family: var(--sans);
  font-size: 0.95rem;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

/* --- Film grain overlay (shared across all pages) --- */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  opacity: 0.06;
  mix-blend-mode: overlay;
}

/* --- Shared page header (films.html, about.html, watch.html) --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.site-header .wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-header nav a { color: var(--muted); }
.site-header nav a:hover { color: var(--text); }

/* --- Shared footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 4rem;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

.site-footer .sep { margin: 0 0.5rem; opacity: 0.5; }

/* --- Shared signup section (Tally form embed) ---
   Used on index.html and about.html. Visually quiet by design:
   no card, no border, no background block — the page background
   carries through and the form (set to transparent in the Tally
   dashboard) blends in. Heading + one sentence + iframe. */
.signup-section {
  width: 100%;
  max-width: 520px;
  margin: 4rem auto 0;
  text-align: center;
}

.signup-section h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.signup-section p {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.tally-embed-wrap {
  width: 100%;
}

.tally-embed-wrap iframe {
  width: 100%;
  border: 0;
  display: block;
  background: transparent;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 2px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--bg); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   INDEX (homepage)
   ========================================================= */
body.page-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 2rem 1.5rem;
  overflow-x: hidden;
}

.page-index main {
  /* margin: auto 0 vertically centers main when there's spare space
     and collapses to 0 when content (hero + signup section) fills
     the viewport, so the page scrolls naturally on shorter screens
     instead of clipping content. */
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
  width: 100%;
  z-index: 1;
}

.page-index h1 {
  font-family: var(--serif);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.page-index .tagline {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.5rem;
}

.page-index .description {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 52ch;
  margin-top: 2rem;
  opacity: 0.85;
}

.page-index .cta {
  display: flex;
  gap: 0.75rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.page-index .site-footer {
  /* No longer fixed — flows after main so the signup section can
     scroll into view without being covered by a pinned footer. */
  border-top: none;
  margin-top: 3rem;
  padding: 1.5rem;
}

@media (max-width: 520px) {
  .page-index .cta { flex-direction: column; width: 100%; max-width: 300px; }
  .page-index .cta .btn { width: 100%; }
}

/* =========================================================
   FILMS (catalog)
   ========================================================= */
.page-films main,
.page-about main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
}

.film-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 900px) {
  .film-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .film-grid { grid-template-columns: 1fr; }
}

.film-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  color: var(--text);
  text-decoration: none;
}

/* Available (clickable) cards: anchor tag with pointer + hover elevation. */
a.film-card {
  cursor: pointer;
}

a.film-card:hover,
a.film-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  outline: none;
}

a.film-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(201, 169, 107, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

a.film-card:hover h2,
a.film-card:focus-visible h2 {
  color: var(--accent);
}

/* Unavailable cards render as divs — no pointer, dimmed, not interactive. */
.film-card.unavailable {
  cursor: default;
  opacity: 0.75;
}

/* Small inline banner above the grid for redirect notices from watch.html. */
.catalog-error {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
  border-radius: 2px;
}

.film-poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #000;
  overflow: hidden;
}

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

.coming-soon-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(20, 17, 15, 0.9);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--accent);
}

/* Sound/silent badge — sits in the top-right so it can't collide with
   the coming-soon badge in the top-left. Two color variants that are
   visually distinct but both restrained + on-brand. */
.sound-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(20, 17, 15, 0.9);
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.55rem;
  border-radius: 1px;
}

.sound-badge.sound-sound {
  color: var(--accent);
  border: 1px solid rgba(201, 169, 107, 0.45);
}

.sound-badge.sound-silent {
  color: #a9b7c6;
  border: 1px solid rgba(169, 183, 198, 0.4);
}

/* Catalog page header: title on the left, filter inline on the right.
   On narrower screens the filter wraps below the title text. */
.page-films .page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.75rem 3rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}

.page-header-text {
  min-width: 0;
  flex: 1 1 auto;
}

/* Filter lives inside .page-header now — no margin / border-bottom. */
.catalog-filter {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  border: none;
  padding-bottom: 0.35rem; /* nudge the baseline toward the h1's descender */
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  padding: 0.7rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  min-width: 5rem;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* Active state: filled accent pill, strong contrast against the
   outlined inactive siblings so the current selection reads instantly. */
.filter-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.filter-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg);
}

.filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(201, 169, 107, 0.45);
}

@media (max-width: 600px) {
  .page-films .page-header { align-items: flex-start; }
  .filter-btn { flex: 1 1 auto; min-width: 0; padding: 0.7rem 1rem; }
}

/* Catalog sections — each with a Fraunces header and muted subtitle. */
.catalog-section {
  margin-bottom: 3.5rem;
}

.catalog-section[hidden] {
  display: none;
}

.catalog-section .section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.catalog-section .section-header h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text);
}

.section-subtitle {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.film-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.film-card h2 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.film-card .film-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.film-card .editorial-note {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.85;
}

.catalog-note {
  margin-top: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.catalog-note a { color: var(--accent); }

/* =========================================================
   ABOUT
   ========================================================= */
.page-about main {
  max-width: 680px;
}

.page-about .hero {
  margin-bottom: 3rem;
}

.page-about .hero h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.page-about .hero .tagline {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.page-about section {
  margin-bottom: 2.5rem;
}

.page-about h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  color: var(--text);
}

.page-about p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  opacity: 0.9;
  margin-bottom: 1rem;
}

.page-about p + p { margin-top: 0; }

.page-about .contact a { color: var(--accent); }
.page-about .contact a:hover { color: var(--accent-hover); }

/* =========================================================
   WATCH (player)
   ========================================================= */
body.page-watch {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow: hidden;
}

.watch-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 5;
}

.watch-header .wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  justify-self: start;
}

.watch-header .film-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  justify-self: center;
  text-align: center;
  padding: 0 1rem;
}

.watch-header .back-link {
  font-size: 0.8rem;
  color: var(--muted);
  justify-self: end;
}

.watch-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 900px) {
  body.page-watch { overflow: auto; }
  .watch-layout { grid-template-columns: 1fr; overflow: visible; }
}

/* --- Player column --- */
.player-column {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.player-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .player-column { aspect-ratio: 16 / 9; height: auto; }
  .player-wrap { aspect-ratio: 16 / 9; height: auto; }
}

.player-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.video-unavailable {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--serif);
  gap: 0.5rem;
  padding: 2rem;
  text-align: center;
  background: #0a0907;
}

/* The `hidden` attribute's UA default is `[hidden] { display: none }`,
   which has lower specificity than `.video-unavailable` above and loses
   the cascade. Explicit class+attribute selector wins the specificity
   fight so `videoUnavailable.hidden = true` actually hides the overlay. */
.video-unavailable[hidden] {
  display: none;
}

.video-unavailable .title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.video-unavailable .hint {
  font-size: 0.85rem;
  font-family: var(--sans);
  max-width: 36ch;
  line-height: 1.5;
}

/* Auto-recovery toast — shown briefly after the player rediscovers a working
   video URL via the archive.org fallback flow. Lives in the same player-wrap
   stacking context as the controls so it sits over the video at the bottom. */
.recovery-toast {
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  z-index: 4;
  padding: 0.5rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(20, 14, 10, 0.92);
  border: 1px solid var(--accent);
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}
.recovery-toast.visible { opacity: 1; }
.recovery-toast[hidden] { display: none; }

/* --- Initial-state play overlay ---
   Big centered play button shown on top of the poster frame the very
   first time a film loads, before the user has interacted. Click
   anywhere in the overlay (button or surrounding video frame) starts
   playback; the overlay then fades out and never returns this session.
   The button is the visual affordance, but the whole element fills
   the player-wrap so the entire video frame is the click target. */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: 4;
  opacity: 1;
  transition: opacity 0.25s ease-out;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.play-overlay[hidden] { display: none; }
.play-overlay.fading { opacity: 0; pointer-events: none; }

.play-overlay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(20, 17, 15, 0.85);            /* #14110f at 85% */
  border: 1px solid rgba(201, 169, 107, 0.30);   /* #c9a96b at 30% */
  color: #f4ede4;
  box-shadow: 0 6px 28px -8px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease-out, border-color 0.15s ease-out, background 0.15s ease-out;
  pointer-events: none; /* clicks pass through to the parent button */
}
.play-overlay-btn svg {
  width: 32px;
  height: 32px;
  display: block;
  /* The play triangle is left-heavy (base on the left edge); offset
     it right by a couple of pixels so the visual mass is centered. */
  margin-left: 4px;
}
.play-overlay:hover .play-overlay-btn,
.play-overlay:focus-visible .play-overlay-btn {
  transform: scale(1.05);
  border-color: rgba(201, 169, 107, 0.60);
  background: rgba(20, 17, 15, 0.92);
}
.play-overlay:focus-visible { outline: none; }

@media (max-width: 600px) {
  .play-overlay-btn {
    width: 64px;
    height: 64px;
  }
  .play-overlay-btn svg {
    width: 26px;
    height: 26px;
    margin-left: 3px;
  }
}

/* --- Player controls --- */
.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 1.25rem 0.9rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  opacity: 1;
  transition: opacity 0.25s;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text);
  z-index: 3;
}

.player-controls.hidden { opacity: 0; pointer-events: none; }

.scrubber {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.18);
  position: relative;
  cursor: pointer;
  border-radius: 2px;
}

.scrubber .fill {
  position: absolute;
  inset: 0;
  right: auto;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
}

.scrubber .thumb {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  left: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}

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

.control-row .spacer { flex: 1; }

.control-btn {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.15s, color 0.15s;
}

.control-btn:hover { opacity: 1; color: var(--accent); }

.control-btn svg { width: 18px; height: 18px; display: block; }

.time-display {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.85;
  white-space: nowrap;
}

.volume-wrap { display: flex; align-items: center; gap: 0.4rem; }
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  padding: 0.35rem 0.6rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover { color: var(--text); border-color: var(--muted); }
.mode-btn.active { color: var(--accent); border-color: var(--accent); }

/* --- Sidebar --- */
.sidebar {
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

@media (max-width: 900px) {
  .sidebar { border-left: none; border-top: 1px solid var(--border); height: auto; min-height: 60vh; }
}

.sidebar.hidden-mode {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .sidebar.hidden-mode { transform: none; opacity: 1; pointer-events: auto; }
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 4rem;
  min-height: 0;
  scroll-behavior: smooth;
}

/* Mobile-only single-annotation card. Hidden entirely on desktop/tablet;
   the @media (max-width: 600px) block further down promotes it to a
   flex column, and hides .sidebar-scroll in the same block. */
.mobile-ann { display: none; }

.scene-header {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 1.25rem 0 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.scene-header:first-child { margin-top: 0; }

.scene-header .scene-time {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.scene-summary {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.annotation {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  border-radius: 2px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.annotation.cat-reference { border-left-color: #7a9cc6; }
.annotation.cat-science { border-left-color: #6bc97a; }
.annotation.cat-history { border-left-color: #c9a96b; }
.annotation.cat-production { border-left-color: #c96b8a; }
.annotation.cat-craft { border-left-color: #b07ac9; }
.annotation.cat-theme { border-left-color: #c9c16b; }

.annotation.current {
  border-left-width: 5px;
  background: #24201c;
}

.annotation.collapsed .ann-body,
.annotation.collapsed .ann-footer { display: none; }

.annotation.collapsed {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  cursor: pointer;
}

.annotation.collapsed:hover { border-color: var(--muted); }

.ann-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.annotation.collapsed .ann-header { margin-bottom: 0; }

.ann-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.005em;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.ann-label {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  background: var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 1px;
  flex-shrink: 0;
}

.ann-label.confidence-low { background: #3a2020; color: #c97a6b; }
.ann-label.confidence-medium { background: #2d2a1f; color: var(--muted); }
.ann-label.confidence-high { background: #1e2a1e; color: #7ab07a; }

.ann-body {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text);
  opacity: 0.9;
}

.ann-body.spoiler-hidden {
  filter: blur(6px);
  user-select: none;
  cursor: pointer;
}

.spoiler-reveal {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.spoiler-reveal:hover { color: var(--accent); }

.ann-footer {
  margin-top: 0.7rem;
  display: none;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.review-mode .ann-footer { display: flex; }

.review-btn {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.3rem 0.55rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.review-btn:hover { color: var(--text); border-color: var(--muted); }

.annotation.review-keep { border-color: #6bc97a; }
.annotation.review-cut { border-color: #c96b6b; }
.annotation.review-cut .ann-title,
.annotation.review-cut .ann-body { text-decoration: line-through; opacity: 0.55; }
.annotation.review-rewrite { border-color: var(--accent); }

.review-keep .review-btn[data-action="keep"] { background: #1e2a1e; color: #7ab07a; border-color: #6bc97a; }
.review-cut .review-btn[data-action="cut"] { background: #2a1e1e; color: #c97a7a; border-color: #c96b6b; }
.review-rewrite .review-btn[data-action="rewrite"] { background: #2a251a; color: var(--accent); border-color: var(--accent); }

.rewrite-field {
  margin-top: 0.5rem;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 0.5rem 0.6rem;
  border-radius: 2px;
  resize: vertical;
  min-height: 3rem;
  outline: none;
}

.rewrite-field:focus { border-color: var(--accent); }

.review-legend {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.6;
  border-radius: 2px;
  z-index: 20;
  max-width: 220px;
}

.review-legend strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.review-legend kbd {
  background: var(--border);
  color: var(--text);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  font-size: 0.68rem;
  margin-right: 0.2rem;
}

.review-legend .export-btn {
  margin-top: 0.6rem;
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: lowercase;
  cursor: pointer;
  border-radius: 2px;
}

.review-legend .export-btn:hover { background: var(--accent-hover); }

.watch-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
}

.watch-error h2 { font-size: 1.4rem; font-weight: 600; color: var(--text); margin-bottom: 0.5rem; }
.watch-error p { font-family: var(--sans); font-size: 0.9rem; max-width: 40ch; }
.watch-error a { color: var(--accent); margin-top: 1rem; }

.sidebar-empty {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

/* =========================================================
   RESPONSIVE OVERRIDES
   =========================================================
   Mobile (≤600px) overrides phones; tablet bracket (601–900px)
   handles iPad portrait and similar. Desktop layout above 900px
   is untouched. The existing layout-stacking media queries
   (.film-grid, .watch-layout, .cta) already cover the structural
   reflow; everything below is touch-target sizing, padding
   tightening, and tucking away controls that don't make sense
   on a phone. */

/* --- Phones (≤600px) --- */
@media (max-width: 600px) {

  /* Shared site header (films, about) — tighten padding so the row
     doesn't dominate the top of a small screen. wordmark + 2-link
     nav still fits horizontally at 375px. */
  .site-header {
    padding: 1rem 1.25rem;
  }
  .site-header .wordmark { font-size: 1.2rem; }
  .site-header nav { gap: 1rem; }
  .site-header nav a { font-size: 0.9rem; }

  /* Page main — slightly tighter horizontal padding for more
     usable card width on the catalog and more breathing room on
     about's body copy. */
  .page-films main,
  .page-about main {
    padding: 2rem 1.25rem;
  }

  /* --- Signup section --- */
  .signup-section {
    margin-top: 2.5rem;
  }
  .signup-section h2 { font-size: 1.3rem; }
  .signup-section p { font-size: 0.9rem; }

  /* --- Films catalog --- */

  .page-header { margin-bottom: 2rem; }
  .page-films .page-header {
    gap: 1.25rem;
    margin-bottom: 2rem;
  }

  /* Filter buttons: minimum 44px touch target (currently 41px),
     plus a slightly bigger font so the label isn't a squint. The
     existing rule already gives them flex:1 on small widths so
     they share the row evenly. */
  .filter-btn {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    min-height: 44px;
  }

  .catalog-section { margin-bottom: 2.5rem; }
  .catalog-section .section-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    gap: 0.75rem;
  }
  .catalog-section .section-header h2 { font-size: 1.6rem; }

  .film-grid { gap: 1.25rem; }
  .film-card-body { padding: 1rem 1rem 1.1rem; }
  .film-card h2 { font-size: 1.25rem; }
  .film-card .editorial-note { font-size: 0.85rem; }

  .catalog-note { margin-top: 2rem; padding: 1.5rem 0; }

  /* --- About --- */

  .page-about .hero { margin-bottom: 2rem; }
  .page-about .hero .tagline { font-size: 1.15rem; }
  .page-about section { margin-bottom: 2rem; }
  .page-about h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }
  .page-about p { font-size: 1rem; line-height: 1.7; }

  /* --- Watch page (mobile layout, ≤600px) ---
     Completely different structure from desktop:
       • Video fixed at 45vh (not aspect-ratio) so it takes meaningful
         screen real estate.
       • Below the video, ONE annotation card at a time instead of the
         scrollable sidebar list. prev/next arrows for multi-annotation
         scenes. Card updates automatically as the playhead crosses
         scene boundaries.
       • Full-width flex column, no grid — the previous grid layout
         was overlapping the sidebar onto the video area.
   */

  /* Kill the desktop grid; single-column flex with scrollable body */
  body.page-watch { overflow: auto; }
  .watch-layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  /* Video: fixed 45vh, full width, not aspect-ratio driven */
  .player-column {
    flex: 0 0 auto;
    width: 100%;
    height: 45vh;
    min-height: 45vh;
    aspect-ratio: auto;
  }
  .player-wrap {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
  .player-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Sidebar: the remaining space below the video, scrollable for the
     single card + prev/next nav */
  .sidebar {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    width: 100%;
    overflow-y: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  /* Hide the desktop scrollable list on mobile, show the single-card */
  .sidebar-scroll { display: none; }
  .mobile-ann {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1rem 2rem;
    gap: 1rem;
  }

  /* Scene header above the card */
  .mobile-ann-scene-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .mobile-ann-scene-location {
    font-family: var(--serif);
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  .mobile-ann-scene-time {
    font-family: var(--sans);
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
    color: var(--muted);
  }
  .mobile-ann-scene-summary {
    font-size: 0.82rem;
    color: var(--muted);
    font-style: italic;
    line-height: 1.55;
    margin-top: 0.3rem;
  }

  /* Empty state when a scene has no annotations */
  .mobile-ann-empty {
    font-size: 0.9rem;
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 1.1rem;
    border: 1px dashed var(--border);
    border-radius: 2px;
  }

  /* Prev/next nav */
  .mobile-ann-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding-top: 0.25rem;
  }
  .mobile-ann-nav-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1.2rem;
    width: 44px;
    height: 44px;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-ann-nav-btn:disabled { opacity: 0.3; cursor: default; }
  .mobile-ann-nav-btn:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
  .mobile-ann-counter {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    text-align: center;
  }

  /* Header stays 2-column on mobile (drop the film-title) */
  .watch-header {
    grid-template-columns: 1fr auto;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
  .watch-header .wordmark {
    font-size: 1.1rem;
    justify-self: start;
  }
  .watch-header .film-title { display: none; }
  .watch-header .back-link {
    font-size: 0.85rem;
    white-space: nowrap;
    justify-self: end;
  }

  /* Player controls: tighter padding + bigger touch targets. Keep all
     the existing buttons (play / time / mute / mode toggles / fullscreen)
     — crowded but functional. The volume slider is dropped because it's
     a fiddly target and phones have hardware volume buttons. */
  .player-controls {
    padding: 0.75rem 0.85rem 0.85rem;
    gap: 0.6rem;
  }
  .player-controls .control-row { gap: 0.4rem; }
  .player-controls .control-btn {
    padding: 0.55rem 0.55rem;
    min-width: 44px;
    min-height: 44px;
    opacity: 1;
  }
  .player-controls .control-btn svg { width: 22px; height: 22px; }
  .player-controls .volume-slider { display: none; }
  .player-controls .volume-wrap { gap: 0; }
  .player-controls .mode-btn {
    padding: 0.5rem 0.55rem;
    font-size: 0.72rem;
    min-height: 44px;
    letter-spacing: 0;
  }

  /* Scrubber: slightly fatter */
  .scrubber { height: 6px; }
  .scrubber .thumb { width: 16px; height: 16px; }

  .time-display { font-size: 0.85rem; }

  /* Annotation card (reused inside .mobile-ann-body) */
  .mobile-ann-body .annotation {
    padding: 1rem 1rem 1.1rem;
    margin-bottom: 0;
  }
  .mobile-ann-body .ann-title { font-size: 1rem; }
  .mobile-ann-body .ann-body { font-size: 0.92rem; line-height: 1.65; }

  .site-footer { padding: 1.5rem 1rem; margin-top: 2rem; }
}

/* --- Tablet (601–900px) ---
   The film grid already drops to 2 columns and the watch layout
   already stacks the sidebar below the video at this width. The
   only things that need attention are touch-target sizing and
   slightly tighter header padding. */
@media (max-width: 900px) and (min-width: 601px) {
  .site-header { padding: 1.25rem 1.5rem; }

  .filter-btn {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
  }

  .player-controls .control-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 0.5rem 0.6rem;
    opacity: 1;
  }
  .player-controls .control-btn svg { width: 20px; height: 20px; }

  .player-controls .mode-btn {
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
    min-height: 40px;
  }
}

/* iOS Safari auto-zooms when a form input has font-size <16px and
   the user taps it. Bump all form inputs to 16px on small viewports
   so the zoom never fires. (Buttons aren't affected.) */
@media (max-width: 900px) {
  input[type="text"], input[type="email"], input[type="search"],
  input[type="number"], input[type="tel"], input[type="url"],
  input[type="password"], textarea, select {
    font-size: 16px;
  }
}
