/* ============================================================
   STORIES OF THE PNW — site chrome
   Concept: a recovered-device evidence archive.
   Palette:  ink #0B0F0D · pine #141D17 · fog #A9B4AC · bone #E8E6DD
             blaze #FF5A1F (search & rescue orange) · signal #8FB3A9
   Type:     Zilla Slab (ranger-signage slab display)
             IBM Plex Mono (evidence metadata)
             IBM Plex Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #0B0F0D;
  --ink-2: #070A08;
  --pine: #141D17;
  --pine-2: #1B2620;
  --edge: #263129;
  --fog: #A9B4AC;
  --fog-dim: #6E7A72;
  --bone: #E8E6DD;
  --blaze: #FF5A1F;
  --blaze-dim: #8A3512;
  --signal: #8FB3A9;
  --danger: #E04A3A;
  --font-display: 'Zilla Slab', 'Rockwell', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
}

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

html { scrollbar-color: var(--edge) var(--ink); }

body {
  background: var(--ink);
  color: var(--fog);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--blaze); color: var(--ink); }

a { color: var(--signal); text-decoration: none; }
a:hover { color: var(--bone); }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blaze); outline-offset: 3px; }

/* ---------- film grain + vignette ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 9000;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0,0); }
  25% { transform: translate(-1.4%, 1.1%); }
  50% { transform: translate(1.2%, -0.8%); }
  75% { transform: translate(-0.7%, -1.3%); }
  100% { transform: translate(0.9%, 1.2%); }
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 8999;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(4,6,5,0.55) 100%);
}
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- top nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: linear-gradient(180deg, rgba(7,10,8,0.92), rgba(7,10,8,0));
}
.nav-mark {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.28em;
  color: var(--bone); text-transform: uppercase;
}
.nav-mark b { color: var(--blaze); font-weight: 600; }
.nav-links { display: flex; gap: 26px; }
.nav-links a {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--fog);
  padding-bottom: 3px; border-bottom: 1px solid transparent;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--bone); border-bottom-color: var(--blaze);
}

/* ---------- landing hero ---------- */
.hero {
  position: relative; min-height: 92vh;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding: 0 6vw 9vh;
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center 30%;
  filter: saturate(0.75) brightness(0.82);
  animation: hero-drift 40s ease-in-out infinite alternate;
}
@keyframes hero-drift { from { transform: scale(1.0); } to { transform: scale(1.06); } }
.hero-fade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(11,15,13,0.55) 0%, rgba(11,15,13,0.1) 35%, rgba(11,15,13,0.92) 88%),
    linear-gradient(90deg, rgba(11,15,13,0.55), transparent 45%);
}
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.34em;
  color: var(--blaze); text-transform: uppercase; margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
}
.hero-eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--blaze); }
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(52px, 9vw, 128px);
  line-height: 0.94; letter-spacing: 0.01em;
  color: var(--bone); text-transform: uppercase;
  max-width: 12ch;
  text-shadow: 0 4px 40px rgba(0,0,0,0.6);
}
.hero h1 .thin { color: var(--fog); font-weight: 500; }
.hero-sub {
  margin-top: 22px; max-width: 52ch; color: var(--fog);
  font-size: 17px;
}
.hero-cta {
  margin-top: 34px; display: inline-flex; align-items: center; gap: 14px;
  background: transparent; border: 1px solid var(--blaze); color: var(--blaze);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.26em;
  text-transform: uppercase; padding: 15px 28px;
  transition: background 0.25s, color 0.25s;
}
.hero-cta:hover { background: var(--blaze); color: var(--ink); }
.hero-scroll {
  position: absolute; right: 6vw; bottom: 9vh;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em;
  color: var(--fog-dim); text-transform: uppercase;
  writing-mode: vertical-rl;
}

/* ---------- case files (story selector) ---------- */
.cases { padding: 90px 6vw 120px; }
.section-head {
  display: flex; align-items: baseline; gap: 22px; margin-bottom: 10px;
}
.section-head h2 {
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase;
  font-size: clamp(26px, 3.4vw, 40px); color: var(--bone); letter-spacing: 0.03em;
}
.section-head .rule { flex: 1; height: 1px; background: var(--edge); }
.section-head .count { font-family: var(--font-mono); font-size: 12px; color: var(--fog-dim); letter-spacing: 0.2em; }
.section-note {
  font-family: var(--font-mono); font-size: 12px; color: var(--fog-dim);
  letter-spacing: 0.06em; margin-bottom: 48px; max-width: 70ch;
}
.case-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 34px; max-width: 1240px;
}
.case-card {
  position: relative; background: var(--pine);
  border: 1px solid var(--edge); text-align: left;
  padding: 0; overflow: hidden; color: inherit; display: block;
  transition: transform 0.35s cubic-bezier(0.2,0.8,0.2,1), border-color 0.35s;
}
.case-card:hover { transform: translateY(-6px); border-color: var(--fog-dim); }
.case-card:hover .case-poster img { filter: saturate(0.9) brightness(1.0); transform: scale(1.04); }
.case-poster {
  aspect-ratio: 2 / 3; overflow: hidden; position: relative; background: var(--ink-2);
}
.case-poster img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(0.7) brightness(0.85);
  transition: filter 0.5s, transform 0.9s cubic-bezier(0.2,0.8,0.2,1);
}
.case-poster::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,15,13,0.25), transparent 30%, transparent 60%, rgba(11,15,13,0.85));
}
.case-tag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.24em;
  color: var(--ink); background: var(--blaze); padding: 5px 9px;
  text-transform: uppercase;
}
.case-tag.soon { background: var(--edge); color: var(--fog); }
.case-progress {
  position: absolute; bottom: 14px; left: 14px; right: 14px; z-index: 2;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em;
  color: var(--fog); text-transform: uppercase;
}
.case-meta { padding: 18px 20px 22px; border-top: 1px solid var(--edge); }
.case-no { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.26em; color: var(--fog-dim); }
.case-title {
  font-family: var(--font-display); font-weight: 700; font-size: 30px;
  color: var(--bone); text-transform: uppercase; letter-spacing: 0.04em;
  margin: 6px 0 8px;
}
.case-tagline { font-size: 14px; color: var(--fog); min-height: 3.2em; }
.case-open {
  margin-top: 14px; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.24em; color: var(--blaze); text-transform: uppercase;
}
.case-card.locked { cursor: default; opacity: 0.75; }
.case-card.locked:hover { transform: none; border-color: var(--edge); }
.case-card.locked .case-open { color: var(--fog-dim); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--edge); padding: 32px 6vw 40px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--fog-dim);
}

/* ---------- content pages (about / help) ---------- */
.page {
  max-width: 780px; margin: 0 auto; padding: 150px 24px 120px;
}
.page-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.32em;
  color: var(--blaze); text-transform: uppercase; margin-bottom: 14px;
}
.page h1 {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(38px, 6vw, 64px); color: var(--bone); line-height: 1;
  margin-bottom: 30px;
}
.page h2 {
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase;
  font-size: 22px; color: var(--bone); margin: 46px 0 12px; letter-spacing: 0.03em;
}
.page p { margin-bottom: 16px; max-width: 66ch; }
.page .mono { font-family: var(--font-mono); font-size: 13px; color: var(--fog-dim); }
.page .resource-list {
  max-width: 66ch; margin: 0; padding-left: 20px; color: var(--fog);
}
.page .resource-list li { margin-bottom: 10px; padding-left: 4px; }
.page .resource-list a {
  color: var(--bone); text-decoration: none; border-bottom: 1px solid var(--edge);
}
.page .resource-list a:hover { color: var(--blaze); border-bottom-color: var(--blaze); }
.divider { height: 1px; background: var(--edge); margin: 40px 0; }

/* help controls */
.control-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--pine); border: 1px solid var(--edge);
  padding: 20px 22px; margin: 14px 0;
}
.control-row .label { color: var(--bone); font-weight: 500; }
.control-row .hint { font-size: 13px; color: var(--fog-dim); margin-top: 3px; max-width: 46ch; }
.toggle {
  --w: 52px; position: relative; width: var(--w); height: 28px; flex: 0 0 auto;
  background: var(--ink-2); border: 1px solid var(--edge); border-radius: 999px;
  transition: background 0.25s, border-color 0.25s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--fog-dim); transition: transform 0.25s, background 0.25s;
}
.toggle[aria-checked="true"] { background: var(--blaze-dim); border-color: var(--blaze); }
.toggle[aria-checked="true"]::after { transform: translateX(calc(var(--w) - 28px)); background: var(--blaze); }
.btn-danger, .btn-plain {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  background: transparent; padding: 11px 18px; flex: 0 0 auto;
}
.btn-danger { border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--ink); }
.btn-plain { border: 1px solid var(--edge); color: var(--fog); }
.btn-plain:hover { border-color: var(--fog); color: var(--bone); }

/* ============================================================
   STORY PAGE — the stage
   ============================================================ */
.stage {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 86px 20px 40px; position: relative;
}
.stage-bg {
  position: fixed; inset: 0; z-index: -3;
  background-size: cover; background-position: center;
  filter: saturate(0.5) brightness(0.28) blur(6px);
  transform: scale(1.05);
}
.stage-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(11,15,13,0.25), rgba(7,10,8,0.94) 75%);
}

/* ---------- timeline / playbar ---------- */
.timeline {
  width: min(720px, 94vw); margin-bottom: 26px;
  background: rgba(13,18,15,0.88); border: 1px solid var(--edge);
  backdrop-filter: blur(8px);
  padding: 14px 18px 16px;
}
.tl-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-bottom: 10px;
}
.tl-title {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--fog);
}
.tl-title b { color: var(--bone); font-weight: 600; }
.tl-clock {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.12em;
  color: var(--blaze);
}
.tl-clock .rec {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--blaze); margin-right: 8px; vertical-align: 1px;
  animation: rec-pulse 1.6s ease-in-out infinite;
}
.tl-clock.paused .rec { animation: none; background: var(--fog-dim); }
@keyframes rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.tl-main { display: flex; align-items: center; gap: 14px; }
.tl-btn {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid var(--edge); background: var(--pine-2); color: var(--bone);
  display: grid; place-items: center; font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
}
.tl-btn:hover { border-color: var(--blaze); }
.tl-btn svg { width: 15px; height: 15px; fill: currentColor; }
.tl-track {
  position: relative; flex: 1; height: 34px; cursor: pointer;
  touch-action: none;
}
.tl-rail {
  position: absolute; left: 0; right: 0; top: 50%; height: 4px;
  transform: translateY(-50%); background: var(--edge); border-radius: 2px;
}
.tl-fill {
  position: absolute; left: 0; top: 50%; height: 4px; width: 0%;
  transform: translateY(-50%); background: linear-gradient(90deg, var(--blaze-dim), var(--blaze));
  border-radius: 2px;
}
.tl-needle {
  position: absolute; top: 3px; bottom: 3px; width: 2px; left: 0%;
  background: var(--blaze); box-shadow: 0 0 10px rgba(255,90,31,0.7);
}
.tl-needle::after {
  content: ""; position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--blaze);
}
.tl-tick {
  position: absolute; top: 50%; width: 1px; height: 12px;
  transform: translateY(-50%); background: var(--fog-dim); opacity: 0.85;
}
.tl-tick.gate { background: var(--signal); height: 16px; }
.tl-bottom {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--fog-dim);
}
.tl-status {
  margin-top: 8px; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; color: var(--signal); min-height: 16px;
}
.tl-status.alert { color: var(--blaze); }

/* ---------- ambient widget ---------- */
.ambient {
  position: fixed; right: 22px; bottom: 22px; z-index: 500;
  width: 244px; background: rgba(13,18,15,0.94);
  border: 1px solid var(--edge); backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  transition: transform 0.3s cubic-bezier(0.2,0.8,0.2,1);
}
.ambient.min { transform: translateY(calc(100% - 42px)); }
.amb-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: 0; color: var(--fog);
  padding: 12px 14px; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase;
}
.amb-head:hover { color: var(--bone); }
.amb-head .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--fog-dim);
}
.ambient.on .amb-head .dot { background: var(--blaze); box-shadow: 0 0 8px var(--blaze); animation: rec-pulse 2s infinite; }
.amb-body { padding: 4px 14px 14px; }
.amb-track {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.amb-track .name {
  flex: 1; font-size: 11px; letter-spacing: 0.14em; color: var(--bone);
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.amb-btn {
  width: 30px; height: 30px; border: 1px solid var(--edge); background: var(--pine-2);
  color: var(--bone); border-radius: 4px; display: grid; place-items: center;
}
.amb-btn:hover { border-color: var(--blaze); }
.amb-btn svg { width: 11px; height: 11px; fill: currentColor; }
.amb-vol { display: flex; align-items: center; gap: 10px; }
.amb-vol input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px;
  background: var(--edge); border-radius: 2px;
}
.amb-vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--blaze); cursor: pointer;
}
.amb-vol input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--blaze); cursor: pointer;
}
.amb-hint { margin-top: 10px; font-size: 9px; letter-spacing: 0.08em; color: var(--fog-dim); line-height: 1.5; }
.amb-hint.err { color: var(--danger); }

/* ---------- interstitials (chapter cards) ---------- */
.interstitial {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: rgba(5,7,6,0.96); opacity: 0; pointer-events: none;
  transition: opacity 0.8s;
}
.interstitial.show { opacity: 1; pointer-events: auto; }
.inter-inner { text-align: center; padding: 20px; }
.inter-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.34em;
  color: var(--blaze); text-transform: uppercase; margin-bottom: 16px;
}
.inter-title {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(34px, 6vw, 62px); color: var(--bone); line-height: 1.02;
}
.inter-sub {
  margin-top: 16px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.18em; color: var(--fog-dim);
}
.inter-actions { margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.inter-btn {
  border: 1px solid var(--blaze); color: var(--blaze); background: transparent;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.24em;
  text-transform: uppercase; padding: 14px 26px;
}
.inter-btn:hover { background: var(--blaze); color: var(--ink); }
.inter-btn.ghost { border-color: var(--edge); color: var(--fog); }
.inter-btn.ghost:hover { background: transparent; border-color: var(--fog); color: var(--bone); }

/* chapter select sheet */
.chapsheet {
  position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center;
  background: rgba(5,7,6,0.9); opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.chapsheet.show { opacity: 1; pointer-events: auto; }
.chap-panel {
  width: min(460px, 92vw); background: var(--pine); border: 1px solid var(--edge);
  padding: 26px 26px 22px;
}
.chap-panel h3 {
  font-family: var(--font-display); text-transform: uppercase; color: var(--bone);
  font-size: 24px; margin-bottom: 4px;
}
.chap-panel .mono { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.24em; color: var(--fog-dim); text-transform: uppercase; }
.chap-list { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.chap-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; background: var(--ink-2); border: 1px solid var(--edge);
  color: var(--bone); padding: 14px 16px; font-family: var(--font-body); font-size: 14px;
}
.chap-item .state { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--fog-dim); text-transform: uppercase; }
.chap-item:not([disabled]):hover { border-color: var(--blaze); }
.chap-item:not([disabled]):hover .state { color: var(--blaze); }
.chap-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.chap-close { margin-top: 18px; width: 100%; }

/* small screens */
@media (max-width: 720px) {
  .nav { padding: 14px 18px; }
  .nav-links { gap: 16px; }
  .hero { padding: 0 20px 12vh; }
  .cases { padding: 60px 20px 90px; }
  .ambient { right: 12px; bottom: 12px; width: 210px; }
  .stage { padding-top: 74px; }
}
