:root {
  --paper: #f4ede3;
  --paper-deep: #ece2d4;
  --clay: #3b2a22;
  --muted: #6a5c4f;
  --terracotta: #b5573a;
  --terracotta-deep: #94422b;
  --sage: #9aa48e;
  --rule: #d8cbba;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --measure: 44rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--clay);
  font-family: var(--serif);
  font-size: clamp(1.02rem, 0.96rem + 0.3vw, 1.18rem);
  line-height: 1.72;
}

h1, h2, h3, p, dt, dd, legend, figcaption, output { overflow-wrap: anywhere; }

h1, h2, h3 { line-height: 1.16; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

p { margin: 0; }

dl, dd { margin: 0; }

/* ---------- shell + rhythm ---------- */

.shell {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

main section { padding-block: clamp(3.5rem, 8vw, 7rem); }

main section + section { border-top: 1px solid var(--rule); }

.prose { max-width: var(--measure); color: var(--clay); }

.prose + .prose, .prose + h3, .figures + .prose { margin-top: 1.15em; }

h3 { font-size: 1.12rem; margin-top: 1.6em; color: var(--terracotta-deep); }

h3 + .prose { margin-top: 0.4em; }

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.3rem);
  max-width: var(--measure);
  margin-bottom: 0.9em;
}

h2::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 2px;
  margin-top: 0.55rem;
  background: var(--terracotta);
}

/* ---------- header ---------- */

.site-head { padding-block: 1.6rem; border-bottom: 1px solid var(--rule); }

.brand { font-size: 1.16rem; letter-spacing: 0.02em; }

.brand-domain {
  font-size: 0.83rem;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin-top: 1rem;
  font-size: 0.92rem;
}

.nav a {
  color: var(--terracotta-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.nav a:hover { border-bottom-color: var(--terracotta); }

/* ---------- hero ---------- */

.hero { position: relative; overflow: hidden; background: var(--paper-deep); }

.hero::before {
  content: "";
  position: absolute;
  inset-block-start: -7rem;
  inset-inline-end: -6rem;
  width: 22rem;
  max-width: 60%;
  aspect-ratio: 1;
  border: 1px solid var(--sage);
  border-radius: 50%;
  opacity: 0.55;
}

.hero .shell { position: relative; }

.dateline {
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
}

h1 {
  font-size: clamp(2rem, 1.1rem + 4.4vw, 4.4rem);
  max-width: 20ch;
  margin-block: 0.5em 0.55em;
}

.lede {
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.4rem);
  font-style: italic;
  color: var(--muted);
  max-width: 36rem;
}

.intro { margin-top: 2.2rem; }

/* ---------- grids and figures ---------- */

.grid {
  display: grid;
  gap: 1.6rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  margin-block: 2rem;
}

.cell { border-top: 2px solid var(--sage); padding-top: 0.9rem; }

dt { font-size: 1.05rem; letter-spacing: 0.01em; margin-bottom: 0.35em; }

dd { font-size: 0.97rem; color: var(--muted); }

.figures {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  margin-block: 2.4rem;
  max-width: 52rem;
}

figure { margin: 0; color: var(--terracotta); }

.figure-wide { max-width: 32rem; margin-top: 2.4rem; }

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

figcaption {
  margin-top: 0.7rem;
  font-size: 0.86rem;
  font-style: italic;
  color: var(--muted);
}

/* ---------- shrinkage calculator ---------- */

.split {
  display: grid;
  gap: 2.4rem 3rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  align-items: start;
}

.split-text .prose { max-width: 38rem; }

.calc {
  border: 1px solid var(--rule);
  border-top: 3px solid var(--terracotta);
  background: var(--paper-deep);
  padding: 1.5rem clamp(1.1rem, 3vw, 1.8rem) 1.7rem;
}

.calc h3 { margin-top: 0; font-size: 1.05rem; color: var(--clay); }

.field { margin-top: 1.1rem; }

.field label { display: block; font-size: 0.88rem; color: var(--muted); }

.calc input[type="number"] {
  margin-top: 0.35rem;
  width: 100%;
  max-width: 11rem;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 1rem;
  color: var(--clay);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.dirs { border: 0; padding: 0; margin-inline: 0; }

.dirs legend { font-size: 0.88rem; color: var(--muted); padding: 0; }

.dirs label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.95rem;
  color: var(--clay);
}

.dirs input { accent-color: var(--terracotta); }

.result {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.25rem, 1.1rem + 1vw, 1.7rem);
  color: var(--terracotta-deep);
}

.calc-note { margin-top: 0.7rem; font-size: 0.82rem; font-style: italic; color: var(--muted); }

/* ---------- footer ---------- */

.site-foot {
  padding-block: 2.6rem 3.2rem;
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
}

.foot-note { margin-top: 0.8rem; font-size: 0.92rem; font-style: italic; color: var(--muted); }

.foot-year { margin-top: 0.3rem; font-size: 0.82rem; letter-spacing: 0.12em; color: var(--muted); }

/* ---------- focus + motion ---------- */

a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--terracotta-deep);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .nav a { transition: border-color 160ms ease; }
}
