/* MultiTool: steel workbench palette, signal-yellow for the things you act on. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #15202b;
  --muted: #566372;
  --line: #cbd3dc;
  --accent: #f2b705;
  --accent-strong: #d99e00;
  --on-accent: #15202b;
  --link: #0b6670;
  --ok: #1d7a46;
  --error: #b3261e;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181f;
    --surface: #1a222b;
    --ink: #e8edf2;
    --muted: #9aa6b2;
    --line: #2e3a46;
    --link: #62c7d0;
    --ok: #5ccf8b;
    --error: #ff8a80;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
}
img { max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--r-sm); z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 1.2rem var(--display); color: var(--ink); text-decoration: none; }
.logo-mark { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); box-shadow: inset 0 -6px 0 var(--accent-strong); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); font-size: .95rem; }
.nav a:hover { background: var(--surface); }

/* Home */
.hero { padding: clamp(40px, 9vw, 96px) 0 40px; max-width: 760px; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5rem); line-height: 1; letter-spacing: -.03em; margin-bottom: 24px; }
.hero .lede { font-size: 1.15rem; max-width: 60ch; }
.search input[type=search] {
  width: 100%; max-width: 520px; margin-top: 8px;
  font: inherit; padding: 14px 16px; border-radius: var(--r-md);
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
}
.search input[type=search]:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.cat { padding: 32px 0; border-top: 1px solid var(--line); }
.cat-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: 0; }
.tool-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 32px; }
.tool-list a { display: block; padding: 14px 0; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.tool-list a strong { display: block; font-family: var(--display); font-size: 1.1rem; font-weight: 700; }
.tool-list a span { color: var(--muted); font-size: .95rem; }
.tool-list a:hover strong { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.quick { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.quick a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9rem; }
.quick a:hover { border-color: var(--ink); }
.no-match { padding: 24px 0; }

/* Tool page */
.tool-page { padding: 24px 0 56px; }
.crumbs { display: flex; gap: 8px; font-size: .9rem; color: var(--muted); margin-bottom: 20px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.tool-page > h1, .tool-page > .lede { max-width: 760px; }
.lede { font-size: 1.1rem; color: var(--muted); }
.bench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 6px solid var(--accent);
  border-radius: var(--r-lg);
  padding: clamp(16px, 4vw, 28px);
  margin: 24px 0 40px;
  max-width: 900px;
}
.local-note { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; font-size: .9rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }

.content { max-width: 760px; }
.content section { margin-bottom: 36px; }
.steps { padding-left: 1.4em; }
.steps li { margin-bottom: 6px; padding-left: 4px; }
.steps li::marker { font-family: var(--display); font-weight: 700; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.related { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--ink); font-size: .95rem; }
.related a:hover { border-color: var(--ink); }

.prose { max-width: 720px; padding: 40px 0 64px; }
.prose h2 { margin-top: 1.6em; font-size: 1.25rem; }

/* Controls */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 180px; padding: 24px; cursor: pointer;
  border: 2px dashed var(--muted); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.drop:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }
.drop-title {
  display: inline-block; font: 700 1.05rem var(--display);
  background: var(--accent); color: var(--on-accent); padding: 10px 20px; border-radius: var(--r-sm); margin-bottom: 6px;
}
.drop-sub { color: var(--ink); }
.drop-hint { color: var(--muted); font-size: .88rem; }

.controls { display: flex; flex-wrap: wrap; gap: 16px 20px; margin: 20px 0 0; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 1 1 150px; }
.field-wide { flex-basis: 100%; width: 100%; }
.field-inline { flex-direction: row; align-items: center; flex: 0 0 auto; min-width: 0; }
.field > span:first-child { font-size: .9rem; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.field output { font-weight: 400; color: var(--muted); }
input[type=number], input[type=text], input[type=date], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; width: 100%; min-height: 44px; line-height: 1.4;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
textarea.code, .code { font-family: var(--mono); font-size: .92rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: 0; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--accent-strong); }
input[type=color] { width: 100%; height: 42px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-strong); width: 18px; height: 18px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline select { width: auto; flex: none; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 18px 0; }
.radios { border: 0; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; }
.radios-row { flex-direction: row; flex-wrap: wrap; gap: 8px 24px; margin-top: 0; }
.radios legend { font-size: .9rem; font-weight: 600; margin-bottom: 8px; padding: 0; }
.hint { font-size: .88rem; color: var(--muted); margin: 12px 0 0; }
.src-info { margin: 14px 0 0; color: var(--muted); font-size: .95rem; }
.src-info:empty { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem var(--display); text-decoration: none;
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--accent); border-radius: var(--r-sm);
  padding: 10px 20px; cursor: pointer; margin-top: 20px;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--bg); border-color: var(--ink); }
.btn-small { padding: 6px 14px; font-size: .9rem; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 16px; }
.actions .btn { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { font: inherit; font-size: .92rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.controls .chips { margin-top: 0; }

.status { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--bg); font-size: .95rem; }
.status[data-kind=ok] { color: var(--ok); }
.status[data-kind=error] { color: var(--error); background: color-mix(in srgb, var(--error) 10%, var(--surface)); }

.results { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.result { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: var(--r-sm); background: var(--bg); flex: none; }
.thumb-doc { display: grid; place-items: center; font: 700 .75rem var(--display); color: var(--error); border: 1px solid var(--line); }
.result-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.result-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { color: var(--muted); font-size: .9rem; }
.result.is-error .result-meta { color: var(--error); }
.row-actions { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; margin: 20px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stats div { background: var(--surface); padding: 12px 14px; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { margin: 0; font: 700 1.6rem var(--display); }

.split { display: grid; grid-template-columns: 1fr minmax(200px, 300px); gap: 24px; align-items: start; }
@media (max-width: 640px) { .split { grid-template-columns: 1fr; } }
.qr-box { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; background: var(--bg); text-align: center; }
.qr-box canvas { display: block !important; width: 100%; height: auto; image-rendering: pixelated; }
.qr-box img { display: none !important; }

.pw-out { padding: 18px; border: 2px solid var(--ink); border-radius: var(--r-md); background: var(--bg); font-size: 1.3rem; word-break: break-all; min-height: 68px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--error); transition: width .2s, background-color .2s; }

.answer { margin-top: 24px; }
.answer .big { font: 700 clamp(2rem, 6vw, 3rem)/1.1 var(--display); margin: 0 0 8px; }
.answer dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 24px; margin: 16px 0 0; }
.answer dt { font-size: .85rem; color: var(--muted); }
.answer dd { margin: 0; font-weight: 700; font-size: 1.15rem; }

.table-wrap { overflow-x: auto; margin-top: 24px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--muted); }

.calc-rows { display: flex; flex-direction: column; gap: 12px; }
.calc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.calc-row input { width: 110px; }
.calc-row output { font: 700 1.3rem var(--display); margin-left: auto; min-width: 90px; text-align: right; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: .92rem; }
.footer-in { display: flex; flex-direction: column; gap: 12px; }
.footer-in nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-in p { margin: 0; }
.footer-note { max-width: 60ch; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
