/* The free calculators' form controls (protein, sleep, calories, heart-rate zones, water, one-rep max), linked only by
   those pages (tools/calc_pages.py), so css/site.css stays as it is. Signal's look, from site.css's own tokens: the
   calculator is a .tile; fields are the app's grey wells (--tile2) with Rounded numbers; the units and choices are a
   segmented control whose picked option is a lifted card (--surf), as iOS draws one; results sit in a hued well. Every
   control is at least 44 px tall (tools/audit.mjs), radios and checkboxes are real inputs laid over their labels, and
   the results keep their size whatever they show, so nothing jumps while typing. */

.calc { display: grid; gap: 22px; padding: 22px 18px; }
@media (min-width: 900px) { .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; padding: 36px 40px; align-items: start; } }
.calc__form { display: grid; gap: 18px; min-width: 0; }
.calc fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.calc legend, .field > label, .field__label { display: block; padding: 0; margin-bottom: 8px; font: 600 15px/1.3 var(--sans); color: var(--ink); }
.field__hint { display: block; margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--ink2); }
.field__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* A number in a well, its unit inside on the right. */
.box { position: relative; display: block; }
.box input, .box select, .calc input[type="time"] { width: 100%; min-height: 50px; padding: 0 16px; border: 1px solid var(--hair); border-radius: 14px; background: var(--tile2); color: var(--ink);
  font: 600 18px/1.2 var(--num); letter-spacing: -.01em; font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none; }
.box input { padding-right: 52px; -moz-appearance: textfield; }
.box input::-webkit-outer-spin-button, .box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.box input::placeholder { color: var(--ink2); font-weight: 500; opacity: 1; }
.box__u { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font: 600 15px/1 var(--round); color: var(--ink2); pointer-events: none; }
.box select { font: 500 16px/1.2 var(--sans); padding-right: 44px; cursor: pointer; }
.box--select::after { content: ""; position: absolute; right: 19px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--ink2); border-bottom: 2px solid var(--ink2); transform: rotate(45deg); pointer-events: none; }
.box input:focus-visible, .box select:focus-visible, .calc input[type="time"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 14px; }
.box input[aria-invalid="true"] { border-color: var(--alert); }
.calc input[type="time"] { max-width: 220px; }

/* The segmented control (units, goal, sex, effort): one row of options; the picked one is a lifted card. */
.seg__opts { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--tile2); box-shadow: inset 0 0 0 1px var(--hair); }
.seg__o { position: relative; flex: 1 1 0; min-width: 0; }
.seg__o input, .check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.seg__o span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 4px 8px; border-radius: 12px; text-align: center;
  font: 600 15px/1.2 var(--sans); color: var(--ink2); }
.seg__o input:checked + span { background: var(--cardBg); color: var(--ink); box-shadow: var(--surf); }
.seg__o:has(input:focus-visible) span, .check:has(input:focus-visible) span { outline: 2px solid var(--ink); outline-offset: 1px; }
.seg--units { justify-self: start; width: min(100%, 300px); }

/* A checkbox on its own line. */
.check { position: relative; display: block; }
.check span { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; color: var(--ink2); line-height: 1.35; }
.check span::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--tile2); box-shadow: inset 0 0 0 1.5px var(--ink3); }
.check input:checked + span::before { background: var(--ink); box-shadow: none; }
.check input:checked + span::after { content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 11px; margin-top: -8px; border-right: 2.5px solid var(--tile); border-bottom: 2.5px solid var(--tile); transform: rotate(45deg); }

/* Results: a hued well that keeps its size. */
.calc__out { display: grid; gap: 14px; align-content: start; padding: 22px 20px; border-radius: 22px; background: var(--w, var(--tile2)); min-width: 0; --ink2: var(--ink2t); }
.calc__out .eyebrow { margin: 0; }
.calc__big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; font-size: clamp(64px, 9vw, 92px); color: var(--ink); }
.calc__big small { margin-left: 0; font-size: 18px; color: var(--ink2); }
.calc__msg { color: var(--ink2); font-size: 15px; line-height: 1.45; min-height: 4.4em; }
.calc__list { display: grid; margin: 0; }
.calc__list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.calc__list > div[hidden] { display: none; }
.calc__list dt { color: var(--ink2); font-size: 15px; }
.calc__list dd { font: 700 19px/1.2 var(--num); font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; white-space: nowrap; }
.calc__trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.calc__trio > div { padding: 12px 10px; border-radius: 16px; background: var(--cardBg); box-shadow: var(--surf); text-align: center; min-width: 0; }
.calc__trio b { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); }
.calc__trio .num { display: block; margin-top: 6px; font-size: clamp(22px, 2.6vw, 28px); color: var(--ink); }
.calc__trio small { display: block; margin-top: 4px; font-size: 12px; color: var(--ink2); }
.calc table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.calc th, .calc td { text-align: left; padding: 9px 8px 9px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); vertical-align: baseline; }
.calc thead th { border-top: 0; font-size: 13px; font-weight: 600; color: var(--ink2); padding-top: 0; }
.calc tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
.calc td { color: var(--ink2); }
.calc td.v { font: 700 17px/1.2 var(--num); color: var(--ink); white-space: nowrap; }
.calc .zdot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--zc); vertical-align: 1px; }
.calc noscript p { color: var(--ink2); font-size: 15px; }

/* "How it works": the formula in a grey well. */
.formula { margin-top: 16px; padding: 14px 18px; border-radius: 16px; background: var(--tile2); font: 600 16px/1.5 var(--round); color: var(--ink); overflow-wrap: anywhere; }
.how .tile { padding: 28px 24px; }
.how h2, .faq-h { font-size: clamp(28px, 3.2vw, 40px); }
.how .tile__p { margin-top: 12px; max-width: 42em; }
@media (min-width: 760px) { .how .tile { padding: 40px 48px; } }
.how .checks li a { color: var(--coralT); }

/* The calculators index: three across on a wide screen. */
@media (min-width: 1000px) { .fgrid--3 { grid-template-columns: repeat(3, 1fr); } }
