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

:root {
  color-scheme: light;
  --bg: #e4eee9;
  --paper: #f7fbf9;
  --ink: #14221c;
  --muted: #3d4f47;
  --pine: #1c4536;
  --btn: #16382c;
  --copper: #8c3e24;
  --line: #c9d8d1;
  --focus: #0f3f8f;
  --bad: #9f1239;
  --bad-bg: #fff1f2;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Segoe UI", "Avenir Next", sans-serif;
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, .big {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.35rem); margin: 0 0 0.6rem; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.9rem; }
a { color: #0f3f8f; }

.skip {
  position: absolute; left: 0.75rem; top: 0.75rem; transform: translateY(-160%);
  background: #fff; color: var(--ink); padding: 0.55rem 0.8rem; z-index: 5; border-radius: 8px;
}
.skip:focus { transform: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }

.site-header { background: #fff; border-bottom: 4px solid var(--pine); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.25rem 1.25rem; min-height: 4.25rem;
}
.brand {
  color: var(--pine); text-decoration: none; font-family: var(--serif);
  font-size: 1.55rem; min-height: 44px; display: inline-flex; align-items: center; gap: 0.5rem;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.nav a { color: var(--ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.28rem; }

.hero { padding: 1.5rem 0 0.2rem; }
.kicker {
  margin: 0 0 0.4rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 0.76rem; font-weight: 700; color: var(--copper);
}
.lede { max-width: 42rem; color: var(--muted); font-size: 1.12rem; }
.tool { padding: 0.6rem 0 1.2rem; }
.layout { display: flex; flex-direction: column; gap: 1rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
.modes { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 0.8rem; }
.modes button[aria-selected="true"] { background: var(--pine); color: #fff; border-color: var(--pine); }

fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
legend { font-weight: 750; margin-bottom: 0.55rem; }
.fields { display: grid; gap: 0.8rem; }
.choice { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.55rem; }
.choice label {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; font-weight: 650;
}
label { display: block; font-weight: 700; margin-bottom: 0.28rem; }
.unit { font-weight: 550; color: var(--muted); }
input[type="number"], input[type="text"], select {
  width: 100%; min-height: 48px; padding: 0.55rem 0.75rem; border: 1.5px solid #b7c9c0;
  border-radius: 10px; background: #fff; color: var(--ink); font: inherit;
}
input[type="radio"] { width: 1.15rem; height: 1.15rem; }
input[aria-invalid="true"] { border-color: var(--bad); background: #fff7f8; }
.hint { color: var(--muted); font-size: 0.92rem; margin: 0.28rem 0 0; }
.error { color: var(--bad); font-size: 0.92rem; margin: 0.28rem 0 0; }
.error-summary { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 0.7rem 0.8rem; margin: 0 0 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
button {
  font: inherit; min-height: 48px; padding: 0.6rem 1rem; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.primary { background: var(--btn); color: #fff; border-color: var(--btn); }
.primary:hover { background: #0f241c; }
.note { color: var(--muted); }

.eyebrow { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; font-weight: 700; color: var(--copper); }
.big {
  font-size: clamp(2.4rem, 6vw, 3.6rem); margin: 0.1rem 0 0.35rem; color: var(--copper);
  font-variant-numeric: tabular-nums;
}
.lines { margin: 0.4rem 0 0.8rem; }
.lines div {
  display: flex; justify-content: space-between; gap: 1rem;
  border-bottom: 1px dotted #b7c7bf; padding: 0.42rem 0; font-variant-numeric: tabular-nums;
}
.lines dd { margin: 0; }
.lines .total-line { font-weight: 750; border-bottom: 0; font-size: 1.08rem; }
.summary:focus { outline-offset: 4px; }

.schedule { margin-top: 1rem; }
.year-field { max-width: 16rem; margin-bottom: 0.6rem; }
.table-scroll {
  overflow-x: auto; max-width: 100%; margin: 0 0 1rem; border: 1px solid var(--line);
  border-radius: 12px; background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 36rem; }
caption { text-align: left; font-weight: 750; padding: 0.7rem 0.75rem 0.35rem; }
th, td { padding: 0.48rem 0.65rem; text-align: left; }
th { background: var(--pine); color: #fff; font-weight: 650; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #f3f8f5; }

.section { padding: 0.4rem 0 1.3rem; }
.prose { max-width: 68ch; }
.formula {
  background: #fff; border-left: 4px solid var(--copper); padding: 0.75rem 0.9rem; border-radius: 0 12px 12px 0;
}
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; }
.planned { list-style: none; padding: 0; }
.planned li {
  display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0; border-bottom: 1px solid var(--line);
}
.tag {
  flex: none; border: 1px solid var(--pine); color: var(--pine); border-radius: 999px;
  padding: 0.05rem 0.45rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
}
.site-footer { background: var(--pine); color: #e7f2ec; margin-top: 1rem; }
.footer-inner { padding: 1.4rem 0 1.6rem; }
.site-footer a { color: #fff; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.6rem; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }
.fine { font-size: 0.92rem; color: #d5e6de; }

@media (min-width: 720px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .field-span { grid-column: 1 / -1; }
  .panel { padding: 1.15rem 1.2rem; }
}
@media (min-width: 980px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr); align-items: start; }
  .results { position: sticky; top: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
