/* Fuel & Plate — base styles */
:root {
  --ink: #1c3a30;
  --ink-soft: #3f5c51;
  --paper: #ffffff;
  --mist: #e4ece6;
  --line: #c9d6cd;
  --saffron: #efb234;
  --label-ink: #111a16;
  --danger: #9b2c2c;
  --sans: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --wrap: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #dfeee5; --ink-soft: #a9c2b5; --paper: #10201a; --mist: #1a2f26;
    --line: #2f4a3e; --label-ink: #111a16; --danger: #f2a3a3;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.5;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.01em; }
.brand span { font-weight: 400; }
.site-nav { display: flex; gap: 20px; font-size: 15px; }
.site-nav a { text-decoration: none; }
.site-nav a[aria-current="page"] { text-decoration: underline; }
.site-foot { margin-top: 80px; border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 14px; color: var(--ink-soft); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.site-foot p { max-width: 70ch; margin: 8px 0; }

/* Type */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; }
h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 800; margin: 48px 0 12px; }
h2 { font-size: 28px; font-weight: 700; margin: 56px 0 12px; }
h3 { font-size: 20px; font-weight: 700; margin: 32px 0 8px; }
.lede { font-size: 20px; color: var(--ink-soft); max-width: 60ch; margin: 0 0 32px; }
.prose { font-family: var(--serif); font-size: 18px; line-height: 1.65; max-width: 68ch; }
.prose h2, .prose h3 { font-family: var(--sans); }
.prose li { margin: 6px 0; }
.prose .refs { font-size: 15px; line-height: 1.5; }
.meta { font-size: 14px; color: var(--ink-soft); margin: 0 0 24px; }

/* Calculator layout */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 48px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; gap: 32px; } }
.form fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.form legend, .form label.lab { display: block; padding: 0; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.hint { font-size: 14px; color: var(--ink-soft); font-weight: 400; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 15px; }
.seg input:checked + label { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + label { outline: 3px solid var(--saffron); outline-offset: -3px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 6px; background: var(--paper); }
.field:focus-within { border-color: var(--ink); }
.field input, .form select { font: inherit; color: var(--ink); background: transparent; border: 0; padding: 10px 12px; width: 7.5em; }
.field input:focus, .form select:focus { outline: none; }
.field span { padding-right: 12px; color: var(--ink-soft); font-size: 15px; }
.form select { width: 100%; max-width: 520px; border: 2px solid var(--line); border-radius: 6px; background: var(--paper); }
.form select:focus { border-color: var(--ink); }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 4px 0 0; }
.btn { font: inherit; font-weight: 700; background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 12px 22px; cursor: pointer; }
.btn:hover { filter: brightness(1.15); }
details.more { margin: 0 0 22px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 15px; }

/* The label: modeled on the U.S. Nutrition Facts panel */
.label {
  background: #fff; color: var(--label-ink); border: 2px solid var(--label-ink);
  padding: 8px 10px 12px; font-family: var(--sans); position: sticky; top: 16px;
}
.label h2 { font-size: 40px; font-weight: 900; margin: 0; letter-spacing: -0.02em; line-height: 1; }
.label .sub { font-size: 15px; margin: 4px 0 0; border-bottom: 10px solid var(--label-ink); padding-bottom: 6px; }
.label .big { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 5px solid var(--label-ink); padding: 6px 0; }
.label .big b { font-size: 17px; font-weight: 900; }
.label .big output { font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.label .ln { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--label-ink); padding: 5px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.label .ln.indent { padding-left: 14px; }
.label .ln.pick { background: var(--saffron); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
.label .ln.indent.pick { padding-left: 24px; }
.label .ln output { font-weight: 800; }
.label .thick { border-bottom: 10px solid var(--label-ink); }
.label .foot { font-size: 12.5px; line-height: 1.35; margin: 8px 0 0; }
.label[data-empty="true"] output { color: #8a948f; }

/* Meal split block */
.split { background: var(--mist); border-radius: 8px; padding: 20px 22px; margin-top: 32px; max-width: 720px; }
.split h3 { margin-top: 0; }
.split table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.split td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.split td:last-child { text-align: right; font-weight: 700; }
.split .note { font-size: 14px; color: var(--ink-soft); margin: 12px 0 0; }

/* Home */
.hero { padding: 24px 0 8px; }
.hero h1 { max-width: 16ch; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0; border-top: 2px solid var(--ink); margin-top: 24px; }
.tool { padding: 20px 20px 24px 0; border-bottom: 1px solid var(--line); text-decoration: none; display: block; }
.tool h3 { margin: 0 0 6px; text-decoration: underline; text-underline-offset: 4px; }
.tool p { margin: 0; color: var(--ink-soft); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; max-width: 68ch; }
.faq summary { cursor: pointer; font-weight: 700; font-family: var(--sans); }
.faq details p { margin: 10px 0 0; }

.callout { border-left: 4px solid var(--saffron); padding: 4px 0 4px 16px; margin: 24px 0; max-width: 68ch; font-size: 15px; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
