/* Detect BS — sales and legal pages. One stylesheet, no external requests. */

:root {
  --ink: #16181d;
  --muted: #5b6270;
  --line: #e2e5ea;
  --bg: #ffffff;
  --panel: #f6f7f9;
  --accent: #1a5fd0;
  --buy: #14803a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e8ec;
    --muted: #9aa3b2;
    --line: #2b3038;
    --bg: #121418;
    --panel: #1a1d23;
    --accent: #6ea8ff;
    --buy: #2ea55c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  max-width: 46rem;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 {
  font-size: clamp(1.9rem, 5.5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: clamp(1.25rem, 3.4vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 3rem 0 0.85rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

h3 { font-size: 1rem; margin: 0 0 0.35rem; }

p { margin: 0 0 1rem; }
a { color: var(--accent); }

.tagline { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.75rem; }

/* Purchase */
.buy {
  display: inline-block;
  background: var(--buy);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.85rem 2rem;
  border-radius: 8px;
}
.buy:hover { filter: brightness(1.08); }
.fineprint { font-size: 0.87rem; color: var(--muted); margin-top: 0.7rem; }

/* The four checks */
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.checks > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
}
.checks p { font-size: 0.94rem; color: var(--muted); margin: 0; }

.pullquote {
  font-size: 1.12rem;
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
}

/* Terminal sample — must scroll itself, never the page */
pre, .term {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0 0 1rem;
}
code {
  font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

ul { padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }

footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}
footer a { color: var(--muted); }

/* Legal pages */
.doc-nav { font-size: 0.9rem; margin-bottom: 2rem; }
.plain { white-space: pre-wrap; }

/* Display equations can be wider than the column; scroll the equation, not the page */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: 0.25rem 0; }

/* Figures */
figure { margin: 1.5rem 0; }
figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
figure img.shot { border: 1px solid var(--line); background: #fff; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.5; }

h4 { font-size: 0.98rem; margin: 1.6rem 0 0.4rem; }
blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink);
}
blockquote p { margin: 0.5rem 0; }
