/* ══════════════════════════════════════════════════════════
   NEBULA — visual system
   ══════════════════════════════════════════════════════════ */

:root {
  --ink:        #05060a;
  --ink-soft:   #0b0d14;
  --paper:      #f4f2ee;
  --paper-dim:  rgba(244, 242, 238, 0.58);
  --paper-faint:rgba(244, 242, 238, 0.22);
  --line:       rgba(244, 242, 238, 0.12);

  --accent:     #7c5cff;
  --accent-2:   #ff5c8a;
  --accent-3:   #2ee6c5;

  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --gut: clamp(1.5rem, 5vw, 5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; height: 100vh; }

::selection { background: var(--accent); color: #fff; }

/* ─── Canvas & atmosphere ──────────────────────────────── */

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

.grain {
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
  animation: grainShift 0.6s steps(3) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-1.5%, 1%); }
  66%  { transform: translate(1%, -1.5%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    /* scrim that keeps body copy legible over the particle field;
       symmetric because copy sits on either side depending on section */
    linear-gradient(to right, rgba(5, 6, 10, 0.8) 0%, rgba(5, 6, 10, 0.3) 30%, transparent 46%),
    linear-gradient(to left,  rgba(5, 6, 10, 0.8) 0%, rgba(5, 6, 10, 0.3) 30%, transparent 46%),
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(5, 6, 10, 0.75) 100%),
    linear-gradient(to bottom, rgba(5, 6, 10, 0.55) 0%, transparent 22%, transparent 78%, rgba(5, 6, 10, 0.7) 100%);
}

@media (max-width: 860px) {
  .vignette {
    background:
      linear-gradient(to bottom, rgba(5, 6, 10, 0.78) 0%, rgba(5, 6, 10, 0.55) 30%, rgba(5, 6, 10, 0.55) 70%, rgba(5, 6, 10, 0.85) 100%),
      radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(5, 6, 10, 0.75) 100%);
  }
}

/* ─── Loader ───────────────────────────────────────────── */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink);
  display: grid;
  place-items: center;
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}

.loader.is-done { opacity: 0; visibility: hidden; }

/* Belt and braces: the overlay covers the whole page, so it must leave
   even if the fade transition never runs (throttled tab, no compositing). */
.loader.is-gone { display: none; }

.loader__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.loader__mark {
  font-family: var(--serif);
  font-size: 2rem;
  letter-spacing: 0;
  color: var(--paper);
  line-height: 1;
}

.loader__bar {
  width: clamp(120px, 22vw, 260px);
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.loader__bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s linear;
}

.loader__pct { font-variant-numeric: tabular-nums; min-width: 2.5ch; }

/* ─── Navigation ───────────────────────────────────────── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.1rem, 2.4vw, 1.9rem) var(--gut);
  mix-blend-mode: difference;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-decoration: none;
  color: var(--paper);
}

.nav__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 12px var(--accent-3);
  animation: pulse 2.6s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}

.nav__links { display: flex; gap: clamp(1.2rem, 3vw, 2.6rem); }

.nav__links a {
  position: relative;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
  transition: color 0.4s var(--ease);
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}

.nav__links a:hover { color: var(--paper); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav__cta {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.6rem 1.1rem;
  transition: border-color 0.4s var(--ease), letter-spacing 0.4s var(--ease);
}

.nav__cta span { display: inline-block; transition: transform 0.4s var(--ease); }
.nav__cta:hover { border-color: var(--paper); }
.nav__cta:hover span { transform: translateX(4px); }

/* ─── Scroll progress ──────────────────────────────────── */

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 30;
  background: transparent;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent), var(--accent-2));
}

/* ─── Layout primitives ────────────────────────────────── */

main { position: relative; z-index: 10; }

.panel {
  position: relative;
  min-height: 100svh;
  padding: clamp(6rem, 14vh, 10rem) var(--gut);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow, .tag {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--paper-faint);
  margin: 0 0 1.6rem;
}

.tag { color: var(--accent-3); opacity: 0.8; }

em { font-style: italic; }

/* ─── Hero ─────────────────────────────────────────────── */

.panel--hero { justify-content: center; align-items: flex-start; }

/* width is explicit: as a flex item the hero would otherwise
   collapse to the width of its narrowest child. */
.hero { width: 100%; max-width: 60rem; }

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.9rem, 7.4vw, 7.5rem);
  line-height: 0.98;
  letter-spacing: -0.022em;
  margin: 0 0 1.8rem;
  text-wrap: balance;
}

/* Each line masks its own reveal; the padding/margin pair keeps
   descenders from being clipped by that mask. */
.hero__title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  white-space: nowrap;
}

.hero__title .line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 1.15s var(--ease);
}

.hero__title em { color: var(--accent-2); }

.hero__sub {
  max-width: 44ch;
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  color: var(--paper-dim);
  margin: 0 0 2.6rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.btn {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.95rem 1.9rem;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: all 0.45s var(--ease);
}

.btn--solid {
  background: var(--paper);
  color: var(--ink);
}
.btn--solid:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 40px -8px var(--accent);
}

.btn--ghost {
  border-color: var(--line);
  color: var(--paper);
}
.btn--ghost:hover { border-color: var(--paper); background: rgba(244,242,238,0.06); }

.scrollcue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.8rem, 5vh, 3rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.scrollcue i {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--paper-faint), transparent);
  position: relative;
  overflow: hidden;
}

.scrollcue i::after {
  content: "";
  position: absolute;
  top: -50%; left: 0;
  width: 100%; height: 50%;
  background: var(--accent-3);
  animation: cueRun 2.2s var(--ease) infinite;
}

@keyframes cueRun {
  0%   { top: -50%; opacity: 0; }
  30%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ─── Split panels ─────────────────────────────────────── */

/* Text is kept to a single column on one side so the WebGL form
   always has clear space on the other. */
.panel--split {
  display: grid;
  grid-template-columns: minmax(0, 32rem);
  justify-content: start;
  align-content: center;
  gap: clamp(1.6rem, 3vw, 2.6rem);
}

.panel--reverse { justify-content: end; }

.col h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
}

.col h2 em { color: var(--accent); }

.col--right p {
  max-width: 46ch;
  font-size: clamp(0.95rem, 1.2vw, 1.08rem);
  color: var(--paper-dim);
  margin: 0 0 2.8rem;
}

.specs {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.specs li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.specs b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.01em;
}

.specs span {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

/* ─── Centered statement ───────────────────────────────── */

.panel--center { align-items: center; text-align: center; }

/* This panel's copy is centred over the form, so it carries its own
   radial scrim rather than relying on the edge vignette. */
.statement { position: relative; }

.statement::before {
  content: "";
  position: absolute;
  inset: -18% -22%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(5, 6, 10, 0.92) 0%, rgba(5, 6, 10, 0.72) 55%, transparent 100%);
}

/* measured in rem, not ch: `ch` here would resolve against the
   inherited body font and throttle the display heading. */
.statement { max-width: 46rem; }

.statement h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 2rem;
}

.statement h2 em { color: var(--accent-2); }

.statement p {
  max-width: 52ch;
  margin: 0 auto;
  color: var(--paper-dim);
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
}

/* ─── Cards ────────────────────────────────────────────── */

.cards { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }

.card {
  background: rgba(5, 6, 10, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: clamp(1.4rem, 2.6vw, 2.2rem);
  transition: background 0.5s var(--ease);
}

.card:hover { background: rgba(124, 92, 255, 0.1); }

.card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  margin: 0 0 0.5rem;
}

.card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--paper-dim);
  max-width: 40ch;
}

/* ─── Outro ────────────────────────────────────────────── */

.panel--outro { justify-content: flex-end; align-items: center; text-align: center; }

.outro { margin: auto 0; }

.outro h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 2.4rem;
}

.outro h2 em { color: var(--accent-3); }

.signup {
  display: flex;
  gap: 0.5rem;
  max-width: 460px;
  margin: 0 auto 1.2rem;
  /* sits over the brightest part of the field, so it needs a real
     surface rather than a hairline border alone */
  border: 1px solid rgba(244, 242, 238, 0.28);
  background: rgba(5, 6, 10, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 100px;
  padding: 0.4rem 0.4rem 0.4rem 1.4rem;
  transition: border-color 0.4s var(--ease);
}

.signup:focus-within { border-color: var(--paper); }

.signup.is-sent { justify-content: center; padding: 0.9rem 1.4rem; }
.signup.is-sent input, .signup.is-sent button { display: none; }

.signup__done {
  display: none;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-3);
}

.signup.is-sent .signup__done { display: block; }

.signup input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 300;
}

.signup input::placeholder { color: var(--paper-faint); }

.signup button {
  flex-shrink: 0;
  background: var(--paper);
  color: var(--ink);
  border: none;
  border-radius: 100px;
  padding: 0.75rem 1.4rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

.signup button:hover { background: var(--accent-3); }

.fineprint {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--paper-faint);
  margin: 0;
}

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  width: 100%;
}

/* ─── Reveal choreography ──────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

[data-reveal].is-in { opacity: 1; transform: none; }

.hero__title .line[data-reveal] { opacity: 1; transform: none; }
.hero__title .line.is-in > span  { transform: translateY(0); }

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 860px) {
  .nav__links { display: none; }

  .panel--split,
  .panel--reverse { grid-template-columns: 1fr; justify-content: stretch; }

  .col--right p { margin-bottom: 2rem; }

  .hero { max-width: 100%; }
  .foot { flex-direction: column; gap: 0.6rem; text-align: center; }
  .foot__mid { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .hero__title .line > span { transform: none; }
}
