/* ===========================================================================
   Toolbench — shared design system
   One stylesheet for the hub + every tool. Committed "graphite instrument"
   theme: neutral graphite shell, a single warm persimmon signal, a display
   grotesque + neutral text grotesque + mono for numeric readouts.
   =========================================================================== */

:root {
  /* shell — neutral graphite (deliberately NOT navy/SaaS) */
  --bg:        oklch(0.165 0.004 250);
  --surface:   oklch(0.213 0.005 250);
  --surface-2: oklch(0.258 0.006 250);
  --line:      oklch(0.320 0.007 250);
  --ink:       oklch(0.970 0.004 250);
  --muted:     oklch(0.745 0.012 250);   /* ~7:1 on --bg */

  /* one signal colour carries every primary action */
  --accent:     oklch(0.705 0.185 38);   /* warm persimmon */
  --accent-ink: oklch(0.190 0.030 40);   /* dark text on accent */

  /* functional (status only, never decoration) */
  --ok:   oklch(0.80 0.15 155);
  --warn: oklch(0.84 0.13 90);
  --bad:  oklch(0.66 0.19 22);

  /* type */
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-ui:      "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* spacing scale (0.25rem base) */
  --sp-1: 0.5rem;  --sp-2: 0.75rem; --sp-3: 1rem;   --sp-4: 1.5rem;
  --sp-5: 2rem;    --sp-6: 3rem;    --sp-7: 4.5rem;

  /* radii — cards top out at 16px on purpose */
  --r-sm: 9px; --r: 13px; --r-lg: 16px;

  /* z-scale — semantic, never 999 */
  --z-sticky: 100; --z-modal-back: 200; --z-modal: 210; --z-toast: 300;

  --ease: cubic-bezier(0.22, 0.8, 0.18, 1);   /* ease-out-quint-ish */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.06rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
  margin: 0;
}

p { text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* --- layout shell ------------------------------------------------------- */
.shell { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
.shell--narrow { max-width: 600px; }
.shell--mid { max-width: 760px; }

/* --- top bar (every page) ---------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 960px; margin: 0 auto; padding: 1.1rem 1.25rem;
}
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.03em; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.wordmark .dot { color: var(--accent); }
.backlink {
  font-size: 0.92rem; color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem; transition: color 0.18s var(--ease);
}
.backlink:hover { color: var(--ink); }
.backlink svg { width: 1.05em; height: 1.05em; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 1rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1.1rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: color-mix(in oklch, var(--surface-2), white 7%); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn--accent:hover { background: color-mix(in oklch, var(--accent), white 9%); }
.btn--full { width: 100%; }
.btn--lg { min-height: 52px; font-size: 1.05rem; padding: 0 1.4rem; }
.btn[aria-pressed="true"], .btn.is-active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* --- form controls ------------------------------------------------------ */
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font-family: var(--font-ui); font-size: 1rem; color: var(--ink);
  background: oklch(0.145 0.004 250); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 0.7rem 0.8rem; width: 100%;
  transition: border-color 0.18s var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent), transparent 78%); }
textarea { resize: vertical; line-height: 1.55; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="color"] { padding: 0; height: 42px; cursor: pointer; }
label { font-size: 0.9rem; color: var(--muted); }
::placeholder { color: color-mix(in oklch, var(--muted), transparent 25%); }

/* --- surfaces ----------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-4); }

/* --- ad slot (reserved, quiet, low-CLS) -------------------------------- */
.ad {
  display: flex; align-items: center; justify-content: center;
  min-height: 96px; max-width: 728px; margin: var(--sp-5) auto;
  border-radius: var(--r-sm);
  background: color-mix(in oklch, var(--surface), transparent 45%);
  border: 1px solid color-mix(in oklch, var(--line), transparent 50%);
  color: color-mix(in oklch, var(--muted), transparent 25%);
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
}

/* --- page footer -------------------------------------------------------- */
.foot { color: var(--muted); font-size: 0.86rem; text-align: center; padding: var(--sp-6) 1.25rem var(--sp-5); }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--ink); }

/* --- tool page header (icon + name, shared across tools) --------------- */
.tool-head { display: flex; align-items: center; gap: 0.85rem; padding: var(--sp-4) 0 var(--sp-1); }
.tool-head .glyph { flex: none; width: 38px; height: 38px; color: var(--accent); }
.tool-head h1 { font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.1rem); }
.tool-head .sub { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 0; max-width: 60ch; }

/* numeric readouts use the mono face + tabular figures */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
