:root {
  color-scheme: light;
  --ink: #183f38;
  --muted: #50665f;
  --paper: #f4f5ed;
  --surface: #fff;
  --line: #d1dbcf;
  --accent: #c9ec87;
  --result: #e6efdf;
  --tight: #fae9d5;
  --error: #a12e20;
  --focus: #327d68;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.skip-link {
  position: absolute;
  z-index: 5;
  top: -100px;
  left: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.skip-link:focus { top: 12px; }
.wrap { width: min(1120px, 100%); margin-inline: auto; padding-inline: 32px; }
.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: block; flex: 0 0 auto; font-size: 1.2rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark { margin-right: 8px; color: #3d7160; }
.tagline { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; letter-spacing: .08em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 20px; }
.nav a { font-size: .9rem; text-decoration: none; }
.nav a:hover, .text-link:hover { text-decoration-thickness: 2px; }
.main { min-height: 60vh; }
.intro { max-width: 780px; padding-block: 54px 30px; }
.eyebrow { margin: 0 0 12px; font-size: .76rem; font-weight: 750; letter-spacing: .14em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 {
  margin: 14px 0 20px;
  font-size: clamp(2.8rem, 6.5vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1.04;
}
h2 { margin: 0 0 14px; font-size: 1.45rem; font-weight: 650; line-height: 1.3; }
h3 { margin: 0; font-size: 1.1rem; font-weight: 650; line-height: 1.4; }
.lede { max-width: 660px; margin: 0; font-size: 1.2rem; line-height: 1.55; }
.caveat, .muted, .help, .state-copy { color: var(--muted); }
.caveat { margin: 18px 0 0; font-size: .92rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.button, .primary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 11px 18px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}
.button:hover, .primary:hover { background: #285f52; }
.button.secondary { background: transparent; color: var(--ink); }
.button.secondary:hover { background: var(--result); }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-block: 28px 52px; }
.card, .article-card, .form-panel, .output-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card { padding: 24px; }
.card p:last-child, .article-card > :last-child { margin-bottom: 0; }
.card p, .section-copy { color: var(--muted); }
.section-heading { margin-top: 0; }
.article { max-width: 780px; padding-block: 48px 64px; }
.article > .eyebrow { margin-bottom: 10px; }
.article h1 { font-size: clamp(2.5rem, 5vw, 4.2rem); }
.article h2 { margin-top: 32px; }
.article p, .article li { color: #344f47; }
.article ul, .article ol { padding-left: 1.4rem; }
.article li + li { margin-top: 10px; }
.article-card { margin-block: 22px; padding: 24px; }
.formula-block {
  overflow-wrap: anywhere;
  padding: 16px;
  border-radius: 10px;
  background: var(--result);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.source-list { padding-left: 1.25rem; }
.source-list li + li { margin-top: 20px; }
.planner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); margin: 6px 0 46px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.form-panel { padding: 30px; border: 0; border-radius: 0; }
.panel-copy { margin: 0; color: var(--muted); font-size: .93rem; }
.fields { display: grid; gap: 15px; margin-top: 22px; }
.field label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: .9rem; font-weight: 650; }
.unit { color: var(--muted); font-size: .8rem; font-weight: 400; }
.field input {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #a4b7ac;
  border-radius: 8px;
  background: #fafcf8;
  color: var(--ink);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.help, .field-error { margin: 5px 0 0; font-size: .8rem; }
.field-error, .error-summary, .error-copy { color: var(--error); }
.field input[aria-invalid="true"] { border-color: var(--error); }
.error-summary { margin: 14px 0 0; font-weight: 600; }
.primary { width: 100%; justify-content: space-between; margin-top: 22px; }
.primary:disabled { cursor: wait; opacity: .72; }
.output-panel { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: 30px; border: 0; border-radius: 0; background: var(--result); }
.output-panel[data-state="tight"] { background: var(--tight); }
.output-panel[data-state="error"] { background: #fff7f4; }
.output-panel[data-state="loading"] .loading-indicator { animation: pulse 800ms ease-in-out infinite alternate; }
.output-label { margin-bottom: 18px; }
.empty-mark { display: inline-grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: #d4e3cf; font-size: 1.2rem; }
.empty-title, .state-title { margin-top: 12px; }
.state-copy { margin: 8px 0 0; font-size: .9rem; }
.loading-indicator { display: block; width: 30px; height: 30px; border: 3px solid #aac0ad; border-top-color: var(--ink); border-radius: 50%; }
.result-number { margin: 4px 0 0; font-size: clamp(2.8rem, 5vw, 4.6rem); font-weight: 650; letter-spacing: -.055em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-status { margin: 8px 0 0; font-weight: 650; }
.range { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.range-item { min-width: 0; padding: 10px; border: 1px solid #bdcebb; border-radius: 10px; }
.range-label, .range-value { display: block; }
.range-label { color: var(--muted); font-size: .78rem; }
.range-value { overflow-wrap: anywhere; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.breakdown { margin: 20px 0 0; padding-block: 8px; border-top: 1px solid #bdcebb; border-bottom: 1px solid #bdcebb; font-size: .88rem; font-variant-numeric: tabular-nums; }
.breakdown-row { display: flex; justify-content: space-between; gap: 16px; padding-block: 4px; }
.breakdown-row dt { color: var(--muted); }
.breakdown-row dd { margin: 0; text-align: right; }
.formula-line, .comparison-copy { font-size: .88rem; font-variant-numeric: tabular-nums; }
.comparison { margin-top: 12px; padding-top: 12px; border-top: 1px solid #bdcebb; }
.comparison-title { margin: 0; font-size: .82rem; font-weight: 700; }
.comparison-copy { margin: 4px 0 0; }
.examples { margin-block: 48px; }
.section-copy { max-width: 760px; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.preset { min-width: 0; min-height: 76px; padding: 14px; border: 1px solid #a4b7ac; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; }
.preset:hover { background: var(--accent); }
.preset strong, .preset span { display: block; }
.preset strong { font-size: 1.2rem; }
.preset span { margin-top: 4px; font-size: .78rem; }
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; margin-block: 42px; padding-block: 30px; border-top: 1px solid var(--line); }
.details p, .details li { color: var(--muted); font-size: .92rem; }
.site-footer { padding-block: 22px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.site-footer p { margin: 6px 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.footer-links a { color: var(--ink); }
.not-found-code { color: var(--muted); font-size: .9rem; }

@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@media (max-width: 760px) {
  .wrap { padding-inline: 20px; }
  .site-header { min-height: 78px; flex-wrap: wrap; justify-content: flex-start; padding-block: 14px; }
  .nav { width: 100%; justify-content: flex-start; gap: 8px 18px; }
  .intro { padding-block: 38px 24px; }
  .planner, .details, .content-grid { grid-template-columns: minmax(0, 1fr); }
  .form-panel, .output-panel { padding: 24px; }
  .details { gap: 20px; }
  .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .wrap { padding-inline: 16px; }
  .site-header { gap: 10px; }
  .nav { column-gap: 14px; }
  .nav a { font-size: .85rem; }
  .presets { grid-template-columns: minmax(0, 1fr); }
  .field label { align-items: flex-start; flex-direction: column; gap: 0; }
  .range { gap: 5px; }
  .range-item { padding: 8px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
