/* Shared stylesheet for xenarch.com's reading pages (guides, comparisons,
   about, 404). Built by scripts/build_pages.py from content/pages/*.html.
   Tokens come from /assets/tokens.css (linked first by the page builder). */


* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
code, pre, .mono { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }
::selection { background: rgba(74, 222, 128, 0.15); color: var(--fg); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--link-blue); outline-offset: 2px; border-radius: var(--radius-sm);
}

.page { max-width: 1040px; margin: 0 auto; padding: 0 28px 72px; }

/* ---------- Header (same as the landers) ---------- */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 22px 0 0; position: relative; }
.logo { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 500; color: var(--fg); }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); transition: color .15s; letter-spacing: .02em; line-height: 1.55; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.nav a.nav-cta { color: var(--fg); border: 1px solid var(--dim); border-radius: 6px; padding: 7px 14px; margin-left: 6px; }
.nav a.nav-cta:hover { border-color: var(--secondary); background: var(--surface); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--dim); color: var(--fg);
  font-family: 'JetBrains Mono', monospace; font-size: 18px; line-height: 1; border-radius: var(--radius-md);
  cursor: pointer; width: 34px; height: 32px; align-items: center; justify-content: center; padding: 0; }

/* ---------- Article ---------- */
.article { max-width: 720px; margin: 64px auto 0; }
.crumbs { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); letter-spacing: .04em; margin-bottom: 20px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { margin: 0 8px; color: var(--dim); }
.article h1 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 500;
  font-size: 42px; line-height: 1.12; letter-spacing: -0.02em; color: var(--fg-strong);
  text-wrap: balance; margin-bottom: 20px;
}
.article .lead { font-size: 19px; line-height: 1.6; color: var(--ink); margin-bottom: 14px; text-wrap: pretty; }
.article .meta { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-bottom: 44px; }
.article h2 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 500;
  font-size: 27px; line-height: 1.25; letter-spacing: -0.015em; color: var(--fg-strong);
  margin: 56px 0 16px; text-wrap: balance; scroll-margin-top: 24px;
}
.article h3 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 500;
  font-size: 20px; line-height: 1.35; color: var(--fg); margin: 32px 0 10px;
}
.article p { color: var(--ink); margin-bottom: 18px; text-wrap: pretty; }
.article p strong, .article li strong { color: var(--fg); font-weight: 600; }
.article ul, .article ol { color: var(--ink); margin: 0 0 20px 1.3em; }
.article li { margin-bottom: 8px; padding-left: 4px; }
.article a:not(.btn) { color: var(--fg); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.article a:not(.btn):hover { text-decoration-color: var(--fg); }
.article code { overflow-wrap: anywhere; font-size: 14.5px; background: var(--surface); border: 1px solid var(--surface-border); padding: 1px 6px; border-radius: var(--radius-sm); color: var(--fg); }
.article pre {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 18px 20px; margin: 8px 0 24px; overflow-x: auto; font-size: 14px; line-height: 1.6; color: var(--fg);
}
.article pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.article figure { margin: 8px 0 28px; }
.article figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* Tables scroll inside their own box on a phone; the page never does. */
.table-wrap { overflow-x: auto; margin: 8px 0 28px; border: 1px solid var(--card-border); border-radius: var(--radius-lg); }
.article table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; min-width: 560px; }
.article th, .article td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--card-border); }
.article tr:last-child td { border-bottom: 0; }
.article th { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .04em; background: var(--card); }
.article td { color: var(--ink); }
.article td:first-child { color: var(--fg); font-weight: 500; }

/* Short answer box under the lead: the one-paragraph answer an AI or a skimmer takes. */
.answer { border-left: 2px solid var(--fg); padding: 2px 0 2px 18px; margin: 0 0 40px; }
.answer p { color: var(--fg); margin: 0; }

/* Contents */
.toc { border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); padding: 18px 0; margin: 0 0 8px; }
.toc-label { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.toc ol { margin: 0 0 0 1.2em; columns: 2; column-gap: 32px; font-size: 15px; }
.toc li { margin-bottom: 6px; break-inside: avoid; }
.toc a { color: var(--ink) !important; text-decoration: none !important; }
.toc a:hover { color: var(--fg) !important; }

/* FAQ: question as a real heading-weight line, answer under it. scripts/faq_sync.py reads these. */
.faq { margin-top: 8px; }
.faq-q { font-family: 'Space Grotesk', sans-serif; font-weight: 500; font-size: 18px; color: var(--fg); margin: 26px 0 6px; }
.faq-a { color: var(--ink); }

/* Closing call to action */
.cta { margin: 56px 0 0; padding: 26px 28px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-lg); }
.cta h2 { margin: 0 0 8px; font-size: 22px; }
.cta p { margin-bottom: 16px; }
.cta pre { margin-bottom: 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; padding: 10px 20px;
  border-radius: var(--radius-md); background: var(--fg); color: var(--bg); border: 1px solid var(--fg); }
.btn:hover { background: var(--fg-strong); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--dim); margin-left: 8px; }
.btn.ghost:hover { border-color: var(--secondary); background: var(--surface); }

/* Related reading */
.related { margin-top: 56px; border-top: 1px solid var(--card-border); padding-top: 22px; }
.related-label { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.related ul { list-style: none; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 32px; }
.related li { margin: 0; padding: 0; }
.related a { color: var(--fg) !important; text-decoration: none !important; }
.related a::after { content: " \2192"; color: var(--muted); }
.related a:hover::after { color: var(--fg); }

/* ---------- Footer (same as the landers, plus the reading pages) ---------- */
.ftr { margin-top: 72px; padding: 22px 0; border-top: 1px solid var(--card-border);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.ftr-l { display: flex; gap: 18px; align-items: center; }
.ftr-r { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ftr a { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); transition: color .15s; }
.ftr a:hover { color: var(--fg); }
.ftr .sep { color: var(--muted); font-size: 12px; }
.gh { display: inline-block; width: 14px; height: 14px; vertical-align: middle; fill: currentColor; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .page { padding: 0 18px 48px; }
  .article { margin-top: 40px; }
  .article h1 { font-size: 32px; }
  .article .lead { font-size: 18px; }
  .article h2 { font-size: 23px; margin-top: 44px; }
  .toc ol { columns: 1; }
  .related ul { grid-template-columns: 1fr; }
  .btn.ghost { margin: 10px 0 0; }
  .nav-toggle { display: inline-flex; }
  .nav-toggle[aria-expanded="true"] { position: fixed; top: 14px; right: 18px; z-index: 201; font-size: 0; }
  .nav-toggle[aria-expanded="true"]::before { content: "\00d7"; font-size: 26px; line-height: 1; }
  .nav { display: none; }
  .nav.open { display: flex; position: fixed; inset: 0; z-index: 200; background: var(--bg);
    flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 76px 34px 44px; }
  .nav.open a { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 600; color: var(--ink); padding: 14px 2px; }
  .nav.open a.nav-cta { margin-top: 22px; font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 500;
    color: var(--fg); border: 1px solid var(--dim); border-radius: 8px; padding: 14px 22px; }
}

/* Code comments and captions under a code sample or table */
.article pre .c { color: var(--muted); }
.article .cap { font-size: 14px; color: var(--muted); margin: -12px 0 24px; }
