:root {
  --ink: oklch(25% 0.035 250);
  --ink-soft: oklch(42% 0.035 250);
  --paper: oklch(96% 0.025 94);
  --paper-deep: oklch(91% 0.043 98);
  --mist: oklch(91% 0.045 262);
  --lime: oklch(94% 0.055 112);
  --oxide: oklch(62% 0.15 34);
  --oxide-light: oklch(83% 0.095 42);
  --blue: oklch(60% 0.13 268);
  --blue-light: oklch(82% 0.08 275);
  --success: oklch(58% 0.11 158);
  --border: oklch(72% 0.03 250);
  --surface-code: oklch(24% 0.035 254);
  --code-text: oklch(92% 0.025 100);
  --font-display: "Instrument Sans", "Avenir Next", sans-serif;
  --font-editorial: "Newsreader", Georgia, serif;
  --display-weight: 500;
  --display-tracking: -0.04em;
  --display-leading: 0.98;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 9rem;
  --max: 87.5rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 20rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.5;
  font-kerning: normal;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { text-wrap: balance; }

body::selection { background: var(--oxide-light); color: var(--ink); }

a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--oxide);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-160%);
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper);
  transition: transform 180ms var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed;
  z-index: 200;
  inset: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 4.5rem;
  padding: 0.75rem clamp(1.1rem, 3vw, 3rem);
  border-bottom: 1px solid transparent;
  transition: background 250ms var(--ease-out), border-color 250ms var(--ease-out);
}

.site-header.is-scrolled {
  background: oklch(96% 0.025 94 / 0.94);
  border-color: oklch(72% 0.03 250 / 0.55);
  backdrop-filter: blur(14px);
}

.wordmark {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-editorial);
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.wordmark img { width: 1.45rem; height: 1.45rem; flex: none; }

.primary-nav { display: none; align-items: center; gap: clamp(1.5rem, 3vw, 3.25rem); }
.primary-nav a, .nav-status {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.primary-nav a { position: relative; min-height: 2.75rem; display: inline-flex; align-items: center; }
.primary-nav a::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 250ms var(--ease-out);
}
.primary-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav-status {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  background: transparent;
  color: inherit;
  border: 1px solid var(--ink);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.nav-status:hover { background: var(--ink); color: var(--paper); }
.auth-button:disabled { cursor: wait; opacity: 0.62; }
.status-dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--oxide); }

.hero {
  position: relative;
  min-height: max(52rem, 100svh);
  overflow: hidden;
  padding: 8rem clamp(1.1rem, 4vw, 4rem) 2rem;
  background:
    radial-gradient(ellipse at 52% 72%, var(--lime) 0%, transparent 48%),
    linear-gradient(150deg, var(--mist) 0%, var(--paper) 46%, var(--paper-deep) 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.atmosphere { position: absolute; border-radius: 50%; filter: blur(28px); opacity: 0.6; }
.atmosphere-one { width: 28rem; height: 14rem; left: -9rem; top: 39%; background: var(--blue-light); transform: rotate(-12deg); }
.atmosphere-two { width: 22rem; height: 11rem; right: -7rem; top: 19%; background: var(--oxide-light); transform: rotate(16deg); }

.hero-inner { position: relative; z-index: 1; width: min(100%, var(--max)); margin: 0 auto; }
.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero > .hero-inner > .eyebrow { text-align: center; }

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: clamp(4rem, 10vh, 7.5rem) 0 0;
  font-family: var(--font-display);
  font-size: clamp(3.9rem, 8.5vw, 8.35rem);
  font-weight: 520;
  letter-spacing: -0.05em;
  line-height: 0.9;
}
.hero-line { display: block; width: max-content; max-width: 100%; }
.hero-line-shift { align-self: flex-end; text-align: right; }

.hero-support {
  display: grid;
  gap: var(--space-lg);
  width: min(100%, 31rem);
  margin: clamp(3.5rem, 8vh, 6.5rem) 0 0 auto;
}
.hero-support > p {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  line-height: 1.25;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0 1.2rem;
  border: 1px solid var(--ink);
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 650;
  transition: transform 180ms var(--ease-out), background 180ms var(--ease-out), color 180ms var(--ease-out);
}
.button-primary { background: var(--ink); color: var(--paper); }
.button:hover { transform: translateY(-2px); }
.button-primary:hover { background: var(--oxide); border-color: var(--oxide); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35rem;
}

.gradient-loop { margin: clamp(3rem, 7vh, 6rem) 0 0; }
.loop-svg { width: 100%; height: auto; overflow: visible; }
.loop-track, .loop-return { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.loop-track { stroke: var(--ink); }
.loop-return { stroke: var(--oxide); stroke-dasharray: 5 9; }
.loop-node circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.loop-node text, .path-label { fill: var(--ink); font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-anchor: middle; }
.loop-node-accent circle { fill: var(--oxide); stroke: var(--oxide); }
.loop-node-gradient circle { fill: var(--blue); stroke: var(--blue); }
.path-label { font-size: 10px; opacity: 0.6; text-transform: uppercase; }
.flow-pulse { fill: var(--blue); offset-path: path("M55 150 C245 32 433 36 572 126 C713 218 860 243 1018 156 C1100 111 1168 97 1225 119"); animation: forward-flow 6s linear infinite; }
.flow-pulse-return { fill: var(--oxide); offset-path: path("M1225 119 C1117 278 889 311 668 244 C481 187 342 161 55 150"); animation: return-flow 6s linear infinite 3s; opacity: 0; }
@keyframes forward-flow { 0% { offset-distance: 0%; opacity: 0; } 8%, 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
@keyframes return-flow { 0% { offset-distance: 0%; opacity: 0; } 8%, 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }

.hero-scroll {
  position: absolute;
  z-index: 2;
  bottom: 2rem;
  left: clamp(1.1rem, 4vw, 4rem);
  display: none;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.hero-scroll i { display: block; width: 4.5rem; height: 1px; background: var(--ink); }

.reveal { animation: reveal-up 760ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes reveal-up { from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: translateY(0); } }

.section { padding: clamp(5rem, 11vw, 10rem) clamp(1.1rem, 4vw, 4rem); }
.section > * { width: min(100%, var(--max)); margin-left: auto; margin-right: auto; }
.section-rule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.loop-header h2, .ownership-layout h2 {
  margin: 0;
  font-size: clamp(3.2rem, 6.5vw, 6.7rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: var(--display-leading);
}

.code-window { overflow: hidden; background: var(--surface-code); color: var(--code-text); border-radius: 0.75rem; box-shadow: 0 1.8rem 5rem oklch(25% 0.03 255 / 0.12); }
.code-bar { display: flex; justify-content: space-between; align-items: center; min-height: 3.25rem; padding: 0 1.1rem; border-bottom: 1px solid oklch(41% 0.035 254); color: oklch(78% 0.03 255); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.copy-button { min-height: 2.75rem; padding: 0 0.25rem; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.copy-button:hover { color: var(--code-text); }
.code-window pre { margin: 0; overflow-x: auto; padding: clamp(1.2rem, 3vw, 2.5rem); font-size: clamp(0.78rem, 1.4vw, 0.95rem); line-height: 1.75; tab-size: 4; }
.code-window code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-ligatures: none; }
.code-muted { color: oklch(73% 0.08 274); }
.code-string { color: oklch(80% 0.11 112); }
.code-number { color: oklch(78% 0.13 42); }

.loop-section { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); }
.loop-atmosphere { position: absolute; right: -15%; top: 12%; width: 48rem; height: 48rem; border-radius: 50%; background: radial-gradient(circle, oklch(51% 0.15 271 / 0.48), transparent 68%); filter: blur(25px); }
.loop-section > *:not(.loop-atmosphere) { position: relative; z-index: 1; }
.section-rule-light { border-color: oklch(52% 0.035 250); }
.loop-header { display: grid; gap: var(--space-xl); margin-top: clamp(3rem, 7vw, 6rem); }
.loop-header > p { max-width: 32rem; margin: 0; color: oklch(86% 0.03 250); font-family: var(--font-editorial); font-size: clamp(1.3rem, 2.1vw, 1.7rem); line-height: 1.35; }
.loop-steps { position: relative; display: grid; gap: 0; margin-top: clamp(5rem, 10vw, 9rem); padding: 0; list-style: none; border-top: 1px solid oklch(48% 0.035 250); }
.loop-steps::before { content: ""; position: absolute; left: 1.45rem; top: 0; bottom: 0; width: 1px; background: linear-gradient(var(--blue), var(--oxide)); }
.loop-steps li { position: relative; display: grid; grid-template-columns: 3rem 1fr; gap: 1.2rem; padding: 2rem 0; border-bottom: 1px solid oklch(48% 0.035 250); }
.step-number { position: relative; z-index: 1; display: grid; place-items: center; align-self: start; width: 3rem; height: 3rem; background: var(--ink); border: 1px solid oklch(63% 0.05 260); border-radius: 50%; font-size: 0.75rem; font-weight: 700; }
.loop-steps h3 { margin: 0 0 0.7rem; font-size: clamp(2rem, 4vw, 3.5rem); font-weight: var(--display-weight); letter-spacing: -0.025em; line-height: 1.04; }
.loop-steps p { max-width: 29rem; margin: 0; color: oklch(83% 0.025 250); font-family: var(--font-editorial); font-size: 1.12rem; line-height: 1.45; }

.ownership { position: relative; min-height: min(58rem, 92vh); overflow: hidden; background: var(--paper-deep); }
.ownership > *:not(.ownership-field) { position: relative; z-index: 1; }
.ownership-field { position: absolute; right: -12rem; bottom: -17rem; width: min(70vw, 62rem); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--blue-light) 0%, var(--oxide-light) 42%, transparent 70%); filter: blur(48px); opacity: 0.62; }
.ownership-layout { display: grid; gap: clamp(3rem, 8vw, 8rem); margin-top: clamp(4rem, 9vw, 8rem); align-items: end; }
.ownership-layout h2 { font-size: clamp(4rem, 9.2vw, 9.5rem); }
.ownership-layout h2 em { color: var(--oxide); font-family: var(--font-editorial); font-weight: 400; }
.ownership-copy { max-width: 37rem; margin: 0; font-family: var(--font-editorial); font-size: clamp(1.35rem, 2.5vw, 2rem); line-height: 1.34; }
.ownership-signals { display: grid; margin-top: clamp(6rem, 12vw, 11rem); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ownership-signals span { padding: 1.25rem 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.ownership-signals span + span { border-top: 1px solid var(--border); }

.site-footer {
  display: grid;
  gap: 1rem;
  padding: 3rem clamp(1.1rem, 4vw, 4rem) max(3rem, env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--paper);
}
.site-footer > p, .site-footer > span { margin: 0; color: var(--paper-deep); font-size: 0.78rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: 0.82rem; font-weight: 650; }

@media (min-width: 43rem) {
  .primary-nav { display: flex; }
  .hero-scroll { display: flex; }
  .loop-header { grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr); align-items: end; }
  .loop-steps { grid-template-columns: repeat(4, 1fr); }
  .loop-steps::before { left: 0; right: 0; top: 1.45rem; bottom: auto; width: auto; height: 1px; background: linear-gradient(90deg, var(--blue), var(--oxide)); }
  .loop-steps li { grid-template-columns: 1fr; grid-template-rows: 3rem auto; padding: 0 1.5rem 2rem 0; border-bottom: 0; }
  .loop-steps li:not(:first-child) { padding-left: 1.5rem; border-left: 1px solid oklch(48% 0.035 250); }
  .ownership-layout { grid-template-columns: minmax(0, 1.2fr) minmax(22rem, 0.8fr); }
  .ownership-signals { grid-template-columns: repeat(3, 1fr); }
  .ownership-signals span { padding-right: 1.5rem; }
  .ownership-signals span + span { padding-left: 1.5rem; border-top: 0; border-left: 1px solid var(--border); }
  .site-footer { grid-template-columns: 1fr auto; align-items: end; }
  .site-footer > p { grid-column: 1; }
  .site-footer nav { grid-column: 2; grid-row: 1; }
  .site-footer > span { grid-column: 2; grid-row: 2; justify-self: end; }
}

@media (max-width: 42.99rem) {
  .site-header { grid-template-columns: 1fr auto; }
  .nav-status { padding-inline: 0.75rem; }
  .nav-status .status-dot { display: none; }
  .hero { min-height: 50rem; }
  .hero-title { margin-top: 5rem; font-size: clamp(3.45rem, 16.8vw, 5.1rem); line-height: 0.94; }
  .hero-line { width: auto; }
  .hero-line-shift { margin-top: 0.14em; text-align: left; }
  .hero-support { margin-top: 3.5rem; }
  .gradient-loop { margin-top: 4rem; transform: scale(1.35); transform-origin: center left; }
  .loop-node text, .path-label { display: none; }
}

@media (pointer: coarse) {
  .primary-nav a, .nav-status, .text-link, .copy-button { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .flow-pulse { display: none; }
}
