:root {
  --bg: #fff8ea;
  --surface: #ffffff;
  --ink: #1f1a2e;
  --text: #1f1a2e;
  --muted: #4a4459;
  --faint: #7a748a;
  --border: #eadfca;
  --line: #f1e6cf;
  --teal: #0f7c7a;
  --teal-dark: #0a5b59;
  --coral: #e5573f;
  --mustard: #f0b429;
  --footer-text: #cfc8dc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.site-header nav a {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.site-header nav a:hover { background: var(--line); }
.site-header nav a.active { background: var(--ink); color: var(--bg); }

main { padding: 1.75rem 1rem 3rem; }

h1, h2 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
h1 { font-size: 3.1rem; letter-spacing: -0.03em; margin: 0.4rem 0 0.6rem; }
h1 .hl { color: var(--teal); }
h2 { font-size: 1.8rem; margin: 2.4rem 0 0.6rem; }
h3 { font-weight: 800; font-size: 1.15rem; margin: 1.5rem 0 0.4rem; }

.lede { color: var(--muted); font-size: 1.2rem; margin-top: 0; }

.eyebrow {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--mustard);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.75rem 0 0;
}

a { color: var(--teal); }
a:hover { color: var(--teal-dark); }

/* Tool card */
.tool {
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 1.6rem 1.6rem 1.7rem;
  margin: 1.75rem 0;
  box-shadow: 8px 8px 0 var(--teal);
}
.tool h2:first-child { margin-top: 0; }
.tool h2 { font-size: 1.4rem; margin: 1.6rem 0 0.8rem; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.1rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label, .group-label {
  font-size: 0.85rem;
  font-weight: 800;
}
.field .hint { font-size: 0.8rem; color: var(--faint); font-weight: 400; }
input, select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}
input:focus, select:focus {
  outline: 3px solid var(--mustard);
  outline-offset: 1px;
}

/* Pill radio groups */
.pill-group { margin-bottom: 1.1rem; }
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.pill { position: relative; cursor: pointer; }
.pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.pill span {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}
.pill input:checked + span { background: var(--ink); color: var(--bg); font-weight: 800; }
.pill input:focus-visible + span { outline: 3px solid var(--mustard); outline-offset: 1px; }

/* Results */
.results { margin-top: 1.4rem; }
.panel {
  background: var(--teal);
  color: var(--bg);
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.panel-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.big-result {
  font-weight: 800;
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0.2rem 0 0;
}
.panel-sub { margin: 0.4rem 0 0; opacity: 0.92; }
.panel-side {
  background: var(--bg);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  text-align: center;
  min-width: 140px;
}
.panel-side strong { display: block; font-weight: 800; font-size: 2.4rem; line-height: 1; }
.panel-side span { font-size: 0.85rem; font-weight: 600; }
.results table { margin-top: 1.1rem; }
.muted { color: var(--muted); }
.footnote { color: var(--faint); font-size: 0.88rem; margin-bottom: 0; }
.note {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.7rem;
  border-bottom: 2px solid var(--line);
  font-size: 0.95rem;
}
th { font-weight: 800; }
thead th { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.hit td, tr.hit th { background: #fff1cf; }
.table-wrap { overflow-x: auto; }

@media (max-width: 480px) {
  th, td { padding: 0.45rem 0.4rem; font-size: 0.9rem; }
}

/* Tool cards on the homepage */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem 1.6rem;
  margin: 2rem 0.5rem 2.2rem 0;
  padding: 0;
  list-style: none;
}
.tool-grid a {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 1.2rem 1.3rem;
  color: inherit;
  text-decoration: none;
  box-shadow: 6px 6px 0 var(--teal);
}
.tool-grid li:nth-child(3n + 2) a { box-shadow: 6px 6px 0 var(--coral); }
.tool-grid li:nth-child(3n) a { box-shadow: 6px 6px 0 var(--mustard); }
.tool-grid a:hover { transform: translate(-2px, -2px); }
.tool-grid h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.tool-grid p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Footer */
.site-footer {
  background: var(--ink);
  color: var(--footer-text);
  padding: 1.4rem 0 1.8rem;
  font-size: 0.9rem;
}
.site-footer nav { display: flex; gap: 1.25rem; margin-bottom: 0.5rem; }
.site-footer a { color: var(--bg); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }

@media (max-width: 600px) {
  h1 { font-size: 2.3rem; }
  .lede { font-size: 1.05rem; }
  .tool { padding: 1.1rem 1rem 1.2rem; border-radius: 18px; box-shadow: 5px 5px 0 var(--teal); }
  .big-result { font-size: 2.5rem; }
  .panel { padding: 1.1rem 1.2rem; }
  .panel-side { width: 100%; }
}
