/* StackMon website.
   Dark by default because visitors move on to a dark dashboard and the page is largely code.
   One accent (purple) marks the action and "what matters" (your code, the lines that change).
   Severity colors appear only where they mean severity. */

:root {
  --bg: #15111f;
  --surface: #1c1729;
  --surface-2: #231c34;
  --line: rgba(232, 224, 255, 0.12);
  --text: #f1edf8;
  --muted: #b5adc6;        /* 8.6:1 on --bg */
  --accent: #7446d6;       /* button fill, 5.9:1 with white text */
  --accent-hover: #6438c4;
  --accent-text: #bfa2f7;  /* accent on dark surfaces, 8:1 on --bg */
  --ok: #86dbad;
  --error: #f39a72;
  --warn: #f0c674;
  --radius: 10px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
}
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); margin-bottom: 16px; }
p { margin: 0 0 16px; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); }
code { font-size: 0.86em; background: var(--surface-2); padding: 0.12em 0.4em; border-radius: 5px; overflow-wrap: anywhere; }
b { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

a, button, summary, label[for] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 6px; }
.skip:focus { left: 16px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: rgba(21, 17, 31, 0.92); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(8px)) {
  /* The only blurred element: keeps text readable when content scrolls under the header. */
  .top { background: rgba(21, 17, 31, 0.8); backdrop-filter: blur(8px); }
}
.top-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 18px; min-height: 44px; }
.mark { width: 28px; height: 28px; flex: none; }
.mark rect { fill: var(--accent); }
.mark path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a, .link-quiet { color: var(--muted); text-decoration: none; font-size: 15px; padding: 10px 10px; border-radius: 6px; display: inline-flex; align-items: center; min-height: 44px; }
.nav a:hover, .link-quiet:hover { color: var(--text); background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px; border-radius: 8px;
  font: 500 16px/1 var(--sans); text-decoration: none; border: 1px solid transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: #5730ad; }
.btn-ghost { color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-ghost:active { background: var(--surface-2); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 15px; }

/* ---------- hero ---------- */
.hero { padding: 88px 0 96px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 48px; align-items: start; }
.lede { font-size: 19px; color: var(--muted); max-width: 34em; margin-top: 20px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.fine { margin-top: 16px; font-size: 14px; color: var(--muted); }

.run-caption { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.hero-run { margin: 0; min-width: 0; }
.copy-line {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 8px 8px 16px;
}
.copy-line code { background: none; padding: 0; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow-x: auto; }
.copy-line-wrap code { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.copy {
  flex: none; min-height: 40px; min-width: 64px; padding: 0 12px; border-radius: 7px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font: 500 14px var(--sans);
}
.copy:hover { border-color: var(--muted); }
.copy:active { background: var(--bg); }
.copy[data-done] { color: var(--ok); }

.transcript {
  margin: 12px 0 0; padding: 18px 20px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.65; color: var(--text);
}
/* Identity motif: lines that change (diff "+") are marked in the accent, as in the CLI. */
.transcript .add, .add { color: var(--accent-text); }
.transcript .ok { color: var(--ok); }
.transcript .dim { color: var(--muted); }
.transcript .you { color: var(--accent-text); font-weight: 500; }
.transcript .code-word { color: var(--text); font-weight: 500; letter-spacing: 0.04em; }

/* ---------- sections ---------- */
section { padding: 88px 0; }
.band { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band code { background: var(--bg); }
.section-lede { color: var(--muted); max-width: 40em; margin-bottom: 32px; }
.split { display: grid; gap: 40px; grid-template-columns: 1fr; }
.split p { max-width: 36em; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps li {
  counter-increment: step; position: relative; padding: 14px 16px 14px 56px;
  border-radius: 8px; color: var(--muted);
}
.steps li b { color: var(--text); display: block; }
.steps li::before {
  content: "+ " counter(step); position: absolute; left: 14px; top: 14px;
  font-family: var(--mono); font-size: 14px; color: var(--accent-text);
}

/* Stacks: a table, because the content is the same three facts for six stacks. */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.stack-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.stack-table th, .stack-table td { text-align: left; vertical-align: top; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.stack-table tbody tr:last-child > * { border-bottom: 0; }
.stack-table thead th { font-size: 14px; font-weight: 500; color: var(--muted); background: var(--surface); }
.stack-table tbody th { font-weight: 600; white-space: nowrap; width: 9em; }
.stack-table td { color: var(--muted); }
.stack-table td:last-child { width: 34%; }

/* Issues: copy next to an example of the real issue view. */
.issue-layout { display: grid; gap: 48px; grid-template-columns: 1fr; align-items: start; }
.facts { margin: 24px 0 0; display: grid; gap: 18px; }
.facts dt { font-weight: 600; }
.facts dd { margin: 2px 0 0; color: var(--muted); }

.issue-card { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 22px; min-width: 0; }
.example-label { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.issue-title { font-weight: 600; margin: 0; display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--error); flex: none; transform: translateY(-1px); }
.issue-culprit { font-family: var(--mono); font-size: 14px; color: var(--muted); margin: 4px 0 0 20px; }
.issue-meta { font-size: 14px; color: var(--muted); margin: 10px 0 18px 20px; }
.frames { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.frames li { display: flex; flex-direction: column; padding: 9px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.frames li:last-child { border-bottom: 0; }
.frames .loc { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.frames .fn { overflow-wrap: anywhere; color: var(--muted); }
/* Your code is the accent, libraries recede: same rule as the dashboard. */
.frames .in-app { background: rgba(116, 70, 214, 0.16); }
.frames .in-app .fn { color: var(--text); font-weight: 500; }
.crumbs-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.crumbs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.cat { display: inline-block; min-width: 3.4em; color: var(--muted); }
.cat.warn { color: var(--warn); }

.asks { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
.asks li { font-size: 18px; color: var(--text); }
.code-panel { align-self: center; min-width: 0; }

.data-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 22px; max-width: 46em; }
.data-list li { color: var(--muted); }
.data-list b { color: var(--text); display: block; }

.closing { padding: 104px 0; }
.closing-inner { text-align: center; }
.closing-inner p { color: var(--muted); }
.cta-center { justify-content: center; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 28px 0; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot nav a { color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.foot nav a:hover { color: var(--text); }
.foot .muted { margin: 0 0 0 auto; }
.brand-small { font-size: 16px; }
.brand-small .mark { width: 22px; height: 22px; }

/* ---------- docs ---------- */
.doc { padding: 56px 0 96px; }
.doc-grid { display: grid; gap: 40px; grid-template-columns: 1fr; }
.doc-toc { font-size: 15px; }
.doc-toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.doc-toc a { color: var(--muted); text-decoration: none; display: block; padding: 8px 0; }
.doc-toc a:hover { color: var(--text); }
.doc-body { min-width: 0; max-width: 46em; }
.doc-body h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: 16px; }
.doc-body h2 { margin-top: 56px; padding-top: 8px; }
.doc-body h3 { font-size: 18px; margin: 28px 0 10px; }
.doc-body pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.6; margin: 0 0 16px;
}
.doc-body pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.doc-body ol, .doc-body ul { padding-left: 1.3em; }
.doc-body li { margin-bottom: 6px; }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; color: var(--muted); }

/* ---------- 404 ---------- */
.lost { padding: 120px 0; text-align: center; }

/* ---------- wider screens ---------- */
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 5fr 6fr; gap: 56px; }
  .split { grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
  .split-reverse > :first-child { order: 0; }
  .issue-layout { grid-template-columns: 1fr 1.05fr; gap: 64px; }
  .doc-grid { grid-template-columns: 200px 1fr; gap: 56px; }
  .doc-toc { position: sticky; top: 88px; align-self: start; }
}

@media (max-width: 860px) {
  .nav { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero { padding: 56px 0 64px; }
  section { padding: 64px 0; }
  .lede { font-size: 17px; }
  .link-quiet { display: none; }
  .copy-line code { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  .foot .muted { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
