/* ===== Cliffstone — tokens ===== */
:root {
  --bg: #f6f4ef;          /* paper */
  --bg-alt: #eeebe3;
  --surface: #fbfaf7;
  --line: #d9d4c8;
  --text: #16181d;        /* ink */
  --muted: #5c5f66;
  --accent: #1f4fd1;      /* ink blue */
  --accent-soft: rgba(31, 79, 209, .10);
  --plot: #16181d;

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --wrap: 1100px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #14171c;
    --surface: #181b21;
    --line: #2a2e36;
    --text: #e9e7e1;
    --muted: #a0a3ab;
    --accent: #7ea2ff;
    --accent-soft: rgba(126, 162, 255, .12);
    --plot: #e9e7e1;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #14171c;
  --surface: #181b21;
  --line: #2a2e36;
  --text: #e9e7e1;
  --muted: #a0a3ab;
  --accent: #7ea2ff;
  --accent-soft: rgba(126, 162, 255, .12);
  --plot: #e9e7e1;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--font-mono); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.8rem, 5.6vw, 4.4rem); font-weight: 300; }
h1 em { font-style: italic; color: var(--accent); }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); max-width: 22ch; }
h3 { font-size: 1.4rem; font-weight: 500; }
p { margin: 0 0 1em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.section-lede { color: var(--muted); max-width: 60ch; font-size: 1.08rem; }

.btn {
  display: inline-block;
  font: 500 1rem/1 var(--font-body);
  padding: .95rem 1.4rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); opacity: .9; }
.btn:focus-visible, .site-header a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-big { font-size: clamp(1rem, 3.4vw, 1.2rem); padding: 1.1rem 1.7rem; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; font-family: var(--font-display); font-size: 1.35rem; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.nav nav { display: flex; gap: 1.5rem; }
.nav nav a { text-decoration: none; color: var(--muted); font-size: .95rem; }
.nav nav a:hover { color: var(--text); }
@media (max-width: 640px) {
  .nav nav a:not(:last-child) { display: none; }
}

/* ===== Hero ===== */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(56px, 8vw, 96px); }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.lede { font-size: clamp(1.1rem, 2vw, 1.25rem); max-width: 40ch; color: var(--muted); margin-bottom: 1.8rem; }
.hero-figure { margin: 0; }
#gauss {
  width: 100%; height: auto; display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.hero-figure figcaption { display: flex; justify-content: space-between; gap: 1rem; margin-top: .6rem; font-size: .85rem; color: var(--muted); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

/* ===== Sections ===== */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2.4rem; }
.principle {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; display: flex; flex-direction: column; min-width: 0;
}
.formula {
  min-height: 92px; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; padding-bottom: 1rem;
  overflow-x: auto; color: var(--text);
}
.formula-stack { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.formula-stack math { margin: 0; }
.formula math { font-size: 1.25rem; font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", math; }
.who { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .5rem; }
.principle p:last-child { color: var(--muted); margin: 0; }
@media (max-width: 900px) { .principles { grid-template-columns: 1fr; } }

.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.criteria { list-style: none; margin: 0; padding: 0; }
.criteria li { padding: 1.2rem 0; border-top: 1px solid var(--line); }
.criteria li:last-child { border-bottom: 1px solid var(--line); }
.criteria h3 { font-size: 1.25rem; margin-bottom: .25rem; }
.criteria p { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; margin-top: 2.4rem; }
.how-item { border-top: 2px solid var(--text); padding-top: 1.2rem; }
.how-num { color: var(--accent); font-size: .85rem; margin-bottom: .6rem; }
.how-item p:last-child { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .how { grid-template-columns: 1fr; } }

.contact { text-align: left; }

/* ===== Footer ===== */
.site-footer { padding: 2rem 0; font-size: .86rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; }

/* ===== Reveal ===== */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
