/* ═══════════════════════════════════════════════════════════
   xan3vo.dev — an experience, not a website
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #07070b;
  --bg-soft: #0c0c14;
  --ink: #f2f1ee;
  --ink-dim: rgba(242, 241, 238, 0.55);
  --ink-faint: rgba(242, 241, 238, 0.28);
  --violet: #8b7cf6;
  --blue: #5aa9ff;
  --teal: #6fe3d4;
  --accent-grad: linear-gradient(115deg, #8b7cf6 0%, #5aa9ff 50%, #6fe3d4 100%);
  --line: rgba(242, 241, 238, 0.1);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(139, 124, 246, 0.35); color: var(--ink); }

/* ═══════════ PRELOADER · a star is born ═══════════
   One point of light breathes in the void, flares,
   and bursts outward into the whole star field. */

.preloader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.75s ease 0.15s, visibility 0.75s 0.15s;
}
.preloader.done { opacity: 0; visibility: hidden; }

.preloader__star {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 12px 3px rgba(255, 255, 255, 0.9),
    0 0 36px 10px rgba(139, 124, 246, 0.55),
    0 0 80px 26px rgba(90, 169, 255, 0.25);
  animation: star-breathe 1.3s ease-in-out infinite;
}
@keyframes star-breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.7); opacity: 1; }
}
.preloader.done .preloader__star {
  animation: star-flare 0.55s var(--ease-out) forwards;
}
@keyframes star-flare {
  30% { transform: scale(4); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

.preloader__ring {
  position: absolute;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(139, 124, 246, 0.85);
  opacity: 0;
  transform: scale(0.2);
}
.preloader.done .preloader__ring {
  animation: ring-burst 0.95s var(--ease-out) forwards;
}
.preloader__ring--echo {
  border-color: rgba(111, 227, 212, 0.5);
}
.preloader.done .preloader__ring--echo {
  animation-delay: 0.12s;
  animation-duration: 1.1s;
}
@keyframes ring-burst {
  0% { opacity: 0.9; transform: scale(0.2); }
  100% { opacity: 0; transform: scale(38); }
}

/* ═══════════ AMBIENT LAYERS ═══════════ */

#field {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.aurora {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
  filter: blur(90px) saturate(130%);
  opacity: 0.65;
}
.aurora__blob {
  position: absolute; border-radius: 50%;
  will-change: transform;
}
.aurora__blob--1 {
  width: 55vmax; height: 55vmax;
  left: -15vmax; top: -20vmax;
  background: radial-gradient(circle at 30% 30%, rgba(139, 124, 246, 0.5), transparent 65%);
  animation: drift-1 26s ease-in-out infinite alternate;
}
.aurora__blob--2 {
  width: 48vmax; height: 48vmax;
  right: -18vmax; top: 25vh;
  background: radial-gradient(circle at 60% 40%, rgba(90, 169, 255, 0.4), transparent 65%);
  animation: drift-2 32s ease-in-out infinite alternate;
}
.aurora__blob--3 {
  width: 40vmax; height: 40vmax;
  left: 30vw; bottom: -25vmax;
  background: radial-gradient(circle at 50% 50%, rgba(111, 227, 212, 0.28), transparent 65%);
  animation: drift-3 38s ease-in-out infinite alternate;
}
@keyframes drift-1 { to { transform: translate(12vw, 10vh) scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-10vw, -12vh) scale(0.9); } }
@keyframes drift-3 { to { transform: translate(-14vw, -8vh) scale(1.2); } }

.grain {
  position: fixed; inset: -50%; z-index: 3;
  pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.7s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ═══════════ CHROME ═══════════ */

.progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 60;
  background: transparent;
}
.progress i {
  display: block; height: 100%; width: 100%;
  background: var(--accent-grad);
  transform-origin: left;
  transform: scaleX(0);
}

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.6rem clamp(1.4rem, 4vw, 3.2rem);
  mix-blend-mode: difference;
}
.nav__mark {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--ink); text-decoration: none;
}
.nav__mark span { opacity: 0.5; }
.nav__links { display: flex; gap: clamp(1.2rem, 3vw, 2.4rem); }
.nav__links a {
  position: relative;
  color: var(--ink); text-decoration: none;
  font-size: 0.82rem; letter-spacing: 0.14em;
  text-transform: lowercase;
  opacity: 0.7; transition: opacity 0.3s;
}
.nav__links a::after {
  content: ""; position: absolute;
  left: 0; bottom: -4px; height: 1px; width: 100%;
  background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}
.nav__links a:hover { opacity: 1; }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ═══════════ LAYOUT ═══════════ */

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

/* ═══════════ SCENE 01 · HERO ═══════════ */

.hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center;
  padding: 0 1.5rem;
  position: relative;
}

.hero__eyebrow {
  font-size: 0.78rem; letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 3vh;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4.2rem, 17vw, 15rem);
  line-height: 0.88;
  letter-spacing: -0.02em;
  user-select: none;
}
.hero__line { display: block; overflow: hidden; }
.hero__word {
  display: inline-block;
  will-change: transform;
  background: linear-gradient(180deg, var(--ink) 60%, rgba(242, 241, 238, 0.35));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: word-rise 1.2s 1s var(--ease-out) both;
}
.hero__line--offset { margin-left: clamp(2rem, 10vw, 9rem); }
.hero__word--ghost {
  background: var(--accent-grad);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  animation: word-rise 1.2s 1.15s var(--ease-out) both,
             grad-flow 9s ease-in-out infinite;
}
@keyframes word-rise {
  from { transform: translateY(110%); }
  to { transform: translateY(0); }
}
@keyframes grad-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero__sub { margin-top: 5vh; }
.hero__sub p:first-child {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 400;
}
.hero__sub-dim {
  margin-top: 0.5rem;
  font-size: 0.85rem; letter-spacing: 0.08em;
  color: var(--ink-dim);
}

.hero__scroll {
  position: absolute; bottom: 4vh; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 0.7rem;
}
.hero__scroll-label {
  font-size: 0.68rem; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--ink-faint);
}
.hero__scroll-line {
  width: 1px; height: 56px;
  background: linear-gradient(var(--ink-faint), transparent);
  overflow: hidden; position: relative;
}
.hero__scroll-line::after {
  content: ""; position: absolute;
  top: 0; left: 0; width: 100%; height: 40%;
  background: var(--violet);
  animation: scroll-pulse 2s var(--ease-out) infinite;
}
@keyframes scroll-pulse {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(280%); }
}

/* ═══════════ MARQUEE ═══════════ */

.marquee {
  overflow: hidden;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(-1.2deg) scale(1.02);
  background: rgba(12, 12, 20, 0.45);
  backdrop-filter: blur(8px);
}
.marquee__track {
  display: flex; width: max-content;
  animation: marquee-run 30s linear infinite;
}
.marquee__track span {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
@keyframes marquee-run { to { transform: translateX(-50%); } }

/* ═══════════ SCENES ═══════════ */

.scene {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(7rem, 16vh, 12rem) clamp(1.4rem, 5vw, 3rem);
}

.scene__index {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 3rem;
  font-size: 0.75rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--ink-dim);
}
.scene__index i {
  display: block; width: 64px; height: 1px;
  background: var(--accent-grad);
}

.scene__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: 3.5rem;
}

.scene__body {
  max-width: 620px;
  display: grid; gap: 1.6rem;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--ink-dim);
}
.scene__body em {
  font-style: normal; color: var(--ink);
  border-bottom: 1px solid rgba(139, 124, 246, 0.5);
}

/* split-line title reveal */
.split-lines .line-wrap { display: block; overflow: hidden; }
.split-lines .line-inner {
  display: block;
  transform: translateY(115%);
  transition: transform 1s var(--ease-out);
}
.split-lines.in-view .line-inner { transform: translateY(0); }
.split-lines .line-wrap:nth-child(2) .line-inner { transition-delay: 0.12s; }
.split-lines .line-wrap:nth-child(3) .line-inner { transition-delay: 0.24s; }

/* generic reveal */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ═══════════ ORBIT ORNAMENT ═══════════ */

.orbit {
  position: absolute;
  right: clamp(-2rem, 2vw, 4rem); top: 30%;
  width: 300px; height: 300px;
  opacity: 0.85;
  pointer-events: none;
}
.orbit__core {
  position: absolute; top: 50%; left: 50%;
  width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--ink);
  box-shadow: 0 0 24px 6px rgba(139, 124, 246, 0.55);
}
.orbit__ring {
  position: absolute; top: 50%; left: 50%;
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.orbit__ring i {
  position: absolute; top: -3px; left: 50%;
  width: 6px; height: 6px; border-radius: 50%;
}
.orbit__ring--1 { width: 110px; height: 110px; animation: spin 9s linear infinite; }
.orbit__ring--1 i { background: var(--violet); }
.orbit__ring--2 { width: 190px; height: 190px; animation: spin 16s linear infinite reverse; }
.orbit__ring--2 i { background: var(--blue); }
.orbit__ring--3 { width: 275px; height: 275px; animation: spin 26s linear infinite; }
.orbit__ring--3 i { background: var(--teal); }
@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 900px) {
  .orbit { display: none; }
}

/* ═══════════ MIND SYSTEM ═══════════ */

.mind-visual canvas {
  display: block;
  width: 100%;
}

/* ═══════════ CREED ═══════════ */

.scene--creed {
  max-width: 100%;
  text-align: center;
  padding-top: clamp(9rem, 22vh, 15rem);
  padding-bottom: clamp(9rem, 22vh, 15rem);
}

.creed { max-width: 920px; margin: 0 auto; }
.creed__text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.7rem, 4.6vw, 3.4rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.creed__text .w {
  display: inline-block;
  opacity: 0.12;
  transform: translateY(0.25em);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.creed__text .w.lit { opacity: 1; transform: translateY(0); }
.creed__accent {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.creed cite {
  display: block; margin-top: 2.4rem;
  font-style: normal; font-size: 0.85rem;
  letter-spacing: 0.2em; color: var(--ink-faint);
}

/* ═══════════ SIGNAL ═══════════ */

.scene--signal {
  text-align: center;
  padding-bottom: clamp(6rem, 14vh, 10rem);
}
.scene--signal .scene__index { justify-content: center; }

.signal__lead {
  color: var(--ink-dim);
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 3rem;
}

.signal__link {
  display: inline-flex; align-items: baseline; gap: 1.6rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 7.5rem);
  letter-spacing: -0.03em;
  line-height: 1;
  position: relative;
}
.signal__text {
  position: relative;
  transition: color 0.4s;
}
.signal__text::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  background: var(--accent-grad);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s var(--ease-out);
  animation: grad-flow 7s ease-in-out infinite;
}
.signal__link:hover .signal__text::after { clip-path: inset(0 0 0 0); }
.signal__arrow {
  font-size: 0.5em;
  transition: transform 0.5s var(--ease-out);
}
.signal__link:hover .signal__arrow { transform: translateX(0.4em) rotate(-45deg); }

.signal__dim {
  margin-top: 2.6rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

/* ═══════════ FOOTER ═══════════ */

.footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  padding: 2rem clamp(1.4rem, 4vw, 3.2rem);
  border-top: 1px solid var(--line);
  font-size: 0.78rem; letter-spacing: 0.1em;
  color: var(--ink-dim);
}
.footer__dim { color: var(--ink-faint); }
.footer__count { color: var(--ink-faint); }
.footer__count b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ═══════════ ACCESSIBILITY ═══════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal, .creed__text .w { opacity: 1; transform: none; translate: 0 0; }
  .split-lines .line-inner { transform: none; }
}
