/* Hutchkit — a cabinet of small tools. Cards are drawers: a handle on top, a thick front edge below. */
:root {
  --bg: #edf0ec;
  --surface: #ffffff;
  --panel: #ffffff;
  --surface-2: #e3e8e2;
  --line: #c9d1c9;
  --ink: #15302b;
  --text: #15302b;
  --muted: #5b6b66;
  --brand: #15302b;
  --pop: #ff6b4a;
  --accent: #0f7a63;
  --accent-text: #ffffff;
  --danger: #b3372b;
  --add: #dff3e3;
  --del: #fbe1dd;
  --mark: #ffd9cc;
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  --l: 40%;
  --tint: 92%;
  --side: 264px;
}
[data-theme="dark"] {
  --bg: #0f1716;
  --surface: #17211f;
  --panel: #17211f;
  --surface-2: #1f2c29;
  --line: #2f403c;
  --ink: #9db5ae;
  --text: #e6eeeb;
  --muted: #94a59f;
  --brand: #e6eeeb;
  --pop: #ff7d5e;
  --accent: #5fd0b3;
  --accent-text: #0c1b18;
  --danger: #f08b7f;
  --add: #1f3a27;
  --del: #47211d;
  --mark: #6b2e1e;
  --l: 70%;
  --tint: 22%;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pop); outline-offset: 2px; }

/* Category icon tile. Colour comes from --hue on the element or a parent. */
.ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: hsl(var(--hue, 165) 60% var(--tint)); color: hsl(var(--hue, 165) 60% var(--l));
}
.ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- sidebar ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 10;
  display: flex; flex-direction: column; gap: 16px; padding: 18px 14px;
  background: var(--panel); border-right: 2px solid var(--ink); overflow-y: auto;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; text-decoration: none; }
.logo { width: 34px; height: 34px; }
.search { position: relative; }
.search input {
  width: 100%; padding: 10px 62px 10px 12px;
  background: var(--bg); border: 2px solid var(--ink); border-radius: 10px;
}
.search input:focus { outline: none; border-color: var(--pop); }
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 11px var(--mono); color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; pointer-events: none;
}
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px;
  text-decoration: none; font-weight: 600; border: 2px solid transparent;
}
.nav a:hover { background: var(--surface-2); }
.nav a.on { border-color: var(--ink); background: hsl(var(--hue, 165) 60% var(--tint)); }
.nav .n { margin-left: auto; font: 12px var(--mono); color: var(--muted); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--muted); }
.side-foot span { display: block; margin-bottom: 4px; }

/* ---------- layout ---------- */
.page { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 32px 56px; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; border-top: 2px solid var(--line); padding: 18px 24px; color: var(--muted); font-size: 14px; }
.foot a { color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: center; }
.hero-text { display: grid; gap: 16px; }
.eyebrow { font: 600 13px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hero h1 { font-size: clamp(34px, 4.6vw, 60px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; }
.hero h1 mark { background: none; color: var(--pop); border-radius: 0; }
.hero p { color: var(--muted); max-width: 52ch; font-size: 18px; }
.hero-drop .drop { padding: 44px 24px; background: var(--brand); color: var(--bg); border-color: var(--brand); border-style: solid; }
.hero-drop .drop strong { font-size: 19px; }
.hero-drop .drop span { color: inherit; opacity: .75; }
.hero-drop .drop:hover, .hero-drop .drop.over { background: var(--pop); border-color: var(--pop); color: #fff; }

.quick { margin-top: 40px; }
.quick h2, .shelf-head h2 { font-size: 22px; letter-spacing: -0.02em; font-weight: 800; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.quick-grid a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; text-decoration: none; font-weight: 600;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 999px;
  transition: transform .12s, background .12s;
}
.quick-grid a .ico { border-radius: 50%; }
.quick-grid a:hover { transform: translateX(3px); background: hsl(var(--hue) 60% var(--tint)); }

.shelf { margin-top: 44px; }
.shelf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.shelf-head p { color: var(--muted); font-size: 14px; }
.shelf-head .more { margin-left: auto; font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--accent); }
.shelf-head .more:hover { text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

/* A drawer */
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px 16px; text-decoration: none;
  background: var(--surface); border: 2px solid var(--ink); border-bottom-width: 6px; border-radius: var(--radius);
  transition: transform .12s, border-color .12s;
}
.card .handle { position: absolute; top: 8px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--line); transition: background .12s, width .12s, margin .12s; }
.card:hover { transform: translateY(3px); border-bottom-color: hsl(var(--hue) 60% var(--l)); }
.card:hover .handle { background: hsl(var(--hue) 60% var(--l)); width: 64px; margin-left: -32px; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card h3 { font-size: 16px; margin-top: 4px; }
.card p { font-size: 14px; color: var(--muted); }
.star { background: none; border: 0; cursor: pointer; font-size: 19px; line-height: 1; color: var(--muted); padding: 2px 4px; border-radius: 6px; }
.star.on { color: var(--pop); }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }

/* ---------- buttons, drop zone ---------- */
.btn {
  cursor: pointer; padding: 8px 16px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 26px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.drop span { color: var(--muted); font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.suggest { margin-top: 12px; }
.suggest-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- tool page ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.tool-head h1 { font-size: 30px; letter-spacing: -0.01em; }
.tool-head p { color: var(--muted); margin-top: 4px; }
.tool-head .star { font-size: 26px; }
.tool-body { display: grid; gap: 16px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius); }
.controls:empty { display: none; }
.ctl { display: grid; gap: 4px; font-size: 14px; }
.ctl-label { color: var(--muted); font-size: 13px; }
.ctl-check { display: flex; flex-direction: row-reverse; align-items: center; gap: 6px; justify-content: flex-end; padding-bottom: 6px; }
.ctl-check .ctl-label { color: var(--text); font-size: 14px; }
.ctl .val { font: 12px var(--mono); color: var(--muted); }
input[type="text"], input[type="number"], input[type="date"], select {
  padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0;
}
input[type="number"] { width: 110px; }
input[type="color"] { width: 54px; height: 36px; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
input[type="range"] { width: 160px; accent-color: var(--accent); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane { display: grid; grid-template-rows: auto 1fr; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pane-actions { display: flex; gap: 6px; }
textarea.io {
  display: block; width: 100%; min-height: 280px; padding: 12px; resize: vertical;
  background: transparent; border: 0; font: 14px/1.5 var(--mono); tab-size: 2;
}
textarea.io:focus { outline: none; }
.pane:focus-within { border-color: var(--accent); }
textarea.tall { min-height: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.status { font-size: 14px; color: var(--muted); min-height: 21px; }
.status.err { color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

.results { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.results .row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.results .row:last-child { border-bottom: 0; }
.results .row span { color: var(--muted); }
.results .row b { font-family: var(--mono); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.hl { font: 14px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; min-height: 60px; }
mark { background: var(--mark); color: inherit; border-radius: 3px; }
.matches { margin: 0; padding-left: 22px; font-size: 14px; max-height: 260px; overflow: auto; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.diff { font: 13px/1.55 var(--mono); overflow: auto; max-height: 520px; padding: 0; }
.diff div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 12px; min-height: 1.55em; }
.diff .add { background: var(--add); }
.diff .del { background: var(--del); }

.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose > * { margin: 0 0 .8em; }
.prose h1, .prose h2, .prose h3 { line-height: 1.25; }
.prose pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.prose a { color: var(--accent); }

.preview-wrap { display: grid; place-items: center; padding: 16px; background: var(--surface-2); border-radius: var(--radius); min-height: 160px; }
.preview { max-width: 100%; max-height: 460px; border-radius: 6px; }
img.preview:not([src]) { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.stage { display: grid; place-items: center; min-height: 240px; padding: 36px; background: var(--surface-2); border-radius: var(--radius); }
.stage-box { width: 220px; height: 140px; background: var(--surface); display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.swatch { height: 84px; border: 0; border-radius: 10px; cursor: pointer; display: flex; align-items: flex-end; padding: 8px; font: 12px var(--mono); }
.bigswatch { height: 120px; border-radius: var(--radius); border: 1px solid var(--line); }
.sample { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); }
.sample b { font-size: 24px; display: block; }
.pass { color: var(--accent); font-weight: 600; }
.fail { color: var(--danger); font-weight: 600; }

.filelist { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.filelist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.hex { font: 12px/1.6 var(--mono); white-space: pre; overflow: auto; margin: 0; }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; }
.foot a { color: var(--accent); }
.legal { max-width: 70ch; }
.legal h1 { font-size: 32px; letter-spacing: -0.01em; }
.legal h2 { font-size: 19px; margin-top: 1.6em; }

.clock { font-size: clamp(40px, 9vw, 72px); font-family: var(--mono); text-align: center; padding: 18px 0; }
.table-wrap { padding: 0; overflow: auto; max-height: 520px; }
.table-wrap:empty { display: none; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surface-2); cursor: pointer; user-select: none; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- overrides for the tool interface ---------- */
.btn { border-width: 2px; border-color: var(--ink); border-radius: 10px; font-weight: 600; }
.btn:hover { border-color: var(--ink); background: var(--surface-2); }
.btn.primary { background: var(--pop); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--pop); filter: brightness(1.07); }
.drop { border-color: var(--ink); }
.tool-head { align-items: center; justify-content: flex-start; padding: 16px; background: var(--surface); border: 2px solid var(--ink); border-bottom-width: 6px; border-radius: var(--radius); }
.tool-head .ico { width: 48px; height: 48px; border-radius: 14px; }
.tool-head .ico svg { width: 26px; height: 26px; }
.tool-head h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.02em; }
.tool-head .star { margin-left: auto; }
.crumbs a { font-weight: 600; }
.controls { border: 2px solid var(--line); }
.pane, .stat, .results, .box { border-width: 2px; }
.pane:focus-within { border-color: var(--ink); }
.pass { color: var(--accent); }

.legal { max-width: 70ch; }
.legal h1 { font-size: 34px; letter-spacing: -0.02em; font-weight: 800; }
.legal h2 { font-size: 19px; margin-top: 1.6em; }

/* Text under each tool, and the plain page shown for a moment before the scripts start */
[hidden] { display: none !important; }
.about { max-width: 72ch; margin-top: 56px; padding-top: 28px; border-top: 2px solid var(--line); }
.about h2 { font-size: 21px; margin-top: 1.5em; }
.about h3 { font-size: 16px; margin: 1.2em 0 .3em; }
.about a, #app > ul a, #app > h2 a { color: var(--accent); }
#app > h1 { font-size: 30px; margin-bottom: 8px; }
#app > ul { line-height: 1.9; }

@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  /* The sidebar becomes a strip across the top; categories scroll sideways. */
  .side { position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 2px solid var(--ink); overflow: visible; }
  .side-top { flex: none; }
  .brand { font-size: 18px; }
  .search { flex: 1; min-width: 140px; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .nav { order: 3; flex-basis: 100%; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .nav a { flex: none; padding: 3px 10px 3px 4px; font-size: 14px; }
  .nav .ico { width: 26px; height: 26px; border-radius: 8px; }
  .nav .ico svg { width: 15px; height: 15px; }
  .nav .n { display: none; }
  .side-foot { display: none; }
  .page { margin-left: 0; }
  main { padding: 20px 14px 40px; }
  .panes { grid-template-columns: 1fr; }
}
