:root {
  --karma-mist: #e8f0f8;
  --twilight-depth: #c5d5e8;
  --inflated-blue: #a8c8e0;
  --lavender-breath: #d8c8e8;
  --divider-blue: #b8d4e3;
  --pale-lavender: #e8dff5;
  --still-pond: #7a9ab8;
  --ink-meditation: #2c3e50;
  --fog-script: #6b8299;
  --karmic-gold: #d4c49a;
}

/* IntersectionObserver border-animate triggers fade-in timing. No frameworks trigger. The animation duration is 2.5s with `ease-in-out` */

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--karma-mist);
  color: var(--ink-meditation);
  font-family: "Nunito", sans-serif;
}

.descent {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  background: var(--karma-mist);
}

.room {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
  overflow: hidden;
  isolation: isolate;
}

.opening-room,
.philosophy-room,
.return-room { background: var(--karma-mist); }

.badge-room,
.collection-room { background: var(--twilight-depth); }

.void-content,
.philosophy-lines,
.badge-trinity {
  position: relative;
  z-index: 3;
  width: min(60vw, 900px);
  display: grid;
  place-items: center;
}

.hero-word {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ink-meditation);
  text-shadow: 0 18px 42px rgba(122, 154, 184, 0.16);
}

.timed-word,
.reveal-word,
.reveal-line {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(10px);
  transition: opacity 2s ease-in-out, filter 2s ease-in-out, transform 2s ease-in-out;
}

.timed-word.visible,
.reveal-word.visible,
.reveal-line.visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.philosophy-lines {
  gap: clamp(1rem, 3vh, 2.5rem);
  text-align: center;
}

.philosophy-lines p {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--ink-meditation);
}

.threshold {
  position: absolute;
  left: 10vw;
  right: 10vw;
  bottom: clamp(2.5rem, 7vh, 5rem);
  height: 1px;
  z-index: 4;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, #b8d4e3, #e8dff5, #a8c8e0, #d8c8e8, transparent);
  transition: transform 2.5s ease-in-out;
}

.threshold.drawn { transform: scaleX(1); }

.threshold-node {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--karmic-gold);
  box-shadow: 0 0 24px rgba(212, 196, 154, 0.46);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  transition: opacity 1.5s ease-in-out 1.1s, transform 1.5s ease-in-out 1.1s;
}

.threshold.drawn .threshold-node {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.badge {
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #c5d5e8 0%, #a8c8e0 42%, #7a9ab8 100%);
  box-shadow:
    inset 0 -8px 20px rgba(122,154,184,0.3),
    inset 0 8px 20px rgba(255,255,255,0.4),
    0 15px 40px rgba(122,154,184,0.2);
  transform: perspective(800px) rotateX(5deg) rotateY(-3deg);
}

.large-badge {
  width: 250px;
  height: 250px;
  z-index: 3;
  animation: badgeFloat 6s ease-in-out infinite;
}

.large-badge::after,
.small-badge::after {
  content: "";
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.48), rgba(255,255,255,0) 60%);
}

.golden-halo {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  z-index: 2;
  background: radial-gradient(circle, rgba(212,196,154,0.08), rgba(212,196,154,0) 58%);
}

@keyframes badgeFloat {
  0%, 100% { transform: perspective(800px) rotateX(5deg) rotateY(-3deg) translateY(0); }
  50% { transform: perspective(800px) rotateX(5deg) rotateY(-3deg) translateY(-4px); }
}

.badge-trinity {
  width: auto;
  grid-template-columns: repeat(3, 120px);
  gap: clamp(2rem, 5vw, 4rem);
}

.small-badge {
  width: 120px;
  height: 120px;
  border: 1px solid transparent;
  background:
    radial-gradient(circle at 34% 28%, #c5d5e8 0%, #a8c8e0 42%, #7a9ab8 100%) padding-box,
    linear-gradient(var(--angle), var(--lavender-breath), var(--inflated-blue), var(--lavender-breath)) border-box;
  animation: rotateBorder 8s linear infinite;
}

@keyframes rotateBorder { to { --angle: 360deg; } }

.yin-badge::before {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 25%, #7a9ab8 0 9%, transparent 10%),
    radial-gradient(circle at 50% 75%, #e8f0f8 0 9%, transparent 10%),
    linear-gradient(90deg, #e8f0f8 0 50%, #7a9ab8 50% 100%);
  opacity: 0.46;
  filter: blur(0.2px);
}

.mandala-badge span,
.mandala-corner {
  position: absolute;
  pointer-events: none;
}

.mandala-badge span {
  inset: 24%;
  border-radius: 50%;
  border: 1px solid rgba(232,240,248,0.58);
}

.mandala-badge span::before,
.mandala-badge span::after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border-top: 1px solid rgba(232,240,248,0.62);
  border-left: 1px solid rgba(232,240,248,0.38);
  transform: rotate(28deg);
}

.mandala-badge span::after { inset: 34%; transform: rotate(78deg); }

.mandala-corner {
  width: clamp(130px, 20vw, 260px);
  height: clamp(130px, 20vw, 260px);
  border: 1px solid rgba(197,213,232,0.6);
  border-radius: 50%;
  opacity: 0.34;
}

.mandala-corner::before,
.mandala-corner::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(197,213,232,0.55);
  border-radius: 50%;
}

.mandala-corner::after { inset: 37%; }
.corner-tl { top: -7%; left: -7%; clip-path: inset(0 50% 50% 0); }
.corner-tr { top: -7%; right: -7%; clip-path: inset(0 0 50% 50%); }
.corner-bl { bottom: -7%; left: -7%; clip-path: inset(50% 50% 0 0); }
.corner-br { bottom: -7%; right: -7%; clip-path: inset(50% 0 0 50%); }

.bokeh-field {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.bokeh {
  position: absolute;
  display: block;
  width: var(--size, 80px);
  height: var(--size, 80px);
  left: var(--x, 50%);
  top: var(--y, 50%);
  border-radius: 50%;
  opacity: var(--alpha, 0.08);
  filter: blur(30px);
  background: var(--tone, #a8c8e0);
}

.soft-field .bokeh { --alpha: 0.045; }
.dense-field .bokeh { --alpha: 0.1; }
.b1 { --size: 120px; --x: 8%; --y: 12%; --tone: #a8c8e0; }
.b2 { --size: 74px; --x: 22%; --y: 70%; --tone: #d8c8e8; }
.b3 { --size: 96px; --x: 78%; --y: 18%; --tone: #a8c8e0; }
.b4 { --size: 58px; --x: 88%; --y: 64%; --tone: #d4c49a; }
.b5 { --size: 110px; --x: 48%; --y: 82%; --tone: #d8c8e8; }
.b6 { --size: 42px; --x: 38%; --y: 19%; --tone: #a8c8e0; }
.b7 { --size: 88px; --x: 64%; --y: 52%; --tone: #d8c8e8; }
.b8 { --size: 116px; --x: 4%; --y: 88%; --tone: #a8c8e0; }
.b9 { --size: 62px; --x: 92%; --y: 8%; --tone: #d4c49a; }
.b10 { --size: 80px; --x: 15%; --y: 42%; --tone: #d8c8e8; }
.b11 { --size: 104px; --x: 72%; --y: 84%; --tone: #a8c8e0; }
.b12 { --size: 52px; --x: 55%; --y: 9%; --tone: #d8c8e8; }
.b13 { --size: 92px; --x: 31%; --y: 49%; --tone: #a8c8e0; }
.b14 { --size: 70px; --x: 84%; --y: 39%; --tone: #d8c8e8; }
.b15 { --size: 124px; --x: 42%; --y: 92%; --tone: #a8c8e0; }
.b16 { --size: 66px; --x: 11%; --y: 26%; --tone: #d4c49a; }
.b17 { --size: 118px; --x: 59%; --y: 28%; --tone: #d8c8e8; }
.b18 { --size: 84px; --x: 26%; --y: 86%; --tone: #a8c8e0; }
.b19 { --size: 48px; --x: 69%; --y: 7%; --tone: #d4c49a; }
.b20 { --size: 112px; --x: 95%; --y: 82%; --tone: #a8c8e0; }
.b21 { --size: 76px; --x: 6%; --y: 58%; --tone: #d8c8e8; }
.b22 { --size: 100px; --x: 36%; --y: 5%; --tone: #a8c8e0; }
.b23 { --size: 54px; --x: 51%; --y: 62%; --tone: #d4c49a; }
.b24 { --size: 106px; --x: 81%; --y: 93%; --tone: #d8c8e8; }
.b25 { --size: 68px; --x: 18%; --y: 7%; --tone: #a8c8e0; }

.final-arc {
  width: min(220px, 42vw);
  height: auto;
  margin-top: 1.6rem;
  overflow: visible;
}

.final-arc path {
  fill: none;
  stroke: var(--twilight-depth);
  stroke-width: 1;
  opacity: 0.5;
  stroke-dasharray: 360;
  stroke-dashoffset: 360;
  transition: stroke-dashoffset 4s ease-in-out;
}

.final-arc.draw path { stroke-dashoffset: 0; }

@media (max-width: 720px) {
  .void-content,
  .philosophy-lines { width: 78vw; }
  .badge-trinity { grid-template-columns: repeat(3, 86px); gap: 1.15rem; }
  .small-badge { width: 86px; height: 86px; }
  .large-badge { width: 220px; height: 220px; }
  .threshold { left: 8vw; right: 8vw; }
}
