/* ---------------------------------------------------------------------------
   tools.css  ·  Calculator UI for /tools/*.
   Sits on top of styles.css + article.css and reuses their custom properties,
   so the tools inherit the site palette and both themes of print.css for free.
--------------------------------------------------------------------------- */

/* Stamped onto printed sheets only. print.css flips this to block. */
.print-head { display: none; }
.print-head b { font: 600 17px 'Space Grotesk', sans-serif; letter-spacing: 2px; }
.print-head span { color: #4c6b0a; }
.print-head small { display: block; margin-top: 4px; color: #3c443e; font-size: 9.5pt; }

.calc {
  display: grid; gap: 18px; margin: 30px 0 8px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
@media (max-width: 760px) { .calc { grid-template-columns: minmax(0, 1fr); } }

.calc-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 3px; padding: 22px 24px; min-width: 0;
}
.calc-panel > h2 {
  font: 600 15px 'Space Grotesk', sans-serif; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 18px; padding: 0; border: 0;
}

/* --- inputs --- */
.calc-form { display: grid; gap: 15px; }
.calc-form label { display: grid; gap: 6px; font: 500 13px 'Space Grotesk', sans-serif; color: var(--muted); letter-spacing: .3px; }
.calc-form input, .calc-form select {
  width: 100%; min-width: 0; background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px; padding: 11px 12px;
  font: 400 16px/1.2 'DM Sans', sans-serif; /* 16px stops iOS zooming on focus */
  min-height: 44px;
}
.calc-form input:focus-visible, .calc-form select:focus-visible {
  outline: 2px solid var(--lime); outline-offset: 1px; border-color: var(--lime);
}
.calc-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.calc-row .unit { width: 92px; }
.calc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0; }

/* --- output --- */
.calc-result { display: grid; gap: 16px; align-content: start; }
.calc-headline {
  border: 1px solid var(--line); border-left: 2px solid var(--lime);
  background: var(--panel2); padding: 18px 20px; border-radius: 2px;
}
.calc-headline small {
  display: block; font: 600 11px 'Space Grotesk', sans-serif;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted);
}
.calc-headline .big {
  display: block; margin-top: 6px; color: var(--lime);
  font: 600 clamp(34px, 6vw, 46px)/1 'Space Grotesk', sans-serif;
  letter-spacing: -1.6px; font-variant-numeric: tabular-nums;
}
.calc-headline .unit-label { font-size: 17px; letter-spacing: 0; color: var(--muted); }
.calc-headline p { margin: 9px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; max-width: none; }

.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; }
.calc-cell {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 2px; padding: 13px 14px; min-width: 0;
}
.calc-cell small {
  display: block; font: 600 10.5px 'Space Grotesk', sans-serif;
  letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted);
}
.calc-cell strong {
  display: block; margin-top: 5px; color: var(--ink);
  font: 600 21px 'Space Grotesk', sans-serif; font-variant-numeric: tabular-nums;
}
.calc-cell .pct { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* Macro split. Widths are written inline from the same kcal figures shown
   in the cells above, so the bar cannot drift from the numbers. */
.macro-bar { display: flex; height: 12px; border-radius: 2px; overflow: hidden; border: 1px solid var(--line); }
.macro-bar .seg { display: block; height: 100%; }
.macro-bar .seg-p { background: var(--lime); }
.macro-bar .seg-c { background: #6f8f2a; }
.macro-bar .seg-f { background: #35431f; }
.macro-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.macro-key span { display: inline-flex; align-items: center; gap: 6px; }
.macro-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* The arithmetic, shown rather than hidden. */
.calc-working {
  border-top: 1px solid var(--line); padding-top: 14px;
  font-family: ui-monospace, 'DejaVu Sans Mono', monospace;
  font-size: 12.5px; line-height: 1.9; color: var(--muted); overflow-x: auto;
}
.calc-working b { color: var(--ink); font-weight: 500; }

/* Percentage table on the one-rep-max page. */
.pct-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pct-table th, .pct-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.pct-table th { color: var(--lime); font: 600 14px 'Space Grotesk', sans-serif; width: 90px; }
.pct-table td { color: var(--ink); font-variant-numeric: tabular-nums; }
.pct-table tr:last-child th, .pct-table tr:last-child td { border-bottom: 0; }
/* No scroll container here. Capping the height made the table a scrollable
   region, which axe flags as needing keyboard focus, and it clipped the last
   rows so their contrast could not be measured. Eleven rows fit fine. */
.pct-wrap { overflow-x: auto; }

.tool-cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 30px 0 0; }
.tool-cta p { margin: 0; font-size: 14.5px; color: var(--muted); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 30px 0; }
.tool-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 3px; padding: 20px 22px; text-decoration: none;
}
.tool-card:hover, .tool-card:focus-visible { border-color: var(--lime); }
.tool-card strong { display: block; color: var(--ink); font: 600 17px 'Space Grotesk', sans-serif; margin-bottom: 6px; }
.tool-card span { display: block; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Accessible captions and labels that should not occupy layout space. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
