/* ============================================================================
   atopile docs-site — shared styles
   Design language: design/tokens.css (dark skin). Orange is ink (no glow, no
   wash); hairline borders; JetBrains Mono spine + Barlow for display.
   ============================================================================ */

/* All design tokens (--orange, greys, --font-*, --radius-*, --shadow-*, the
   --syntax-* palette, …) come from tokens.css — a verbatim copy of the monorepo
   design system at design/tokens.css, kept in sync by the docs-site-tokens-sync
   prek hook. Every page must <link> /tokens.css BEFORE /styles.css. Do not
   redefine token values here; add a new one to design/tokens.css instead. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 0 28px 96px; }
.wrap.narrow { max-width: 720px; }

/* ── Header / breadcrumb ──────────────────────────────────────────────────── */
header.site { padding: 40px 0 8px; }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; font-size: 13px; }
.brand .home { display: block; line-height: 0; }
.brand img { height: 20px; display: block; }
.brand .divider { color: var(--border); }
.brand .section { color: var(--muted); letter-spacing: 0.04em; }
.brand a.section { text-decoration: none; }
.brand a.section:hover { color: var(--orange); }

/* ── Type ─────────────────────────────────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em;
  color: var(--ink); margin-bottom: 14px;
}
h1 .accent { color: var(--orange); }
h2 {
  font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.005em;
  margin: 44px 0 12px; padding-top: 8px; scroll-margin-top: 20px;
}
h3 { font-size: 15px; font-weight: 700; color: var(--fg); margin: 24px 0 6px; }
.lede { color: var(--fg-2); font-size: 17px; max-width: 660px; }
p { margin: 0 0 12px; color: var(--fg); }
p .muted, .muted { color: var(--muted); }
b, strong { color: var(--ink); font-weight: 700; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0 0 12px 22px; }
li { margin-bottom: 6px; }
hr.rule { border: none; border-top: 1px solid var(--border); margin: 40px 0 0; }

/* ── Code ─────────────────────────────────────────────────────────────────── */
code {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1px 6px; font-size: 12.5px; color: var(--fg);
  word-break: break-word;
}
pre {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 13px 16px; margin: 8px 0 14px;
  overflow-x: auto;
}
pre code { background: none; border: none; padding: 0; font-size: 12.5px; color: var(--fg); line-height: 1.6; white-space: pre; }
.code-label {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  margin: 14px 0 2px; font-weight: 500;
}
.tok-comment { color: var(--syntax-comment); font-style: italic; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
table {
  width: 100%; border-collapse: collapse; margin: 8px 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
  font-size: 13px;
}
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-2); color: var(--muted); font-weight: 500; letter-spacing: 0.03em; text-transform: uppercase; font-size: 11px; }
tr:last-child td { border-bottom: none; }
td code { font-size: 12px; }

/* ── Callouts (tip / note / warning) ──────────────────────────────────────── */
.callout {
  margin: 14px 0; padding: 12px 16px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-left: 2px solid var(--orange); border-radius: var(--radius-md);
  color: var(--fg-2); font-size: 13px;
}
.callout > :last-child { margin-bottom: 0; }
.callout .label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; margin-bottom: 4px; color: var(--orange);
}
.callout.note { border-left-color: var(--blue); }
.callout.note .label { color: var(--blue); }
.callout.warn { border-left-color: var(--yellow); }
.callout.warn .label { color: var(--yellow); }

/* ── Steps (ordered, numbered) ────────────────────────────────────────────── */
ol.steps { list-style: none; margin: 18px 0; counter-reset: step; }
ol.steps > li {
  position: relative; padding-left: 40px; padding-bottom: 22px; margin-bottom: 0;
  border-left: 1px solid var(--border); margin-left: 13px;
}
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -13px; top: -2px; width: 26px; height: 26px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: var(--orange); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
ol.steps > li .step-title { font-weight: 700; color: var(--ink); font-size: 15px; margin-bottom: 6px; padding-top: 2px; }

/* ── Accordion (native <details>) ─────────────────────────────────────────── */
details.accordion {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-2); margin: 8px 0; overflow: hidden;
}
details.accordion + details.accordion { margin-top: 6px; }
details.accordion > summary {
  cursor: pointer; padding: 11px 16px; font-weight: 700; color: var(--fg);
  list-style: none; display: flex; align-items: center; gap: 10px; user-select: none;
}
details.accordion > summary::-webkit-details-marker { display: none; }
details.accordion > summary::before {
  content: "›"; color: var(--orange); font-weight: 700; font-size: 15px;
  transition: transform 0.15s ease; display: inline-block;
}
details.accordion[open] > summary::before { transform: rotate(90deg); }
details.accordion[open] > summary { border-bottom: 1px solid var(--border); }
details.accordion .acc-body { padding: 14px 16px; color: var(--fg-2); font-size: 13px; }
details.accordion .acc-body > :last-child { margin-bottom: 0; }

/* ── Tabs (class-based, wired by docs.js; degrades to all-panels-shown) ────── */
.tabs { margin: 14px 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.tabs > .tab-labels { display: flex; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.tabs > .tab-labels > .tab-btn {
  padding: 9px 16px; font-size: 13px; color: var(--muted); cursor: pointer;
  border: none; border-right: 1px solid var(--border); background: none;
  font-family: inherit; font-weight: 500;
}
.tabs > .tab-labels > .tab-btn:hover { color: var(--fg); }
.tabs > .tab-labels > .tab-btn.active { color: var(--orange); box-shadow: inset 0 -2px 0 var(--orange); }
.tabs > .tab-panel { padding: 16px; }
.tabs > .tab-panel > :last-child { margin-bottom: 0; }
/* Once docs.js runs (js-ready on <html>), inactive panels hide and the label
   bar shows. Without JS, every panel renders stacked (each prefixed by its
   caption) so the content is never hidden. */
html.js-ready .tabs > .tab-panel { display: none; }
html.js-ready .tabs > .tab-panel.active { display: block; }
.tabs > .tab-panel > .tab-caption { display: none; }
html:not(.js-ready) .tabs > .tab-labels { display: none; }
html:not(.js-ready) .tabs > .tab-panel > .tab-caption {
  display: block; font-weight: 700; color: var(--orange); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
}
html:not(.js-ready) .tabs > .tab-panel + .tab-panel { border-top: 1px solid var(--border); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer.site {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
footer.site .links { display: flex; gap: 18px; }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--orange); text-decoration: none; }

@media (max-width: 560px) {
  h1 { font-size: 32px; }
  .lede { font-size: 15px; }
  .tabs > .tab-labels { flex-wrap: wrap; }
}
