/* The free tools (worker/tools.js). Clarity first: big type, labels in full colour, numbered steps (1 fill in,
   2 your answer), and the answer as the biggest thing on the page. The search (js/tools/search.js) is a plain
   panel over the page, like a command palette. */

.tool .lead { margin-bottom: 30px; color: var(--text); opacity: .82; }
.tool-card { margin: 0 0 16px; padding: 26px 28px 28px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.doc .prose.guide .step { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--text); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.step b { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600; }

.tool-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0; }
@media (max-width: 620px) { .tool-form { grid-template-columns: 1fr; } }
.tf { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tf-wide, .tf:has(textarea), .tf-file { grid-column: 1 / -1; }
.tf label { color: var(--text); font-size: 16px; font-weight: 600; line-height: 1.3; }
.tf .unit { color: var(--muted); font-weight: 400; }
.tf input:not([type=checkbox]):not([type=range]):not([type=file]), .tf select, .tf textarea {
  width: 100%; min-height: 56px; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 20px; line-height: 1.35; transition: border-color .12s, box-shadow .12s; }
.tf input::placeholder, .tf textarea::placeholder { color: var(--faint); }
.tf textarea { min-height: 200px; resize: vertical; font-size: 18px; line-height: 1.55; }
.tf input:focus, .tf select:focus, .tf textarea:focus, .conv-num:focus, .conv select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.tf input[type=color] { padding: 4px; height: 56px; }
.tf-check { flex-direction: row; align-items: center; gap: 12px; min-height: 40px; }
.tf-check input { width: 22px; height: 22px; accent-color: var(--accent); }
.tf-check label { font-size: 17px; font-weight: 500; cursor: pointer; }
.tf-range { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.tf-range input { flex: 1; accent-color: var(--accent); }
.tf-range output { min-width: 3ch; font-size: 22px; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.tf-file input { padding: 28px; border: 2px dashed var(--border); border-radius: 14px; background: var(--bg); font-size: 17px; cursor: pointer; }
.tf-file input:hover { border-color: var(--muted); }
.tool-go { justify-self: start; height: 56px; padding: 0 32px; border-radius: 12px; font-size: 18px; }

/* Step 2: the answer. The first row is the headline. */
.tool-answer { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.doc .prose.guide .tool-wait { margin: 0; color: var(--muted); font-size: 17px; }
.tool-rows { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; font-size: 19px; line-height: 1.35; }
.tool-rows dt, .tool-rows dd { margin: 0; padding: 14px 0; border-top: 1px solid var(--hair); }
.tool-rows dt { color: var(--text); opacity: .8; }
.tool-rows dd { padding-left: 24px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.tool-rows dt:first-of-type, .tool-rows dd:first-of-type { padding-top: 0; border-top: 0; }
.tool-rows dt:first-of-type { align-self: end; opacity: 1; font-size: 20px; }
.tool-rows dd:first-of-type { font-size: 40px; letter-spacing: -0.03em; line-height: 1.05; }
.tool-text { position: relative; }
.tool-rows + .tool-text { margin-top: 18px; }
.tool-text textarea { display: block; width: 100%; padding: 14px 96px 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); font: 17px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; resize: vertical; }
.tool-copy { height: 38px; padding: 0 16px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.tool-copy:hover { border-color: var(--text); }
.tool-text .tool-copy { position: absolute; top: 10px; right: 10px; }
.tool-img { display: block; max-width: 100%; max-height: 520px; margin: 18px auto 0; border-radius: 10px; }
.tool-dl { margin-top: 18px; height: 52px; padding: 0 26px; font-size: 17px; text-decoration: none; }
.doc .prose.guide .tool-err { margin: 0; color: var(--text); font-size: 18px; }
.tool-sandbox { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }
.doc .prose.guide .tool-plug { margin-top: 48px; color: var(--muted); font-size: 17px; text-align: center; }

/* Converters: [number + unit] swap [answer + unit], then the answer as a sentence */
.conv-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; }
.conv-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.doc .prose.guide .conv-side .step { margin-bottom: 4px; font-size: 17px; }
.conv-num { width: 100%; min-height: 72px; padding: 10px 18px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.2; }
.conv-ans { display: flex; align-items: center; overflow-x: auto; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); white-space: nowrap; }
.conv select { width: 100%; height: 52px; padding: 0 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; }
.conv-swap { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 62px; padding: 0; border: 1.5px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; transition: transform .2s, border-color .12s; }
.conv-swap:hover { border-color: var(--text); transform: rotate(180deg); }
.conv-swap svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.doc .prose.guide .conv-say { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--hair); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.doc .prose.guide .conv-formula { margin: 18px 0 0; color: var(--muted); font-size: 17px; text-align: center; }
.doc .prose.guide .conv-formula:empty { display: none; }
.conv-chart { width: 100%; border-collapse: collapse; font-size: 18px; font-variant-numeric: tabular-nums; }
.conv-chart th, .conv-chart td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--hair); text-align: left; }
.conv-chart th { color: var(--muted); font-size: 15px; font-weight: 600; }
@media (max-width: 620px) {
  .tool-card { padding: 20px 18px 22px; border-radius: 16px; }
  .conv-grid { grid-template-columns: 1fr; gap: 14px; }
  .conv-swap { justify-self: center; margin: 0; transform: rotate(90deg); }
  .conv-swap:hover { transform: rotate(270deg); }
  .conv-num { min-height: 64px; font-size: 30px; }
  .tool-rows dd:first-of-type { font-size: 34px; }
  .doc .prose.guide .conv-say { font-size: 18px; }
}

/* /tools */
.hub-search { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px; height: 52px; margin: 0 auto 26px; padding: 0 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--faint); font: inherit; font-size: 17px; cursor: text; transition: border-color .12s; }
.hub-search:hover { border-color: var(--muted); }
.hub-search svg, .ts-bar svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hub-search span { flex: 1; text-align: left; }
.hub-search kbd, .ts-esc { padding: 2px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--faint); font: 12px/1.4 var(--font); }
/* /tools: most used first, then the kinds (each kind's page lists all its tools) */
.doc .prose.guide h2.hub-h { margin: 44px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.doc .prose.guide .hub-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; margin: 0; padding: 0; list-style: none; }
.doc .prose.guide .hub-top li { margin: 0; border-top: 1px solid var(--hair); }
.doc .prose.guide .hub-top li:nth-last-child(-n+2) { border-bottom: 1px solid var(--hair); }
.hub-top a { display: flex; align-items: center; gap: 14px; padding: 13px 4px; color: var(--text); text-decoration: none; }
.hub-top a:hover b { color: var(--accent); }
.hub-top a > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.hub-top b { font-size: 17px; font-weight: 600; }
.hub-top b + span { font-size: 14px; color: var(--muted); }
.hub-badge { display: flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--hair); color: var(--text); font-size: 13px; font-weight: 700; }
.hub-badge-w { background: var(--mark); color: var(--accent-press); }
.hub-kinds { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 !important; }
.hub-kinds a { padding: 9px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; }
.hub-kinds a:hover { border-color: var(--muted); }
.hub-kinds span { margin-left: 4px; color: var(--faint); font-weight: 400; }
.hub-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 48px; padding: 20px 22px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface); }
.doc .prose.guide .hub-cta p { flex: 1 1 320px; margin: 0; font-size: 17px; }
.hub-cta .go { text-decoration: none; }
@media (max-width: 640px) { .doc .prose.guide .hub-top { grid-template-columns: 1fr; } .doc .prose.guide .hub-top li:nth-last-child(2) { border-bottom: 0; } }
.hub-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 0 0 8px !important; font-size: 15px; }
.hub-jump a { color: var(--muted); text-decoration: none; }
.hub-jump a:hover { color: var(--text); }
.tools-hub section { scroll-margin-top: 20px; }
.doc .prose.guide .hub-list { columns: 3 220px; column-gap: 28px; margin: 0; padding: 0; list-style: none; font-size: 16px; }
.doc .prose.guide .hub-list li { margin: 0; padding: 4px 0; break-inside: avoid; }
.hub-list a { text-decoration: none; }
.hub-list a:hover { text-decoration: underline; text-decoration-color: var(--border); }

/* The search panel */
.ts-open { overflow: hidden; }
.ts { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgb(0 0 0 / .32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: ts-in .12s ease-out; }
.ts[hidden] { display: none; }
@keyframes ts-in { from { opacity: 0; } }
.ts-panel { width: 100%; max-width: 600px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 30px 80px -30px rgb(0 0 0 / .55); animation: ts-up .16s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes ts-up { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.ts-bar { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--hair); color: var(--faint); }
.ts-input { flex: 1; height: 58px; border: 0; background: none; color: var(--text); font: inherit; font-size: 18px; outline: none; }
.ts-input::-webkit-search-cancel-button { display: none; }
.ts-esc { cursor: pointer; }
.ts-list { max-height: min(56vh, 460px); margin: 0; padding: 6px; overflow-y: auto; list-style: none; }
.ts-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.ts-item.on { background: var(--hair); }
.ts-name { flex: 1; padding: 12px 0; color: var(--text); font-size: 16px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-name b { font-weight: 600; }
.ts-cat { flex: none; color: var(--faint); font-size: 13px; }
.ts-make .ts-name { color: var(--accent); font-weight: 500; }
.ts-note { margin: 0; padding: 0 18px; color: var(--muted); font-size: 15px; }
.ts-note:not(:empty) { padding: 16px 18px 18px; }
.ts-busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; vertical-align: -1px; animation: ts-spin .7s linear infinite; }
@keyframes ts-spin { to { transform: rotate(360deg); } }
@media (max-width: 560px) { .ts { padding-top: 10px; } .ts-list { max-height: 62vh; } }

/* Tool pages: the tool is centred on the page like every other page, and the list of every tool is a quiet
   column pinned to the window's left edge, below the bar. It stays in view while the page scrolls. Where the
   window is too narrow for both, the tool moves right just enough to clear it; on a phone the list follows the tool. */
.tool-layout { position: relative; width: 100%; }
.doc .tool-layout > .prose.guide.tool { width: auto; max-width: 848px; margin-left: max(296px, calc(50% - 424px)); margin-right: auto; padding-left: 24px; padding-right: 24px; }
.ts-side { position: absolute; top: 0; bottom: 0; left: 0; width: 272px; border-right: 1px solid var(--hair); }
.side-in { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain; padding: 22px 14px 40px 18px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.side-in:hover { scrollbar-color: var(--border) transparent; }
.side-search { display: flex; align-items: center; gap: 9px; width: 100%; height: 40px; margin: 0 0 18px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14.5px; cursor: text; transition: border-color .12s, color .12s; }
.side-search:hover { border-color: var(--muted); color: var(--text); }
.side-search span { flex: 1; text-align: left; }
.side-search svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.side-search kbd { padding: 0 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--faint); font: 12px/1.6 var(--font); }
.side-h { margin: 18px 0 4px; padding: 0 8px; color: var(--faint); font-size: 13px; font-weight: 500; }
.side-h a { color: inherit; text-decoration: none; }
.side-h a:hover { color: var(--text); }
.side-list { margin: 0; padding: 0; list-style: none; }
.side-list a { position: relative; display: block; padding: 5px 8px; border-radius: 7px; color: var(--muted); font-size: 14.5px; line-height: 1.35; text-decoration: none; transition: background .1s, color .1s; }
.side-list a:hover { background: var(--hair); color: var(--text); }
.side-list a[aria-current="page"] { color: var(--text); font-weight: 600; }
.side-list a[aria-current="page"]::before { content: ""; position: absolute; left: -2px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.side-kind summary { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--text); font-size: 14.5px; font-weight: 500; list-style: none; cursor: pointer; transition: background .1s; }
.side-kind summary::-webkit-details-marker { display: none; }
.side-kind summary:hover { background: var(--hair); }
.side-kind summary::after { content: ""; flex: none; width: 6px; height: 6px; margin: 0 3px 2px 0; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; }
.side-kind[open] > summary::after { transform: rotate(45deg); margin-bottom: 4px; }
.side-kind summary span:first-of-type { flex: 1; }
.side-n { color: var(--faint); font-size: 12.5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.side-kind .side-list { margin: 2px 0 10px 8px; }
.side-kind .side-list a { font-size: 14px; padding: 4px 8px; }
.side-all a { color: var(--faint); font-size: 13.5px; }
@media (max-width: 980px) {
  .doc .tool-layout > .prose.guide.tool { max-width: 828px; margin: 0 auto; }
  .ts-side { position: static; width: auto; max-width: 828px; margin: 8px auto 24px; border-right: 0; border-top: 1px solid var(--border); }
  .side-in { position: static; max-height: none; overflow: visible; padding: 24px 24px 0; }
}
