/* === BASE === */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

:root {
  --abyss: #0A0E1A;
  --deep-indigo: #111833;
  --midnight-sapphire: #1A2744;
  --lunar-white: #E8ECF4;
  --steel-mist: #8B95A8;
  --frozen-cyan: #3DEFE9;
  --twilight-violet: #7B5EA7;
  --rose-dust: #C4738E;
  --font-display: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'Fira Code', monospace;
}

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

body {
  background: var(--abyss);
  color: var(--lunar-white);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  line-height: 1.85;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

/* === SCENES === */
.scene {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  padding: clamp(2rem, 8vw, 8rem);
  scroll-snap-align: start;
}

.scene-content {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* === F-LAYOUT === */
.f-layout {
  display: flex;
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
}

.f-layout.reverse { flex-direction: row-reverse; }

.text-block { flex: 1; max-width: 560px; }
.form-anchor { flex: 1; display: flex; justify-content: center; align-items: center; }

/* === TYPOGRAPHY === */
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 8rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.title-line {
  display: block;
}

.subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  color: var(--steel-mist);
  margin-top: 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 5vw, 4rem);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.body-text {
  color: var(--steel-mist);
  margin-bottom: 1rem;
}

.system-label {
  margin-top: 1.5rem;
}

.accent-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel-mist);
  margin-right: 0.5rem;
}

.accent-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--frozen-cyan);
}

.rose-accent {
  color: var(--rose-dust);
}

.tension-phrase {
  position: absolute;
  bottom: 15%;
  left: clamp(2rem, 8vw, 8rem);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  line-height: 1.4;
  color: var(--steel-mist);
}

.closing-phrase {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 4rem;
  position: relative;
  z-index: 3;
}

/* === MORPH ANIMATION === */
.morph-text {
  opacity: 0;
  transform: scaleX(0.3) scaleY(0.05);
  transition: opacity 1.2s ease-out, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--morph-delay, 0s);
  will-change: transform, opacity;
}

.morph-text.visible {
  opacity: 1;
  transform: scaleX(1) scaleY(1);
}

/* === THRESHOLD === */
.threshold .scene-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title-block { flex: 1; z-index: 3; }

.sentinel-sphere {
  position: relative;
  width: clamp(200px, 45vw, 550px);
  height: clamp(200px, 45vw, 550px);
  flex-shrink: 0;
}

.sphere-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #111833, #1A2744, #3DEFE9, #7B5EA7, #111833);
  background-size: 100% 100%;
  animation: sphere-rotate 60s linear infinite;
  box-shadow:
    0 0 120px rgba(61,239,233,0.03),
    0 0 80px rgba(61,239,233,0.05),
    0 0 40px rgba(61,239,233,0.08),
    inset 0 0 60px rgba(61,239,233,0.1),
    inset 0 0 30px rgba(255,255,255,0.05),
    inset 0 -20px 40px rgba(123,94,167,0.15);
  position: relative;
}

@keyframes sphere-rotate {
  from { background: conic-gradient(from 0deg, #111833, #1A2744, #3DEFE9, #7B5EA7, #111833); }
  to { background: conic-gradient(from 360deg, #111833, #1A2744, #3DEFE9, #7B5EA7, #111833); }
}

.constellation-line {
  position: absolute;
  top: 50%;
  left: 30%;
  width: 20%;
  height: 1px;
  background: linear-gradient(90deg, var(--steel-mist), transparent);
  opacity: 0.2;
}

/* === DESCENT === */
.descent {
  background: radial-gradient(ellipse at 30% 50%, rgba(26,39,68,0.4) 0%, transparent 60%);
}

.horizon-line {
  position: absolute;
  top: 60%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--midnight-sapphire);
}

.toroid-svg {
  width: clamp(200px, 30vw, 350px);
  animation: toroid-breathe 8s ease-in-out infinite;
}

@keyframes toroid-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* === FORMATION === */
.formation {
  background: var(--deep-indigo);
}

.drift-capsule {
  width: clamp(120px, 20vw, 240px);
  height: clamp(240px, 40vw, 480px);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--frozen-cyan), var(--twilight-violet));
  opacity: 0.6;
  transform: rotate(15deg);
  animation: capsule-drift 12s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  box-shadow:
    0 0 60px rgba(61,239,233,0.08),
    inset 0 0 40px rgba(255,255,255,0.05);
}

@keyframes capsule-drift {
  0%, 100% { transform: rotate(15deg) translateY(0); }
  50% { transform: rotate(15deg) translateY(-20px); }
}

/* === CONVERGENCE === */
.convergence-layout {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.left-col, .right-col { flex: 1; max-width: 400px; }
.convergence-layout .center { flex: 0 0 auto; }

.nested-cluster {
  position: relative;
  width: clamp(180px, 25vw, 300px);
  height: clamp(180px, 25vw, 300px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-outer {
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--twilight-violet);
  opacity: 0.15;
  animation: pulse-outer 6s ease-in-out infinite;
}

.cluster-middle {
  position: absolute;
  width: 60%; height: 60%;
  border-radius: 50%;
  background: var(--frozen-cyan);
  opacity: 0.3;
  animation: pulse-middle 6s ease-in-out 1s infinite;
}

.cluster-inner {
  position: absolute;
  width: 25%; height: 25%;
  border-radius: 50%;
  background: var(--lunar-white);
  opacity: 0.5;
  animation: pulse-inner 6s ease-in-out 2s infinite;
}

@keyframes pulse-outer { 0%,100%{transform:scale(1);} 50%{transform:scale(1.05);} }
@keyframes pulse-middle { 0%,100%{transform:scale(1);} 50%{transform:scale(1.08);} }
@keyframes pulse-inner { 0%,100%{transform:scale(1);} 50%{transform:scale(1.12);} }

/* === TENSION === */
.tension {
  min-height: 90vh;
}

.top-right {
  position: absolute;
  top: 10%;
  right: 10%;
}

.shard-svg {
  width: clamp(180px, 25vw, 300px);
}

.shard-inner {
  animation: shard-rotate 30s linear infinite;
  transform-origin: center;
}

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

/* === HORIZON === */
.horizon {
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

.horizon .scene-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mountains {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  z-index: 1;
}

.mountain-svg {
  width: 100%;
  height: 100%;
}

.ridge-glow {
  animation: ridge-pulse 8s ease-in-out infinite;
}

@keyframes ridge-pulse {
  0%,100% { opacity: 0.25; }
  50% { opacity: 0.5; }
}

.stars {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 60%;
  background:
    radial-gradient(1px 1px at 10% 15%, rgba(232,236,244,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 25% 40%, rgba(232,236,244,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 45% 10%, rgba(232,236,244,0.5) 50%, transparent 50%),
    radial-gradient(2px 2px at 60% 30%, rgba(232,236,244,0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 75% 20%, rgba(232,236,244,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 88% 45%, rgba(232,236,244,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 35% 55%, rgba(232,236,244,0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 55% 50%, rgba(232,236,244,0.5) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 15% 60%, rgba(232,236,244,0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 55%, rgba(232,236,244,0.4) 50%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* Mini forms */
.mini-forms {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  perspective: 600px;
  z-index: 3;
  position: relative;
}

.mini {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--frozen-cyan), var(--twilight-violet));
}

.mini-1 { width: 40px; height: 40px; opacity: 0.7; transform: translateZ(-20px); }
.mini-2 { width: 28px; height: 28px; opacity: 0.5; transform: translateZ(-60px); }
.mini-3 { width: 20px; height: 20px; opacity: 0.35; transform: translateZ(-100px); }
.mini-4 { width: 14px; height: 14px; opacity: 0.2; transform: translateZ(-140px); }
.mini-5 { width: 8px; height: 8px; opacity: 0.1; transform: translateZ(-180px); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .scene { padding: 2rem 1.5rem; }
  .f-layout, .f-layout.reverse { flex-direction: column; }
  .convergence-layout { flex-direction: column; }
  .threshold .scene-content { flex-direction: column; gap: 3rem; }
  .sentinel-sphere { width: 70vw; height: 70vw; }
  .top-right { position: relative; top: auto; right: auto; margin-bottom: 2rem; }
  .tension-phrase { position: relative; bottom: auto; left: auto; margin-top: 2rem; }
}
