/* Shared styles for all tool pages.
   NO WEB FONTS, deliberately. These pages compete on being fast — a font
   request is a render-blocking round trip on a page whose whole job is to
   load, take input and answer. System stacks cost nothing and look correct
   on every platform. */

:root {
  --ground: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f3;
  --ink: #14181c;
  --ink-2: #3f4a53;
  /* #6b7780 measured 4.28:1 on --ground and 4.05:1 on --surface-2, under the
     4.5:1 floor. Darkened until it clears on every surface it is used on. */
  --muted: #626e77;
  --line: #d8dee3;
  --line-soft: #e7ecef;
  --accent: #1a5f8a;
  --accent-2: #0f4667;
  --accent-soft: #e2eef6;
  --good: #1c6b45;
  --warn: #8a5c14;
  --bad: #8f3535;
  --radius: 4px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101316;
    --surface: #181d21;
    --surface-2: #1f262b;
    --ink: #e6ebee;
    --ink-2: #b6c1c8;
    --muted: #8b979f;
    --line: #2a333a;
    --line-soft: #222a30;
    --accent: #6cb6e0;
    --accent-2: #92cdec;
    --accent-soft: #16303f;
    --good: #57b183;
    --warn: #c79a45;
    --bad: #cd7676;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ---- header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 5px 9px;
  border-radius: var(--radius);
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ---- page furniture ---- */
main { padding: 32px 0 56px; }
h1 {
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.15;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.lede { font-size: 17px; color: var(--ink-2); margin: 0 0 26px; max-width: 62ch; }
h2 {
  font-size: 21px;
  margin: 38px 0 12px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h3 { font-size: 16.5px; margin: 24px 0 8px; }
p { margin: 0 0 14px; max-width: 68ch; color: var(--ink-2); }
p strong, li strong { color: var(--ink); }
ul, ol { margin: 0 0 14px; padding-left: 22px; color: var(--ink-2); max-width: 68ch; }
li { margin-bottom: 6px; }
a { color: var(--accent); }
code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

/* ---- the tool panel ---- */
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin: 0 0 12px;
}
.controls { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 150px; }
.field { display: flex; flex-direction: column; gap: 5px; }
label, .label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
input[type="number"], input[type="text"], select, textarea {
  font-family: var(--sans);
  font-size: 15px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ground);
  color: var(--ink);
  width: 100%;
}
textarea { font-family: var(--mono); font-size: 14px; min-height: 170px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  background: var(--ground);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.radios label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.radios input { margin: 0; accent-color: var(--accent); }

button.go {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 11px 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  align-self: flex-start;
}
button.go:hover { background: var(--accent-2); }
@media (prefers-color-scheme: dark) { button.go { color: #0c1418; } }

button.ghost {
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---- results ---- */
.result {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.big {
  font-family: var(--mono);
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.verdict { font-size: 17px; font-weight: 600; margin-top: 4px; }
.verdict.good { color: var(--good); }
.verdict.warn { color: var(--warn); }
.verdict.bad { color: var(--bad); }
.explain { font-size: 14px; color: var(--muted); margin-top: 8px; }

.stats { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
         background: var(--line-soft); border: 1px solid var(--line-soft); }
.stat { background: var(--surface); padding: 13px 14px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat .v { font-family: var(--mono); font-size: 21px; font-variant-numeric: tabular-nums; color: var(--ink); }

.out {
  font-family: var(--mono);
  font-size: 15px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 60px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 11px;
  cursor: pointer;
  color: var(--ink);
}
.pill:hover { border-color: var(--accent); background: var(--accent-soft); }
.copied { color: var(--good); font-size: 13px; }

table.ref { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-bottom: 14px; }
table.ref th, table.ref td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
table.ref th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.ref td:last-child, table.ref th:last-child { text-align: right; font-family: var(--mono); }
.tablewrap { overflow-x: auto; }

.note {
  font-size: 14px;
  color: var(--muted);
  background: var(--surface-2);
  border-left: 3px solid var(--line);
  padding: 12px 14px;
  margin: 0 0 14px;
}
.note strong { color: var(--ink); }

/* ---- other tools ---- */
.also { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 12px; }
.also a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
}
.also a:hover { border-color: var(--accent); }
.also .t { font-weight: 600; color: var(--ink); font-size: 15px; }
.also .d { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  font-size: 13.5px;
  color: var(--muted);
}
footer.site-footer p { color: var(--muted); font-size: 13.5px; margin-bottom: 8px; }
footer.site-footer a { color: var(--muted); }

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