/* FuelCount — static, no build step, system fonts only */
:root {
  --bg: #f3efe6;
  --bg-band: #e8e1d2;
  --paper: #fffdf8;
  --ink: #1b1915;
  --ink-soft: #5c574e;
  --line: #d9d1c2;
  --line-strong: #c7bda9;
  --forest: #1c6b48;
  --forest-dark: #134a32;
  --forest-soft: #e7f4ec;
  --terra: #c45c26;
  --terra-dark: #9a4318;
  --terra-soft: #fdece1;
  --gold: #e8c47a;
  --danger: #8a2f1a;
  --ad-bg: #f7f5f0;
  --shadow: 0 1px 2px rgba(27, 25, 21, 0.06), 0 12px 32px rgba(27, 25, 21, 0.06);
  --radius: 16px;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: "ui-monospace", "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 72rem;
  --measure: 46rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--forest-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 1rem; }

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

.wrap-narrow { width: min(100% - 2rem, var(--measure)); }

/* Header */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.03em;
  font-size: 1.25rem;
}
.logo span {
  color: var(--forest);
}
.logo-mark {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-block;
  vertical-align: -0.15rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.95rem;
}
.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Hero */
.hero {
  padding: 3.2rem 0 2.4rem;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 3.35rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  max-width: 18ch;
}
.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 42rem;
  margin: 0 0 1.5rem;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.hero-meta li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.hero-meta li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--forest);
  display: inline-block;
}

/* Tool cards */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.7rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
  margin: 0 0 3rem;
}

.tool-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem 1.3rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 11.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: inherit;
}
.tool-card .eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
  margin: 0 0 0.45rem;
}
.tool-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.tool-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  flex: 1;
}
.tool-card .go {
  margin-top: 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--forest-dark);
}

/* Page layout for tools */
.page-hero {
  padding: 2.1rem 0 0.4rem;
}
.page-hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.55rem;
}
.page-hero p {
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
  max-width: 42rem;
}

.crumb {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 0.8rem;
}
.crumb a { color: var(--ink-soft); text-decoration: none; }
.crumb a:hover { color: var(--ink); }

.tool-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin: 0 0 2.5rem;
  align-items: start;
}
@media (min-width: 840px) {
  .tool-layout {
    grid-template-columns: 1.05fr 0.95fr;
  }
  .results-card { position: sticky; top: 4.8rem; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}

.card h2, .prose h2 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
  font-size: 1.45rem;
  margin: 0 0 0.8rem;
}

.unit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}
.unit-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.unit-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.fields { display: grid; gap: 0.85rem; }

.field label, .field .label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.field input:user-invalid,
.field select:user-invalid {
  border-color: var(--danger);
}

.row-2, .row-3 {
  display: grid;
  gap: 0.7rem;
}
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) {
  .row-3 { grid-template-columns: 1fr 1fr; }
  .height-imperial { grid-column: 1 / -1; }
}

.hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0.3rem 0 0;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--forest);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 0.7rem 1.1rem;
  border-radius: 11px;
  cursor: pointer;
}
.btn:hover { background: var(--forest-dark); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.imperial-only, .metric-only { display: none; }
html[data-units="imperial"] .imperial-only { display: block; }
html[data-units="metric"] .metric-only { display: block; }
html[data-units="imperial"] .row-2.imperial-only,
html[data-units="metric"] .row-2.metric-only { display: grid; }
html[data-units="imperial"] .female-only-row { }
body[data-sex="male"] .female-only { display: none !important; }

/* Results */
.results-card {
  background: var(--ink);
  color: #f6f1e8;
  border: 0;
}
.results-card h2 { color: #fff; }
.results-card .muted { color: #c9c0b0; }

.big-number {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0.15rem 0 0.2rem;
}
.big-number span {
  font-size: 0.38em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--gold);
  margin-left: 0.2rem;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 1.1rem;
}
.result-cell {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}
.result-cell .k {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c9c0b0;
  margin: 0 0 0.15rem;
}
.result-cell .v {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  display: flex;
  margin: 0.85rem 0 0.35rem;
}
.bar i { display: block; height: 100%; }
.bar .p { background: #7dcea0; }
.bar .c { background: #e8c47a; }
.bar .f { background: #e07a4a; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  font-size: 0.82rem;
  color: #c9c0b0;
}
.legend b { color: #fff; font-weight: 650; }
.swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -0.05rem;
}

.placeholder-msg { color: #c9c0b0; margin: 0; }
.error {
  color: #ffb4a2;
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.results-card th, .results-card td {
  border-bottom-color: rgba(255,255,255,0.1);
}
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.results-card th { color: #c9c0b0; }

/* Prose / FAQ */
.prose {
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto 3rem;
}
.prose h2, .prose h3 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.prose h2 { font-size: 1.55rem; margin: 2rem 0 0.7rem; }
.prose h3 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.2rem; }
.prose li { margin: 0 0 0.35rem; }
.prose .note {
  background: var(--forest-soft);
  border-left: 4px solid var(--forest);
  padding: 0.85rem 1rem;
  border-radius: 0 12px 12px 0;
}

.related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0 0;
}
.related a {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}
.related a:hover { border-color: var(--forest); color: var(--forest-dark); }

/* Ads / affiliates */
.ad-slot, .aff-slot {
  border: 1px dashed var(--line-strong);
  background: var(--ad-bg);
  border-radius: 12px;
  padding: 1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-align: center;
  margin: 1rem 0;
}
.ad-slot strong, .aff-slot strong { display: block; color: var(--ink); margin-bottom: 0.2rem; }
.aff-slot { text-align: left; }
.aff-slot p { margin: 0.35rem 0 0; }

.disclaimer {
  font-size: 0.88rem;
  color: var(--ink-soft);
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto 2.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--ink);
  color: #d7d0c4;
  padding: 2.2rem 0 2.4rem;
  font-size: 0.92rem;
}
.site-footer a { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
}
.site-footer h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a9a196;
  margin: 0 0 0.5rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 0.3rem; }
.fineprint {
  margin: 1.6rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: #a9a196;
  font-size: 0.82rem;
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.about-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 0 0 2rem;
}
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
}

.group-label {
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
  margin: 1.4rem 0 0.7rem;
}
.group-label:first-child { margin-top: 0; }
