/* ============================================================
   QOI Protocol — design system
   ============================================================ */
:root {
  --bg: #05060a;
  --bg-soft: #0a0c14;
  --ink: #eef1ff;
  --ink-dim: rgba(238, 241, 255, 0.55);
  --ink-faint: rgba(238, 241, 255, 0.28);
  --mint: #4effb8;
  --accent: #6fd6ff;
  --accent2: #b3ecff;
  --line: rgba(238, 241, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.03);
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* palette experiments: append ?theme=purple (or gold) to the URL.
   Default accent is ice cyan. */
[data-theme="purple"] {
  --accent: #8b5cf6;
  --accent2: #b49aff;
}
[data-theme="gold"] {
  --accent: #f5b95a;
  --accent2: #ffd99a;
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

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: var(--mint); color: #05060a; }

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

/* ---------- progress bar ---------- */
.progress-bar {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--accent), var(--accent2));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- grain + orbs ---------- */
.grain {
  position: fixed; inset: -5%;
  z-index: 90; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
  will-change: transform;
}
@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%); }
}

/* soft glow baked into a radial gradient — a transformed filter:blur(110px)
   layer re-rasterizes on scroll in Safari/mobile and tanks the frame rate */
.orb {
  position: fixed; z-index: 0; pointer-events: none;
  background: radial-gradient(circle closest-side, var(--orb-c), transparent 72%);
  will-change: transform;
}
.orb--mint { --orb-c: rgba(78, 255, 184, 0.16); width: 60vw; height: 60vw; top: -20vw; right: -20vw; }
.orb--violet {
  --orb-c: rgba(111, 214, 255, 0.20);
  --orb-c: color-mix(in srgb, var(--accent) 20%, transparent);
  width: 66vw; height: 66vw; top: 55vh; left: -24vw;
}
.orb--purple {
  --orb-c: rgba(179, 236, 255, 0.12);
  --orb-c: color-mix(in srgb, var(--accent2) 12%, transparent);
  width: 48vw; height: 48vw; top: 145vh; right: -16vw;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  transition: background 0.4s, backdrop-filter 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(5, 6, 10, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: var(--line);
}
.nav__logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 0.55rem;
}
.nav__logo-mark {
  width: 19px; height: 19px; display: block;
  filter: drop-shadow(0 0 6px rgba(78, 255, 184, 0.45));
}
.nav__logo-dim { color: var(--ink-faint); font-weight: 400; }
.nav__links { display: flex; gap: 2rem; font-size: 0.85rem; color: var(--ink-dim); }
.nav__links a { position: relative; transition: color 0.3s; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -5px;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--mint), var(--accent));
  transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform 0.4s var(--ease-out);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: 0 50%; }

/* ---------- chain rail: the Q, straightened into a section indicator ---------- */
.chain-nav {
  position: fixed; right: clamp(1.1rem, 2.2vw, 2.4rem); top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: flex; flex-direction: column; align-items: flex-end; gap: 1.7rem;
  opacity: 0; pointer-events: none; /* revealed as the chain straightens in */
}
.chain-nav__line {
  position: absolute; top: 7px; bottom: 7px; right: 6.5px; width: 1px;
  background: var(--line); overflow: hidden;
}
.chain-nav__line-fill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--mint), var(--accent));
  transform: scaleY(0); transform-origin: 50% 0;
  opacity: 0.7;
}
.chain-nav__item { display: flex; align-items: center; gap: 0.8rem; }
.chain-nav__node {
  width: 14px; height: 14px; border-radius: 5px;
  border: 1px solid rgba(238, 241, 255, 0.25);
  background: rgba(8, 11, 18, 0.85);
  position: relative;
  transition: border-color 0.35s, box-shadow 0.35s;
}
.chain-nav__node::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--mint); opacity: 0; transition: opacity 0.35s;
}
.chain-nav__label {
  font-family: var(--font-display); font-size: 0.62rem;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-faint); white-space: nowrap;
  opacity: 0; transform: translateX(6px);
  transition: opacity 0.3s, transform 0.3s, color 0.3s;
}
.chain-nav__item:hover .chain-nav__label { opacity: 1; transform: none; }
.chain-nav__item:hover .chain-nav__node { border-color: rgba(78, 255, 184, 0.5); }
.chain-nav__item.is-active .chain-nav__node {
  border-color: var(--mint);
  box-shadow: 0 0 12px rgba(78, 255, 184, 0.28);
}
.chain-nav__item.is-active .chain-nav__node::after { opacity: 1; }
.chain-nav__item.is-active .chain-nav__label { opacity: 0.85; transform: none; color: var(--mint); }
@media (max-width: 900px) { .chain-nav { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 500;
  font-size: 0.9rem; letter-spacing: 0.03em;
  padding: 0.8rem 1.7rem; border-radius: 999px;
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s, border-color 0.3s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary {
  background: linear-gradient(135deg, var(--mint), var(--accent));
  color: #04050a; border: none;
  box-shadow: 0 0 0 rgba(78, 255, 184, 0);
}
.btn--primary:hover { box-shadow: 0 8px 40px rgba(78, 255, 184, 0.35); }
.btn--ghost { color: var(--ink); background: var(--glass); }
.btn--ghost:hover { border-color: rgba(78, 255, 184, 0.5); }
.btn--xl { padding: 1.1rem 2.6rem; font-size: 1.05rem; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  /* column flow: content centers in the free space, the scroll hint sits
     below it in normal flow — overlap is impossible at any viewport size */
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding-top: 6.5rem;
}
/* static ambient glow behind the chain — was a per-frame canvas fill */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(52vmin 48vmin at 50% 52%, rgba(78, 255, 184, 0.06), transparent 70%);
  pointer-events: none;
}
.hero__canvas {
  /* fixed: the chain lives in viewport space so its nodes can fly to the
     fixed section rail during the morph */
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
/* once the morph starts the hero copy is gone — lift the flying nodes
   above the incoming section */
.hero__canvas--front { z-index: 65; }
.hero__content { position: relative; z-index: 2; padding: 0 1.5rem; max-width: 880px; margin: auto 0; }
.hero__eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem; letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--mint); margin-bottom: 1.6rem;
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8.5vw, 6.4rem);
  font-weight: 700; line-height: 1.02; letter-spacing: -0.03em;
}
.hero__title-line { display: block; overflow: hidden; }
.hero__title-line--accent {
  background: linear-gradient(92deg, var(--mint) 10%, var(--accent) 55%, var(--accent2) 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero__sub {
  margin: 1.8rem auto 0; max-width: 560px;
  color: var(--ink-dim); font-size: clamp(0.95rem, 1.4vw, 1.1rem);
}
.hero__actions { margin-top: 2.6rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* split-line reveal helper */
.reveal-line { overflow: hidden; display: block; }
.reveal-line > span { display: inline-block; will-change: transform; }

/* ---------- sections ---------- */
.section { position: relative; z-index: 2; padding: clamp(6rem, 12vw, 10rem) 0; }
.section__inner { max-width: 1180px; margin: 0 auto; padding: 0 clamp(1.2rem, 4vw, 3rem); }
.section__eyebrow {
  font-family: var(--font-display); font-size: 0.8rem;
  letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--mint); margin-bottom: 1.2rem;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.12;
  max-width: 720px; margin-bottom: 3.2rem;
}
.split-words .word { display: inline-block; will-change: transform, opacity; }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}
.stat {
  border: 1px solid var(--line); border-radius: 20px;
  padding: 2.2rem 1.8rem;
  background: var(--glass);
  transition: border-color 0.4s;
}
.stat:hover { border-color: rgba(78, 255, 184, 0.35); }
.stat__value {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: 1;
  background: linear-gradient(120deg, var(--mint), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat__value--sm { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: 0.04em; }
.stat__label { margin-top: 0.8rem; color: var(--ink-dim); font-size: 0.85rem; letter-spacing: 0.04em; }

/* ---------- feature cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}
.card {
  position: relative;
  border: 1px solid var(--line); border-radius: 24px;
  padding: 2.4rem 2rem 2.8rem;
  background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.01));
  overflow: hidden;
  transition: border-color 0.4s;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(78, 255, 184, 0.10), transparent 65%);
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: rgba(111, 214, 255, 0.4);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.card__icon {
  width: 56px; height: 56px; margin-bottom: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(150deg, rgba(78, 255, 184, 0.07), rgba(111, 214, 255, 0.07));
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--mint) 7%, transparent),
    color-mix(in srgb, var(--accent) 7%, transparent));
  transition: border-color 0.4s;
}
.card:hover .card__icon { border-color: rgba(78, 255, 184, 0.35); }
.card__icon svg { width: 32px; height: 32px; display: block; }
.card h3 {
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  margin-bottom: 0.7rem; letter-spacing: -0.01em;
}
.card p { color: var(--ink-dim); font-size: 0.92rem; }
.card__num {
  position: absolute; right: 1.4rem; bottom: 0.6rem;
  font-family: var(--font-display); font-size: 3.4rem; font-weight: 700;
  color: rgba(238, 241, 255, 0.05);
}

/* ---------- roadmap (pinned horizontal) ---------- */
.roadmap { position: relative; z-index: 2; }
.roadmap__pin {
  height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  padding: 0 clamp(1.2rem, 4vw, 3rem);
}
.roadmap__head { max-width: 1180px; margin: 0 auto 3rem; width: 100%; }
.roadmap__head .section__title { margin-bottom: 0; }
.roadmap__track {
  display: flex; gap: 1.6rem;
  width: max-content;
  will-change: transform;
  padding-left: max(calc((100vw - 1180px) / 2), 1.2rem);
}
.phase {
  position: relative;
  width: clamp(300px, 36vw, 460px);
  flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 26px;
  padding: 2.6rem 2.2rem 3rem;
  background: linear-gradient(150deg, rgba(255,255,255,0.05), rgba(255,255,255,0.012));
  overflow: hidden;
}
.phase__tag {
  font-family: var(--font-display); font-size: 0.75rem;
  letter-spacing: 0.25em; text-transform: uppercase; color: var(--mint);
}
.phase h3 {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
  margin: 1rem 0 0.8rem;
}
.phase p { color: var(--ink-dim); font-size: 0.95rem; max-width: 34ch; }
.phase__num {
  position: absolute; right: 1.6rem; top: 1.2rem;
  font-family: var(--font-display); font-size: 4.6rem; font-weight: 700;
  color: rgba(238, 241, 255, 0.06);
}
.roadmap__progress {
  max-width: 1180px; margin: 3rem auto 0; width: 100%;
  height: 2px; background: var(--line); border-radius: 2px;
}
.roadmap__progress-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--accent), var(--accent2));
  transform: scaleX(0); transform-origin: 0 50%;
  border-radius: 2px;
}

/* ---------- tokenomics ---------- */
.tokenomics__grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4rem; align-items: center;
}
@media (max-width: 820px) { .tokenomics__grid { grid-template-columns: 1fr; } }
.tokenomics__chart-wrap { display: flex; justify-content: center; }
.donut { width: min(380px, 80vw); transform: rotate(-90deg); overflow: visible; }
.donut__track { fill: none; stroke: rgba(238, 241, 255, 0.06); stroke-width: 26; }
.donut__seg {
  fill: none; stroke-width: 26; stroke-linecap: butt;
}
.donut__seg--a { stroke: var(--mint); }
.donut__seg--b { stroke: var(--accent); }
.donut__seg--c { stroke: var(--accent2); }
.donut__seg--d { stroke: #3a4670; }
.donut__center {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 700;
  fill: var(--ink); transform: rotate(90deg); transform-origin: 120px 120px;
}
.donut__center-sub {
  font-family: var(--font-body); font-size: 0.56rem; letter-spacing: 0.1em;
  fill: var(--ink-dim); transform: rotate(90deg); transform-origin: 120px 120px;
  text-transform: uppercase;
}
.legend { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }
.legend__item {
  display: flex; align-items: center; gap: 0.9rem;
  color: var(--ink-dim); font-size: 1rem;
  border-bottom: 1px solid var(--line); padding-bottom: 1.1rem;
}
.legend__item strong { color: var(--ink); font-family: var(--font-display); min-width: 3.2rem; }
.legend__dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.legend__dot--a { background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.legend__dot--b { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.legend__dot--c { background: var(--accent2); box-shadow: 0 0 10px var(--accent2); }
.legend__dot--d { background: #3a4670; }

/* ---------- company registry card ---------- */
.registry {
  margin-top: 2.2rem;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--glass);
  padding: 1.4rem 1.6rem;
  font-size: 0.88rem;
}
.registry__row {
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.registry__row span { color: var(--ink-faint); white-space: nowrap; }
.registry__row strong { color: var(--ink); font-weight: 500; text-align: right; }
.registry__link {
  display: inline-block; margin-top: 1rem;
  font-family: var(--font-display); font-size: 0.85rem;
  color: var(--mint);
  border-bottom: 1px solid rgba(78, 255, 184, 0.35);
  transition: border-color 0.3s, color 0.3s;
}
.registry__link:hover { color: var(--ink); border-color: var(--ink); }

.footer__legal { line-height: 1.7; }

/* ---------- CTA ---------- */
.cta {
  position: relative; z-index: 2;
  padding: clamp(8rem, 16vw, 13rem) 1.5rem;
  text-align: center;
  background:
    radial-gradient(700px 360px at 50% 110%, rgba(111, 214, 255, 0.16), transparent 70%),
    radial-gradient(500px 280px at 50% -10%, rgba(78, 255, 184, 0.08), transparent 70%);
}
.cta__title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 5.4rem); font-weight: 700; letter-spacing: -0.03em;
  margin-bottom: 1.4rem;
}
.cta__sub { color: var(--ink-dim); margin-bottom: 2.8rem; font-size: 1.05rem; }

/* ---------- footer ---------- */
.footer {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  padding: 2rem clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 0.85rem;
}
.footer__links { display: flex; gap: 1.6rem; }
.footer__links a { transition: color 0.3s; }
.footer__links a:hover { color: var(--mint); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .hero__title { font-size: clamp(2.4rem, 11vw, 3.4rem); }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}

/* touch devices: static grain — the animated layer costs battery and frames */
@media (hover: none) {
  .grain { animation: none; }
}
