:root {
  --bg: #0e0d13;
  --bg-2: #141320;
  --panel: #191826;
  --panel-2: #201e30;
  --line: #2a2838;
  --line-2: #35324a;
  --text: #ece9f5;
  --muted: #a7a2bd;
  --muted-2: #7d7896;

  --thread: #e8935a;        /* warm "thread" accent (warp) */
  --thread-warp: #e8935a;
  --thread-weft: #6f7cf0;   /* cool cross-thread for the weave motif */
  --thread-soft: rgba(232, 147, 90, 0.14);
  --thread-line: rgba(232, 147, 90, 0.35);

  --radius: 14px;
  --radius-sm: 10px;
  --wrap: 1120px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--thread); color: #1a1206; padding: 10px 16px;
  border-radius: 8px; font-weight: 600; transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: 15.5px; line-height: 1;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .16s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  white-space: nowrap;
}
.btn-sm { padding: 9px 16px; font-size: 14.5px; }
.btn-primary {
  background: var(--thread); color: #1a1206;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 24px -10px rgba(232,147,90,.7);
}
.btn-primary:hover { background: #f0a06c; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: rgba(255,255,255,.03); color: var(--text);
  border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--thread-line); background: rgba(232,147,90,.06); transform: translateY(-1px); }
.arrow { transition: transform .18s var(--ease); }
.btn-ghost:hover .arrow { transform: translateX(3px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-mark { display: inline-grid; place-items: center; }
.brand-mark svg { display: block; }
.header-nav { display: flex; align-items: center; gap: 1.4rem; }
.header-nav > a:not(.btn) { color: var(--muted); font-size: 15px; font-weight: 500; transition: color .15s var(--ease); }
.header-nav > a:not(.btn):hover { color: var(--text); }
@media (max-width: 800px) {
  .header-nav > a:not(.btn) { display: none; }
  .header-nav { gap: .6rem; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(84px, 13vw, 168px) 0 clamp(64px, 9vw, 116px); }
.loom { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .9; }
.hero-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(232,147,90,.10), transparent 55%),
    linear-gradient(180deg, transparent 40%, var(--bg) 96%);
}
.hero-inner { position: relative; z-index: 2; text-align: center; max-width: 860px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 13.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--thread); text-transform: uppercase;
  background: var(--thread-soft); border: 1px solid var(--thread-line);
  padding: 6px 14px; border-radius: 999px; margin: 0 0 22px;
}
.eyebrow.center { margin-left: auto; margin-right: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--thread); box-shadow: 0 0 0 0 rgba(232,147,90,.6); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232,147,90,.5);} 70% { box-shadow: 0 0 0 8px rgba(232,147,90,0);} 100% { box-shadow: 0 0 0 0 rgba(232,147,90,0);} }

.hero-title {
  font-size: clamp(2.35rem, 6.4vw, 4.35rem);
  line-height: 1.04; letter-spacing: -0.03em; font-weight: 800;
  margin: 0 0 22px;
}
.grad { background: linear-gradient(100deg, var(--thread) 10%, #f2b184 45%, var(--thread-weft) 115%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: clamp(1.05rem, 2.3vw, 1.28rem); color: var(--muted); max-width: 660px; margin: 0 auto 34px; line-height: 1.55; }
.hero-sub em { color: var(--text); font-style: normal; font-weight: 600; }
@media (max-width: 620px) { .nb { display: none; } }

/* ---------- Waitlist form ---------- */
.waitlist { display: flex; gap: .55rem; max-width: 480px; }
.hero-waitlist { margin: 0 auto; }
.waitlist-center { margin: 6px auto 0; }
.waitlist-input {
  flex: 1; min-width: 0;
  background: rgba(20,19,32,.85); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 13px 20px; font-size: 16px; font-family: inherit;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.waitlist-input::placeholder { color: var(--muted-2); }
.waitlist-input:focus { outline: none; border-color: var(--thread); box-shadow: 0 0 0 3px var(--thread-soft); }
.waitlist .btn { flex-shrink: 0; }
@media (max-width: 480px) {
  .waitlist { flex-direction: column; }
  .waitlist .btn { justify-content: center; }
}
.waitlist-msg { min-height: 1.4em; margin: 12px 0 0; font-size: 14.5px; font-weight: 500; }
.waitlist-msg.center { text-align: center; }
.waitlist-msg.ok { color: #8fd6a8; }
.waitlist-msg.err { color: #f0a08f; }

.hero-cta-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 30px; }
.cta-note { color: var(--muted-2); font-size: 14px; }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 10vw, 118px) 0; position: relative; }
.band { background: linear-gradient(180deg, var(--bg-2), var(--bg)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-h { font-size: clamp(1.7rem, 3.8vw, 2.6rem); line-height: 1.12; letter-spacing: -0.025em; font-weight: 800; margin: 0 0 14px; }
.section-h.center { text-align: center; }
.section-lead { color: var(--muted); font-size: 1.12rem; margin: 0 0 40px; max-width: 620px; }
.section-lead.center { text-align: center; margin-left: auto; margin-right: auto; }
.kicker { color: var(--thread); font-weight: 700; font-size: 13.5px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 12px; }

/* ---------- Pillars grid ---------- */
.grid { display: grid; gap: 20px; }
.pillars { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .pillars { grid-template-columns: 1fr; } }
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 28px; position: relative; overflow: hidden;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--thread-line), transparent);
  opacity: 0; transition: opacity .25s var(--ease);
}
.card:hover { border-color: var(--line-2); transform: translateY(-3px); }
.card:hover::before { opacity: 1; }
.card-ico {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  color: var(--thread); background: var(--thread-soft); border: 1px solid var(--thread-line);
  margin-bottom: 18px;
}
.card h3 { font-size: 1.24rem; letter-spacing: -0.02em; margin: 0 0 9px; font-weight: 700; }
.card p { color: var(--muted); margin: 0; font-size: 15.5px; line-height: 1.58; }
.card p strong { color: var(--text); font-weight: 600; }

/* ---------- CRDT band ---------- */
.crdt-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
@media (max-width: 860px) { .crdt-grid { grid-template-columns: 1fr; gap: 40px; } }
.prose { color: var(--muted); margin: 0 0 18px; line-height: 1.62; }
.prose strong { color: var(--text); font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.checks li { position: relative; padding-left: 30px; color: var(--muted); font-size: 15.5px; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: var(--thread-soft); border: 1px solid var(--thread-line);
}
.checks li::after {
  content: ""; position: absolute; left: 5.5px; top: 7px; width: 8px; height: 4.5px;
  border-left: 1.8px solid var(--thread); border-bottom: 1.8px solid var(--thread);
  transform: rotate(-45deg);
}

.crdt-viz { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.weave-demo {
  width: 100%; max-width: 340px; aspect-ratio: 1; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  background-image:
    repeating-linear-gradient(90deg, var(--thread-warp) 0 3px, transparent 3px 26px),
    repeating-linear-gradient(0deg, var(--thread-weft) 0 3px, transparent 3px 26px);
  background-size: 26px 26px;
  position: relative; overflow: hidden;
  --shimmer: 0;
  mask-image: linear-gradient(115deg, #000 30%, rgba(0,0,0,.35) 50%, #000 70%);
  mask-size: 260% 100%;
  animation: weaveShimmer 6.5s linear infinite;
}
.weave-demo::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 50% 45%, rgba(232,147,90,.14), transparent 70%);
}
@keyframes weaveShimmer { to { mask-position: -260% 0; } }
.viz-cap { color: var(--muted-2); font-size: 13px; margin: 0; font-family: var(--mono); letter-spacing: .01em; }

/* ---------- Docs generation ---------- */
.docs-grid { display: grid; grid-template-columns: 1fr .9fr; gap: 56px; align-items: center; }
@media (max-width: 860px) { .docs-grid { grid-template-columns: 1fr; gap: 40px; } }
.docs-flow { display: flex; align-items: center; justify-content: center; gap: 8px; }
.flow-node { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 18px; min-width: 0; }
.flow-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.flow-lines { display: grid; gap: 7px; }
.flow-lines span { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--thread-soft), transparent); }
.flow-lines span:nth-child(1) { width: 90%; } .flow-lines span:nth-child(2) { width: 70%; background: linear-gradient(90deg, rgba(111,124,240,.22), transparent); }
.flow-lines span:nth-child(3) { width: 82%; } .flow-lines span:nth-child(4) { width: 60%; background: linear-gradient(90deg, rgba(111,124,240,.22), transparent); }
.flow-arrow { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--thread); flex-shrink: 0; }
.flow-arrow span { font-size: 11px; font-family: var(--mono); color: var(--muted-2); }
.flow-doc { display: grid; gap: 8px; }
.flow-doc b, .flow-doc span { height: 8px; border-radius: 4px; background: var(--line-2); }
.flow-doc b { width: 55%; height: 11px; background: var(--thread); }
.flow-doc span { width: 100%; } .flow-doc .short { width: 68%; }
.docs-node.doc { border-color: var(--thread-line); }
.flow-node.doc { border-color: var(--thread-line); box-shadow: 0 12px 40px -22px rgba(232,147,90,.6); }

/* ---------- Final CTA ---------- */
.cta-final { position: relative; overflow: hidden; text-align: center; background: var(--bg-2); border-top: 1px solid var(--line); }
.loom-footer { opacity: .5; }
.cta-inner { position: relative; z-index: 2; max-width: 640px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg); padding: 44px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.footer-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 16px; }
.footer-tag { color: var(--muted); margin: 4px 0 0; font-size: 15px; }
.footer-fine { color: var(--muted-2); font-size: 13.5px; margin: 6px 0 0; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
