/* ═══════════════════════════════════════════════
   page.css — Shared styles for SnapDOM content
   pages (comparisons, guides, how-tos, hubs).
   "Capture instrument" design system
   System fonts: Arial/Helvetica everywhere
   ═══════════════════════════════════════════════ */


:root {
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --surface-hover: #F0F4FB;
  --border: #0F1E4D;
  --border-soft: rgba(15,30,77,0.16);
  --hairline: rgba(15,30,77,0.12);
  --text: #0F1E4D;
  --text-muted: #55617C;
  --accent: #2D5BFF;
  --accent-hover: #1D3FD8;
  --accent-soft: rgba(45,91,255,0.08);
  --accent-ink: #1D3FD8;
  --green: #1E9F6E;
  --green-soft: rgba(30,159,110,0.12);
  --amber: #F5A623;
  --amber-soft: rgba(245,166,35,0.18);
  --amber-ink: #8A4F00;
  --rose: #E63946;
  --rose-soft: rgba(230,57,70,0.12);
  --cyan: #2BA8C9;
  --code-bg: #0F1E4D;
  --code-text: #D9E2F7;
  /* legacy aliases kept so page-local styles don't break */
  --shadow-sticker: none;
  --shadow-sticker-sm: none;
  --shadow-sticker-lg: none;
  --grid-color: rgba(15,30,77,0.05);
  --halftone-color: transparent;
  --halftone-size: 5px;
  --halftone-dot: 0px;
  --halftone-offset: 0px;
  --font-display: Arial, Helvetica, sans-serif;
  --font-body: Arial, Helvetica, sans-serif;
  --font-mono: Arial, Helvetica, sans-serif;
  --font-code: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  --font-hand: Arial, Helvetica, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

::selection { background: rgba(45,91,255,0.18); }

/* ── Hero ── */
.hero { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 76px 0 44px; text-align: left; position: relative; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5.4vw, 64px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  margin-bottom: 18px;
  max-width: 880px;
  margin-left: 0;
  margin-right: 0;
  text-wrap: balance;
}
.hero p.lead { color: var(--text-muted); font-size: 18px; max-width: 680px; margin: 0 0 28px; line-height: 1.65; }
.hero p.lead em { font-style: normal; color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 12px; justify-content: flex-start; flex-wrap: wrap; }
.hero > .github-badge { display: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 0;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-hover); color: #FFFFFF; }
.btn-ghost { background: transparent; color: var(--text); border-color: rgba(15,30,77,0.28); }
.btn-ghost:hover { border-color: var(--border); color: var(--text); }
.btn-sm { padding: 8px 16px; font-size: 12.5px; }
/* `.prose a` below has higher specificity than `.btn-primary`/`.btn-ghost` alone
   (two selectors vs one), so a .btn placed inside .prose — e.g. a capture's
   download link — would otherwise inherit accent-colored text and an
   underline instead of its own button styling. */
.prose a.btn { border-bottom: none; font-weight: 600; }
.prose a.btn-primary { color: #FFFFFF; }
.prose a.btn-ghost { color: var(--text); }

/* ── Layout ── */
main.page { max-width: 880px; margin: 0 auto; padding: 0 24px 110px; }
main.page-wide { max-width: 1100px; margin: 0 auto; padding: 0 24px 110px; }

/* ── Section label (mono uppercase divider) ── */
.section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--accent);
  margin: 56px 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }
.section-label:first-child { margin-top: 0; }

/* ── Prose (article body) ── */
.prose h2 { font-family: var(--font-display); font-size: 30px; font-weight: 400; letter-spacing: 0.3px; margin: 52px 0 16px; line-height: 1.15; color: var(--text); }
.prose h3 { font-size: 19px; font-weight: 700; font-family: var(--font-body); margin: 32px 0 12px; letter-spacing: -0.2px; color: var(--text); }
.prose h4 { font-size: 12px; font-weight: 700; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin: 24px 0 10px; }
.prose p { color: var(--text); font-size: 16px; line-height: 1.7; margin-bottom: 16px; }
.prose p.muted { color: var(--text-muted); }
.prose ul, .prose ol { color: var(--text); font-size: 16px; line-height: 1.7; padding-left: 22px; margin-bottom: 18px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--accent); font-family: var(--font-mono); }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(45,91,255,0.35); transition: border-color 0.2s, color 0.2s; font-weight: 600; }
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { color: var(--text); font-weight: 700; }
.prose code { font-family: var(--font-code); font-size: 13px; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 0; font-weight: 600; }

/* ── Code blocks ── */
.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-bg);
  border-radius: 0;
  padding: 22px 64px 22px 24px;
  overflow: visible;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.75;
  color: var(--code-text);
  margin: 16px 0 24px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}
.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--code-text);
  background: transparent;
  border: 1px solid rgba(217, 226, 247, 0.3);
  border-radius: 0;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.code-copy:hover { border-color: rgba(217, 226, 247, 0.7); }
.code-copy.copied { color: #9FE8C5; border-color: #9FE8C5; }
.code-block .kw { color: #8FB5FF; }
.code-block .str { color: #9FE8C5; }
.code-block .fn { color: #5BD4F0; }
.code-block .cm { color: #6E7DA6; font-style: italic; }
.code-block .op { color: var(--code-text); }
.code-block .num { color: #FFD166; }

/* ── Cards (panels) ── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 0;
  padding: 26px 28px;
  margin-bottom: 20px;
}
.card h3 { font-size: 17px; font-weight: 700; font-family: var(--font-body); margin-bottom: 8px; color: var(--text); }
.card p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }

/* ── TL;DR callout ── */
.tldr { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 0; padding: 20px 24px; margin: 0 0 32px; }
.tldr::before, .tldr::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.tldr::before { top: -1px; left: -1px; border-top: 3px solid var(--accent); border-left: 3px solid var(--accent); }
.tldr::after { bottom: -1px; right: -1px; border-bottom: 3px solid var(--accent); border-right: 3px solid var(--accent); }
.tldr .tldr-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 2.5px; color: var(--accent); margin-bottom: 8px; font-weight: 700; }
.tldr p { color: var(--text); font-size: 15px; line-height: 1.65; margin: 0; }
.tldr code { overflow-wrap: anywhere; word-break: break-word; }

/* ── Comparison table ── */
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 16px 0 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 0; overflow: hidden; }
.cmp-table th, .cmp-table td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--hairline); }
.cmp-table thead th { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: #FFFFFF; background: var(--border); font-weight: 700; }
.cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-table tbody tr:hover { background: var(--surface-hover); }
.cmp-table td.feature { color: var(--text); font-weight: 600; }
.cmp-table td.yes { color: var(--green); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.cmp-table td.no { color: var(--rose); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.cmp-table td.partial { color: var(--amber-ink); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.cmp-table td.num { font-family: var(--font-mono); color: var(--accent); font-size: 13px; font-weight: 700; }

/* ── Verdict cards (when to use X / Y) ── */
.verdict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0 32px; }
.verdict-card { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0; padding: 22px 24px; }
.verdict-card.snapdom { border: 1px solid var(--accent); }
.verdict-card.snapdom::before { content: ''; position: absolute; top: -1px; left: -1px; width: 16px; height: 16px; border-top: 3px solid var(--accent); border-left: 3px solid var(--accent); }
.verdict-card h4 { font-family: var(--font-mono); font-size: 12.5px; text-transform: none; letter-spacing: 0; margin-bottom: 10px; color: var(--text); font-weight: 700; }
.verdict-card ul { padding-left: 18px; margin: 0; }
.verdict-card li { font-size: 14px; color: var(--text); line-height: 1.55; margin-bottom: 4px; }
.verdict-card li::marker { color: var(--accent); }
@media (max-width: 640px) { .verdict-grid { grid-template-columns: 1fr; } }

/* ── Step list (how-to) ── */
.steps { counter-reset: step; padding: 0; list-style: none; margin: 16px 0 28px; }
.steps li { counter-increment: step; position: relative; padding: 18px 22px 18px 68px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0; margin-bottom: 12px; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 20px;
  left: 20px;
  width: 32px;
  height: 24px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 2px solid var(--accent);
}
.steps li h4 { font-family: var(--font-body); font-size: 15px; text-transform: none; letter-spacing: -0.1px; color: var(--text); margin: 0 0 6px; font-weight: 700; }
.steps li p { font-size: 14px; color: var(--text-muted); margin: 0 0 8px; line-height: 1.6; }
.steps li .code-block { margin: 10px 0 0; }

/* ── FAQ (uses <details>) ── */
.faq details { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0; padding: 16px 22px; margin-bottom: 12px; }
.faq details[open] { border-color: var(--border); }
.faq summary { font-family: var(--font-body); font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--font-mono); font-size: 20px; color: var(--accent); transition: transform 0.2s; line-height: 1; font-weight: 400; flex: 0 0 auto; }
.faq details[open] summary::after { content: '\2212'; }
.faq details p { font-size: 14px; color: var(--text); line-height: 1.65; margin: 12px 0 0; }
.faq details p + p { margin-top: 10px; }
.faq details code { font-family: var(--font-code); font-size: 12px; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 0; font-weight: 600; }

/* ── Hub grid (cards linking to spokes) ── */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 16px 0 40px; }
.hub-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 0;
  padding: 22px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
  display: block;
}
.hub-card:hover { border-color: var(--border); background: var(--surface); }
.hub-card:hover h3 { color: var(--accent); }
.hub-card .tag { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); border: 1px solid rgba(45,91,255,0.4); padding: 3px 8px; border-radius: 0; display: inline-block; margin-bottom: 14px; font-weight: 700; background: transparent; }
.hub-card h3 { font-family: var(--font-body); font-size: 16.5px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.2px; color: var(--text); transition: color 0.15s; }
.hub-card p { color: var(--text-muted); font-size: 13.5px; line-height: 1.55; margin: 0; }

/* ── Related links (footer of articles) ── */
.related { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--hairline); }
.related .section-label { margin-top: 0; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.related-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 0; padding: 14px 16px; text-decoration: none; color: var(--text); font-size: 14px; font-weight: 600; transition: border-color 0.15s, color 0.15s; display: block; }
.related-card:hover { border-color: var(--border); color: var(--accent); }
.related-card .arrow { float: right; color: var(--text-muted); font-family: var(--font-mono); transition: color 0.2s; }
.related-card:hover .arrow { color: var(--accent); }

/* ── CTA ── */
.cta-section { margin: 64px 0 0; }
.cta-card { position: relative; background: var(--border); border: 1px solid var(--border); border-radius: 0; padding: 48px 40px; text-align: center; }
.cta-card::before, .cta-card::after { content: ''; position: absolute; width: 20px; height: 20px; pointer-events: none; }
.cta-card::before { top: 10px; left: 10px; border-top: 3px solid var(--accent); border-left: 3px solid var(--accent); }
.cta-card::after { bottom: 10px; right: 10px; border-bottom: 3px solid var(--accent); border-right: 3px solid var(--accent); }
.cta-card h2 { font-family: var(--font-display); font-size: 30px; font-weight: 400; letter-spacing: 0.5px; margin-bottom: 10px; color: #FFFFFF; }
.cta-card p { color: rgba(217, 226, 247, 0.8); font-size: 15px; max-width: 460px; margin: 0 auto 26px; }
.cta-card .btn { margin: 0 6px; }
.cta-card .btn-ghost { color: #FFFFFF; border-color: rgba(255,255,255,0.35); }
.cta-card .btn-ghost:hover { border-color: #FFFFFF; color: #FFFFFF; }

/* ── Live demo blocks (guides & how-to, powered by /demo.js) ── */
.demo-box { border: 1px solid var(--border); background: var(--surface); padding: 22px; margin: 18px 0 8px; }
.demo-stage { display: flex; justify-content: center; margin-bottom: 16px; }
.demo-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.demo-output { min-height: 72px; border: 1px dashed var(--border); background: var(--surface-hover, #F0F4FB); padding: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.demo-output img { max-width: 100%; height: auto; display: block; }
.demo-hint { color: var(--text-muted); font-size: 12.5px; font-family: var(--font-mono); }
.demo-error { color: var(--rose, #C9264B); }

/* ── Shared live benchmark (compare pages, powered by /compare/bench.js) ── */
.bench-section { margin: 0 0 40px; }
.bench-section .section-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); margin-bottom: 10px; font-weight: 700; }
.bench-section h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin: 0 0 8px; line-height: 1.25; color: var(--text); }
.bench-section p.bench-lead { color: var(--text-muted); font-size: 15px; line-height: 1.6; margin: 0 0 18px; }
/* Centered via the flex wrapper, not auto margins: html-to-image and dom-to-image
   copy the root's computed margins into their clone and shift the capture out of
   frame, which would rig the bench against them over an incidental style. */
.bench-target-row { display: flex; justify-content: center; margin-bottom: 18px; }
.bench-target { background: var(--surface); border: 1px solid var(--border); border-radius: 0; padding: 16px; max-width: 280px; margin: 0; text-align: center; font-size: 14px; }
.bench-target::before { content: '◆'; color: var(--accent); margin-right: 6px; }
.bench-target::after { content: '◆'; color: var(--accent); margin-left: 6px; }
.bench-actions { text-align: center; margin: 0 0 18px; }
.bench-result { text-align: center; margin: 0 0 18px; font-family: var(--font-mono); font-weight: 700; font-size: 16px; min-height: 1.4em; }
.bench-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bench-col { display: flex; flex-direction: column; }
.bench-col .label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 8px; text-align: center; font-weight: 700; }
.bench-output { width: 100%; height: 240px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 0; padding: 10px; background: var(--surface-hover, #F0F4FB); display: flex; flex-direction: column; }
.bench-output img, .bench-output canvas { max-width: 100%; max-height: 190px; object-fit: contain; margin: auto; display: block; flex-shrink: 0; background: #fff; outline: 1px solid var(--border-soft); }
.bench-output .progress-message { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); font-weight: 700; margin: auto; text-align: center; }
.bench-output .result-message { margin: 8px auto 0; flex-shrink: 0; font-size: 12px; font-family: var(--font-mono); font-weight: 700; color: var(--text); background: rgba(0,0,0,0.05); padding: 4px 8px; border-radius: 4px; }
.bench-crash { width: 100%; padding: 12px; text-align: left; }
.bench-crash-tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; padding: 3px 8px; border-radius: 4px; background: var(--rose, #E63946); color: #FFFCF4; font-weight: 700; margin-bottom: 8px; }
.bench-crash-msg { font-family: var(--font-mono); font-size: 11px; line-height: 1.5; color: var(--rose, #E63946); background: var(--rose-soft, rgba(230,57,70,0.12)); border: 1px solid var(--rose, #E63946); border-radius: 6px; padding: 8px 10px; word-break: break-word; }
.winner-glow { animation: bench-glow 1.2s infinite alternate ease-in-out; border-radius: 0; }
@keyframes bench-glow {
  from { box-shadow: 0 0 0 1px rgba(45,91,255,0.25); }
  to   { box-shadow: 0 0 0 3px rgba(45,91,255,0.55); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero { width: calc(100% - 28px); padding: 60px 0 30px; }
  .hero p.lead { font-size: 16px; }
  .prose h2 { font-size: 25px; }
  .prose p, .prose ul, .prose ol { font-size: 15px; }
  .cta-card { padding: 32px 20px; }
  .cmp-table { display: block; max-width: 100%; overflow-x: auto; font-size: 12px; }
  .cmp-table th, .cmp-table td { padding: 10px 12px; }
  .bench-grid { grid-template-columns: 1fr; }
}
