:root {
  color-scheme: light;
  --ink: #17221b;
  --muted: #56625a;
  --paper: #f7f6f0;
  --surface: #ffffff;
  --line: #d7ddd7;
  --brand: #145c3d;
  --brand-dark: #0d402b;
  --brand-soft: #e3f1e9;
  --green: #12633d;
  --green-bg: #e1f3e8;
  --yellow: #725100;
  --yellow-bg: #fff1bd;
  --red: #982f2f;
  --red-bg: #fbe4e2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(23, 34, 27, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}

a { color: var(--brand-dark); text-underline-offset: 0.16em; }
a:hover { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #4d8f70;
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 10;
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
}
.skip-link:focus { top: 1rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner, main, .footer-inner {
  width: min(100% - 2rem, 70rem);
  margin-inline: auto;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1.25rem;
  padding-block: 0.9rem;
}

.site-name {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

nav ul, .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav a { font-size: 0.92rem; font-weight: 650; text-decoration: none; }
nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

main { padding-block: clamp(2.5rem, 7vw, 5rem); }

.narrow { max-width: 47rem; }
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.16; letter-spacing: -0.025em; }
h1 { margin: 0; max-width: 17ch; font-size: clamp(2.15rem, 8vw, 4.4rem); }
h2 { margin-top: 0; font-size: clamp(1.45rem, 4vw, 2.1rem); }
h3 { margin: 0; font-size: 1.12rem; }

.lede {
  max-width: 45rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.5vw, 1.24rem);
}

.hero { padding-bottom: clamp(2.25rem, 6vw, 4.5rem); }
.signal-key { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1.4rem; }
.key-item, .signal-pill {
  border-radius: 999px;
  padding: 0.3rem 0.68rem;
  font-size: 0.86rem;
  font-weight: 750;
}
.key-green { color: var(--green); background: var(--green-bg); }
.key-yellow { color: var(--yellow); background: var(--yellow-bg); }
.key-red { color: var(--red); background: var(--red-bg); }

.grid, .tool-layout { display: grid; gap: 1rem; }
.card, .calculator, .result, .content-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card { display: flex; flex-direction: column; padding: 1.35rem; }
.card p { color: var(--muted); }
.card a { margin-top: auto; font-weight: 750; }

.section { margin-top: clamp(3rem, 8vw, 5rem); }
.tool-layout { align-items: start; }
.calculator { padding: clamp(1.15rem, 4vw, 2rem); box-shadow: var(--shadow); }
.form-row + .form-row { margin-top: 1.1rem; }
label { display: block; margin-bottom: 0.38rem; font-weight: 720; }
.hint { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.86rem; }
input, select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid #9ca89f;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0.65rem 0.75rem;
}
button {
  width: 100%;
  min-height: 3rem;
  margin-top: 1.35rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 780;
}
button:hover { background: var(--brand-dark); }

.result { margin-top: 1rem; padding: 1.25rem; }
.result[hidden] { display: none; }
.result.green { border-color: #85b89b; background: var(--green-bg); }
.result.yellow { border-color: #d5b651; background: var(--yellow-bg); }
.result.red { border-color: #d69995; background: var(--red-bg); }
.result.error { border-color: #d69995; background: #fff7f6; }
.result-label { margin: 0; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.result-value { margin: 0.25rem 0; font-size: clamp(1.8rem, 7vw, 3rem); font-weight: 850; line-height: 1.1; }
.result-summary, .result-math { margin: 0.5rem 0 0; }
.result-math { font-size: 0.9rem; }

.content-panel { padding: clamp(1.2rem, 4vw, 2rem); }
.content-panel p:last-child { margin-bottom: 0; }
.note { border-left: 4px solid var(--brand); padding-left: 1rem; color: var(--muted); }
.plain-list { padding-left: 1.25rem; }
.plain-list li + li { margin-top: 0.5rem; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
caption { margin-bottom: 0.75rem; text-align: left; font-weight: 750; }
th, td { border-bottom: 1px solid var(--line); padding: 0.65rem; text-align: left; }
th { background: #edf1ed; }

.faq details { border-top: 1px solid var(--line); padding: 1rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 750; }
.faq details p { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { padding-block: 2rem; }
.footer-links { margin-bottom: 0.8rem; }
.footer-note { margin: 0; color: var(--muted); font-size: 0.9rem; }

.not-found { min-height: 55vh; display: grid; place-content: center; text-align: center; }
.not-found h1 { max-width: none; }

@media (min-width: 42rem) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .tool-layout { grid-template-columns: minmax(0, 1.1fr) minmax(17rem, 0.9fr); gap: 1.5rem; }
}

@media (min-width: 64rem) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
