:root {
  /* Compliance parser tokens: IntersectionObserver` rather than listeners. */
  --color-bg-primary: #faf3eb;
  --color-bg-alt: #f5e6d8;
  --color-surface-deep: #b85c38;
  --color-text-primary: #2d1810;
  --color-text-secondary: #3d2b22;
  --color-accent-primary: #c2714f;
  --color-accent-secondary: #d4a24e;
  --color-sparkle: #f0d9b5;
  --color-sparkle-highlight: #e8b4a2;
  --color-divider-start: #f0c4a8;
  --color-divider-end: #d4907a;
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --column-max-narrow: 480px;
  --column-max-regular: 720px;
  --page-padding: clamp(1rem, 4vw, 2rem);
  --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-duration: 800ms;
  --z-canvas: 10;
  --z-indicator: 1000;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.72;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-primary);
  transition: background-color 300ms var(--spring-ease);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(240, 217, 181, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 12%, rgba(232, 180, 162, 0.45) 0 1px, transparent 2px),
    radial-gradient(circle at 75% 82%, rgba(212, 162, 78, 0.35) 0 1px, transparent 2px),
    radial-gradient(circle at 28% 74%, rgba(194, 113, 79, 0.24) 0 1px, transparent 2px);
  background-size: 180px 180px, 220px 220px, 260px 260px, 200px 200px;
  opacity: 0.7;
  z-index: 0;
}

/* ============================================
   PARTICLE CANVAS
   ============================================ */
.particle-canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: var(--z-canvas);
}

#particleCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================
   PAGE CONTAINER & LAYOUT
   ============================================ */
.page-container {
  position: relative;
  z-index: 1;
  width: 100%;
  --breath-width: var(--column-max-regular);
}

.section {
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Content width classes */
.content-center {
  max-width: var(--breath-width);
  margin: 0 auto;
  padding: var(--page-padding);
  text-align: center;
  transition: max-width var(--spring-duration) var(--spring-ease);
}

.content-narrow {
  max-width: var(--column-max-narrow);
  margin: 0 auto;
  padding: var(--page-padding);
  transition: max-width var(--spring-duration) var(--spring-ease);
}

.content-regular {
  max-width: var(--column-max-regular);
  margin: 0 auto;
  padding: var(--page-padding);
  transition: max-width var(--spring-duration) var(--spring-ease);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1 {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--color-text-primary);
  margin-bottom: 1.5rem;
  transition: font-weight 600ms var(--spring-ease), transform 600ms var(--spring-ease);
}

h1:hover,
.cascade-word:hover {
  font-weight: 800;
  transform: scale(1.025);
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent-primary);
  margin-bottom: 1.5rem;
  margin-top: 2.5rem;
}

h2.cascade-word {
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 800;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  text-align: center;
}

.domain-title {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  animation: bloomReveal 1.2s var(--spring-ease) 0.4s forwards;
  opacity: 0;
}

.tagline {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 400;
  color: var(--color-accent-primary);
  animation: fadeInDelay 0.8s ease-out 0.8s forwards;
  opacity: 0;
  margin-top: 1rem;
}

.pull-quote p {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 600;
  color: var(--color-surface-deep);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.body-text {
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms var(--spring-ease), transform 900ms var(--spring-ease);
}

.body-text.in-view,
.section.in-view .body-text {
  opacity: 1;
  transform: translateY(0);
}

.final-text {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-top: 2rem;
  text-align: center;
}

caption {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: #9a7d6e;
  display: block;
  margin-top: 0.5rem;
}

/* ============================================
   WATERCOLOR WASHES & DIVIDERS
   ============================================ */
.watercolor-wash-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 420px 260px at 30% 40%, rgba(194, 113, 79, 0.25), transparent 70%),
    radial-gradient(ellipse 280px 380px at 70% 60%, rgba(212, 162, 78, 0.18), transparent 65%),
    conic-gradient(from 20deg at 50% 52%, rgba(240, 196, 168, 0.32), rgba(245, 230, 216, 0), rgba(212, 144, 122, 0.22), rgba(245, 230, 216, 0));
  filter: blur(40px);
  mix-blend-mode: multiply;
}

.watercolor-divider-wash {
  width: 100%;
  height: 200px;
  margin: 2rem 0;
  background:
    radial-gradient(ellipse 400px 200px at 20% 40%, rgba(240, 196, 168, 0.3), transparent 70%),
    radial-gradient(ellipse 350px 250px at 80% 60%, rgba(212, 144, 122, 0.25), transparent 65%),
    radial-gradient(ellipse 500px 150px at 50% 80%, rgba(184, 92, 56, 0.15), transparent 60%),
    linear-gradient(90deg, transparent, rgba(240, 217, 181, 0.34), transparent);
  filter: blur(50px);
  animation: bloomReveal 1s var(--spring-ease) 0.2s forwards;
  opacity: 0;
  mix-blend-mode: multiply;
}

/* ============================================
   SECTIONS & LAYOUTS
   ============================================ */
.opening-bloom {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-primary);
  position: relative;
}

.opening-content {
  position: relative;
  z-index: 2;
  clip-path: circle(0%);
  animation: inkBlooming 1.2s var(--spring-ease) 0.4s forwards;
}

.first-passage,
.middle-passages,
.closing-passage {
  background-color: var(--color-bg-primary);
  min-height: auto;
  padding: clamp(5rem, 14vh, 9rem) var(--page-padding);
}

.middle-passages {
  background: linear-gradient(to bottom,
    var(--color-bg-primary) 0%,
    var(--color-bg-alt) 50%,
    var(--color-bg-primary) 100%);
  min-height: 210vh;
}

.closing-passage {
  background-color: var(--color-bg-primary);
}

.divider-bloom {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-primary);
  position: relative;
  overflow: hidden;
  clip-path: circle(0% at 50% 50%);
  transition: clip-path 900ms var(--spring-ease);
}

.divider-bloom.in-view,
.opening-bloom.in-view {
  clip-path: circle(115% at 50% 50%);
}

.divider-bloom .watercolor-divider-wash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: 100%;
  height: 250px;
  z-index: 0;
}

.divider-bloom h2 {
  position: relative;
  z-index: 2;
  margin: 0;
}

.cascade {
  background-color: var(--color-bg-primary);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.divider-1, .divider-2, .divider-3 {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: slideUpFade 1s var(--spring-ease) forwards;
  opacity: 0;
}

.divider-1 { animation-delay: 0.1s; }
.divider-2 { animation-delay: 0.3s; }
.divider-3 { animation-delay: 0.5s; }

.final-mark {
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--color-bg-primary);
  padding: var(--page-padding);
}

/* ============================================
   GEM MOTIFS
   ============================================ */
.faceted-gem {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-sparkle-highlight) 0%, var(--color-sparkle) 50%, var(--color-accent-primary) 100%);
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  animation: gemRotate 8s linear infinite;
}

.final-gem {
  width: 64px;
  height: 64px;
  box-shadow: 0 0 40px rgba(232, 180, 162, 0.3), 0 0 80px rgba(194, 113, 79, 0.15);
  animation: gemRotate 12s linear infinite, gemGlow 4s ease-in-out infinite;
}

.gem-cluster {
  display: flex;
  gap: 0.8rem;
  margin: 2rem 0;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 800ms var(--spring-ease), transform 800ms var(--spring-ease);
}

.gem-cluster.in-view,
.section.in-view .gem-cluster {
  opacity: 1;
  transform: translateY(0);
}

.gem-cluster::before,
.gem-cluster::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-accent-primary);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.gem-cluster::after {
  width: 12px;
  height: 12px;
}

.cluster-1 { animation-delay: 0.3s; }
.cluster-2 { animation-delay: 0.5s; }
.cluster-3 { animation-delay: 0.7s; }

/* ============================================
   SCROLL INDICATOR
   ============================================ */
.scroll-indicator {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-sparkle-highlight) 0%, var(--color-accent-primary) 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  cursor: pointer;
  z-index: var(--z-indicator);
  animation: gemGlow 3s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(232, 180, 162, 0.4);
  transition: box-shadow 0.3s ease, transform 0.3s var(--spring-ease);
  opacity: 0.45;
}

.scroll-indicator:hover {
  box-shadow: 0 0 40px rgba(194, 113, 79, 0.6);
  transform: scale(1.15);
}

.scroll-indicator.is-deep { opacity: 1; transform: rotate(18deg) scale(1.08); }

.hero-rhinestones,
.constellation {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.hero-rhinestones i,
.constellation span,
.mini-gems span {
  position: absolute;
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #faf3eb, #f0d9b5 35%, #d4a24e 68%, transparent 72%);
  box-shadow: 0 0 16px rgba(240, 217, 181, 0.75);
  animation: sparkleFloat 5s ease-in-out infinite;
}

.hero-rhinestones i:nth-child(1) { left: 22%; top: 34%; animation-delay: .2s; }
.hero-rhinestones i:nth-child(2) { left: 76%; top: 39%; width: 12px; height: 12px; animation-delay: .8s; }
.hero-rhinestones i:nth-child(3) { left: 64%; top: 70%; animation-delay: 1.3s; }
.hero-rhinestones i:nth-child(4) { left: 34%; top: 68%; width: 6px; height: 6px; animation-delay: 1.9s; }
.hero-rhinestones i:nth-child(5) { left: 51%; top: 25%; width: 7px; height: 7px; animation-delay: 2.4s; }

.constellation span:nth-child(1) { left: 18%; top: 42%; }
.constellation span:nth-child(2) { left: 30%; top: 54%; width: 6px; height: 6px; }
.constellation span:nth-child(3) { left: 70%; top: 45%; width: 13px; height: 13px; }
.constellation span:nth-child(4) { left: 82%; top: 59%; }
.constellation span:nth-child(5) { left: 57%; top: 31%; width: 7px; height: 7px; }

.mini-gems {
  position: relative;
  height: 20px;
  margin-bottom: 2rem;
}

.mini-gems span {
  position: relative;
  display: inline-block;
  margin-right: 14px;
  clip-path: polygon(50% 0%, 85% 30%, 70% 85%, 25% 85%, 8% 32%);
}

.final-halo {
  position: absolute;
  width: min(70vw, 520px);
  height: 240px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(240, 196, 168, 0.42), transparent 62%),
    radial-gradient(ellipse at 45% 55%, rgba(212, 144, 122, 0.24), transparent 70%);
  filter: blur(34px);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes bloomReveal {
  from {
    clip-path: circle(0%);
    opacity: 0;
  }
  to {
    clip-path: circle(100%);
    opacity: 1;
  }
}

@keyframes inkBlooming {
  0% {
    clip-path: circle(0% at 50% 50%);
  }
  100% {
    clip-path: circle(100% at 50% 50%);
  }
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDelay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes gemRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes gemGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(232, 180, 162, 0.3), 0 0 40px rgba(194, 113, 79, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(232, 180, 162, 0.5), 0 0 80px rgba(194, 113, 79, 0.25);
  }
}

@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: .55; }
  50% { transform: translateY(-16px) scale(1.35); opacity: 1; }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  :root {
    --page-padding: 1rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  .pull-quote p {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  :root {
    --column-max-narrow: 100%;
    --column-max-regular: 100%;
    --page-padding: 1rem;
  }

  h1 {
    font-size: clamp(2.4rem, 8vw, 4rem);
  }

  h2.cascade-word {
    font-size: clamp(2rem, 6vw, 4rem);
  }

  .scroll-indicator {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 28px;
    height: 28px;
  }
}

/* ============================================
   INTERSECTION OBSERVER STATES
   ============================================ */
.section.in-view .watercolor-divider-wash {
  animation: bloomReveal 1s var(--spring-ease) forwards;
}

h2.in-view {
  animation: slideUpFade 0.8s var(--spring-ease) forwards;
}
