:root {
  --green: #2f5d3a;
  --green-dark: #23472c;
  --green-soft: #e8efe9;
  --wheat: #c8922a;
  --wheat-soft: #f6edd6;
  --ink: #1b1b1b;
  --muted: #5b5b5b;
  --line: #d9d5cc;
  --paper: #faf8f2;
  --card: #ffffff;
  --max: 860px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 6vw, 44px); }
h2 { font-size: clamp(24px, 4.5vw, 30px); margin-top: 1.6em; padding-bottom: .2em; border-bottom: 2px solid var(--green); }
h3 { font-size: clamp(19px, 3.6vw, 22px); margin-top: 1.3em; }
p { margin: 0 0 1em; }
a { color: var(--green); }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: .35em; }
strong { font-weight: 700; }
code, .mono { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 18px; }

header.site {
  background: var(--green);
  color: #fff;
  padding: 14px 0;
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
header.site a { color: #fff; text-decoration: none; font-weight: 600; }
header.site nav a { margin-left: 16px; font-weight: 500; opacity: .92; }
header.site nav a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }

.hero { padding: 36px 0 12px; }
.hero p.lead { font-size: 1.15em; color: var(--muted); max-width: 640px; }

.cards { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 22px 0 34px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 6px solid var(--green);
  border-radius: 12px;
  padding: 22px 22px 20px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card.fields { border-top-color: var(--wheat); }
.card:hover, .card:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card .kicker { font-size: .8em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card h2 { border: 0; margin: .2em 0 .35em; font-size: 26px; }
.card p { color: var(--muted); margin-bottom: .8em; }
.card .cta { color: var(--green); font-weight: 700; }
.card.fields .cta { color: #8a5f10; }

.box { background: var(--green-soft); border-left: 5px solid var(--green); padding: 14px 18px; border-radius: 6px; margin: 18px 0; }
.box.warn { background: var(--wheat-soft); border-left-color: var(--wheat); }
.box p:last-child { margin-bottom: 0; }

table { border-collapse: collapse; width: 100%; margin: 8px 0 20px; font-size: .95em; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--green-soft); }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.formula {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .9em;
  background: #f1efe8;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 6px;
  white-space: pre-wrap;
  margin: 8px 0 16px;
}

/* Calculators */
.calc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 18px 14px;
  margin: 20px 0 26px;
}
.calc h3 { margin-top: 0; }
.calc .hint { color: var(--muted); font-size: .92em; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }
label { display: block; font-weight: 600; font-size: .95em; }
label span.u { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 12px;
  min-height: 48px;
  border: 1px solid #b9b4a8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  margin-top: 4px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(47,93,58,.35); border-color: var(--green); }
textarea { min-height: 120px; resize: vertical; }
.result {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--green-soft);
  border-radius: 8px;
  font-size: 1.05em;
}
.result .big { font-size: 1.5em; font-weight: 700; font-family: Georgia, serif; }
.result .note { color: var(--muted); font-size: .9em; }
.result.empty { color: var(--muted); background: #f1efe8; }

button, .btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 8px;
  border: 0;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--green-dark); }
button[disabled] { opacity: .6; cursor: default; }
.btn.secondary { background: #fff; color: var(--green); border: 2px solid var(--green); }

/* Feedback */
.feedback { background: var(--card); border: 2px solid var(--green); border-radius: 12px; padding: 20px 18px; margin: 30px 0; }
.feedback h2 { border: 0; margin-top: 0; }
.rating { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.rating label { display: flex; align-items: center; gap: 6px; font-weight: 500; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.rating input { width: auto; min-height: 0; margin: 0; }
.rating label:has(input:checked) { background: var(--green-soft); border-color: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { margin-top: 12px; font-weight: 600; }
.status.ok { color: var(--green); }
.status.err { color: #9b2c2c; }

.toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 18px 0 8px; }
.toc ol { margin: 0; columns: 1; }
@media (min-width: 560px) { .toc ol { columns: 2; } }
.toc li { break-inside: avoid; }

footer.site { margin-top: 40px; padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9em; }
footer.site a { color: var(--green); }
.small { font-size: .9em; color: var(--muted); }
.two-col { columns: 1; }
@media (min-width: 640px) { .two-col { columns: 2; column-gap: 28px; } .two-col li { break-inside: avoid; } }
dl dt { font-weight: 700; margin-top: 8px; }
dl dd { margin: 0; }
