/* ============================================================
   NEBULA — style.css
   Deep-space art direction: near-black blue, cyan / magenta /
   warm-core accents. Syne for display, IBM Plex Mono for labels.
   ============================================================ */

:root {
  --bg: #030612;
  --bg-deep: #010309;
  --ink: #e9eefb;
  --ink-dim: rgba(233, 238, 251, 0.62);
  --ink-faint: rgba(233, 238, 251, 0.38);
  --cyan: #7df9ff;
  --magenta: #ff6ec7;
  --core: #ffb37a;
  --hairline: rgba(233, 238, 251, 0.16);
  --font-display: "Syne", "Avenir Next", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

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

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

html.is-loading {
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.has-cursor,
.has-cursor * {
  cursor: none !important;
}

::selection {
  background: var(--cyan);
  color: var(--bg-deep);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

/* ------------------------------------------------ canvas + overlays */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.overlay-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 44%,
    transparent 52%,
    rgba(1, 3, 9, 0.62) 100%
  );
}

.overlay-grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='180'%20height='180'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='saturate'%20values='0'/%3E%3C/filter%3E%3Crect%20width='180'%20height='180'%20filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ------------------------------------------------ header */

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 4vw, 2.6rem);
  pointer-events: none;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  pointer-events: auto;
  font-weight: 800;
  letter-spacing: 0.34em;
  font-size: 0.92rem;
}

.mark-svg {
  width: 20px;
  height: 20px;
  animation: spin 26s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.head-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
}

/* ------------------------------------------------ journey / chapters */

#journey {
  position: relative;
  z-index: 2;
}

.chapter {
  --accent: var(--cyan);
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 clamp(1.4rem, 6vw, 7rem);
}

#nursery {
  --accent: var(--magenta);
}

#core {
  --accent: var(--core);
}

#contact {
  --accent: var(--ink);
}

.chapter-inner {
  max-width: 38rem;
  position: relative;
}

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

.align-right {
  justify-content: flex-end;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  color: var(--accent);
  margin-bottom: 1.7rem;
}

.k-rule {
  display: inline-block;
  width: 3rem;
  height: 1px;
  background: linear-gradient(90deg, currentColor, transparent);
}

.title {
  font-weight: 800;
  font-size: clamp(2.4rem, 6.2vw, 4.9rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(1, 3, 9, 0.85);
}

.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.13em;
  margin-bottom: -0.13em;
}

.line-inner {
  display: inline-block;
  will-change: transform;
}

.body {
  margin-top: 1.9rem;
  max-width: 33rem;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  line-height: 1.78;
  color: var(--ink-dim);
  text-shadow: 0 1px 18px rgba(1, 3, 9, 0.85);
}

.align-center .body {
  margin-left: auto;
  margin-right: auto;
}

.hero-status {
  margin-top: 2.4rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
}

/* stats */

.stats {
  display: flex;
  gap: clamp(1.4rem, 4vw, 2.8rem);
  margin-top: 2.5rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
}

.align-center .stats {
  justify-content: center;
}

.stats dt {
  font-size: 0.56rem;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
  margin-bottom: 0.45rem;
}

.stats dd {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
}

/* cta + footer */

.cta {
  margin-top: 2.8rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: 1.05rem 2.6rem;
  transition: border-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

.cta:hover,
.cta:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 28px rgba(125, 249, 255, 0.22);
}

.site-foot {
  margin-top: 3.6rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.26em;
  color: var(--ink-faint);
  line-height: 2.1;
}

/* scroll cue */

.scroll-cue {
  position: absolute;
  bottom: 2.6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--ink-faint);
}

.cue-line {
  width: 1px;
  height: 54px;
  background: linear-gradient(var(--cyan), transparent);
  transform-origin: top;
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  60% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

/* ------------------------------------------------ progress rail */

#rail {
  position: fixed;
  right: clamp(1rem, 2.6vw, 2.2rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  align-items: center;
}

.rail-track {
  position: absolute;
  top: -2.4rem;
  bottom: -2.4rem;
  left: 50%;
  width: 1px;
  background: var(--hairline);
}

#rail-fill {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  background: linear-gradient(var(--cyan), var(--magenta));
  transform: scaleY(0);
  transform-origin: top;
}

.rail-dot {
  position: relative;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.dot-core {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: var(--bg);
  transition: background 0.35s ease, border-color 0.35s ease,
    box-shadow 0.35s ease, transform 0.35s ease;
}

.rail-dot:hover .dot-core {
  border-color: var(--ink);
}

.rail-dot.is-active .dot-core {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  transform: scale(1.3);
}

.dot-label {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  white-space: nowrap;
  opacity: 0;
  padding: 0.4em 0.7em 0.4em 0.8em;
  background: rgba(2, 4, 12, 0.72);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  backdrop-filter: blur(5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.rail-dot.is-active .dot-label {
  color: var(--ink);
  border-color: rgba(125, 249, 255, 0.35);
}

.rail-dot:hover .dot-label,
.rail-dot:focus-visible .dot-label,
.rail-dot.is-active .dot-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ------------------------------------------------ hud */

#hud {
  position: fixed;
  left: clamp(1.2rem, 4vw, 2.6rem);
  bottom: 1.7rem;
  z-index: 10;
  display: flex;
  gap: 2.4rem;
  font-family: var(--font-mono);
}

#hud span {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

#hud b {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------ custom cursor */

#cursor {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: none;
}

.has-cursor #cursor {
  display: block;
}

#cursor.is-visible {
  opacity: 1;
}

.cursor-dot {
  position: fixed;
  top: -3px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.cursor-ring {
  position: fixed;
  top: -17px;
  left: -17px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(125, 249, 255, 0.5);
  transition: width 0.25s ease, height 0.25s ease, top 0.25s ease,
    left 0.25s ease, border-color 0.25s ease;
}

#cursor.is-hover .cursor-ring {
  width: 52px;
  height: 52px;
  top: -26px;
  left: -26px;
  border-color: var(--magenta);
}

/* ------------------------------------------------ loader */

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #071022 0%, var(--bg-deep) 68%);
}

.loader-core {
  width: min(320px, 78vw);
}

.loader-mark {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-size: 0.95rem;
  margin-bottom: 2.2rem;
}

.loader-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  color: var(--ink-dim);
  margin-bottom: 0.8rem;
}

.loader-bar {
  height: 2px;
  background: rgba(233, 238, 251, 0.12);
  overflow: hidden;
}

#loader-fill {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
}

.loader-steps {
  list-style: none;
  margin-top: 1.5rem;
  display: grid;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
}

.loader-steps li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  transition: color 0.4s ease;
}

.step-box {
  width: 6px;
  height: 6px;
  border: 1px solid var(--ink-faint);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.loader-steps li.is-live {
  color: var(--ink-dim);
}

.loader-steps li.is-live .step-box {
  border-color: var(--cyan);
  animation: step-pulse 1s ease-in-out infinite alternate;
}

.loader-steps li.is-done {
  color: var(--ink-dim);
}

.loader-steps li.is-done .step-box {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(125, 249, 255, 0.55);
  animation: none;
}

@keyframes step-pulse {
  from {
    box-shadow: 0 0 0 rgba(125, 249, 255, 0);
  }
  to {
    box-shadow: 0 0 9px rgba(125, 249, 255, 0.7);
  }
}

.loader-sub {
  margin-top: 1.6rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.3em;
  color: var(--ink-faint);
}

/* ------------------------------------------------ noscript */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  padding: 2rem;
}

.noscript p {
  max-width: 30rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  line-height: 2;
  color: var(--ink-dim);
}

/* ------------------------------------------------ responsive */

@media (max-width: 860px) {
  #hud {
    display: none;
  }

  .head-meta {
    display: none;
  }

  .dot-label {
    display: none;
  }

  .align-left,
  .align-right {
    justify-content: flex-start;
  }

  .align-center {
    text-align: left;
    justify-content: flex-start;
  }

  .align-center .stats {
    justify-content: flex-start;
  }

  .align-center .body {
    margin-left: 0;
    margin-right: 0;
  }

  .title {
    font-size: clamp(2.1rem, 9.4vw, 3.4rem);
  }

  .stats {
    flex-wrap: wrap;
    gap: 1.2rem 2rem;
  }

  .scroll-cue {
    left: clamp(1.4rem, 6vw, 7rem);
    transform: none;
    align-items: flex-start;
  }
}

/* ------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .cue-line,
  .mark-svg,
  .loader-steps li.is-live .step-box {
    animation: none;
  }

  .cta,
  .dot-core,
  .dot-label,
  .cursor-ring {
    transition: none;
  }
}
