/* ============================================================
   BackThread — site styles
   Dark, committed. One stylesheet for landing + document pages.
   ============================================================ */

:root {
  --bg: #070a12;
  --bg-2: #0b101c;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.02);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9edf5;
  --text-soft: #c3cbda;
  --muted: #8e99ad;
  --acc1: #7b87ff;
  --acc2: #43d9ad;
  --acc1-dim: rgba(123, 135, 255, 0.14);
  --acc2-dim: rgba(67, 217, 173, 0.12);
  --grad: linear-gradient(92deg, var(--acc1), var(--acc2));
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: rgba(123, 135, 255, 0.35); }

img, svg { max-width: 100%; }

a { color: var(--acc2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(7, 10, 18, 0.78);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand .mark { flex: 0 0 auto; display: block; }
.brand .wm { font-family: var(--font-display); letter-spacing: -0.015em; }
.brand .wm b {
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .wm span { font-weight: 500; color: var(--text); }

.hero .lede strong, .section-lede strong, .card p strong,
.step p strong, .fp p strong, .pricing-note strong {
  color: var(--text);
  font-weight: 650;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}
.site-nav a {
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 500;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--grad);
  color: #06121a;
  box-shadow: 0 4px 24px rgba(103, 156, 220, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 32px rgba(103, 180, 220, 0.4); }
.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.btn-ghost:hover { border-color: var(--acc1); background: var(--acc1-dim); }
.btn-lg { padding: 13px 26px; font-size: 15.5px; }

.menu-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}
.menu-toggle svg { display: block; }

@media (max-width: 860px) {
  .site-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 18px;
    background: rgba(7, 10, 18, 0.97);
    border-bottom: 1px solid var(--border);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 4px; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
  .site-nav .btn { margin-top: 14px; justify-content: center; border-bottom: none; }
  .menu-toggle { display: block; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 190px 0 90px;
  overflow: hidden;
  isolation: isolate;
}
#threads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}
.hero-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 420px at var(--mx, 30%) var(--my, 25%), rgba(123, 135, 255, 0.11), transparent 65%),
    radial-gradient(900px 600px at 85% 90%, rgba(67, 217, 173, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(7, 10, 18, 0.25) 0%, rgba(7, 10, 18, 0) 35%, var(--bg) 96%);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 24, 0.6);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acc2);
  box-shadow: 0 0 0 0 rgba(67, 217, 173, 0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(67, 217, 173, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(67, 217, 173, 0); }
  100% { box-shadow: 0 0 0 0 rgba(67, 217, 173, 0); }
}

.hero h1 {
  margin: 26px 0 20px;
  font-size: clamp(40px, 6.4vw, 74px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
  max-width: 15ch;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lede {
  max-width: 640px;
  font-size: clamp(16.5px, 2vw, 19px);
  color: var(--text-soft);
  margin: 0 0 34px;
}
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-note {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.stat-strip {
  margin-top: 84px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(10, 14, 24, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow: hidden;
}
.stat-strip > div {
  padding: 20px 24px;
  border-left: 1px solid var(--border);
}
.stat-strip > div:first-child { border-left: none; }
.stat-strip .k {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--acc2);
  letter-spacing: 0.12em;
}
.stat-strip .v {
  margin-top: 5px;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}
@media (max-width: 720px) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip > div { border-left: none; border-top: 1px solid var(--border); }
  .stat-strip > div:first-child { border-top: none; }
}

/* ---------- sections ---------- */

section { position: relative; padding: 96px 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acc1);
  margin: 0 0 14px;
}
.eyebrow::before { content: "// "; color: var(--muted); }

.section-title {
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 750;
  margin: 0 0 18px;
  max-width: 22ch;
}
.section-lede {
  color: var(--text-soft);
  font-size: 17px;
  max-width: 720px;
  margin: 0;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  border: none;
  margin: 0;
}

/* ---------- how it works ---------- */

.steps {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  counter-reset: step;
}
.step {
  position: relative;
  padding: 28px 26px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.step .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--acc2);
  letter-spacing: 0.1em;
}
.step h3 {
  margin: 12px 0 10px;
  font-size: 19px;
  letter-spacing: -0.015em;
}
.step p { margin: 0; color: var(--text-soft); font-size: 15px; }
.step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -22px;
  width: 22px;
  height: 1px;
  background: var(--border-strong);
}
.step:last-child::after { display: none; }
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; }
  .step::after { display: none; }
}

/* ---------- capability cards ---------- */

.cards {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 980px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }

.card {
  position: relative;
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: rgba(123, 135, 255, 0.45);
  box-shadow: 0 14px 44px rgba(3, 6, 14, 0.6), 0 0 0 1px rgba(123, 135, 255, 0.12);
}
.card .icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(123, 135, 255, 0.08);
  color: var(--acc2);
  margin-bottom: 18px;
}
.card h3 { margin: 0 0 9px; font-size: 17.5px; letter-spacing: -0.015em; }
.card p { margin: 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.62; }

/* ---------- pricing ---------- */

.tiers {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
@media (max-width: 820px) { .tiers { grid-template-columns: 1fr; } }

.tier {
  padding: 32px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.tier:hover { border-color: rgba(67, 217, 173, 0.4); transform: translateY(-4px); }
.tier .tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc2);
}
.tier h3 { margin: 10px 0 6px; font-size: 24px; letter-spacing: -0.02em; }
.tier .sub { color: var(--muted); font-size: 14.5px; margin: 0 0 22px; }
.tier ul { list-style: none; margin: 0 0 28px; padding: 0; }
.tier li {
  padding: 9px 0 9px 30px;
  position: relative;
  color: var(--text-soft);
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tier li:last-child { border-bottom: none; }
.tier li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 16px;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--acc2);
  border-bottom: 2px solid var(--acc2);
  transform: rotate(-48deg);
}
.tier .btn { margin-top: auto; justify-content: center; }

.pricing-note {
  margin-top: 30px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(10, 14, 24, 0.5);
  color: var(--muted);
  font-size: 14px;
}
.pricing-note a { color: var(--acc2); }

/* ---------- fine print ---------- */

.fineprint {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
@media (max-width: 820px) { .fineprint { grid-template-columns: 1fr; } }
.fp {
  padding: 24px 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.fp h3 {
  margin: 0 0 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fp h3 .glyph { color: var(--acc1); font-family: var(--mono); font-size: 13px; }
.fp p { margin: 0 0 10px; color: var(--text-soft); font-size: 14.5px; }
.fp a { font-size: 13.5px; font-family: var(--mono); }

/* ---------- contact ---------- */

.contact-grid {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  position: relative;
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.contact-card .k {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.contact-card a.big {
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
.contact-card a.big:hover { color: var(--acc2); text-decoration: none; }
.contact-card p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.contact-card address { font-style: normal; color: var(--text-soft); font-size: 15px; line-height: 1.7; }

.spotlight-ring {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
  opacity: 1;
  transition: opacity 0.5s ease;
  filter: drop-shadow(0 0 12px rgba(123, 135, 255, 0.45));
}
.spotlight-ring rect {
  fill: rgba(123, 135, 255, 0.07);
  stroke-width: 2.5;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 40px;
  background: var(--bg-2);
}
.footgrid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
}
@media (max-width: 860px) { .footgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footgrid { grid-template-columns: 1fr; } }
.site-footer h4 {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 500;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 9px; }
.site-footer a { color: var(--text-soft); font-size: 14.5px; }
.site-footer a:hover { color: var(--text); }
.site-footer .brand { margin-bottom: 14px; }
.site-footer address {
  font-style: normal;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}
.copyline {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease var(--d, 0s), transform 0.7s ease var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- document pages (terms / privacy) ---------- */

.doc-hero {
  padding: 150px 0 44px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(640px 300px at 20% 0%, rgba(123, 135, 255, 0.09), transparent 65%),
    radial-gradient(640px 300px at 90% 10%, rgba(67, 217, 173, 0.05), transparent 60%);
}
.doc-hero h1 {
  margin: 14px 0 10px;
  font-size: clamp(30px, 4.4vw, 46px);
  letter-spacing: -0.03em;
  font-weight: 780;
}
.doc-hero .updated {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.doc-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 56px;
  padding: 56px 0 96px;
  align-items: start;
}
@media (max-width: 940px) { .doc-layout { grid-template-columns: 1fr; gap: 34px; } }

.doc-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding-right: 8px;
}
@media (max-width: 940px) {
  .doc-toc { position: static; max-height: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--panel-2); }
}
.doc-toc h4 {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}
.doc-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.doc-toc li { margin: 0; }
.doc-toc a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.doc-toc a:hover { color: var(--text); text-decoration: none; }

.doc-body { max-width: 76ch; }
.doc-body h2 {
  margin: 52px 0 16px;
  font-size: 21px;
  letter-spacing: -0.015em;
  scroll-margin-top: 100px;
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body h2 .no {
  color: var(--acc1);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  margin-right: 10px;
}
.doc-body p { color: var(--text-soft); font-size: 15.5px; margin: 0 0 16px; }
.doc-body ul { color: var(--text-soft); font-size: 15.5px; padding-left: 22px; margin: 0 0 16px; }
.doc-body li { margin-bottom: 8px; }
.doc-body strong { color: var(--text); }
.doc-body .allcaps {
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.doc-body address { font-style: normal; color: var(--text-soft); font-size: 15.5px; line-height: 1.8; margin: 0 0 16px; }
.doc-note {
  margin: 0 0 34px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--acc1);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 404 ---------- */

.notfound {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 160px 24px 80px;
}
.notfound .code {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--acc2);
  letter-spacing: 0.2em;
}
.notfound h1 { font-size: clamp(34px, 5vw, 54px); letter-spacing: -0.03em; margin: 14px 0 10px; }
.notfound p { color: var(--muted); margin: 0 0 28px; }

/* ---------- motion preferences ---------- */

@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;
  }
  .reveal { opacity: 1; transform: none; }
}
