/* mystery.boo - Victorian seance parlor dissolving into digital static */
:root {
  --void-black: #0D0A0E;
  --seance-purple: #1A1520;
  --burnt-umber: #2C1810;
  --sienna-ink: #8B4513;
  --aged-vellum: #C9B896;
  --foxed-gold: #D4A574;
  --terminal-green: #00FF41;
  --dried-blood: #3A0A0A;
}

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

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

html { scroll-behavior: smooth; }

body {
  background: var(--void-black);
  color: var(--aged-vellum);
  font-family: 'Crimson Pro', serif;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.75;
  overflow-x: hidden;
}

/* Scan lines */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    rgba(201,184,150,0.03) 0px,
    rgba(201,184,150,0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 1;
  transition: opacity 2s ease;
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  transition: opacity 3s ease;
}

/* Spirit photography overlays */
.spirit {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(circle, rgba(201,184,150,0.12), transparent 70%);
}
.spirit-1 {
  width: 40vw; height: 40vw;
  top: 10%; left: 10%;
  animation: spiritDrift1 30s ease-in-out 2s infinite;
}
.spirit-2 {
  width: 30vw; height: 30vw;
  top: 40%; right: 5%;
  animation: spiritDrift2 25s ease-in-out 4s infinite;
}
.spirit-3 {
  width: 25vw; height: 25vw;
  bottom: 15%; left: 30%;
  animation: spiritDrift3 35s ease-in-out 1s infinite;
}
@keyframes spiritDrift1 {
  0%, 100% { transform: translate(0, 0); opacity: 0.06; }
  50% { transform: translate(3vw, 2vw); opacity: 0.1; }
}
@keyframes spiritDrift2 {
  0%, 100% { transform: translate(0, 0); opacity: 0.04; }
  50% { transform: translate(-2vw, -3vw); opacity: 0.08; }
}
@keyframes spiritDrift3 {
  0%, 100% { transform: translate(0, 0); opacity: 0.05; }
  50% { transform: translate(2vw, -2vw); opacity: 0.09; }
}

/* Drip progress indicator */
.drip-indicator {
  position: fixed;
  top: 0;
  right: 20px;
  width: 3px;
  height: 100vh;
  background: rgba(139,69,19,0.1);
  z-index: 20;
}
.drip-fill {
  width: 100%;
  background: var(--foxed-gold);
  height: 0%;
  transition: height 0.1s ease;
  border-radius: 0 0 2px 2px;
}

/* Sections */
.section {
  position: relative;
  z-index: 5;
}

/* Section 1: Threshold */
.threshold {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--void-black);
}
.threshold-word {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 22vw;
  color: var(--aged-vellum);
  text-align: center;
  animation: breathe 4s cubic-bezier(0.25,0.46,0.45,0.94) infinite;
  line-height: 1;
}
@keyframes breathe {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

.threshold-domain {
  font-family: 'Special Elite', cursive;
  font-size: 1.2rem;
  color: var(--foxed-gold);
  margin-top: 2rem;
  min-height: 1.5em;
}

/* Wax seal divider */
.wax-seal-divider {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
  position: relative;
  z-index: 5;
}
.wax-seal-svg { width: 80px; height: 80px; }

/* Section 2: Archive */
.archive {
  min-height: 120vh;
  padding: 6rem 2rem;
  background: var(--seance-purple);
  position: relative;
}
.archive-doc {
  max-width: 600px;
  background: rgba(44,24,16,0.85);
  border: 1px solid rgba(139,69,19,0.4);
  padding: 2.5rem;
  box-shadow: 8px 8px 24px rgba(0,0,0,0.6);
  margin-bottom: 2rem;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.25,0.46,0.45,0.94), transform 0.6s cubic-bezier(0.25,0.46,0.45,0.94);
}
.doc-1 { transform: rotate(-2.5deg) translateX(-5%); margin-left: 10%; }
.doc-2 { transform: rotate(1.8deg) translateX(5%); margin-left: 30%; }
.doc-3 { transform: rotate(-1.2deg) translateX(-3%); margin-left: 15%; }

.archive-doc.visible { opacity: 1; }

.doc-heading {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--foxed-gold);
  margin-bottom: 1rem;
}
.doc-body {
  color: var(--aged-vellum);
  margin-bottom: 1rem;
}
.doc-annotation {
  font-family: 'Special Elite', cursive;
  font-size: 0.9rem;
  color: var(--sienna-ink);
  display: block;
  margin-top: 1rem;
}

.string-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Section 3: Evidence */
.evidence {
  min-height: 100vh;
  padding: 6rem 2rem;
  background: var(--seance-purple);
  position: relative;
}
.timeline-line {
  position: absolute;
  left: 50%;
  top: 6rem;
  bottom: 6rem;
  width: 2px;
  background: var(--sienna-ink);
  transform: translateX(-50%);
}

.evidence-timeline {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}
.evidence-entry {
  display: flex;
  align-items: flex-start;
  margin-bottom: 3rem;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.evidence-entry.visible { opacity: 1; transform: scale(1); }

.entry-left { justify-content: flex-start; padding-right: 55%; }
.entry-right { justify-content: flex-end; padding-left: 55%; }

.entry-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--foxed-gold);
  border: 1px solid var(--sienna-ink);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.entry-card {
  background: rgba(44,24,16,0.6);
  border: 1px solid rgba(139,69,19,0.3);
  padding: 1.5rem;
}
.entry-date {
  font-family: 'Special Elite', cursive;
  font-size: 0.95rem;
  color: var(--sienna-ink);
  display: block;
  margin-bottom: 0.5rem;
}
.entry-text {
  color: var(--aged-vellum);
  font-size: 1rem;
}

/* Section 4: Ritual */
.ritual {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--void-black);
  position: relative;
  overflow: hidden;
}
.ritual-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.pulse-circle {
  animation: ritualPulse 3s cubic-bezier(0.25,0.46,0.45,0.94) infinite;
}
@keyframes ritualPulse {
  0%, 100% { r: 100; opacity: 0.6; }
  50% { r: 120; opacity: 1; }
}

/* Candle flicker */
.ritual {
  animation: candleFlicker1 2.3s ease-in-out infinite,
             candleFlicker2 3.7s ease-in-out infinite,
             candleFlicker3 5.1s ease-in-out infinite;
}
@keyframes candleFlicker1 {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.03); }
}
@keyframes candleFlicker2 {
  0%, 100% { filter: brightness(1); }
  30% { filter: brightness(0.97); }
}
@keyframes candleFlicker3 {
  0%, 100% { filter: brightness(1); }
  70% { filter: brightness(1.02); }
}

.orbit-text {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  margin-left: -300px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--aged-vellum);
  opacity: 0.4;
  white-space: nowrap;
  pointer-events: none;
}
.orbit-1 {
  margin-top: -150px;
  animation: orbit 60s linear infinite;
}
.orbit-2 {
  margin-top: 0px;
  animation: orbit 45s linear infinite reverse;
}
.orbit-3 {
  margin-top: 150px;
  animation: orbit 30s linear infinite;
}
@keyframes orbit {
  from { transform: rotate(0deg) translateX(180px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(180px) rotate(-360deg); }
}

/* Section 5: Static */
.static-section {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--void-black);
  position: relative;
  padding: 4rem 2rem;
}

.glitch-bars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.glitch-bar {
  position: absolute;
  left: 0;
  width: 100%;
  background: var(--terminal-green);
  opacity: 0.8;
}

.static-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  text-align: center;
}
.static-text {
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--aged-vellum);
}
.static-text .glitch-char {
  font-family: 'Share Tech Mono', monospace;
  color: var(--terminal-green);
  opacity: 0.6;
}

.final-message {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 3rem;
  color: var(--aged-vellum);
  mix-blend-mode: difference;
  margin-top: 3rem;
  position: relative;
  z-index: 2;
}

@media (max-width: 768px) {
  .threshold-word { font-size: 30vw; }
  .entry-left, .entry-right { padding: 0 0 0 60%; }
  .timeline-line { left: 20px; }
  .entry-node { left: 20px; }
  .archive-doc { margin-left: 5% !important; transform: rotate(0deg) !important; }
  .orbit-text { display: none; }
}
