:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e3d9c8;
  --teal: #0d5c56;
  --teal-soft: #e5f2f0;
  --rust: #8d3d32;
  --rust-soft: #f8ebe6;
  --ok: #1d6b45;
  --shadow: 0 16px 40px rgba(60, 42, 20, 0.06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(13, 92, 86, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--teal); }
a:hover { color: #083f3b; }
img { max-width: 100%; }

.wrap { width: min(1120px, calc(100vw - 32px)); margin: 0 auto; }
select, input { min-width: 0; max-width: 100%; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 0 12px;
}
.brand { text-decoration: none; color: inherit; }
.brand strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; }
.brand span { display: block; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--ink); font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--teal); border-bottom: 2px solid var(--teal); }
.lang { color: var(--muted); font-size: 0.85rem; }
.banner {
  background: var(--ink);
  color: #f6f1e8;
  font-size: 0.92rem;
}
.banner .wrap { padding: 10px 0; }
.banner a { color: #f1d7a5; }

header.hero { padding: 42px 0 12px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); margin: 0 0 12px; }
h2 { font-size: 1.8rem; margin: 0 0 10px; }
h3 { font-size: 1.2rem; margin: 0 0 8px; }
.lede { font-size: 1.18rem; max-width: 46rem; color: #3a342c; }
.grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0 40px; }
.cards article, .stack article { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.kicker { color: var(--teal); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 8px; }
.muted { color: var(--muted); }
footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 40px; color: var(--muted); font-size: 0.92rem; }
footer a { color: var(--ink); }

label { display: block; font-size: 0.86rem; margin: 12px 0 4px; }
input, select, button {
  font: inherit;
  color: inherit;
}
input, select {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
button {
  margin-top: 16px;
  background: var(--teal);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.check input { width: auto; }
.result-line {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.result-line strong { font-variant-numeric: tabular-nums; }
.pill {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--teal-soft);
  color: var(--teal);
  white-space: nowrap;
}
.pill.bad { background: var(--rust-soft); color: var(--rust); }
.pill.na { background: #eeeae3; color: var(--muted); }
.source { grid-column: 1 / -1; font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.source a, .banner a { overflow-wrap: anywhere; }
.scroll-x { overflow-x: auto; max-width: 100%; }
pre { max-width: 100%; }
.totals { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 14px; }
.totals > div { flex: 1 1 180px; min-width: 0; background: var(--teal-soft); border-radius: 12px; padding: 12px; }
.totals .warn { background: var(--rust-soft); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
pre, code { font-family: var(--mono); }
pre {
  background: #221e1a;
  color: #f6f1e8;
  padding: 14px;
  border-radius: 12px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
}
details { margin: 12px 0; }
summary { cursor: pointer; font-weight: 600; }
.flow { width: 100%; height: auto; }
.flow text { font-family: var(--sans); font-size: 13px; fill: var(--ink); }
.note { font-size: 0.92rem; }

.grid > *, .row > *, .card, form, .check, label, select, input { min-width: 0; max-width: 100%; }
.check { align-items: flex-start; }

@media (max-width: 860px) {
  .grid, .cards, .row, .result-line { grid-template-columns: 1fr; }
  .result-line { display: block; }
  .pill { display: inline-block; margin-top: 4px; }
  nav { justify-content: flex-start; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
