/* Kitbench — small tools. Plain CSS, no external requests. */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --ink: #15171c;
  --muted: #5b616e;
  --line: #e3e1da;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #dff1ee;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(20, 22, 28, .05), 0 6px 20px rgba(20, 22, 28, .05);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1d222a;
    --ink: #e8eaee;
    --muted: #9aa1ad;
    --line: #262c35;
    --accent: #2dd4bf;
    --accent-ink: #06201d;
    --accent-soft: #12302d;
    --danger: #f97066;
    --ok: #47cd89;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1d222a;
  --ink: #e8eaee;
  --muted: #9aa1ad;
  --line: #262c35;
  --accent: #2dd4bf;
  --accent-ink: #06201d;
  --accent-soft: #12302d;
  --danger: #f97066;
  --ok: #47cd89;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
code, kbd, .mono { font-family: var(--mono); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 20;
}
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand img { width: 28px; height: 28px; display: block; }
.nav { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 9px; cursor: pointer;
  font: 600 .8rem var(--sans); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- hero ---------- */
.hero { padding: 64px 0 36px; }
.hero p.lead { max-width: 640px; font-size: 1.15rem; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 .92rem var(--sans); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.sm { height: 32px; padding: 0 12px; font-size: .85rem; }

/* ---------- grid / cards ---------- */
.section { padding: 28px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  display: flex; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { font-size: 1.02rem; margin: 0 0 4px; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.ico {
  flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font: 700 .95rem var(--mono);
}
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 24px; padding: 18px 0 8px; }
.features h3 { font-size: 1rem; margin-bottom: 4px; }
.features p { color: var(--muted); font-size: .93rem; margin: 0; }

/* ---------- tool pages ---------- */
.crumbs { padding: 26px 0 0; font-size: .9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.tool-head { padding: 10px 0 20px; }
.tool-head p { color: var(--muted); max-width: 680px; font-size: 1.05rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h2 { font-size: 1rem; margin-bottom: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.row:first-child { margin-top: 0; }
.row:last-child { margin-bottom: 0; }
.spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .lbl { font-size: .82rem; color: var(--muted); font-weight: 600; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }

textarea, input[type="text"], input[type="number"], input[type="datetime-local"], select {
  width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font: 14px/1.5 var(--mono);
}
select { font-family: var(--sans); width: auto; min-width: 80px; }
textarea { min-height: 180px; resize: vertical; }
textarea.short { min-height: 110px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="color"] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; }
input[type="range"] { accent-color: var(--accent); width: 180px; }
.status { min-height: 1.5em; font-size: .9rem; margin-top: 8px; color: var(--muted); }
.status[data-state="ok"] { color: var(--ok); }
.status[data-state="err"] { color: var(--danger); }

.kv { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px 10px; align-items: center; }
.kv .k { font-size: .85rem; color: var(--muted); font-weight: 600; }
.kv input { font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.stat .n { font: 700 clamp(1.05rem, 4.6vw, 1.5rem) var(--mono); overflow-wrap: anywhere; }
.stat .l { font-size: .8rem; color: var(--muted); }
.swatch { width: 100%; height: 84px; border-radius: 10px; border: 1px solid var(--line); }
.contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contrast .box { border-radius: 10px; padding: 14px; border: 1px solid var(--line); font-weight: 600; }
.contrast .box small { display: block; font-weight: 400; opacity: .9; }
.big { font: 600 1.2rem var(--mono); }

/* ---------- rates ---------- */
.rates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.result-line { font: 600 1.35rem var(--mono); margin-top: 14px; word-break: break-word; }
.table-wrap { overflow-x: auto; }
table.rates { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.rates th, table.rates td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.rates th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
table.rates td.num { font-family: var(--mono); text-align: right; }
table.rates th.num { text-align: right; }
table.rates tbody tr { cursor: pointer; }
table.rates tbody tr:hover { background: var(--surface-2); }
.spark { width: 100%; height: 90px; display: block; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark path.area { fill: var(--accent-soft); stroke: none; }
.attrib { font-size: .85rem; color: var(--muted); }

/* ---------- prose ---------- */
.prose { max-width: 700px; padding: 40px 0 20px; }
.prose p { color: var(--muted); font-size: 1.05rem; }
.center { text-align: center; padding: 90px 0; }
.center .code { font: 700 4rem var(--mono); color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0; color: var(--muted); font-size: .88rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: var(--muted); }

@media (max-width: 640px) {
  .nav { display: none; }
  .brand { flex: 1; }
  .hero { padding: 40px 0 20px; }
  .kv { grid-template-columns: 1fr auto; }
  .kv .k { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
