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

:root {
  --bg-dark: #2a1a10;
  --parchment: #d8c8a8;
  --parchment-dark: #c0a880;
  --ember-amber: #d4a060;
  --ember-glow: #e8c080;
  --text-dark: #2a1810;
  --text-light: #d0c0a0;
  --blood: #8a3020;
}

html, body {
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: "Cormorant", "Playfair Display", Georgia, serif;
  font-size: 18px;
  line-height: 1.85;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .vigil-title, .chapter-title {
  font-family: "Playfair Display", "Cormorant", serif;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.evidence-label, .case-no, .footer-meta, .ev-key, .ev-value {
  font-family: "Courier Prime", monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ember-amber);
  text-transform: uppercase;
}

#emberCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* CHAPTER NAV --- bookmark tabs */
.chapter-nav {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
}

.chapter-tab {
  position: relative;
  width: 8px;
  height: 40px;
  background: var(--parchment);
  border: 1px solid var(--parchment-dark);
  border-right: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 11px;
  color: transparent;
  text-decoration: none;
  transition: width 0.6s cubic-bezier(.16,.84,.32,1), background 0.6s ease;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}

.chapter-tab::after {
  content: attr(data-label);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Courier Prime", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dark);
  opacity: 0;
  transition: opacity 0.6s ease;
  text-transform: uppercase;
  white-space: nowrap;
}

.chapter-tab:hover, .chapter-tab.is-active {
  width: 60px;
  background: var(--ember-glow);
}
.chapter-tab:hover { color: var(--text-dark); }
.chapter-tab:hover::after, .chapter-tab.is-active::after { opacity: 0.7; }

/* VIGIL --- 100vh hero */
.vigil {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
}

.vigil__inner {
  max-width: 720px;
  position: relative;
  z-index: 3;
}

.case-no {
  margin-bottom: 36px;
  font-size: 12px;
  color: var(--ember-amber);
  opacity: 0.7;
}

.vigil-title {
  font-size: clamp(48px, 9vw, 120px);
  font-weight: 700;
  line-height: 0.95;
  color: var(--text-light);
  text-shadow: 0 0 40px rgba(212, 160, 96, 0.25), 0 0 80px rgba(212, 160, 96, 0.15);
  opacity: 0;
  animation: smokeIn 3s ease forwards 0.3s;
  letter-spacing: -0.02em;
}

@keyframes smokeIn {
  0%   { opacity: 0; filter: blur(12px); transform: translateY(8px); }
  60%  { opacity: 0.7; filter: blur(2px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.vigil-sub {
  margin-top: 32px;
  font-size: 19px;
  font-style: italic;
  color: var(--text-light);
  opacity: 0;
  animation: fadeIn 2s ease forwards 1.2s;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

.vigil-meta {
  margin-top: 60px;
  font-family: "Courier Prime", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember-amber);
  opacity: 0;
  animation: fadeIn 2s ease forwards 2s;
}

@keyframes fadeIn { to { opacity: 0.85; } }

/* TESTIMONY --- parchment panels */
.testimony {
  position: relative;
  z-index: 2;
  padding: 120px 40px;
  display: flex;
  justify-content: center;
}

.parchment {
  position: relative;
  width: 100%;
  max-width: 680px;
  background: var(--parchment);
  color: var(--text-dark);
  padding: 64px 60px;
  border: 1px solid var(--parchment-dark);
  box-shadow:
    inset 0 0 40px rgba(42, 26, 16, 0.2),
    0 30px 60px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.5s ease, transform 1.5s ease;
}

.parchment.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.parchment::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--parchment);
  filter: url(#parchment-noise);
  opacity: 0.4;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.parchment > * { position: relative; z-index: 1; }

.parchment--narrow { max-width: 580px; }

.parchment__head {
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(42, 24, 16, 0.2);
  padding-bottom: 22px;
}

.evidence-label {
  color: var(--blood);
  font-size: 12px;
  margin-bottom: 14px;
  display: block;
}
.evidence-label.center { text-align: center; }

.case-no { color: var(--ember-amber); }

.chapter-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.1;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}
.chapter-title.center { text-align: center; }

.body {
  margin-top: 22px;
  font-family: "Cormorant", serif;
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-dark);
  font-weight: 400;
}
.body em { font-style: italic; color: var(--blood); }
.body.small { font-size: 15px; opacity: 0.85; line-height: 1.7; }
.body.center { text-align: center; max-width: 540px; margin-left: auto; margin-right: auto; }

.evidence-list {
  list-style: none;
  margin-top: 32px;
  border-top: 1px solid rgba(42, 24, 16, 0.2);
  padding-top: 22px;
}
.evidence-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(42, 24, 16, 0.15);
  font-family: "Courier Prime", monospace;
  font-size: 13px;
}
.ev-key { color: rgba(42, 24, 16, 0.6); }
.ev-value { color: var(--text-dark); font-weight: 700; }

/* GLITCH effect */
.parchment.is-glitching {
  animation: glitch-shift 0.18s steps(2, end);
}
.parchment.is-glitching::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 30%, rgba(138, 48, 32, 0.15) 30.1%, rgba(138, 48, 32, 0.15) 32%, transparent 32.1%, transparent 70%, rgba(64, 96, 168, 0.12) 70.1%, rgba(64, 96, 168, 0.12) 71.5%, transparent 71.6%);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
}
@keyframes glitch-shift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 0); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 1px); }
}

/* MEMORIAL --- name stream */
.memorial {
  position: relative;
  z-index: 2;
  padding: 140px 40px 100px;
  text-align: center;
}

.memorial__inner {
  max-width: 680px;
  margin: 0 auto;
}

.name-stream {
  position: relative;
  height: 360px;
  margin: 60px auto 30px;
  overflow: hidden;
  border-top: 1px solid rgba(212, 160, 96, 0.25);
  border-bottom: 1px solid rgba(212, 160, 96, 0.25);
}

.drift-name {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--text-light);
  white-space: nowrap;
  opacity: 0;
}

/* FOOTER */
.footer {
  position: relative;
  z-index: 2;
  padding: 80px 40px 60px;
  text-align: center;
  border-top: 1px solid rgba(212, 160, 96, 0.2);
}
.footer__inner { max-width: 540px; margin: 0 auto; }
.footer-text {
  margin-top: 20px;
  font-family: "Cormorant", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--text-light);
  opacity: 0.85;
}
.footer-meta {
  margin-top: 32px;
  color: var(--ember-amber);
  opacity: 0.55;
  font-size: 11px;
}

/* Responsive */
@media (max-width: 720px) {
  .chapter-nav { display: none; }
  .vigil { padding: 60px 24px; }
  .testimony { padding: 80px 24px; }
  .parchment { padding: 48px 28px; }
  .memorial { padding: 100px 24px 80px; }
  .name-stream { height: 280px; }
  .drift-name { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .vigil-title, .vigil-sub, .vigil-meta { animation: none; opacity: 1; filter: none; transform: none; }
}
