/* public/css/tools.css: the free tool pages (/tools, /mental-math; plan §1.1 change 2, §2.4). One small file, no web fonts,
   Paper only (no dark toggle). The color tokens are themes.css's Paper values, copied (test/unit/tools-pages.test.js keeps
   them equal); violet (--accent) is only ever the ✱ in the wordmark. Type and spacing follow app.css. */
:root {
  --bg:#ffffff; --ink:#1a1a1a; --muted:#5c5c5c; --rule:#d6d6d6; --mark:#f2f2f2;
  --link:#0645ad; --visited:#0645ad; --accent:#6d28d9; --ok:#1a7f37; --focus:#0645ad; --field:#ffffff;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-meta: 0.8125rem; --gutter: 16px;
  /* app.css's type and spacing steps, which learn-vis.css uses (the /mental-math pictures, DECISIONS 91) */
  --fs-list: 0.9375rem; --fs-body: 1.0625rem; --fs-h2: 1.125rem; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  color-scheme: light;
}
@media (min-width: 641px) { :root { --gutter: 24px; } }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.5 var(--font-ui); font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 750; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 1.4em; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:visited { color: var(--visited); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code { font-family: var(--font-mono); font-size: 0.95em; }
details > summary { cursor: pointer; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -3em; background: var(--bg); padding: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }

/* the one-line top bar and the footer */
.t-top { max-width: 1100px; margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--rule); }
.t-mark, .t-mark:visited { font: 800 1.35rem/1 var(--font-ui); letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.t-mark svg.ast { width: 0.8em; height: 0.8em; vertical-align: -0.02em; color: var(--accent); overflow: visible; }
.t-sep { color: var(--muted); }
.t-hub-link { font-weight: 600; }
.t-foot { max-width: 1100px; margin: 48px auto 0; padding: 16px var(--gutter) 32px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--fs-meta); color: var(--muted); }

/* the page */
.t-page { max-width: 760px; margin: 0 auto; padding: 20px var(--gutter) 0; }
.t-crumbs { margin-bottom: 6px; }
.t-meta { color: var(--muted); font-size: var(--fs-meta); }
.t-answer { font-size: 1.125rem; margin: 16px 0; padding-left: 12px; border-left: 3px solid var(--ink); }
.t-sec { margin-top: 32px; }
.t-h2 { font-size: 1.125rem; font-weight: 700; }
.t-q { font-size: 1rem; margin-top: 16px; }
.t-formulas { list-style: none; padding: 0; }
.t-formulas li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.t-work { color: var(--ink); }
.t-steps li, .t-work li { margin-bottom: 4px; }
.t-prompt { font-weight: 600; }
.t-links { columns: 2 14em; padding-left: 1.2em; }
.t-cards { list-style: none; padding: 0; }
.t-cards li { padding: 10px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 2px; }
.t-checked { margin-top: 32px; }

/* calculators */
.t-calc { margin: 16px 0; padding: 16px; border: 1px solid var(--rule); border-radius: 4px; }
.t-calc + .t-calc { margin-top: 12px; }
.t-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.t-field { display: grid; gap: 4px; }
.t-label { font-size: 0.9375rem; font-weight: 600; }
.t-hint { font-weight: 400; color: var(--muted); font-size: var(--fs-meta); }
.t-input { display: flex; align-items: center; gap: 6px; }
.t-unit { color: var(--muted); white-space: nowrap; }
input, select { font: inherit; font-size: max(16px, 1rem); color: var(--ink); background: var(--field); border: 2px solid var(--muted); border-radius: 3px; padding: 6px 8px; min-width: 0; width: 100%; min-height: 44px; }
input:focus, select:focus { border-color: var(--focus); }
.t-btn { display: inline-block; font: 600 1rem/1.2 var(--font-ui); padding: 10px 16px; min-height: 44px; border-radius: 3px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); cursor: pointer; text-decoration: none; }
a.t-btn, a.t-btn:visited { color: var(--ink); }
.t-btn.primary, a.t-btn.primary, a.t-btn.primary:visited { background: var(--ink); color: var(--bg); }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }
.t-error { margin-top: 12px; font-weight: 600; }
.t-note { margin-top: 8px; color: var(--muted); font-size: 0.9375rem; }
.t-results { margin: 12px 0 0; display: grid; gap: 0; }
.t-out { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.t-out dt { color: var(--muted); }
.t-out dd { margin: 0; font-weight: 700; text-align: right; }
.t-results[data-state="error"] dd { color: var(--muted); }
.t-svg { margin-top: 12px; }
.be-svg { width: 100%; height: auto; display: block; }
.be-frame { fill: none; stroke: var(--ink); stroke-width: 1; }
.be-block { fill: var(--rule); stroke: var(--ink); stroke-width: 1; }
.be-line { stroke: var(--ink); stroke-width: 2; }
.be-text { font: 13px var(--font-ui); fill: var(--muted); }

/* tables */
.t-scroll { overflow-x: auto; }
.t-table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.t-table th, .t-table td { padding: 6px 8px; border-bottom: 1px solid var(--rule); text-align: right; }
.t-table th:first-child { text-align: left; }
.t-table thead th { font-weight: 700; border-bottom: 2px solid var(--ink); }
.ptable { border-collapse: collapse; margin: 0 0 12px; }
.ptable th, .ptable td { border: 1px solid var(--rule); padding: 4px 8px; }

/* try three */
.t-tries { padding-left: 1.4em; }
.t-try { margin-bottom: 20px; }
.t-try-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t-try-form .t-input { max-width: 12rem; }
.t-try-result { font-weight: 600; }
.t-try[data-result="right"] .t-try-result { color: var(--ok); }
.t-reveal { margin-top: 6px; font-size: 0.9375rem; }

/* the funnel */
.t-cta { margin-top: 36px; padding: 16px; border: 1px solid var(--ink); border-radius: 4px; }
.t-cta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* the drill */
.t-drill { margin: 16px 0; padding: 16px; border: 1px solid var(--rule); border-radius: 4px; }
.d-settings fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.d-settings legend { font-weight: 600; margin-bottom: 6px; }
.d-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 8px 0; min-height: 44px; }
.d-chip input { width: auto; min-height: 0; }
.d-custom { margin-bottom: 12px; }
.d-custom .t-field { max-width: 14rem; margin-bottom: 8px; }
.d-rule { font-weight: 600; }
.d-bar { display: flex; justify-content: space-between; font-size: 1.125rem; }
.d-timer { font-weight: 700; font-variant-numeric: tabular-nums; }
.d-prompt { font-size: clamp(2rem, 9vw, 3rem); font-weight: 700; text-align: center; margin: 16px 0; min-height: 1.3em; white-space: nowrap; }
.d-answer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.d-input { font-size: 1.75rem !important; text-align: center; max-width: 11rem; }
.d-input[aria-invalid="true"] { border-color: var(--ink); background: var(--mark); }
.d-big { font-size: 1.375rem; }
.d-big b { font-size: 2.25rem; }
.d-skipped { columns: 2 10em; }
.d-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }

/* the slot for the technique's picture (the Learn visuals package fills it at build time) */
.mm-visual:empty { display: none; }

@media print {
  .t-top, .t-foot, .t-calc, .t-drill, .t-cta, #try, [data-testid="tool-related"] { display: none; }
  body { font-size: 11pt; }
}
/* The Learn visuals block on a /mental-math page (learn-vis.css draws it; its meta lines use the app's .meta). */
.mm-visual .meta { color: var(--muted); font-size: var(--fs-meta); }
/* The drill's result card (S2's drill card, DECISIONS 82). */
.d-card { display: block; max-width: 100%; height: auto; margin: 12px 0; border: 1px solid var(--rule); }
