/* tools.css — shared calculator v2 design for the homepage, TDEE and BMR tools.
 * Loaded by all three pages; provides the v2 form (pill controls, inviting
 * fields) and the result band. Each page's own inline CSS still styles the
 * results-below (chart, tables), concept SVGs and crawlable sections.
 * The tool <section> carries class "cv2" so these tokens are in scope. */
.cv2 {
  --cv2-card-border: #d5dbe1;
  --cv2-field: #c5ccd3;
  --cv2-field-hover: #8a949f;
  --cv2-brand: #237a3b;
  --cv2-brand-hover: #1c6230;
  --cv2-ring: #cfe8d6;
  --cv2-sel-bg: #e8f5ec;
  --cv2-sel-text: #1c6230;
  --cv2-placeholder: #9aa3ad;
  --cv2-band: #134e2a;
  --cv2-err: #c0362c;
}
/* keep [hidden] fields truly hidden even when a class sets display:flex/block */
.cv2 [hidden] { display: none !important; }

/* ---- card + rows -------------------------------------------------------- */
.cv2-card {
  max-width: 880px;
  margin: 1rem auto 0;
  background: #fff;
  border: 1px solid var(--cv2-card-border);
  border-radius: 14px;
  padding: 32px;
}
.cv2-rows { display: flex; flex-direction: column; gap: 24px; }
.cv2-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* field row: labels and inputs sit in separate (sub)grid rows so the boxes
   always share one baseline even if a label wraps */
.cv2-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: auto auto auto; column-gap: 16px; }
.cv2-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: auto auto auto; column-gap: 16px; }
.cv2-row-4 .cv2-field, .cv2-row-3 .cv2-field { display: grid; grid-template-rows: subgrid; grid-row: span 3; }
.cv2-row-4 .cv2-field > label, .cv2-row-3 .cv2-field > label { white-space: nowrap; }
.cv2-group > .cv2-group-label,
.cv2-field > label { display: block; font-size: 15px; font-weight: 500; color: var(--gray-800); margin-bottom: 8px; }
.cv2-field > label .opt { color: var(--gray-500); font-weight: 400; }

/* ---- choice controls: separate rounded pills --------------------------- */
.cv2-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.cv2-opt {
  flex: 1 1 0; min-width: 0; min-height: 44px;
  display: flex; align-items: center; justify-content: center; text-align: center; gap: .3rem;
  padding: .5rem .75rem; cursor: pointer; font-size: 15px; font-weight: 500; line-height: 1.2;
  color: var(--gray-800); background: #fff; border: 1px solid var(--cv2-field); border-radius: 10px;
}
.cv2-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.cv2-opt:hover { border-color: var(--cv2-field-hover); }
.cv2-opt:has(input:checked) { background: var(--cv2-sel-bg); border: 2px solid var(--cv2-brand); color: var(--cv2-sel-text); font-weight: 600; }
/* reserve the check's space in every state so selecting never shifts the label */
.cv2-opt::before { content: "\2713"; font-weight: 700; color: transparent; flex: none; }
.cv2-opt:has(input:checked)::before { color: var(--cv2-sel-text); }
.cv2-opt:has(input:focus-visible) { outline: 2px solid var(--cv2-brand); outline-offset: 2px; }
/* four-option controls become a clean 2x2 on narrow screens */
.cv2-seg-4 .cv2-opt { flex: 1 1 0; }
@media (max-width: 639.98px) { .cv2-seg-4 .cv2-opt { flex: 1 1 calc(50% - 4px); } }

/* ---- number fields: white, inviting, with placeholders ------------------ */
.cv2-input-wrap { position: relative; display: block; }
.cv2-input {
  width: 100%; height: 52px; box-sizing: border-box;
  border: 1px solid var(--cv2-field); border-radius: 12px; background: #fff;
  padding: 0 2.75rem 0 .85rem; font: inherit; font-size: 18px; color: var(--gray-900);
  font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.06);
}
.cv2-input::placeholder { color: var(--cv2-placeholder); }
.cv2-input:hover { border-color: var(--cv2-field-hover); }
.cv2-input:focus { outline: none; border-color: var(--cv2-brand); box-shadow: 0 0 0 1px var(--cv2-brand), 0 0 0 4px var(--cv2-ring); }
.cv2-unit { position: absolute; top: 0; right: .85rem; height: 52px; display: flex; align-items: center; color: var(--gray-600); pointer-events: none; }
/* joined height boxes: one border, ft | in inside; same 52px height as the others */
.cv2-height { display: flex; align-items: stretch; height: 52px; box-sizing: border-box; border: 1px solid var(--cv2-field); border-radius: 12px; background: #fff; overflow: hidden; box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.06); }
.cv2-height:focus-within { border-color: var(--cv2-brand); box-shadow: 0 0 0 1px var(--cv2-brand), 0 0 0 4px var(--cv2-ring); }
.cv2-height .cv2-seg-cell { position: relative; flex: 1 1 0; display: flex; align-items: center; }
.cv2-height .cv2-seg-cell + .cv2-seg-cell { border-left: 1px solid var(--cv2-field); }
.cv2-height .cv2-input { border: 0; border-radius: 0; box-shadow: none; height: auto; padding-right: 2.1rem; }
.cv2-height .cv2-unit { right: .55rem; }
/* errors */
.cv2-input.is-error, .cv2-height.is-error { border-color: var(--cv2-err); }
.cv2-field-err { color: var(--cv2-err); font-size: .85rem; margin-top: 8px; font-weight: 600; }
.cv2-note { font-size: .9rem; color: var(--gray-600); margin: 8px 0 0; line-height: 1.45; }
.cv2-note[aria-live] { min-height: 1.2em; }

.cv2-details > summary { cursor: pointer; color: var(--cv2-brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.cv2-details > div { margin: .35rem 0 0; font-size: .88rem; color: var(--gray-600); line-height: 1.5; }
.cv2-details p { margin: .35rem 0 0; }

/* ---- "fill in an example" link + primary button ------------------------ */
.cv2-example { display: inline-block; background: none; border: 0; color: var(--cv2-brand); text-decoration: underline; cursor: pointer; font: inherit; font-size: .95rem; padding: .4rem 0; min-height: 44px; }
.cv2-example:focus-visible { outline: 2px solid var(--cv2-brand); outline-offset: 2px; }
.cv2-btn {
  width: 100%; min-height: 56px; border: 0; border-radius: 10px;
  background: var(--cv2-brand); color: #fff; font: inherit; font-weight: 700; font-size: 1.1rem;
  cursor: pointer; margin-top: .25rem;
}
.cv2-btn:hover { background: var(--cv2-brand-hover); }
.cv2-btn:focus-visible { outline: 2px solid var(--cv2-brand); outline-offset: 3px; }

.cv2-form-error { color: var(--cv2-err); background: #fbeae8; border: 1px solid var(--cv2-err); border-radius: 10px; padding: .7rem .9rem; margin-top: 1rem; font-weight: 600; }

/* ---- results: the band is the hero ------------------------------------- */
.cv2-results { max-width: 880px; margin: 0 auto; }
.cv2-band {
  background: var(--cv2-band); color: #fff; border-radius: 14px;
  padding: 1.5rem 1.5rem 1.25rem; margin-top: 1rem;
  font-variant-numeric: tabular-nums;
}
.cv2-band-label { margin: 0; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #bfe6cb; font-weight: 700; }
.cv2-band-label:focus { outline: none; }
.cv2-hero { margin: .35rem 0 0; font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.cv2-hero .cv2-hero-num { font-size: 48px; display: inline-block; }
.cv2-band-msg { background: rgba(255,255,255,.12); border-left: 4px solid #bfe6cb; border-radius: 8px; padding: .6rem .8rem; margin: .9rem 0 0; line-height: 1.5; font-size: .95rem; }
.cv2-band-msg.warn { border-left-color: #ffd27a; }
.cv2-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin-top: 1.1rem; }
.cv2-stat { background: rgba(255,255,255,.10); border-radius: 10px; padding: .7rem .8rem; }
.cv2-stat-label { display: block; font-size: .75rem; color: #bfe6cb; text-transform: uppercase; letter-spacing: .04em; }
.cv2-stat-val { display: block; font-size: 1.5rem; font-weight: 700; margin-top: .15rem; }
.cv2-stat-sub { display: block; font-size: .8rem; color: #d7efe0; margin-top: .1rem; }
.cv2-band .stopped { font-size: 1rem; font-weight: 600; font-style: normal; }
.cv2-band-note { font-size: .82rem; color: #bfe6cb; margin: .7rem 0 0; line-height: 1.45; }
.cv2-below { margin-top: 1.25rem; }

/* reveal: fade + 8px rise */
.cv2-results.cv2-reveal { animation: cv2-rise 200ms ease-out; }
@keyframes cv2-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 899.98px) {
  .cv2-card { padding: 20px; }
  .cv2-row-4 { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(6, auto); }  /* fields 2x2 */
  .cv2-row-3 { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 24px; }  /* fields stack */
  .cv2-row-3 .cv2-field { display: block; grid-row: auto; }
  .cv2-hero .cv2-hero-num { font-size: 40px; }
  .cv2-stats { grid-template-columns: 1fr; gap: .6rem; }
}
@media (max-width: 639.98px) {
  .cv2-row-2 { grid-template-columns: 1fr; }  /* Units and Sex each take a full-width row */
}
@media (prefers-reduced-motion: reduce) {
  .cv2-results.cv2-reveal { animation: none; }
}
