/* Free tools (/tools, /tools/<slug>), on top of site.css. Mobile first; colours are site.css
   tokens only, so the dark theme comes for free. Tools append here if a style is missing. */

.crumbs { font-size: .88rem; margin: 0 0 6px; }
.tool-lede { max-width: 70ch; font-size: 1.02rem; margin: 8px 0 18px; }

/* ---- form card */
.tool-form .grid { margin-top: 4px; }
.tool-submit { margin: 14px 0 0; }
.js .tool-calc { display: none; }
.tool-bad { margin: 10px 0 0; }

/* ---- result card */
.tool-result { border-color: var(--accent); }
.tool-result h2 { margin-bottom: 6px; }
.tool-big { font-size: 1.6rem; line-height: 1.25; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.tool-big .sep { color: var(--muted); font-weight: 400; }
.tool-sub { color: var(--muted); margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
table.tool-table th[scope=row] { font-weight: 600; color: var(--text); }
table.tool-table td { white-space: nowrap; }
table.tool-table tr.hl > * { background: var(--accent-soft); }
.tool-result table.tool-table { max-width: 420px; }

/* ---- how it works, static table, questions, related, call to action */
.tool-how p { max-width: 70ch; margin: 0 0 10px; }
.tool-how p:last-child { margin-bottom: 0; }
.tool-static table.tool-table { min-width: 560px; }
.tool-faq dl { margin: 8px 0 0; }
.tool-faq dt { font-weight: 700; margin: 16px 0 4px; }
.tool-faq dt:first-child { margin-top: 6px; }
.tool-faq dd { margin: 0; max-width: 72ch; }
.tool-related ul { margin: 8px 0 0; padding-left: 20px; }
.tool-related li { margin-bottom: 6px; }
.tool-cta { border-color: var(--accent); background: var(--accent-soft); }
.tool-cta p:last-child { margin-bottom: 0; }

/* ---- /tools index */
.tool-family { font-size: 1.15rem; margin: 26px 0 0; }
.tool-cards { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .tool-cards { grid-template-columns: 1fr 1fr; } }
.tool-cards .card { margin: 0; display: flex; flex-direction: column; }
.tool-cards h3 { font-size: 1.05rem; margin: 0 0 4px; }
.tool-cards h3 a { color: var(--text); text-decoration: none; }
.tool-cards h3 a:hover { color: var(--accent); text-decoration: underline; }
.tool-cards p { margin: 0; color: var(--muted); font-size: .93rem; }
.tool-cards .open { margin-top: auto; padding-top: 10px; }
.made-with { margin-top: 24px; }

/* ---- pace converter: four boxes that update each other */
.conv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (min-width: 720px) { .conv-grid { grid-template-columns: repeat(4, 1fr); } }
.conv-cell { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.conv-cell .field { margin: 0; }
.conv-cell .btn { align-self: flex-start; }

/* ---- print: the tool's answer, without the site around it */
@media print {
  .site-head, .site-foot, .tool-form, .tool-related, .tool-cta, .crumbs { display: none !important; }
  .card { border: 0; padding: 0; }
}

/* ---- triathlon and cycling tools (triathlon-time-calculator, swim-pace-calculator,
   heart-rate-zones, cycling-power-zones, ride-time-calculator) */
/* A value and its unit side by side in one grid cell; the unit select stays narrow. */
.tool-pair { display: flex; gap: 10px; align-items: flex-end; }
.tool-pair .field { margin: 0; min-width: 0; }
.tool-pair .field:first-child { flex: 1 1 auto; }
.tool-pair .field:first-child input { width: 100%; }
.tool-pair .field + .field { flex: 0 0 auto; }
.tool-pair .field + .field select { min-width: 5.5em; }
.tool-pair.even .field { flex: 1 1 0; }
.tool-pair.even .field input { width: 100%; }
/* Custom distances show only for a custom race or ride when JS can toggle them; without JS they always show. */
.js .tri-custom[data-off], .js .ride-custom[data-off] { display: none; }
.tool-form .grid + .grid { margin-top: 14px; }
.tool-or { font-size: 1rem; margin: 18px 0 8px; }
/* Zone tables: the effort words may wrap on a phone; the numbers do not. */
table.tool-table td.wrap { white-space: normal; min-width: 9em; }
.tool-result h3 { font-size: 1rem; margin: 16px 0 6px; }
.tool-result .inline-note { max-width: 70ch; }
.tool-how ul { margin: 0; padding-left: 20px; max-width: 70ch; }
.tool-how li { margin-bottom: 4px; }
.tool-static h3 { font-size: 1rem; margin: 14px 0 6px; }
/* ---- running tools (pace-calculator, race-time-predictor, training-paces): a field with its unit beside it */
.tool-pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.tool-pair .field { margin: 0; }
.tool-result h3 { font-size: 1rem; margin: 16px 0 4px; }

/* ---- pace-calculator: the field being worked out and unused custom boxes hide when JS runs */
.pc-form fieldset { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.pc-form legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.pc-form .pc-units { margin: 0; }
.js .pc-form[data-find="pace"] .pc-f-pace,
.js .pc-form[data-find="time"] .pc-f-time,
.js .pc-form[data-find="distance"] .pc-f-dist,
.js .pc-form:not([data-custom]) .pc-f-custom { display: none; }
.pc-custom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.pc-band-link { margin: 0 0 6px; }
.pc-splits { max-width: 320px; }
.pc-splits tr.mark > * { color: var(--muted); font-style: italic; }
.pc-mark { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: 4px; }

/* ---- pace-calculator: the pace band (print=1), a narrow strip that prints on one sheet */
.band-tools { max-width: 60ch; }
.pace-band { width: 2.3in; max-width: 100%; margin: 8px 0 24px; padding: 8px 10px; border: 1.5px dashed var(--muted); background: var(--surface); font-variant-numeric: tabular-nums; }
.pace-band p { margin: 0; }
.pace-band .band-head { font-size: 1rem; }
.pace-band .band-sub { color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.pace-band table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.25; }
.pace-band th, .pace-band td { padding: 1px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.pace-band thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.pace-band td, .pace-band thead th:last-child { text-align: right; }
.pace-band tr.fin > * { font-weight: 700; border-bottom: 0; }
.pace-band .band-foot { color: var(--muted); font-size: .72rem; margin-top: 4px; }
@media print {
  body.band .band-tools { display: none !important; }
  body.band main { padding: 0; margin: 0; }
  body.band .pace-band { width: 2.1in; margin: 0; padding: 4pt 6pt; border: 1pt dashed #000; color: #000; background: #fff; }
  body.band .pace-band table { font-size: 9pt; line-height: 1.15; }
  body.band .pace-band th, body.band .pace-band td { padding: .5pt 3pt; border-bottom: .5pt solid #999; color: #000; }
  body.band .pace-band .band-sub, body.band .pace-band .band-foot { color: #333; }
}

/* ---- race-time-predictor */
.js .rp-grid:not([data-custom]) .rp-custom { display: none; }
.rp-table { max-width: 520px; }
.rp-you { color: var(--muted); font-weight: 400; font-size: .82rem; margin-left: 4px; }
.rp-note { margin: 0 0 10px; }

/* ---- training-paces */
.tp-paces, .tp-reps { max-width: 460px; }
.tp-note { margin: 0 0 10px; }
.tp-uses dl { margin: 6px 0 0; }
.tp-uses dt { font-weight: 700; margin: 12px 0 2px; }
.tp-uses dt:first-child { margin-top: 4px; }
.tp-uses dd { margin: 0; max-width: 72ch; }
