/* Subik — subik.theoatlabs.com
   Tokens mirror the app's DESIGN/tokens.json (dark default, light via
   prefers-color-scheme). System fonts only — no third-party CDN (CSP: self). */

:root {
  color-scheme: dark light;

  --bg: #0a0e1a;
  --card: #1a1f33;
  --card-inner: #1e2338;
  --text: #e8eaf0;
  --text-2: #8b8fa8;
  --text-3: rgba(139, 143, 168, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --green: #4ade80;
  --cyan: #22d3ee;
  --purple: #a78bfa;
  --coral: #ff6f6b;
  --on-primary: #0a0e1a;
  --tint-green: rgba(74, 222, 128, 0.1);
  --tint-red: rgba(239, 68, 68, 0.1);
  --tint-purple: rgba(167, 139, 250, 0.1);
  --glow: rgba(74, 222, 128, 0.18);
  --glow-2: rgba(34, 211, 238, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
  --cta: linear-gradient(90deg, #4ade80, #22d3ee);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  --measure: 68ch;
  --page: 1080px;
  --gutter: 20px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6fa;
    --card: #ffffff;
    --card-inner: #f0f2f7;
    --text: #1a1d2e;
    --text-2: #5f6775;
    --text-3: rgba(107, 114, 128, 0.6);
    --border: rgba(0, 0, 0, 0.06);
    --border-subtle: rgba(0, 0, 0, 0.04);
    --green: #10b981;
    --cyan: #06b6d4;
    --purple: #8b5cf6;
    --coral: #e2574f;
    --on-primary: #ffffff;
    --tint-green: rgba(16, 185, 129, 0.08);
    --tint-red: rgba(239, 68, 68, 0.06);
    --tint-purple: rgba(139, 92, 246, 0.08);
    --glow: rgba(16, 185, 129, 0.14);
    --glow-2: rgba(6, 182, 212, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(20, 30, 60, 0.08);
    --cta: linear-gradient(90deg, #10b981, #06b6d4);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--green);
  text-decoration: none;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 24px;
  line-height: 1.3;
}

h3 {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
}

p {
  margin: 0;
}

.overline {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-2);
}

.muted {
  color: var(--text-2);
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--r-md);
  z-index: 10;
}

.skip:focus {
  left: 12px;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 26px;
  height: 31px;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--r-full);
  transition: background 160ms ease, color 160ms ease;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(56px, 10vw, 112px) 0 clamp(40px, 7vw, 80px);
  text-align: center;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.hero::before {
  width: 520px;
  height: 520px;
  left: 50%;
  top: -120px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
}

.hero::after {
  width: 420px;
  height: 420px;
  left: 50%;
  top: 40px;
  transform: translateX(-30%);
  background: radial-gradient(circle, var(--glow-2) 0%, transparent 65%);
}

.hero .glyph {
  width: clamp(88px, 14vw, 132px);
  margin: 0 auto 28px;
  filter: drop-shadow(0 12px 32px var(--glow));
}

.hero h1 {
  font-size: clamp(34px, 6vw, 48px);
  line-height: 1.08;
  letter-spacing: -1px;
  max-width: 14ch;
  margin-inline: auto;
}

.hero h1 .accent {
  background: var(--cta);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 46ch;
  margin: 20px auto 0;
}

.badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--tint-green);
}

/* ── Sections ─────────────────────────────────────────────────────────── */
.section {
  padding: clamp(40px, 6vw, 72px) 0;
}

.section-head {
  max-width: 56ch;
  margin-bottom: 28px;
}

.section-head h2 {
  margin-top: 8px;
}

.section-head p {
  margin-top: 10px;
  color: var(--text-2);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card h3 {
  margin-top: 14px;
}

.card p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}

.icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--tint-green);
  color: var(--green);
}

.icon.purple {
  background: var(--tint-purple);
  color: var(--purple);
}

.icon.cyan {
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  color: var(--cyan);
}

.icon svg {
  width: 20px;
  height: 20px;
}

/* Trust: two columns of ✓ / ✗ rows */
.trust {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.trust .card {
  padding: 20px 24px;
}

.trust ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.trust li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.trust li .mark {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}

.trust .access .mark {
  background: var(--tint-green);
  color: var(--green);
}

.trust .never .mark {
  background: var(--tint-red);
  color: var(--coral);
}

.trust .overline.green {
  color: var(--green);
}

.trust .overline.red {
  color: var(--coral);
}

/* Steps */
.steps {
  counter-reset: step;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.step {
  position: relative;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow);
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--cyan);
}

.step h3 {
  margin-top: 10px;
}

.step p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}

/* Legal links strip on the homepage */
.linkrow {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.linkrow a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
}

.linkrow a:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: var(--border);
}

.linkrow a::after {
  content: "→";
  color: var(--text-2);
}

/* ── Legal / document pages ───────────────────────────────────────────── */
.doc {
  padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px);
}

.doc-head {
  max-width: var(--measure);
  margin-bottom: 36px;
}

.doc-head h1 {
  margin-top: 8px;
}

.doc-head .meta {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 14px;
}

.doc-head .summary {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border-subtle);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.doc-head .summary strong {
  color: var(--text);
}

.doc-body {
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, var(--measure)) 220px;
  align-items: start;
}

@media (max-width: 900px) {
  .doc-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    order: -1;
  }
}

.prose {
  min-width: 0;
}

.prose h2 {
  font-size: 22px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: 80px;
}

.prose h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.prose h3 {
  font-size: 16px;
  margin-top: 26px;
  scroll-margin-top: 80px;
}

.prose p {
  margin-top: 12px;
  color: var(--text);
}

.prose p.muted,
.prose li.muted {
  color: var(--text-2);
}

.prose ul,
.prose ol {
  margin: 12px 0 0;
  padding-left: 22px;
}

.prose li {
  margin-top: 6px;
}

.prose li::marker {
  color: var(--text-2);
}

.prose blockquote {
  margin: 16px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--green);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--tint-green);
  color: var(--text);
  font-size: 15px;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--card-inner);
  color: var(--text);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.prose th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
}

.prose td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .prose table,
  .prose thead,
  .prose tbody,
  .prose tr,
  .prose th,
  .prose td {
    display: block;
  }

  .prose thead {
    display: none;
  }

  .prose tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .prose td {
    padding: 2px 0;
    border: 0;
  }

  .prose td:first-child {
    white-space: normal;
    padding-top: 0;
  }
}

.callout {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border-subtle);
}

.callout.warn {
  border-color: color-mix(in srgb, var(--coral) 30%, transparent);
  background: var(--tint-red);
}

.callout p {
  margin-top: 6px;
}

.callout p:first-child {
  margin-top: 0;
}

.toc {
  position: sticky;
  top: 76px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.toc .overline {
  margin-bottom: 10px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.toc a {
  color: var(--text-2);
}

.toc a:hover {
  color: var(--text);
}

/* Phones: the outline sits above the text and scrolls away with it (after the
   base rule so it wins at equal specificity). */
@media (max-width: 900px) {
  .toc {
    position: static;
  }
}

/* Support page contact card */
.contact {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 8px;
}

.contact .card p {
  margin-top: 6px;
}

.contact .mail {
  display: inline-block;
  margin-top: 14px;
  padding: 12px 18px;
  border-radius: var(--r-full);
  background: var(--cta);
  color: var(--on-primary);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 24px var(--glow);
}

.contact .mail:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 0 40px;
  color: var(--text-2);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 24px;
  align-items: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.site-footer a {
  color: var(--text-2);
}

.site-footer a:hover {
  color: var(--text);
}

/* ── 404 ──────────────────────────────────────────────────────────────── */
.notfound {
  text-align: center;
  padding: clamp(72px, 14vw, 160px) 0;
}

.notfound .code {
  font-family: var(--mono);
  color: var(--cyan);
  letter-spacing: 2px;
  font-size: 13px;
}

.notfound h1 {
  margin-top: 12px;
}

.notfound p {
  margin-top: 12px;
  color: var(--text-2);
}

.notfound a.btn {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 20px;
  border-radius: var(--r-full);
  background: var(--cta);
  color: var(--on-primary);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .linkrow a,
  .nav a {
    transition: none;
  }
}

@media (max-width: 560px) {
  .nav a {
    padding: 8px 10px;
    font-size: 13px;
  }

  .hero .lede {
    font-size: 16px;
  }
}
