/* ──────────────────────────────────────────────────────────
   Vist · docs — content-light surface
   Documentation reading layout. Shares design tokens with
   blog.css / pricing.css. Stripped of blog-specific frills.
   ────────────────────────────────────────────────────────── */
:root {
  --bg:        #fbfbf9;
  --bg-1:      #f5f5f1;
  --bg-2:      #ffffff;
  --border:    rgba(15, 18, 25, 0.10);
  --border-2:  rgba(15, 18, 25, 0.18);
  --hairline:  rgba(15, 18, 25, 0.06);

  --text:        #15181f;
  --text-dim:    #525866;
  --text-faint:  #7a8194;

  --accent:      #2e5cd8;
  --accent-soft: rgba(46, 92, 216, 0.08);
  --hot:         #008497;

  --sans:  'Inter', system-ui, -apple-system, Segoe UI, Helvetica, Arial, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;

  --pad-x: clamp(20px, 4vw, 56px);
  --section-y: clamp(64px, 7vw, 112px);
  --max: 1280px;
  --max-narrow: 1080px;
  --read: 720px;
}

*,*::before,*::after { box-sizing: border-box; }
html,body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "cv11","ss01","ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(46,92,216,0.20); color: var(--text); }

/* Primitives */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad-x); }
.wrap-narrow { max-width: var(--max-narrow); margin: 0 auto; padding: 0 var(--pad-x); }

.label {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 18px;
  border-radius: 8px;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  line-height: 1; white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(2px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--bg-1); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 6px; }

/* Nav (light) */
.nav-outer {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,251,249,0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-left { display: flex; align-items: center; gap: 36px; }
.wordmark {
  font-family: var(--sans); font-weight: 600;
  font-size: 18px; letter-spacing: -0.02em;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.wordmark .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(46,92,216,0.45);
}
.wordmark-img { display: block; }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 14px; color: var(--text-dim);
  transition: color .15s ease;
}
.nav-links a:hover, .nav-links a.current { color: var(--text); }
.nav-links a.current { font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-right .sign-in { font-size: 14px; color: var(--text-dim); padding: 0 10px; }
.nav-right .sign-in:hover { color: var(--text); }

/* ════════════════════ DOCS INDEX ════════════════════ */

.docs-header {
  padding: clamp(48px, 6vw, 80px) 0 clamp(36px, 4vw, 56px);
  border-bottom: 1px solid var(--hairline);
}
.docs-header .crumbs {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 22px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase;
}
.docs-header .crumbs a { color: var(--text-dim); }
.docs-header .crumbs a:hover { color: var(--text); }
.docs-header h1 {
  margin: 0 0 14px;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--text);
  max-width: 20ch;
  text-wrap: balance;
}
.docs-header h1 .ital {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  letter-spacing: -0.005em;
}
.docs-header .sub {
  margin: 0;
  font-size: 17px;
  color: var(--text-dim);
  max-width: 52ch;
  text-wrap: pretty;
}

.docs-body {
  padding: clamp(48px, 6vw, 80px) 0;
}

.docs-category {
  display: flex; align-items: center; gap: 16px;
  margin: 0 0 24px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 500;
}
.docs-category::before {
  content: "";
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--text-faint);
  flex-shrink: 0;
}

.docs-group {
  margin-bottom: clamp(40px, 5vw, 64px);
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}

.docs-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px 24px 30px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  transition: background .15s ease;
  color: inherit;
  position: relative;
}
.docs-card:hover { background: var(--bg-1); }
.docs-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  text-wrap: balance;
}
.docs-card .dek {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.55;
}
.docs-card .card-arrow {
  position: absolute;
  top: 24px; right: 20px;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  color: var(--accent);
}
.docs-card:hover .card-arrow { opacity: 1; transform: translateX(2px); }

/* ════════════════════ ARTICLE ════════════════════ */

.read-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 2px;
  background: transparent;
  pointer-events: none;
}
.read-progress .bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .1s linear;
}

.article-header {
  padding: clamp(48px, 6vw, 88px) 0 clamp(32px, 3vw, 48px);
  border-bottom: 1px solid var(--hairline);
}
.article-header .crumbs {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 28px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase;
  flex-wrap: wrap;
}
.article-header .crumbs a { color: var(--text-dim); }
.article-header .crumbs a:hover { color: var(--text); }
.article-header .crumbs .sep { color: var(--border-2); }
.header-inner { max-width: 880px; margin: 0 auto; }
.header-inner h1 {
  margin: 0 0 16px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.07;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}
.header-inner .dek {
  margin: 0;
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 60ch;
  text-wrap: pretty;
}
.article-category {
  display: inline-block;
  margin-bottom: 20px;
  font-family: var(--mono); font-size: 11px;
  color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 500;
}

/* 2-column article layout (TOC + article) */
.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, var(--read));
  gap: clamp(32px, 5vw, 80px);
  padding: clamp(48px, 6vw, 80px) var(--pad-x) clamp(64px, 8vw, 120px);
  align-items: start;
  justify-content: center;
  max-width: 1160px;
  margin: 0 auto;
}

/* Full-width single-column variant (no TOC) */
.article-layout--full {
  grid-template-columns: minmax(0, var(--read));
}
.article-layout--full .toc { display: none; }

.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  border-left: 1px solid var(--hairline);
  padding-left: 20px;
}
.toc .toc-label {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--text-faint); letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 18px;
}
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.toc ul ul { padding-left: 14px; margin-top: 8px; gap: 8px; }
.toc a {
  display: block;
  font-size: 13.5px;
  color: var(--text-faint);
  line-height: 1.4;
  border-left: 1px solid transparent;
  margin-left: -21px; padding-left: 20px;
  transition: color .12s ease, border-color .12s ease;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--text); border-left-color: var(--accent); font-weight: 500; }
.toc ul ul a { font-size: 12.5px; }

/* Article body */
article.post { min-width: 0; }
article.post p,
article.post ul,
article.post ol,
article.post blockquote {
  margin: 0 0 22px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
}
article.post p:last-child { margin-bottom: 0; }
article.post h2 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 48px 0 14px;
  color: var(--text);
  scroll-margin-top: 96px;
}
article.post h3 {
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
  scroll-margin-top: 96px;
}
article.post a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(46,92,216,0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s ease;
}
article.post a:hover { text-decoration-color: var(--accent); }
article.post strong { font-weight: 600; color: var(--text); }
article.post em { font-style: italic; }
article.post ul { padding-left: 24px; list-style: disc; }
article.post ol { padding-left: 24px; list-style: decimal; }
article.post li { margin-bottom: 8px; }
article.post li::marker { color: var(--text-faint); }
article.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 28px;
  font-size: 14.5px;
}
article.post th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-2);
  font-weight: 600;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); letter-spacing: 0.08em; text-transform: uppercase;
}
article.post td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-dim);
}
article.post td code { font-size: 0.92em; }
article.post code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px; border-radius: 4px;
}
article.post pre {
  background: #14181f;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  margin: 6px 0 28px;
  padding: 16px 18px;
  font-family: var(--mono); font-size: 13.5px;
  line-height: 1.55;
  color: #c5cad3;
  overflow-x: auto;
}
article.post pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}
article.post blockquote {
  padding: 6px 0 6px 24px;
  border-left: 3px solid var(--accent);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 32px 0 28px;
  font-style: italic;
}

/* Article foot */
.article-foot {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.back-rail {
  margin-top: 48px;
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
}
.back-rail a {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim); letter-spacing: 0.08em;
  text-transform: uppercase;
}
.back-rail a:hover { color: var(--text); }

/* Footer (light) */
footer.foot {
  background: var(--bg);
  padding: clamp(64px, 7vw, 96px) 0 36px;
  border-top: 1px solid var(--hairline);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 56px;
}
.foot-brand .wordmark { font-size: 22px; }
.foot-brand .obsession {
  margin-top: 18px; max-width: 28ch;
  font-size: 13.5px; color: var(--text-faint);
  line-height: 1.55;
}
.foot-brand .obsession em { font-family: var(--serif); color: var(--text-dim); font-style: italic; }
.foot-col h4 {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); letter-spacing: 0.16em; text-transform: uppercase;
  margin: 0 0 18px; font-weight: 500;
}
.foot-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.foot-col a { font-size: 14px; color: var(--text-dim); transition: color .15s ease; }
.foot-col a:hover { color: var(--text); }
.foot-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim); letter-spacing: 0.06em;
  margin-top: 14px;
}
.foot-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #3a8a55; }
.foot-base {
  border-top: 1px solid var(--hairline);
  padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  letter-spacing: 0.06em;
}
.foot-base .socials { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.foot-base .socials a { color: var(--text-faint); }
.foot-base .socials a:hover { color: var(--text); }
.foot-base .rss {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-faint);
  border: 1px solid var(--border); padding: 3px 8px; border-radius: 4px;
}
.foot-base .rss:hover { color: var(--text); border-color: var(--border-2); }

/* Responsive */
@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: minmax(0, var(--read));
    justify-content: center;
  }
  .toc { display: none; }
}
@media (max-width: 960px) {
  .nav-links { display: none; }
  .docs-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 600px) {
  .foot-grid { grid-template-columns: 1fr; }
}
