/* ===== EXACT COLOR PALETTE FROM DESIGN.MD ===== */
:root {
  /* Primary Background */
  --obsidian-depth: #0a0a1a;
  /* Secondary Background */
  --midnight-indigo: #141432;
  --formulating-indigo: #1e1e3a;
  /* Thesis Line / Accent */
  --muted-rose: #e8b4b8;
  /* Jewel Primary */
  --sapphire-logic: #2647a0;
  /* Jewel Secondary */
  --amethyst-doubt: #6b3fa0;
  /* Jewel Tertiary */
  --emerald-evidence: #2d8659;
  /* Text Primary */
  --warm-parchment: #f0e6d3;
  /* Text Secondary */
  --muted-stone: #c8bfb6;
  /* Text Tertiary */
  --slate-blue: #7b8ea0;
  /* Alert / Rebuttal */
  --garnet-warning: #a63d4f;
}

/* ===== GLOBAL RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  font-family: 'Source Serif 4', serif;
  background:
    linear-gradient(135deg, rgba(38, 71, 160, calc(0.05 + (var(--synthesis-intensity, 0) * 0.07))) 0%, rgba(107, 63, 160, calc(0.05 + (var(--synthesis-intensity, 0) * 0.07))) 100%),
    radial-gradient(circle at center, var(--obsidian-depth) 0%, var(--midnight-indigo) 100%);
  background-attachment: fixed;
  color: var(--muted-stone);
  line-height: 1.72;
  overflow-x: hidden;
  position: relative;
}

/* ===== FLOWING CURVES BACKGROUND ===== */
.flowing-curves {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Animated curves */
@keyframes curve-flow-sine {
  0% {
    d: path('M 0,400 Q 300,200 600,400 T 1200,400');
  }
  50% {
    d: path('M 0,400 Q 300,300 600,350 T 1200,400');
  }
  100% {
    d: path('M 0,400 Q 300,200 600,400 T 1200,400');
  }
}

@keyframes curve-flow-spiral {
  0% {
    opacity: 0.08;
  }
  50% {
    opacity: 0.12;
  }
  100% {
    opacity: 0.08;
  }
}

.curve-sine {
  animation: curve-flow-sine 45s ease-in-out infinite;
}

.curve-spiral {
  animation: curve-flow-spiral 50s ease-in-out infinite;
}

.curve-normal {
  animation: curve-flow-spiral 55s ease-in-out infinite;
  animation-delay: -10s;
}

/* ===== PERSISTENT THESIS LINE ===== */
.thesis-line {
  position: fixed;
  top: 61.8vh;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--muted-rose);
  z-index: 50;
  opacity: 0;
  animation: thesis-fade-in 0.8s ease-out 0.6s forwards;
}

@keyframes thesis-fade-in {
  to {
    opacity: 1;
  }
}

/* ===== PERSPECTIVE CONTAINER ===== */
.perspective-container {
  perspective: 1200px;
  position: relative;
  z-index: 10;
}

/* ===== SECTIONS ===== */
.section {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: proximity;
}

.section-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 60px;
}

/* Section 1: The Void */
.section-void {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, var(--obsidian-depth) 0%, var(--midnight-indigo) 100%);
}

.void-content {
  text-align: center;
}

.logical-symbols {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-bottom: 40px;
  letter-spacing: 0.04em;
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  color: var(--slate-blue);
}

.symbol {
  opacity: 0;
  animation: symbol-fade 0.4s ease-out forwards;
}

.symbol:nth-child(1) { animation-delay: 0.8s; }
.symbol:nth-child(2) { animation-delay: 1s; }
.symbol:nth-child(3) { animation-delay: 1.2s; }
.symbol:nth-child(4) { animation-delay: 1.4s; }
.symbol:nth-child(5) { animation-delay: 1.6s; }

@keyframes symbol-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.hero-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(2.8rem, 7vw, 6.5rem);
  font-weight: 700;
  color: var(--warm-parchment);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1;
  margin-bottom: 20px;
}

.hero-title {
  display: flex;
  justify-content: center;
  gap: 0.05em;
}

.hero-title::before,
.hero-title::after {
  content: '';
  display: none;
}

/* Character-by-character reveal effect */
.hero-char {
  opacity: 0;
  animation: char-fade 0.3s ease-out forwards;
}

.hero-char:nth-child(1) { animation-delay: 1.8s; }
.hero-char:nth-child(2) { animation-delay: 1.88s; }
.hero-char:nth-child(3) { animation-delay: 1.96s; }
.hero-char:nth-child(4) { animation-delay: 2.04s; }
.hero-char:nth-child(5) { animation-delay: 2.12s; }
.hero-char:nth-child(6) { animation-delay: 2.2s; }
.hero-char:nth-child(7) { animation-delay: 2.28s; }
.hero-char:nth-child(8) { animation-delay: 2.36s; }
.hero-char:nth-child(9) { animation-delay: 2.44s; }
.hero-char:nth-child(10) { animation-delay: 2.52s; }

@keyframes char-fade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  color: var(--muted-rose);
  margin-top: 20px;
  opacity: 0;
  animation: fade-up 0.8s ease-out 2.6s forwards;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section 2: Fortress Assembly */
.section-fortress {
  min-height: 110vh;
  padding: 80px 40px;
}

.fortress-container {
  display: flex;
  justify-content: center;
  margin-bottom: 80px;
  height: 300px;
}

.fortress-icon {
  width: 100%;
  max-width: 300px;
  height: 300px;
}

.fortress-block-1 {
  animation: dash-draw 2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.fortress-block-2 {
  animation: dash-draw 2s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.fortress-block-3 {
  animation: dash-draw 2s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

.fortress-block-4 {
  animation: dash-draw 2s cubic-bezier(0.16, 1, 0.3, 1) 1.4s forwards;
}

@keyframes dash-draw {
  from {
    stroke-dashoffset: var(--dash-offset, 200);
  }
  to {
    stroke-dashoffset: 0;
  }
}

.argument-panels-container {
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.argument-panel {
  border: 2px solid var(--sapphire-logic);
  background: rgba(20, 20, 50, 0.85);
  backdrop-filter: blur(4px);
  padding: 30px;
  position: relative;
  transform: translateZ(var(--z-depth, 0px));
}

.panel-left {
  --z-depth: 20px;
  transform: translateX(-40px) translateZ(20px);
}

.panel-right {
  --z-depth: 40px;
  transform: translateX(40px) translateZ(40px);
}

/* Skeleton loading effect */
.skeleton-loading {
  opacity: 0;
  animation: skeleton-pulse 1.8s ease-in-out infinite;
  animation-fill-mode: both;
}

@keyframes skeleton-pulse {
  0%, 100% {
    background: rgba(20, 20, 50, 0.85);
  }
  50% {
    background: rgba(30, 30, 58, 0.95);
  }
}

.skeleton-loading .panel-content {
  animation: content-fade-in 0.3s ease-out 0.4s forwards;
}

.skeleton-loading::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(123, 142, 160, 0.32);
  background:
    linear-gradient(90deg, transparent, rgba(240, 230, 211, 0.08), transparent),
    repeating-linear-gradient(180deg, rgba(123, 142, 160, 0.22) 0 1px, transparent 1px 18px);
  opacity: 1;
  animation: pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

.skeleton-loading .panel-content {
  opacity: 0;
  animation: none;
}

.skeleton-loading.is-formulated::before {
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skeleton-loading.is-formulated .panel-content {
  opacity: 1;
  transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.skeleton-loading.is-visible {
  animation: panel-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards, skeleton-pulse 1.8s ease-in-out infinite;
}

.skeleton-loading {
  animation-delay: var(--delay, 0);
}

@keyframes content-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    background-position: -120px 0, 0 0;
    opacity: 0.45;
  }
  50% {
    background-position: 160px 0, 0 0;
    opacity: 0.9;
  }
}

.panel-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 600;
  color: var(--muted-rose);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.panel-text {
  font-size: clamp(0.9rem, 1vw, 1.1rem);
  color: var(--muted-stone);
  line-height: 1.7;
}

/* Section 3: The Weighing */
.section-weighing {
  min-height: 100vh;
  padding: 80px 40px;
}

.scale-container {
  display: flex;
  justify-content: center;
  margin-bottom: 80px;
  height: 200px;
}

.scale-icon {
  width: 100%;
  max-width: 400px;
  height: 200px;
}

.scale-structure {
  transform-origin: 120px 80px;
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.weighing-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  max-width: 1000px;
  margin: 0 auto;
}

.evidence-column {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.evidence-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-blue);
  margin-bottom: 10px;
}

.evidence-supporting {
  border-left: 3px solid var(--emerald-evidence);
  padding-left: 20px;
}

.evidence-counter {
  border-right: 3px solid var(--garnet-warning);
  padding-right: 20px;
}

.panel-evidence,
.panel-challenge {
  border: 2px solid var(--sapphire-logic);
  background: rgba(20, 20, 50, 0.85);
  backdrop-filter: blur(4px);
  padding: 25px;
}

.panel-evidence {
  border-left-color: var(--emerald-evidence);
}

.panel-challenge {
  border-right-color: var(--garnet-warning);
}

.evidence-title,
.challenge-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--muted-rose);
  margin-bottom: 10px;
}

/* Section 4: The Synthesis */
.section-synthesis {
  min-height: 100vh;
  padding: 80px 40px;
}

.synthesis-statement {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 60px;
  padding: 40px;
  border: 2px solid var(--muted-rose);
  background: rgba(20, 20, 50, 0.7);
}

.synthesis-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 700;
  color: var(--warm-parchment);
  margin-bottom: 30px;
  letter-spacing: -0.02em;
}

.synthesis-quote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  color: var(--muted-rose);
  line-height: 1.6;
  margin-bottom: 25px;
}

.synthesis-coda {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--slate-blue);
}

.layered-panels {
  display: grid;
  gap: 40px;
  max-width: 900px;
  margin: 0 auto;
}

.layer-panel {
  border: 2px solid var(--sapphire-logic);
  background: rgba(20, 20, 50, 0.85);
  backdrop-filter: blur(4px);
  padding: 35px;
  opacity: 0;
  animation: panel-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.layer-panel:nth-child(1) {
  animation-delay: 0.2s;
}

.layer-panel:nth-child(2) {
  animation-delay: 0.4s;
}

.layer-panel:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes panel-reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layer-panel h3 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--muted-rose);
  margin-bottom: 15px;
  letter-spacing: -0.01em;
}

.layer-panel p {
  color: var(--muted-stone);
  line-height: 1.7;
}

/* Section 5: The Coda */
.section-coda {
  min-height: 60vh;
  padding: 80px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coda-container {
  text-align: center;
  max-width: 400px;
}

.fortress-final {
  width: 100%;
  max-width: 250px;
  height: 250px;
  margin: 0 auto 40px;
}

.fortress-complete {
  animation: fortress-rotate 60s linear infinite;
}

@keyframes fortress-rotate {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

.coda-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  letter-spacing: 0.02em;
  color: var(--slate-blue);
  margin-top: 40px;
}

/* ===== INTERSECTION OBSERVER ANIMATIONS ===== */
.argument-panel:not(.skeleton-loading) {
  opacity: 1;
}

.argument-panel.skeleton-loading {
  opacity: 1;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .section {
    padding: 40px 20px;
  }

  .section-content {
    gap: 40px;
  }

  .logical-symbols {
    gap: 15px;
    font-size: 1.5rem;
  }

  .hero-title {
    font-size: clamp(2rem, 5vw, 4rem);
  }

  .hero-subtitle {
    font-size: clamp(1rem, 1.8vw, 1.6rem);
  }

  .argument-panels-container {
    grid-template-columns: 1fr;
  }

  .panel-left,
  .panel-right {
    transform: none;
  }

  .weighing-panels {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .evidence-supporting,
  .evidence-counter {
    border: none;
    border-top: 2px solid currentColor;
    padding-left: 0;
    padding-right: 0;
    padding-top: 20px;
  }

  .synthesis-statement {
    padding: 25px;
  }

  .synthesis-title {
    font-size: 1.8rem;
  }

  .synthesis-quote {
    font-size: 1.2rem;
  }
}
