:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 100%;
  --paper: #f3f7f6;
  --surface: #fff;
  --ink: #142b2a;
  --muted: #45615e;
  --teal: #0f766e;
  --teal-deep: #08564f;
  --accent: #0d9488;
  --tint: #e8f5f2;
  --line: #cbded9;
  --control-line: #657f7a;
  --focus: #174d86;
  --danger: #9d2a24;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }

a { color: var(--teal-deep); text-underline-offset: 0.2em; }
a:hover { color: var(--teal); }

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

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: absolute;
  z-index: 1;
  inset: 0.5rem auto auto 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
}

.shell {
  width: min(calc(100% - 3rem), 66rem);
  margin-inline: auto;
}

.site-header, .site-footer { background: var(--surface); }
.site-header { border-block-end: 1px solid var(--line); }

.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.75rem;
}

.header-inner { min-height: 4.5rem; padding-block: 0.65rem; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.wordmark img { display: block; flex-shrink: 0; }

.site-nav, .footer-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; }

.site-nav a, .footer-nav a, .tool-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 650;
}

.site-nav a { border-radius: 0.5rem; text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--teal-deep); background: var(--tint); }
.site-nav a:hover { text-decoration: underline; }

.guide-nav { position: relative; }
.guide-nav summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--control-line);
  border-radius: 0.5rem;
  color: var(--teal-deep);
  font-size: 0.875rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.guide-nav summary::-webkit-details-marker { display: none; }
.guide-nav summary::after {
  width: 0.4rem;
  height: 0.4rem;
  margin-block-start: -0.15rem;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  content: "";
}
.guide-nav[open] summary { background: var(--tint); }
.guide-nav:not([open]) .guide-links { display: none; }
.guide-links {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 0.4rem) 0 auto auto;
  display: grid;
  gap: 0.25rem;
  width: min(15rem, calc(100vw - 2rem));
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  box-shadow: 0 0.4rem 1rem #163e3520;
}
.site-nav .guide-links a { justify-content: flex-start; padding-inline: 0.6rem; text-align: start; }

main { padding-block: clamp(1.6rem, 4vw, 3.5rem) 4rem; }
.page-intro { margin-block-end: 1.5rem; }

h1, h2, h3 { margin: 0; font-weight: 750; line-height: 1.15; letter-spacing: -0.035em; }

h1 { font-size: clamp(2rem, 4.7vw, 3.5rem); line-height: 1.1; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: 1.125rem; }
p { margin: 0; }
.page-intro p { max-width: 60ch; margin-block-start: 0.55rem; color: var(--muted); }

.tool {
  padding: clamp(0.9rem, 2.4vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-block-start: 4px solid var(--teal);
  border-radius: 1rem;
  box-shadow: 0 0.65rem 1.8rem #163e3510;
}

.fallback { display: grid; gap: 0.5rem; max-width: 60ch; }

/* Reserve the measured empty-tool footprint only while the manual fallback is
   shown. The loaded tools retain their natural height. */
@media (scripting: enabled) {
  [data-converter]:has(> [data-fallback]:not([hidden])) { min-block-size: var(--converter-space); }
  .food-tool-slot:has(> [data-fallback]:not([hidden])) { min-block-size: var(--food-tool-space); }

  [data-converter="forward"] { --converter-space: 28.5rem; }
  [data-converter="reverse"] { --converter-space: 26.25rem; }
  .food-tool-slot { --food-tool-space: 46.5rem; }

  @media (max-width: 60rem) {
    [data-converter="forward"] { --converter-space: 32rem; }
    [data-converter="reverse"] { --converter-space: 27.5rem; }
    .food-tool-slot { --food-tool-space: 42.5rem; }
  }

  @media (max-width: 43rem) {
    [data-converter="forward"] { --converter-space: 39.25rem; }
    [data-converter="reverse"] { --converter-space: 35.5rem; }
    .food-tool-slot { --food-tool-space: 49rem; }
  }

  @media (max-width: 25rem) {
    [data-converter="forward"] { --converter-space: 40.5rem; }
    [data-converter="reverse"] { --converter-space: 36.75rem; }
  }

  @media (max-width: 22rem) {
    .food-tool-slot { --food-tool-space: 51.5rem; }
  }
}

.tool-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 1.1rem;
}

.mode-switch {
  display: flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--control-line);
  border-radius: 0.7rem;
  background: var(--paper);
}

.mode-switch button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 750;
}

.mode-switch button[aria-pressed="true"] { background: var(--teal); color: #fff; }
.mode-switch button[aria-pressed="false"]:hover { background: var(--tint); color: var(--ink); }

.precision-control { display: flex; align-items: center; gap: 0.55rem; }
.precision-control label { font-size: 0.875rem; }

label, legend { display: block; font-weight: 700; }

select {
  appearance: none;
  min-height: 44px;
  max-width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1px solid var(--control-line);
  border-radius: 0.5rem;
  background:
    linear-gradient(45deg, transparent 49%, var(--muted) 50%) calc(100% - 15px) center / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 49%, transparent 50%) calc(100% - 9px) center / 6px 6px no-repeat,
    var(--surface);
  color: var(--ink);
}

.tool-link { padding-inline: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  grid-template-areas: "input result" "presets result";
  grid-template-rows: auto 1fr;
  gap: 0.8rem clamp(1.25rem, 3vw, 2.3rem);
}

.input-pane { grid-area: input; min-width: 0; padding-block: 0.25rem; }

.direction-control { min-width: 0; margin: 0 0 0.9rem; padding: 0; border: 0; }
.direction-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem;
  padding: 0.15rem;
  border: 1px solid var(--control-line);
  border-radius: 0.65rem;
}
.direction-options label {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0.35rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.2;
  text-align: center;
}
.direction-options label:hover { background: var(--paper); }
.direction-options input:checked + label {
  border-color: var(--teal);
  background: var(--tint);
  color: var(--teal-deep);
}
.direction-options input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }

input[type="text"], textarea {
  width: 100%;
  min-height: 44px;
  margin-block-start: 0.25rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--control-line);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="text"] {
  min-height: 3.55rem;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
}

textarea { display: block; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.unit-input { position: relative; }
.unit-input input { padding-inline-end: 4.1rem; }
.unit-input span {
  position: absolute;
  inset: 50% 0.75rem auto auto;
  transform: translateY(-50%);
  color: var(--teal-deep);
  font-size: 0.875rem;
  font-weight: 750;
  pointer-events: none;
}
[aria-invalid="true"] { border: 2px solid var(--danger); }

.hint, .input-message { margin-block-start: 0.35rem; font-size: 0.875rem; color: var(--muted); }
.input-message.is-error { font-weight: 650; color: var(--danger); }

.preset-group { grid-area: presets; align-self: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.preset-group legend { margin-block-end: 0.4rem; font-size: 0.875rem; }
.preset-group legend span { color: var(--muted); font-weight: 550; }
.presets { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.presets button, .button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--control-line);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--teal-deep);
  font-size: 0.875rem;
  font-weight: 700;
}

.presets button:hover, .button:not(:disabled):hover { background: var(--tint); }

.result-pane {
  grid-area: result;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 15.5rem;
  padding: clamp(1rem, 2.4vw, 1.5rem);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0.8rem;
  background: var(--tint);
}

.result-top { margin-block-end: 1.25rem; }
.result-label { font-size: 0.875rem; color: var(--teal-deep); font-weight: 750; }
.result-number { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; margin-block: 0.25rem; }
.result-value {
  min-width: 0;
  font-size: clamp(1.8rem, 4.4vw, 2.8rem);
  line-height: 1.1;
  font-weight: 780;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.result-unit { color: var(--teal-deep); font-weight: 750; }
.result-hint, .feedback { color: var(--muted); font-size: 0.875rem; }
.feedback { min-height: 1.4em; margin-block-start: 0.35rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-start: auto; }
.button { padding-inline: 0.9rem; }
.button-primary { color: #fff; border-color: var(--teal); background: var(--teal); }
.button-primary:not(:disabled):hover { color: #fff; background: var(--teal-deep); }
.button:disabled { border-color: var(--line); background: #f1f7f5; color: var(--muted); }

.copy-fallback { margin-block-start: 0.55rem; }
.copy-fallback label { font-size: 0.875rem; }

.formula {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.85rem;
  margin-block-start: 1rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
  background: var(--paper);
  font-size: 0.875rem;
}

.formula-label { color: var(--muted); font-weight: 700; }
.formula [data-formula], .formula [data-worked-formula] {
  min-width: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.reading { max-width: 46rem; margin-block-start: clamp(2rem, 4vw, 3rem); }
.reading p, .reading h3 { margin-block-start: 0.75rem; }
.editorial { max-width: 46rem; overflow-wrap: anywhere; }
.editorial section { margin-block-start: clamp(1.75rem, 4vw, 2.75rem); }
.editorial section p, .editorial h3, .editorial table { margin-block-start: 0.75rem; }
.editorial thead th:first-child { overflow-wrap: normal; }
.editorial li + li, .source-links li + li { margin-block-start: 0.35rem; }
.editorial ul, .source-links ul { padding-inline-start: 1.4rem; }
.math-line {
  padding: 0.55rem 0.8rem;
  border-inline-start: 3px solid var(--teal);
  border-radius: 0.3rem;
  background: var(--tint);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.source-links a { overflow-wrap: anywhere; }

.examples { display: grid; gap: 0.5rem; margin: 0.65rem 0 0; padding: 0; list-style: none; }
.examples li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.15rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
}

.chart { margin-block-start: 0.75rem; }
.batch-results { margin-block-start: 1rem; }
.batch-results table { table-layout: fixed; }
.batch-line { width: 17%; }
table { width: 100%; border-spacing: 0; border: 1px solid var(--line); border-radius: 0.65rem; background: var(--surface); }
caption { margin-block-end: 0.35rem; color: var(--muted); text-align: start; font-size: 0.875rem; }
th, td { padding: 0.55rem 0.8rem; text-align: start; overflow-wrap: anywhere; }
thead th { color: var(--teal-deep); background: var(--tint); }
thead th:first-child { border-start-start-radius: 0.6rem; }
thead th:last-child { border-start-end-radius: 0.6rem; }
tbody tr + tr > * { border-block-start: 1px solid var(--line); }
tbody tr:nth-child(even) { background: var(--paper); }
td { font-variant-numeric: tabular-nums; }
.batch-results tfoot { color: var(--teal-deep); background: var(--tint); font-weight: 750; }
.batch-results tfoot > tr > * { border-block-start: 1px solid var(--line); }
.batch-results tfoot th { border-end-start-radius: 0.6rem; }
.batch-results tfoot td { border-end-end-radius: 0.6rem; }

.food-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.35rem;
  margin-block-start: 1rem;
}
.food-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.food-fields label { font-size: 0.875rem; }
.food-fields select { width: 100%; margin-block-start: 0.25rem; font-size: 0.875rem; }
.food-fields input[type="text"] { min-height: 44px; font-size: 1.1rem; }
.food-actions { margin-block-start: 0.85rem; }
.food-current { grid-area: auto; min-height: 0; }
.food-current .food-actions { margin-block-start: 0.75rem; }
.food-numbers { display: grid; gap: 0.55rem; margin: 0.65rem 0; }
.food-numbers dt { color: var(--muted); font-size: 0.875rem; font-weight: 700; }
.food-numbers dd {
  margin: 0;
  font-size: clamp(1rem, 2.25vw, 1.4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.food-summary { margin-block-start: 1rem; }
.food-summary .food-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block-end: 0.85rem; }
.food-list-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.65rem; }
.food-total, .food-list li {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
}
.food-total { margin-block: 0.75rem; background: var(--tint); }
.food-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.food-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.55rem; }
.food-list li[aria-current="true"] { border-color: var(--teal-deep); }
.food-list p { overflow-wrap: anywhere; }
.food-list .actions { margin: 0; }
.food-list-energy { font-weight: 750; font-variant-numeric: tabular-nums; }
.food-feedback { font-size: 0.875rem; color: var(--teal-deep); }
.food-feedback:not(:empty) { margin-block-start: 0.55rem; }

.site-footer { border-block-start: 1px solid var(--line); }
.footer-inner { padding-block: 1rem; flex-wrap: wrap; }
.footer-nav a { padding-inline: 0.35rem; }

@media (max-width: 43rem) {
  .shell { width: min(calc(100% - 2rem), 66rem); }
  .header-inner { flex-wrap: wrap; }
  .tool-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "input" "result" "presets"; grid-template-rows: auto; gap: 0.7rem; }
  .result-pane { min-height: 0; padding: 0.8rem; }
  .result-top { margin-block-end: 0.55rem; }
  .feedback:empty, .result-hint:empty { display: none; }
  .food-entry-grid { grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
  .food-current .food-numbers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .food-numbers dt { min-height: 2.6em; line-height: 1.3; }
}

@media (max-width: 28rem) {
  .header-inner { gap: 0.15rem 0.8rem; padding-block: 0.4rem 0.5rem; }
  .site-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 0.125rem; }
  .site-nav a { justify-content: center; padding-inline: 0.25rem; line-height: 1.2; text-align: center; }
  .guide-nav summary { padding-inline: 0.4rem; }
  main { padding-block-start: 1rem; }
  .page-intro { margin-block-end: 0.75rem; }
  .page-intro p { margin-block-start: 0.35rem; }
  .tool { padding: 0.75rem; }
  .tool-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: end;
    margin-block-end: 0.6rem;
  }
  .mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-switch button { padding-inline: 0.25rem; line-height: 1.15; }
  .precision-control { display: grid; justify-items: center; gap: 0.15rem; }
  .precision-control label { line-height: 1.2; }
  .direction-control { margin-block-end: 0.5rem; }
  .input-pane { padding-block: 0; }
  .unit-input input { min-height: 3rem; font-size: 1.45rem; }
  .hint, .input-message { margin-block-start: 0.25rem; line-height: 1.4; }
  .formula { margin-block-start: 0.7rem; }
  .batch-results th, .batch-results td { padding-inline: 0.45rem; font-size: 0.875rem; }
  .food-fields { gap: 0.55rem; }
  .food-fields select { padding-inline: 0.35rem 1.5rem; }
  .food-total, .food-list li { padding-inline: 0.75rem; }
}


/* V1.1 header refresh; calculators and footer unchanged. */
.site-header { background:#fff; border-bottom:1px solid #dce9e6; box-shadow:0 2px 12px #142b2a08; position:relative; z-index:5; }
.site-header .header-inner { width:min(calc(100% - 48px), 76rem); min-height:80px; padding:12px 0; flex-wrap:nowrap; gap:24px; }
.site-header .header-brand { flex:none; gap:11px; min-width:0; }
.site-header .header-brand img { width:42px; height:42px; }
.brand-name { display:block; font-size:19px; line-height:1.15; letter-spacing:-.045em; font-weight:800; }
.brand-accent { color:#0f766e; }
.brand-caption { display:block; color:#526d68; font-size:9px; font-weight:700; letter-spacing:.12em; margin-top:5px; }
.site-header .desktop-nav { display:flex; flex-wrap:nowrap; gap:5px; }
.site-header .desktop-nav > a, .site-header .guide-nav summary { font-size:14px; font-weight:650; padding:10px 14px; border-radius:8px; white-space:nowrap; color:#294640; }
.site-header .desktop-nav > a:hover, .site-header .guide-nav summary:hover { background:#f0f7f5; text-decoration:none; color:#08564f; }
.site-header .desktop-nav > a[aria-current="page"] { background:#e0f2ed; color:#08564f; box-shadow:inset 0 -2px #0f766e; }
.site-header .guide-nav summary { border:1px solid transparent; }
.site-header .guide-nav[open] summary { border-color:#cbded9; background:#f0f7f5; }
.site-header .guide-links { width:240px; padding:8px; border-radius:12px; box-shadow:0 12px 30px #142b2a20; }
.site-header .guide-links a { padding:10px 12px; }
.site-header .mobile-menu { display:none; }
.skip-link:focus { z-index:20; }
@media (max-width: 59rem) {
  .site-header .header-inner { width:calc(100% - 32px); min-height:66px; padding:10px 0; gap:8px; flex-wrap:wrap; position:relative; }
  .site-header .header-brand { gap:8px; flex:1 1 0; }
  .site-header .header-brand img { width:36px; height:36px; }
  .brand-name { font-size:clamp(15px,3.9vw,19px); }
  .brand-caption { font-size:8px; letter-spacing:.08em; margin-top:4px; }
  .site-header .desktop-nav { display:none; }
  .site-header .mobile-menu { display:block; flex:0 0 auto; }
  .mobile-menu summary { display:flex; align-items:center; justify-content:center; gap:7px; min-height:44px; min-width:44px; padding:8px 10px; border:1px solid #cbded9; background:#fff; border-radius:9px; color:#08564f; cursor:pointer; font-size:13px; font-weight:750; list-style:none; }
  .mobile-menu summary::-webkit-details-marker { display:none; }
  .menu-icon { display:block; width:17px; height:12px; border-block:2px solid currentColor; position:relative; }
  .menu-icon::after { content:""; position:absolute; top:3px; left:0; width:100%; border-top:2px solid currentColor; }
  .close-label,.mobile-menu[open] .menu-label { display:none; }
  .mobile-menu[open] .close-label { display:inline; }
  .mobile-menu[open] .menu-icon { border:0; height:17px; }
  .mobile-menu[open] .menu-icon::before,.mobile-menu[open] .menu-icon::after { content:""; position:absolute; top:8px; left:0; width:100%; border-top:2px solid currentColor; transform:rotate(45deg); }
  .mobile-menu[open] .menu-icon::after { transform:rotate(-45deg); }
  .mobile-menu:not([open]) .mobile-links { display:none; }
  .mobile-links { position:absolute; top:100%; left:0; right:0; display:grid; gap:4px; border:1px solid #dce9e6; background:#fff; padding:10px; border-radius:0 0 12px 12px; box-shadow:0 12px 24px #142b2a20; }
  .mobile-group-label { font-size:10px; text-transform:uppercase; font-weight:750; letter-spacing:.11em; color:#526d68; padding:9px 10px 3px; }
  .mobile-links a { display:flex; align-items:center; min-height:44px; padding:9px 12px; font-size:15px; font-weight:650; border-radius:8px; color:#294640; text-decoration:none; }
  .mobile-links a:hover,.mobile-links a[aria-current="page"] { background:#e0f2ed; color:#08564f; }
}
@media (max-width: 23rem) { .mobile-menu .menu-label,.mobile-menu .close-label { position:absolute; width:1px;height:1px;overflow:hidden;clip-path:inset(50%); } }

/* V1.2: responsive footer. Existing header and calculator styles preserved. */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
.footer-v12 { background: #142e2b; color: #e2eeeb; border-top: 3px solid #0d9488; margin-top: auto; }
.footer-wrap { width: min(calc(100% - 3rem), 76rem); margin-inline: auto; }
.footer-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr) minmax(0,1fr) minmax(0,.8fr); gap: 2rem; padding-block: 3rem 2.5rem; }
.footer-v12 .footer-logo { color: #fff; font-size: 1.1rem; line-height: 1.35; margin-bottom: .8rem; }
.footer-brand p { color: #c8dcd7; font-size: .9375rem; line-height: 1.7; max-width: 32ch; margin: 0 0 .8rem; }
.footer-note { color: #9fdbd1; font-size: .8125rem; font-weight: 650; }
.footer-group { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.footer-group h2 { color: #fff; font-size: 1rem; line-height: 1.4; margin: .3rem 0 .8rem; letter-spacing: normal; }
.footer-group a, .footer-bottom a { color: #d1e3df; text-decoration: none; font-size: .9rem; line-height: 1.5; display: inline-flex; align-items: center; min-height: 44px; }
.footer-v12 a:hover { color: #fff; text-decoration: underline; }
.footer-v12 a:focus-visible { outline-color: #9fdbd1; }
.footer-bottom { border-top: 1px solid #42635e; display: flex; justify-content: space-between; align-items: center; gap: .75rem 1.5rem; padding-block: .8rem; }
.footer-bottom p { color: #c8dcd7; font-size: .8125rem; margin: 0; }
.footer-bottom a { gap: .5rem; }
@media (max-width: 950px) { .footer-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.75rem; } }
@media (max-width: 540px) { .footer-wrap { width: calc(100% - 2rem); } .footer-grid { grid-template-columns: 1fr; padding-block: 2rem 1.5rem; gap: 1.25rem; } .footer-group { border-top: 1px solid #42635e; padding-top: 1rem; } .footer-group h2 { margin-bottom: .25rem; } .footer-bottom { flex-wrap: wrap; } }

/* V1.3: editorial layout and reading typography. Tool controls unchanged. */
body { background: #fff; }
main > .reading, main > .editorial {
  width: 100%; max-width: 51rem; margin-inline: auto; min-width: 0;
  font-size: 1.0625rem; line-height: 1.75;
}
main > .reading { margin-block-start: clamp(2rem, 4.5vw, 3.5rem); }
main > .editorial section { margin-block-start: clamp(1.75rem, 4vw, 2.75rem); }
.reading h2, .editorial h2 { font-size: clamp(1.4rem, 2.4vw, 1.875rem); line-height: 1.25; letter-spacing: -.025em; }
.reading h3, .editorial h3 { font-size: 1.125rem; line-height: 1.4; letter-spacing: -.01em; margin-block-start: 1.25rem; }
.reading p, .editorial section p { margin-block-start: .85rem; }
.editorial .page-intro p { max-width: none; }
.editorial .page-intro h1 { font-size: clamp(2rem, 4vw, 3rem); }
.reading table, .editorial table { overflow: hidden; border-radius: .65rem; font-size: .975rem; }
.reading th, .reading td, .editorial th, .editorial td { padding: .75rem 1rem; }
.reading tbody tr:nth-child(even), .editorial tbody tr:nth-child(even) { background: #f5f8f7; }
.reading tbody tr:last-child > :first-child, .editorial tbody tr:last-child > :first-child { border-end-start-radius: .6rem; }
.reading tbody tr:last-child > :last-child, .editorial tbody tr:last-child > :last-child { border-end-end-radius: .6rem; }
.reading .math-line, .editorial .math-line { padding: .85rem 1rem; border-radius: .4rem; }
.reading .examples li, .editorial .examples li { padding: .85rem 1rem; background: #f8fbfa; }
.reading.source-links { padding-block-start: 1.25rem; border-block-start: 1px solid var(--line); }
@media (max-width: 43rem) {
  main > .reading, main > .editorial { font-size: 1rem; line-height: 1.7; }
  .reading th, .reading td, .editorial th, .editorial td { padding: .65rem .65rem; }
}

/* V1.4: editorial components */
.conversion-rule{border:1px solid #b5d9d3;border-left:4px solid #0f766e;border-radius:10px;background:#edf8f6;padding:20px;margin:20px 0;display:grid;gap:8px}.conversion-rule>span{font-size:.85rem;color:#315e59;font-weight:700}.conversion-rule>strong{font-size:clamp(1.05rem,2.5vw,1.4rem);overflow-wrap:anywhere}.conversion-rule p{margin:0;color:#315e59}.conversion-steps{padding-left:1.5em}.conversion-steps li{padding-left:.25em;margin:.55em 0}.faq-item{border:1px solid #cbdedb;border-radius:10px;margin:10px 0;background:#fff;overflow:hidden}.faq-item summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 18px;font-weight:700;cursor:pointer;list-style:none;min-height:48px}.faq-item summary::-webkit-details-marker{display:none}.faq-item summary::after{content:"+";color:#0f766e;font-size:1.4rem;line-height:1;flex:none}.faq-item[open] summary::after{content:"−"}.faq-item[open] summary{background:#edf8f6}.faq-answer{padding:14px 18px 18px}.faq-answer p{margin:0}.faq-item summary:focus-visible{outline:2px solid #0f766e;outline-offset:-3px}.related-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.related-card{position:relative;display:flex;flex-direction:column;gap:8px;padding:18px 38px 18px 18px;border:1px solid #cbdedb;border-radius:10px;background:#f8fbfa;text-decoration:none;color:inherit}.related-card strong{color:#0f665f}.related-card span{font-size:.92rem}.related-card:hover{border-color:#0f766e;background:#edf8f6}.related-arrow{position:absolute;right:16px;top:18px;color:#0f766e}@media(max-width:520px){.related-grid{grid-template-columns:1fr}.faq-item summary{padding:13px 14px}.faq-answer{padding:12px 14px 15px}}


/* V2.0: shared editorial rhythm, including related cards and FAQs. */
.reading h2 + .related-grid, .editorial h2 + .related-grid { margin-block-start: 20px; }
.related-grid { gap: 16px; }
.related-card { padding: 20px 40px 20px 20px; }
.reading h2 + .faq-item, .editorial h2 + .faq-item { margin-block-start: 20px; }
.reading h2 + .chart, .editorial h2 + .chart,
.reading h2 + table, .editorial h2 + table,
.reading h2 + .formula-box, .editorial h2 + .formula-box,
.reading h2 + .math-line, .editorial h2 + .math-line,
.reading h3 + .examples, .editorial h3 + .examples { margin-block-start: 16px; }
.reading .formula-box, .editorial .formula-box { background: #edf8f6; border: 1px solid #b5d9d3; border-inline-start: 4px solid #0f766e; border-radius: 10px; padding: 20px; margin-block: 16px; overflow-wrap: anywhere; }
.reading .formula-box > :first-child, .editorial .formula-box > :first-child { margin-block-start: 0; }
.reading .formula-box > :last-child, .editorial .formula-box > :last-child { margin-block-end: 0; }
@media(max-width:520px) {
  .reading h2 + .related-grid, .editorial h2 + .related-grid,
  .reading h2 + .faq-item, .editorial h2 + .faq-item { margin-block-start: 16px; }
  .related-grid { gap: 12px; }
  .related-card { padding: 16px 36px 16px 16px; }
  .reading .formula-box, .editorial .formula-box { padding: 16px; }
}
