/* Free tools - shared components. Loaded only under /free-tools/.
 *
 * Tokens come from site.css. A tool that needs rules of its own puts them in
 * assets/css/tools/<slug>.css, which the shell links only on that tool's page,
 * with class names prefixed by the tool's short name (ft- foam tracer, au- audit,
 * tq- torque, hw- hardware decoder, rv- rivet, lc- landed cost, cp- calibration).
 */

/* ------------------------------------------------------------- hub and shell */

.tools-proof {
  list-style: none; margin: 2rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem;
  color: var(--steel-400); font-size: 0.9rem;
}
.tools-proof strong { color: var(--signal); font-family: var(--font-mono); font-size: 1.25rem; margin-right: 0.35rem; }

.tools-group-h {
  font-size: 0.8rem; font-family: var(--font-mono); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--steel-400); margin: 2.5rem 0 1rem;
}
.tools-group-h:first-child { margin-top: 0; }

.tool-tile { position: relative; }
.tool-tile-icon {
  display: inline-grid; place-items: center; width: 3rem; height: 3rem;
  border-radius: var(--r-md); background: var(--ink-900); border: 1px solid var(--ink-600);
  color: var(--signal);
}
.tool-tile-kicker { font-size: 0.78rem; color: var(--steel-500); font-family: var(--font-mono); }

.tool-head { padding: clamp(2.5rem, 5vw, 4rem) 0 1.5rem; }
.tool-head h1 { max-width: 22ch; margin: 0 0 0.75rem; }
.tool-head .lede { max-width: 60ch; }
.tool-privacy { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.82rem; color: var(--steel-400); margin: 0.5rem 0 0; }
.tool-privacy span { color: var(--ok); font-size: 0.6rem; }

.tool-body { padding: 0 0 var(--section); }

.tool-next { display: grid; gap: var(--gap); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 52rem) { .tool-next { grid-template-columns: 1fr 1.3fr; } }
.tool-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.tool-links a { color: var(--paper); }

/* ------------------------------------------------------------ the components */

/* Main working area: inputs left, result right, stacking on a phone. */
.tool-layout { display: grid; gap: var(--gap); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 60rem) {
  .tool-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tool-layout--wide-right { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
  .tool-layout--wide-left { grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); }
}

.tool-panel {
  background: var(--ink-800); border: 1px solid var(--ink-600);
  border-radius: var(--r-md); padding: clamp(1rem, 2.5vw, 1.5rem);
}
.tool-panel > h2, .tool-panel > h3 { margin-top: 0; font-size: 1.1rem; }
.tool-panel--sticky { position: sticky; top: 5.5rem; }

/* The headline result. */
.tool-result { display: grid; gap: 0.25rem; padding: 1rem 0; border-bottom: 1px solid var(--ink-600); margin-bottom: 1rem; }
.tool-result-label { font-size: 0.78rem; color: var(--steel-400); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; }
.tool-result-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.8rem); font-weight: 700; color: var(--signal); line-height: 1.1; }
.tool-result-sub { font-size: 0.88rem; color: var(--steel-300); }

/* Key value rows. */
.tool-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; margin: 0; font-size: 0.92rem; }
.tool-kv dt { color: var(--steel-400); }
.tool-kv dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--paper); }

/* Segmented control built on radio inputs, so it works with no script. */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ink-600); border-radius: var(--r-sm); overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 0.5rem 0.85rem; font-size: 0.85rem; cursor: pointer; color: var(--steel-300); border-right: 1px solid var(--ink-600); }
.seg label:last-of-type { border-right: 0; }
.seg input:checked + label { background: var(--signal); color: var(--ink-950); font-weight: 600; }
.seg input:focus-visible + label { outline: 2px solid var(--signal); outline-offset: -2px; }

/* Data tables. */
.tool-table-wrap { overflow-x: auto; border: 1px solid var(--ink-600); border-radius: var(--r-md); }
.tool-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tool-table th, .tool-table td { padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid var(--ink-700); }
.tool-table th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--steel-400); background: var(--ink-850); }
.tool-table td.num, .tool-table th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tool-table tr:last-child td { border-bottom: 0; }

/* Status colours. */
.is-ok { color: var(--ok); }
.is-warn { color: var(--signal); }
.is-bad { color: var(--danger); }
.tag { display: inline-block; padding: 0.1rem 0.5rem; border-radius: var(--r-sm); font-size: 0.75rem; font-family: var(--font-mono); border: 1px solid currentColor; }

/* Notes and method. */
.tool-note { font-size: 0.82rem; color: var(--steel-500); margin: 0.75rem 0 0; }
.tool-method { margin-top: var(--section); max-width: 70ch; }
.tool-method h2 { font-size: 1.3rem; }
.tool-method p, .tool-method li { color: var(--steel-300); }
.tool-method code { font-family: var(--font-mono); background: var(--ink-800); padding: 0.1rem 0.35rem; border-radius: var(--r-sm); }

/* Shown only once the script has started, hidden only when it has. */
.needs-js { display: none; }
.has-js .needs-js { display: block; }
.has-js .no-js-only { display: none; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

/* Print: tools that produce a report print just the report. */
@media print {
  .site-head, .site-foot, .tool-head .tool-privacy, .section--alt, .tool-actions, .crumbs, .skip, .strip { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-panel { border-color: #999; background: #fff; }
  .tool-result-value { color: #000; }
}
