:root {
  --bg: #ebe6dc;
  --paper: #fbfaf6;
  --ink: #1c1915;
  --muted: #4e483f;
  --line: #d9d1c3;
  --navy: #1b3348;
  --navy-2: #244864;
  --copper: #9a3412;
  --copper-soft: #f4e2d0;
  --good: #1d6b45;
  --warn-bg: #f7f1e4;
  --header: #f4efe6;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  --sans: Inter, "Liberation Sans", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace;
  --measure: 40rem;
  --page: 72rem;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

::selection { background: #f0d3b0; }

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3.5rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { top: 0.75rem; }

a { color: var(--navy); }

a:hover { color: var(--copper); }

.wrap {
  width: min(var(--page), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--navy);
  color: var(--header);
}

.site-header a { color: var(--header); text-decoration: none; }

.site-header a:hover { color: #f3d2b0; }

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0 0.35rem;
}

.wordmark {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.38rem;
  border: 1px solid rgba(244, 239, 230, 0.45);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: 0.35em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.95rem;
  padding: 0.35rem 0 0.95rem;
}

.nav a {
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: #e39a52;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35rem;
}

main { padding: 1.5rem 0 2.5rem; }

.page p,
.page li,
.page h2,
.page h3,
.page .note,
.page .lede,
.page .faq,
.page .standards { max-width: var(--measure); }

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0.15rem 0 0.6rem;
  max-width: 18ch;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 1.8rem 0 0.5rem;
  color: var(--navy);
}

h3 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
  color: var(--navy);
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper);
}

.lede { font-size: 1.12rem; margin-top: 0; }

.note {
  background: var(--warn-bg);
  border-left: 3px solid var(--copper);
  padding: 0.75rem 0.9rem;
  margin: 1rem 0;
}

.standards {
  color: var(--muted);
  font-size: 0.92rem;
}

.tool { margin: 1.25rem 0 0.5rem; }

.tool-grid {
  display: grid;
  gap: 0.9rem;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.fields, .form-grid { display: grid; gap: 0.8rem; }

label .label-text, .field-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
}

.field {
  display: flex;
  align-items: center;
  border: 1px solid #cfc6b6;
  border-radius: 10px;
  background: white;
  min-height: 48px;
}

.field:focus-within { border-color: var(--navy); }

.field input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  padding: 0.7rem 0.75rem;
  min-width: 0;
  width: 100%;
  color: inherit;
}

.field input:focus { outline: none; }

.suffix {
  padding-right: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.hint, .help {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0.35rem 0 0;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.2rem 0 0.9rem;
}

button, .button {
  font: inherit;
  font-weight: 650;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

button.primary, .lead button {
  background: var(--copper);
  color: white;
}

button.primary:hover, .lead button:hover { background: #7c2d12; }

button.ghost {
  background: transparent;
  color: var(--navy);
  border-color: #cfc6b6;
}

button.ghost:hover { border-color: var(--navy); color: var(--navy); }

.actions { margin-top: 0.9rem; }

.readout { display: grid; gap: 0.85rem; align-content: start; }

.spec { border-top: 1px solid var(--line); padding-top: 0.7rem; }

.spec:first-child { border-top: 0; padding-top: 0; }

.spec-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.spec-num {
  margin: 0.1rem 0 0.2rem;
  font-family: var(--mono);
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--navy);
  line-height: 1.2;
}

.spec-unit {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.15rem;
}

.spec-note { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.92rem; }

.error {
  margin: 0;
  color: #7f1d1d;
  background: #fde8e8;
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}

.constants { margin-top: 0.3rem; }

.constants summary { cursor: pointer; color: var(--navy); min-height: 44px; display: flex; align-items: center; }

.table-wrap { overflow-x: auto; margin: 0.8rem 0 1.2rem; max-width: none; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-weight: 700;
  color: var(--navy);
  padding: 0 0 0.45rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

td.num, th.num { text-align: right; font-family: var(--mono); font-size: 0.9rem; }

.cards {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 0.7rem;
  max-width: none;
}

.cards a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 44px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.cards a:hover { border-color: var(--navy); color: inherit; }

.cards strong { color: var(--navy); }

.cards span { color: var(--muted); font-size: 0.95rem; }

.faq details {
  border-top: 1px solid var(--line);
  padding: 0.35rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.affiliate {
  border: 1px dashed #c4b8a4;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 1.2rem 0;
  background: #f7f3ea;
  max-width: var(--measure);
}

.affiliate-kicker, .footer-label {
  margin: 0 0 0.25rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.affiliate-note { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; }

.ad-slot {
  border: 1px dashed var(--line);
  min-height: 90px;
  display: grid;
  place-items: center;
  color: var(--muted);
  margin: 1rem auto;
  max-width: var(--measure);
  background: var(--paper);
}

.lead {
  background: var(--navy);
  color: var(--header);
  border-radius: 16px;
  padding: 1.15rem 1.1rem 1.25rem;
  margin: 1.5rem 0;
  max-width: 46rem;
}

.lead h2, .lead p { color: inherit; max-width: none; }

.lead a { color: #f6d7b8; }

.lead form { position: relative; }

.lead label { color: var(--header); font-weight: 600; font-size: 0.92rem; }

.lead input, .lead select, .lead textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--paper);
  color: var(--ink);
  min-height: 48px;
}

.lead textarea { min-height: 7rem; resize: vertical; }

.lead .form-grid { margin: 0.8rem 0; }

.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #e4ded2;
  padding: 1.6rem 0 2.4rem;
  color: #3a342c;
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  gap: 1.2rem;
}

.site-footer ul { list-style: none; padding: 0; margin: 0.3rem 0 0; }

.site-footer li { margin: 0.2rem 0; }

.site-footer a { color: var(--navy); }

@media (min-width: 720px) {
  .tool-grid { grid-template-columns: minmax(16rem, 0.92fr) minmax(18rem, 1.08fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .wide { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .site-header, .site-footer, .affiliate, .ad-slot, .lead, .skip, .presets, .actions { display: none !important; }
  body { background: white; }
  .panel { box-shadow: none; }
  a { text-decoration: underline; }
}
