/* thethird.quest -- three-act theatrical scroll */

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

:root {
  --bg-dark: #0d0d0d;
  --bg-mid: #1a1a2e;
  --accent: #9b8ec4;
  --accent-strong: #c4b5e3;
  --rule: #3d3654;
  --text: #d4d0e0;
  --text-dim: #7a7490;
}

html {
  scroll-behavior: smooth;
  background: var(--bg-dark);
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.ripple-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  overflow: hidden;
}

.ripple {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.3;
  animation: rippleOut 800ms ease-out forwards;
}

@keyframes rippleOut {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0.3; }
  100% { transform: translate(-50%, -50%) scale(20); opacity: 0; }
}

/* Navigation */
.act-nav {
  position: fixed;
  right: clamp(20px, 3vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule);
  display: block;
  cursor: pointer;
  transition: background 400ms ease, box-shadow 400ms ease, transform 400ms ease;
}

.nav-dot.active {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(155, 142, 196, 0.7);
  transform: scale(1.3);
}

/* Header */
.meta-header {
  position: fixed;
  top: clamp(20px, 3vh, 40px);
  left: clamp(40px, 8vw, 120px);
  right: clamp(40px, 8vw, 120px);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.meta-label {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.meta-domain { color: var(--accent); }

/* Acts */
.act {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(80px, 12vh, 140px) clamp(40px, 8vw, 120px);
  overflow: hidden;
}

.act-i { background: var(--bg-dark); }
.act-ii { background: var(--bg-mid); }
.act-iii { background: var(--bg-dark); }

/* Watermark Roman numeral */
.watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(280px, 60vw, 920px);
  color: var(--accent);
  opacity: 0.06;
  pointer-events: none;
  letter-spacing: -0.05em;
  user-select: none;
  will-change: transform;
}

.watermark-soft { opacity: 0.04; color: var(--accent-strong); }

/* Grid lines */
.grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.1;
}
.grid-lines-faint { opacity: 0.05; }

/* Act content */
.act-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 800ms ease, transform 800ms ease;
}

.act.in-view .act-content {
  opacity: 1;
  transform: translateY(0);
}

.act-content-wide { max-width: 1100px; }
.act-content-center { text-align: center; max-width: 720px; }

.act-label {
  display: inline-block;
  font-family: "Space Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  margin-bottom: 28px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

.act-question,
.act-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 36px;
  letter-spacing: -0.01em;
}

.act-question .word,
.act-title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.act.in-view .act-question .word,
.act.in-view .act-title .word {
  opacity: 1;
  transform: translateY(0);
}

.act-title em {
  font-style: italic;
  color: var(--accent);
}

.act-body {
  max-width: 580px;
  color: var(--text);
  font-size: clamp(16px, 1.4vw, 19px);
}

.act-body-quiet {
  color: var(--text-dim);
  font-size: 16px;
  margin: 32px auto 0;
  max-width: 460px;
}

/* Scroll cue */
.scroll-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 56px;
}

.scroll-cue-label {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-dim);
}

.scroll-cue-line {
  width: 60px;
  height: 1px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
}

.scroll-cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scrollPulse 2.4s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* Triptych */
.triptych {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 4vw, 64px);
  margin-top: 48px;
}

.triptych-column {
  position: relative;
  padding: 40px 32px 32px;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  background: rgba(13, 13, 14, 0.4);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(196, 181, 227, 0.05);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 700ms ease, transform 700ms ease, border-color 400ms ease;
}

.act.in-view .triptych-column {
  opacity: 1;
  transform: translateY(0);
}

.act.in-view .triptych-column[data-col="1"] { transition-delay: 100ms; }
.act.in-view .triptych-column[data-col="2"] { transition-delay: 250ms; }
.act.in-view .triptych-column[data-col="3"] { transition-delay: 400ms; }

.triptych-column:hover {
  border-color: var(--accent);
}

.column-numeral {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(32px, 3vw, 48px);
  color: var(--accent);
  display: block;
  margin-bottom: 24px;
  letter-spacing: 0.08em;
}

.column-title {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(22px, 2.2vw, 30px);
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.2;
}

.column-body {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.65;
}

/* Act III question mark */
.question-mark {
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: clamp(160px, 20vw, 360px);
  line-height: 1;
  color: var(--accent);
  position: relative;
  display: inline-block;
  margin: 32px auto;
  text-shadow: 0 0 80px rgba(155, 142, 196, 0.4);
}

.question-mark::before,
.question-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1em;
  height: 1em;
  border: 1px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  animation: heroRipple 4s ease-in-out infinite;
}

.question-mark::after {
  animation-delay: 2s;
}

@keyframes heroRipple {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.4; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

.meta-footer {
  display: block;
  margin-top: 48px;
  color: var(--text-dim);
}

@media (max-width: 720px) {
  .triptych { grid-template-columns: 1fr; }
  .meta-header { left: 24px; right: 24px; }
  .act { padding: 100px 24px; }
}
