/* Typography + layout for content pages (/about, /how-it-works,
 * /examples, /history, /the-maths, /faq).
 *
 * Loaded alongside /css/chrome.css. The tool pages (/ and /495) have
 * their own inline styles and do not use this file.
 *
 * Palette + gradients match the homepage so visual identity is
 * consistent across the whole site. */

:root {
  --bg-0: #0e0d10;
  --bg-1: #17151a;
  --ink: #f4efe6;
  --dim: #8a8490;
  --accent: #ffd36b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  min-width: 504px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Same radial washes as the homepage — centred top + bottom — so
     content pages feel like part of the same site. Fixed to viewport
     so they don't reflow as the page grows. */
  background:
    radial-gradient(90vw 70vh at 50% 0%, #241f2a 0%, transparent 60%),
    radial-gradient(80vw 60vh at 50% 100%, #1b1820 0%, transparent 55%),
    var(--bg-0);
  background-attachment: fixed;
  /* Top padding clears the fixed nav bar; bottom padding clears the
     fixed footer plus a 16px breathing margin. */
  padding:
    calc(var(--nav-h, 48px) + 32px) 24px
    calc(var(--footer-h, 52px) + 16px) 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Subtle noise overlay to match the homepage texture. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Content container ---------- */

.content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 0 48px;
  flex: 1 0 auto;
}

.content h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--ink);
}

.content h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
  color: var(--ink);
}

.content h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 17px;
  margin: 28px 0 8px;
  color: var(--ink);
}

.content .lede {
  font-size: 18px;
  line-height: 1.5;
  color: rgba(244, 239, 230, 0.92);
  margin: 0 0 28px;
}

.content p {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(244, 239, 230, 0.82);
}

.content strong {
  color: var(--accent);
  font-weight: 600;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 211, 107, 0.3);
  transition: border-color 0.15s ease;
}

.content a:hover,
.content a:focus-visible {
  border-bottom-color: var(--accent);
  outline: none;
}

.content ul,
.content ol {
  margin: 0 0 16px;
  padding-left: 24px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(244, 239, 230, 0.82);
}

.content li {
  margin: 4px 0;
}

/* Bottom-of-page CTA — "back to the solver" link. Separated from the
   body copy by a subtle rule, centred, and styled with the same
   JetBrains Mono + 0.14em letter-spacing that the rest of the site's
   monospace UI uses. Stands apart from inline prose links. */
.content__back {
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.content__back a {
  color: var(--accent);
  text-decoration: none;
  /* Override the default .content a dotted border — this is a
     standalone CTA, not an inline prose link. */
  border-bottom: none;
  transition: color 0.15s ease;
}

.content__back a:hover,
.content__back a:focus-visible {
  color: var(--ink);
  outline: none;
}

/* Monospaced block for arithmetic walkthroughs. */
.content pre {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 16px 20px;
  margin: 16px 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow-x: auto;
  color: var(--ink);
}
