/* Bayesian Surprise — the desk. See DESIGN.md. */

:root {
  --paper: #EEF0F3;
  --paper-deep: #E2E6EB;
  --ink: #151A21;
  --ink-soft: #4C5560;
  --steel: #1F4F6F;
  --steel-deep: #163A52;
  --graphite: #1C232C;
  --chalk: #E6E9ED;
  --chalk-soft: #AEB6C0;
  --signal: #B83A1E;
  --signal-deep: #922D16;
  --rule: #D3D8DE;

  --display: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --measure: 64ch;
  --col: 44rem;
  --gutter: 24px;
  --section-y: 64px;
}

@media (min-width: 640px) {
  :root { --gutter: 32px; --section-y: 96px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.65;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--steel);
}

::selection { background: rgba(184, 58, 30, 0.22); color: var(--ink); }

a {
  color: var(--steel);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 150ms ease-out;
}
a:hover { color: var(--steel-deep); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}
.graphite a:focus-visible, .graphite button:focus-visible { outline-color: var(--signal); }

img { max-width: 100%; height: auto; display: block; }

.wrap {
  max-width: var(--col);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Top bar */
.top { border-bottom: 1px solid var(--rule); }
.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
  margin-left: 6px;
  vertical-align: 0.1em;
}
.wordmark:hover { color: var(--ink); }
.nav { display: flex; gap: 20px; flex-wrap: wrap; }
.nav a {
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--signal); padding-bottom: 2px; }

/* Hero */
.hero { padding-top: 56px; padding-bottom: var(--section-y); }
@media (min-width: 640px) { .hero { padding-top: 88px; } }
.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 24px;
  max-width: 20ch;
}
.lead {
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: var(--measure);
  margin: 0 0 32px;
}
.signal-rule {
  border: 0;
  height: 1px;
  width: 64px;
  background: var(--signal);
  margin: 0 0 32px;
}

/* Sections */
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.section + .section:not(.graphite):not(.deep) { border-top: 1px solid var(--rule); }
.deep { background: var(--paper-deep); }
.graphite { background: var(--graphite); color: var(--chalk); }
.graphite h2, .graphite h3 { color: var(--chalk); }
.graphite p, .graphite li { color: var(--chalk); }
.graphite .soft { color: var(--chalk-soft); }
.graphite a { color: var(--chalk); }
.graphite a:hover { color: #fff; }

h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.85rem, 3.6vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  max-width: 24ch;
}
h3 {
  font-family: var(--display);
  font-weight: 500;
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 40px 0 8px;
}
h3:first-of-type { margin-top: 0; }
p { margin: 0 0 20px; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
.short { font-size: 1.25rem; }
.soft { color: var(--ink-soft); }
.small { font-size: 0.9375rem; }

ol.steps { list-style: none; padding: 0; margin: 32px 0 0; counter-reset: step; }
ol.steps li { position: relative; padding-left: 56px; margin-bottom: 28px; max-width: var(--measure); }
ol.steps li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 0.35em;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--signal);
  letter-spacing: 0.04em;
}
ol.steps h3 { margin: 0 0 6px; font-style: normal; font-size: 1.3rem; }
ol.steps p { margin: 0; }

ol.rules { padding-left: 0; list-style: none; margin: 24px 0 0; counter-reset: rule; }
ol.rules li { position: relative; padding-left: 56px; margin-bottom: 20px; max-width: var(--measure); }
ol.rules li::before {
  counter-increment: rule;
  content: counter(rule, decimal-leading-zero);
  position: absolute; left: 0; top: 0.3em;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--signal);
}

.two { display: grid; gap: 32px; align-items: start; }
@media (min-width: 720px) { .two { grid-template-columns: 1.4fr 1fr; gap: 48px; } }
.portrait { margin: 0; }
.portrait img { border-radius: 2px; }

/* Buttons */
.button {
  display: inline-block;
  background: var(--signal);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.0625rem;
  padding: 14px 28px;
  border-radius: 3px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background 150ms ease-out;
}
.button:hover { background: var(--signal-deep); color: #fff; }
.cta { margin-top: 32px; }

/* Facts (proof page) */
.facts { list-style: none; padding: 0; margin: 24px 0 0; max-width: var(--measure); }
.facts li { padding: 14px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 7.5rem 1fr; gap: 16px; }
.facts li:last-child { border-bottom: 1px solid var(--rule); }
.facts .k { font-family: var(--mono); font-size: 0.875rem; color: var(--ink-soft); padding-top: 0.2em; }
.facts .v { margin: 0; }
.graphite .facts li { border-color: #2E3843; }
.graphite .facts .k { color: var(--chalk-soft); }

/* Calculator */
.calc { display: grid; gap: 20px; margin-top: 32px; max-width: var(--measure); }
@media (min-width: 640px) { .calc { grid-template-columns: 1fr 1fr; } }
.calc label { display: block; font-size: 0.9375rem; color: var(--ink-soft); margin-bottom: 6px; }
.calc .span { grid-column: 1 / -1; }
.field {
  width: 100%;
  font-family: var(--mono);
  font-size: 1.0625rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 12px 14px;
}
.field:focus { border-color: var(--steel); }
select.field { font-family: var(--sans); appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.money { position: relative; }
.money .field { padding-left: 28px; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-family: var(--mono); color: var(--ink-soft); pointer-events: none; }
.pct { position: relative; }
.pct .field { padding-right: 36px; }
.pct::after { content: "%"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--mono); color: var(--ink-soft); pointer-events: none; }

.result { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--rule); max-width: var(--measure); }
.result .big {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.result .big .num { font-family: var(--display); font-weight: 500; font-variant-numeric: tabular-nums; }
.result .or {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--signal);
  letter-spacing: 0.08em;
  margin: 28px 0 8px;
}
.result .detail { color: var(--ink-soft); font-size: 1rem; }
.result .honest { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--rule); }
.result[hidden] { display: none; }

/* Form */
.form { display: grid; gap: 20px; max-width: var(--measure); margin-top: 32px; }
.form label { display: block; font-size: 0.9375rem; color: var(--ink-soft); margin-bottom: 6px; }
.form .field { font-family: var(--sans); }
.form textarea.field { min-height: 8rem; resize: vertical; }
.form .note { font-size: 0.9375rem; color: var(--ink-soft); }
.form-msg { margin-top: 16px; font-size: 1rem; }

/* Footer */
.foot { background: var(--graphite); color: var(--chalk-soft); padding-top: 48px; padding-bottom: 48px; font-size: 0.9375rem; }
.foot p { max-width: var(--measure); margin-bottom: 12px; }
.foot .name { color: var(--chalk); font-family: var(--display); font-size: 1.125rem; letter-spacing: 0.04em; }
.foot a { color: var(--chalk); }
.foot .links { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 20px; font-family: var(--mono); font-size: 0.8125rem; }
.foot .links a { text-decoration: none; color: var(--chalk-soft); }
.foot .links a:hover { color: var(--chalk); }

/* Motion: one moment */
@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero .lead { animation: rise 600ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .hero .lead { animation-delay: 80ms; }
}
@keyframes rise { from { transform: translateY(8px); } to { transform: translateY(0); } }
