/* mystery.boo &mdash; cinematic investigation
   Palette: navy-metallic | Font: Bitter (slab-serif)
   v2 implementation */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --c-night: #0A1828;
  --c-navy: #1A2838;
  --c-steel: #2A3848;
  --c-silver: #A0A8B0;
  --c-manila: #D8C898;
  --c-red: #C84040;
  --c-moon: #E0E8F0;
  --c-fog: #6A7888;
  --c-circuit: #3A6848;
  --letterbox-h: 8vh;
  --scroll-y: 0px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Bitter', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  background: var(--c-night);
  color: var(--c-silver);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* === Cinematic Letterbox (persistent) === */
.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  height: var(--letterbox-h);
  background: #000;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 0 30px rgba(0,0,0,0.85);
}
.letterbox-top { top: 0; border-bottom: 1px solid rgba(160,168,176,0.05); }
.letterbox-bottom { bottom: 0; border-top: 1px solid rgba(160,168,176,0.05); }

/* === Background gradient (dome) === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, #1A2838 0%, var(--c-night) 70%),
    linear-gradient(180deg, var(--c-night) 0%, #050E1A 100%);
  z-index: -10;
}

/* === Circuit overlay (persistent SVG) === */
.circuit-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  z-index: -2;
  pointer-events: none;
  transition: opacity 600ms ease;
}
body.circuit-active .circuit-overlay { opacity: 0.08; }

/* === Fog layers (parallax) === */
.fog {
  position: fixed;
  inset: -20vh -20vw;
  pointer-events: none;
  z-index: -3;
  will-change: transform;
}
.fog-back {
  background: radial-gradient(ellipse 60vw 30vh at 30% 70%, rgba(106,120,136,0.12), transparent 70%),
              radial-gradient(ellipse 40vw 25vh at 80% 30%, rgba(106,120,136,0.08), transparent 70%);
  transform: translate3d(0, calc(var(--scroll-y) * -0.05), 0);
  filter: blur(20px);
}
.fog-mid {
  background: radial-gradient(ellipse 50vw 22vh at 70% 60%, rgba(106,120,136,0.10), transparent 70%),
              radial-gradient(ellipse 35vw 18vh at 20% 40%, rgba(160,168,176,0.06), transparent 70%);
  transform: translate3d(0, calc(var(--scroll-y) * -0.02), 0);
  filter: blur(14px);
}
.fog-front {
  background: radial-gradient(ellipse 40vw 18vh at 50% 80%, rgba(160,168,176,0.05), transparent 70%);
  transform: translate3d(0, calc(var(--scroll-y) * 0.02), 0);
  filter: blur(10px);
}

/* === Magnifying-glass nav === */
.nav-toggle {
  position: fixed;
  top: calc(var(--letterbox-h) + 18px);
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10,24,40,0.7);
  border: 1px solid rgba(160,168,176,0.3);
  color: var(--c-silver);
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 250ms ease;
  backdrop-filter: blur(6px);
}
.nav-toggle:hover {
  border-color: var(--c-manila);
  color: var(--c-manila);
  transform: scale(1.05);
}
.nav-toggle[aria-expanded="true"] {
  background: var(--c-steel);
  border-color: var(--c-manila);
  color: var(--c-manila);
}

.nav-panel {
  position: fixed;
  top: calc(var(--letterbox-h) + 78px);
  right: 28px;
  width: 340px;
  max-width: calc(100vw - 56px);
  background: rgba(20,32,48,0.96);
  border: 1px solid rgba(160,168,176,0.2);
  border-radius: 2px;
  padding: 22px 22px 18px;
  z-index: 998;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: all 280ms cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}
.nav-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.nav-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-manila);
  margin-bottom: 12px;
}
.nav-search {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(160,168,176,0.3);
  color: var(--c-moon);
  font-family: inherit;
  font-size: 15px;
  padding: 6px 0 8px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 200ms;
}
.nav-search:focus { border-bottom-color: var(--c-manila); }
.nav-search::placeholder { color: rgba(160,168,176,0.5); font-style: italic; }
.nav-links { list-style: none; }
.nav-links li { margin: 8px 0; }
.nav-links a {
  display: block;
  color: var(--c-silver);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: all 180ms ease;
}
.nav-links a:hover {
  color: var(--c-moon);
  border-left-color: var(--c-red);
  padding-left: 14px;
}

/* === Main frame (within letterbox) === */
.frame {
  position: relative;
  z-index: 1;
  padding-top: var(--letterbox-h);
  padding-bottom: var(--letterbox-h);
}

/* === Title card === */
.title-card {
  min-height: calc(100vh - 2 * var(--letterbox-h));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 24px 14vh;
  position: relative;
  text-align: center;
}
.silhouette { position: absolute; pointer-events: none; }
.silhouette-trees {
  bottom: 8vh;
  left: 0;
  width: 100%;
  height: 22vh;
  z-index: -1;
}
.silhouette-moon {
  top: 14vh;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 110px;
  z-index: -1;
}
.silhouette-owl {
  top: 22vh;
  right: 16%;
  width: 56px;
  height: 56px;
  z-index: -1;
  opacity: 0.8;
}

.reel {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--c-manila);
  text-transform: uppercase;
  margin-bottom: 28px;
  opacity: 0;
  animation: fade-in 1000ms 1200ms forwards;
}
.title {
  font-family: 'Bitter', serif;
  font-weight: 700;
  font-size: clamp(36px, 7vw, 88px);
  letter-spacing: 0.02em;
  color: var(--c-moon);
  margin-bottom: 14px;
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
  opacity: 0;
  animation: title-rise 900ms 1400ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
.tagline {
  font-size: clamp(14px, 1.2vw, 17px);
  font-style: italic;
  color: var(--c-silver);
  max-width: 540px;
  margin-bottom: 60px;
  opacity: 0;
  animation: fade-in 800ms 1900ms forwards;
}
.cue {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(160,168,176,0.6);
  text-transform: uppercase;
  opacity: 0;
  animation: cue-pulse 2400ms 2400ms infinite;
}
@keyframes title-rise {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  to { opacity: 1; }
}
@keyframes cue-pulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(4px); }
}

/* === Case file === */
.case-file {
  max-width: 800px;
  margin: 80px auto;
  padding: 0 24px;
  position: relative;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
.case-file.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.case-header {
  background: var(--c-manila);
  color: var(--c-night);
  padding: 22px 30px 18px;
  position: relative;
  border-bottom: 4px solid var(--c-night);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.case-stamp {
  position: absolute;
  top: -10px;
  right: 24px;
  background: transparent;
  color: var(--c-red);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 2px solid var(--c-red);
  transform: rotate(-5deg);
  background: rgba(216,200,152,0.85);
}
.case-meta {
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(10,24,40,0.7);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.case-title {
  font-family: 'Bitter', serif;
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 34px);
  color: var(--c-night);
  letter-spacing: 0.01em;
}
.case-body {
  background: var(--c-steel);
  padding: 30px 30px 34px;
  color: var(--c-silver);
  border-left: 1px solid rgba(160,168,176,0.1);
  border-right: 1px solid rgba(160,168,176,0.1);
  border-bottom: 1px solid rgba(160,168,176,0.1);
  position: relative;
}
.case-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30px;
  right: 30px;
  height: 1px;
  background: rgba(160,168,176,0.1);
}
.case-lead {
  font-size: clamp(15px, 1.1vw, 18px);
  color: var(--c-moon);
  font-weight: 700;
  margin-bottom: 18px;
  line-height: 1.6;
}
.case-body p {
  margin-bottom: 16px;
  font-size: clamp(14px, 1vw, 16px);
}
.case-body p:last-of-type {
  font-style: italic;
  color: rgba(160,168,176,0.85);
  border-left: 2px solid var(--c-circuit);
  padding-left: 16px;
  margin: 22px 0 18px;
}
.case-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed rgba(160,168,176,0.2);
}
.case-tags li {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-manila);
  background: rgba(10,24,40,0.5);
  padding: 4px 10px;
  border: 1px solid rgba(216,200,152,0.25);
}

.case-file:hover .case-header {
  box-shadow: 0 10px 28px rgba(0,0,0,0.55), 0 0 0 1px rgba(216,200,152,0.4);
}

/* === Evidence Board === */
.evidence-board {
  max-width: 900px;
  margin: 110px auto;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 700ms ease, transform 700ms ease;
}
.evidence-board.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.board-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--c-manila);
  text-transform: uppercase;
  margin-bottom: 18px;
  text-align: center;
}
.board-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 360;
  background:
    repeating-linear-gradient(45deg, rgba(216,200,152,0.04) 0 2px, transparent 2px 8px),
    repeating-linear-gradient(-45deg, rgba(216,200,152,0.03) 0 2px, transparent 2px 7px),
    radial-gradient(ellipse at center, #3A2A1A 0%, #2A1E12 100%);
  border: 8px solid #1F1610;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.6), 0 12px 32px rgba(0,0,0,0.5);
}
.evidence-strings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.evidence-strings .string {
  stroke-dasharray: 4 4;
  stroke-dashoffset: 600;
  transition: stroke-dashoffset 1500ms ease;
}
.evidence-board.is-visible .evidence-strings .string {
  stroke-dashoffset: 0;
}
.evidence-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 80px;
  text-align: center;
  transform: translate(-50%, -50%) rotate(var(--r));
  transition: transform 220ms ease;
  cursor: pointer;
}
.evidence-pin::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-red);
  box-shadow: 0 1px 3px rgba(0,0,0,0.6), inset 0 -1px 1px rgba(0,0,0,0.4);
  z-index: 2;
}
.evidence-pin svg {
  width: 50px;
  height: 50px;
  background: rgba(10,24,40,0.65);
  padding: 6px;
  border: 1px solid rgba(216,200,152,0.3);
}
.evidence-pin:hover {
  transform: translate(-50%, -50%) rotate(calc(var(--r) + 1.5deg)) scale(1.05);
}
.pin-note {
  font-size: 11px;
  font-style: italic;
  color: var(--c-manila);
  margin-top: 6px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

/* === Archive === */
.archive {
  max-width: 800px;
  margin: 110px auto 80px;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.archive.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.archive-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--c-manila);
  text-transform: uppercase;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(160,168,176,0.2);
}
.archive-list {
  list-style: none;
}
.archive-list li {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(160,168,176,0.12);
  transition: background 200ms ease, padding 200ms ease;
}
.archive-list li:hover {
  background: rgba(42,56,72,0.4);
  padding-left: 10px;
  padding-right: 10px;
}
.archive-num {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--c-manila);
  letter-spacing: 0.08em;
}
.archive-title {
  font-size: 15px;
  color: var(--c-moon);
  font-style: italic;
}
.archive-status {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid rgba(160,168,176,0.3);
}
.archive-list li:nth-child(odd) .archive-status { color: var(--c-circuit); border-color: rgba(58,104,72,0.5); }
.archive-list li:nth-child(even) .archive-status { color: var(--c-red); border-color: rgba(200,64,64,0.5); }

/* === End card === */
.end-card {
  text-align: center;
  padding: 80px 24px 40px;
  max-width: 600px;
  margin: 0 auto;
}
.end-card .reel { animation: none; opacity: 0.6; }
.end-line {
  font-family: 'Bitter', serif;
  font-style: italic;
  font-size: clamp(16px, 1.4vw, 22px);
  color: var(--c-moon);
  margin: 18px 0 30px;
  line-height: 1.6;
}
.colophon {
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(160,168,176,0.5);
  text-transform: uppercase;
}

/* === Initial fade-in for body === */
@keyframes body-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
body { animation: body-fade-in 1000ms ease forwards; }

/* === Responsive === */
@media (max-width: 720px) {
  :root { --letterbox-h: 5vh; }
  .silhouette-owl { right: 10%; width: 44px; height: 44px; }
  .silhouette-moon { width: 80px; height: 80px; top: 10vh; }
  .case-header { padding: 20px 18px 14px; }
  .case-body { padding: 24px 20px 28px; }
  .case-stamp { right: 10px; font-size: 12px; }
  .nav-toggle { right: 16px; }
  .nav-panel { right: 16px; width: calc(100vw - 32px); }
  .evidence-board { margin: 70px auto; }
  .evidence-pin { width: 60px; }
  .evidence-pin svg { width: 38px; height: 38px; }
  .pin-note { font-size: 10px; }
  .archive-list li { grid-template-columns: 50px 1fr auto; gap: 10px; }
  .archive-title { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
