:root {
  --bg: #121212;
  --bg-raised: #161718;
  --line: #2A2A2A;
  --line-soft: #222324;
  --ink: #FFFFFF;
  --ink-2: #A8ADB2;
  --ink-3: #6E7378;
  --cyan: #00E5FF;
  --cyan-soft: rgba(0, 229, 255, 0.55);
  --cyan-faint: rgba(0, 229, 255, 0.14);
  --w: 1160px;
  --gutter: clamp(20px, 4vw, 48px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

::selection { background: var(--cyan); color: #06181b; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

a { color: inherit; }

/* ============ Nav ============ */
.nav { position: absolute; top: 0; left: 0; right: 0; z-index: 10; }
.nav.nav-solid { position: static; border-bottom: 1px solid var(--line-soft); }

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 28px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.brand .tick {
  width: 10px; height: 10px;
  background: var(--cyan);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: translateY(-1px);
}
.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--ink-2);
  transition: color 160ms ease;
}
.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current] { color: var(--ink); }

/* ============ Buttons & links ============ */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 15px 30px;
  background: var(--cyan);
  color: #06181b;
  transition: filter 160ms ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.link-quiet {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: color 160ms ease, border-color 160ms ease;
}
.link-quiet:hover { color: var(--ink); border-color: var(--cyan); }

/* ============ Hero (home) ============ */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.hero-mesh {
  position: absolute;
  right: -12vw;
  top: 50%;
  transform: translateY(-50%);
  width: min(64vw, 880px);
  height: auto;
  pointer-events: none;
}
.hero-mesh .stroke { fill: none; stroke: var(--cyan); stroke-width: 1; }
.hero-mesh .draw {
  stroke-dasharray: 2600;
  stroke-dashoffset: 2600;
  animation: draw 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.hero-mesh .draw:nth-child(2) { animation-delay: 90ms; }
.hero-mesh .draw:nth-child(3) { animation-delay: 180ms; }
.hero-mesh .draw:nth-child(4) { animation-delay: 270ms; }
.hero-mesh .draw:nth-child(5) { animation-delay: 360ms; }
.hero-mesh .draw:nth-child(6) { animation-delay: 450ms; }
.hero-mesh .draw:nth-child(7) { animation-delay: 540ms; }
.hero-mesh .draw:nth-child(8) { animation-delay: 630ms; }
.hero-mesh .draw:nth-child(9) { animation-delay: 720ms; }
.hero-mesh .draw:nth-child(10) { animation-delay: 810ms; }
.hero-mesh .draw:nth-child(11) { animation-delay: 900ms; }
.hero-mesh .draw:nth-child(12) { animation-delay: 990ms; }
.hero-mesh .draw:nth-child(13) { animation-delay: 1080ms; }

@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hero-mesh .draw { animation: none; stroke-dashoffset: 0; }
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding-top: 80px;
  padding-bottom: 80px;
  max-width: 640px;
}
.hero h1 {
  font-size: clamp(2.75rem, 6.5vw, 4.75rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero .lede {
  margin-top: 28px;
  max-width: 32em;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-cta {
  margin-top: 44px;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 240px;
  background: radial-gradient(60% 140px at 70% 100%, var(--cyan-faint), transparent 70%);
  pointer-events: none;
}

/* ============ Section heads ============ */
.sec-head { max-width: 560px; margin-bottom: clamp(48px, 7vw, 80px); }
.sec-head h2,
.about h2,
.contact h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.sec-head p { margin-top: 16px; color: var(--ink-2); text-wrap: pretty; }

/* ============ Modules grid (home) ============ */
.modules { padding: clamp(88px, 12vw, 140px) 0; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.module {
  position: relative;
  padding: 44px 36px 52px 0;
  border-bottom: 1px solid var(--line);
}
.module + .module { border-left: 1px solid var(--line); padding-left: 36px; }

.module .num {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.02em;
}
.module .kicker { display: block; margin-top: 4px; font-size: 0.9rem; color: var(--ink-3); }

.module figure { margin: 30px 0 26px; height: 96px; display: flex; align-items: center; }
.module figure svg { height: 96px; width: auto; overflow: visible; }

.glyph { fill: none; stroke: var(--cyan-soft); stroke-width: 1.1; }
.glyph-dim { fill: none; stroke: var(--line); stroke-width: 1.1; }
.glyph-dot { fill: var(--cyan); stroke: none; }

.module h3 { font-size: 1.3rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
.module h3 a {
  text-decoration: none;
  transition: color 160ms ease;
}
.module h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.module:hover h3 a, .module h3 a:focus-visible { color: var(--cyan); }
.module p {
  margin-top: 14px;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 34em;
}
.module .read {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 22px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 160ms ease, border-color 160ms ease;
}
.module:hover .read { color: var(--ink); border-color: var(--cyan); }

/* ============ About (home) ============ */
.about {
  background: var(--bg-raised);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: clamp(88px, 12vw, 140px) 0;
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.about-body p { color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.about-body p + p { margin-top: 20px; }
.about-body strong { color: var(--ink); font-weight: 600; }

.about-terms {
  margin-top: 44px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
  border-top: 1px solid var(--line);
}
.term { padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.term b { display: block; font-weight: 600; color: var(--ink); }
.term span { color: var(--ink-3); }

/* ============ Contact (home) ============ */
.contact { padding: clamp(88px, 12vw, 140px) 0; }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
}
.contact-intro p { margin-top: 16px; color: var(--ink-2); max-width: 30em; text-wrap: pretty; }

form { display: grid; gap: 26px; }
.field label { display: block; font-size: 0.92rem; font-weight: 600; margin-bottom: 10px; }
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 6px 0 14px;
  border-radius: 0;
  transition: border-color 160ms ease;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-3); }
.field input:focus,
.field textarea:focus { outline: none; border-bottom-color: var(--cyan); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.55; }

.field .err { display: none; margin-top: 8px; font-size: 0.85rem; color: #ff7a8a; }
.field.invalid input,
.field.invalid textarea { border-bottom-color: #ff7a8a; }
.field.invalid .err { display: block; }

.form-foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.form-note { display: none; font-size: 0.95rem; color: var(--cyan); }
.form-note.show { display: block; }

/* ============ Article pages (modules) ============ */
.article-head {
  border-bottom: 1px solid var(--line-soft);
  padding: clamp(56px, 9vw, 110px) 0 clamp(44px, 7vw, 80px);
  position: relative;
  overflow: hidden;
}
.article-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 160px;
  background: radial-gradient(50% 110px at 22% 100%, var(--cyan-faint), transparent 70%);
  pointer-events: none;
}
.crumb {
  font-size: 0.92rem;
  color: var(--ink-3);
}
.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.crumb .sep { margin: 0 10px; color: var(--ink-3); }

.article-head .num {
  display: block;
  margin-top: 34px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cyan);
}
.article-head h1 {
  margin-top: 10px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.06;
  max-width: 16em;
  text-wrap: balance;
}
.article-head .lede {
  margin-top: 22px;
  max-width: 36em;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.article { padding: clamp(56px, 8vw, 96px) 0 clamp(72px, 10vw, 120px); }
.article-cols {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}

.prose h2 {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 52px 0 16px;
}
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--ink-2); max-width: 38em; margin-bottom: 18px; text-wrap: pretty; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { margin: 0 0 18px; padding-left: 0; list-style: none; }
.prose li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 12px;
  color: var(--ink-2);
  max-width: 38em;
}
.prose li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.62em;
  width: 10px; height: 1.5px;
  background: var(--cyan);
}
.prose li b { color: var(--ink); font-weight: 600; }

.prose figure {
  margin: 34px 0;
  padding: 34px 30px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}
.prose figure svg { width: 100%; height: auto; max-height: 220px; overflow: visible; }
.prose figcaption { margin-top: 18px; font-size: 0.9rem; color: var(--ink-3); }

.callout {
  border-left: 2px solid var(--cyan);
  padding: 4px 0 4px 22px;
  margin: 30px 0;
}
.callout p { color: var(--ink); max-width: 34em; margin: 0; }

/* Sidebar */
.aside-box { position: sticky; top: 40px; }
.aside-box .aside-block {
  border-top: 1px solid var(--line);
  padding: 22px 0 26px;
}
.aside-box h3 { font-size: 1.02rem; font-weight: 650; margin-bottom: 12px; }
.aside-box .term { border-bottom: 0; padding: 10px 0; }
.aside-box ol { list-style: none; counter-reset: toc; }
.aside-box ol a {
  display: block;
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 160ms ease;
}
.aside-box ol a:hover { color: var(--cyan); }

/* Prev / next */
.pager {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.pager a {
  display: block;
  padding: 34px 0;
  text-decoration: none;
  transition: color 160ms ease;
}
.pager a + a { border-left: 1px solid var(--line); padding-left: 40px; text-align: right; padding-right: 0; }
.pager .dir { display: block; font-size: 0.88rem; color: var(--ink-3); margin-bottom: 6px; }
.pager .to { font-size: 1.12rem; font-weight: 650; letter-spacing: -0.01em; }
.pager a:hover .to { color: var(--cyan); }
.pager a.disabled { visibility: hidden; }

/* ============ Footer ============ */
footer { border-top: 1px solid var(--line-soft); padding: 34px 0 44px; }
.foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.92rem;
  color: var(--ink-3);
}
.foot-row a { text-decoration: none; }
.foot-row a:hover { color: var(--ink); }

/* ============ Responsive ============ */
@media (max-width: 980px) {
  .hero-mesh { right: -34vw; opacity: 0.5; width: 110vw; }
  .module-grid { grid-template-columns: 1fr; }
  .module { padding: 40px 0; }
  .module + .module { border-left: 0; padding-left: 0; }
  .about-grid, .contact-grid, .article-cols { grid-template-columns: 1fr; gap: 44px; }
  .aside-box { position: static; }
}
@media (max-width: 560px) {
  .nav-links { display: none; }
  .hero { min-height: 86vh; }
  .about-terms { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager a + a { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; text-align: left; }
}
