/* CIDTEK Tools: shared tokens and components. Page-specific styles live in each page. */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ink: #141c26;
  --muted: #5a6777;
  --line: #dae0e7;
  --accent: #1b5fb0;
  --accent-ink: #ffffff;
  --accent-soft: #e3edf9;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --error: #b3261e;
  --check-a: #e6e9ee;
  --check-b: #ffffff;
  --font-display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1319; --surface: #161d26; --ink: #e5ebf2; --muted: #93a0b0; --line: #29333f;
    --accent: #6da6f2; --accent-ink: #0b1622; --accent-soft: #1c2b3d;
    --warn: #f0b55a; --warn-soft: #33270f; --error: #f2948d;
    --check-a: #222a35; --check-b: #2c3542;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1319; --surface: #161d26; --ink: #e5ebf2; --muted: #93a0b0; --line: #29333f;
  --accent: #6da6f2; --accent-ink: #0b1622; --accent-soft: #1c2b3d;
  --warn: #f0b55a; --warn-soft: #33270f; --error: #f2948d;
  --check-a: #222a35; --check-b: #2c3542;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font-body);
  padding-inline: 16px; padding-block: 18px 48px;
}
.wrap { max-width: 1080px; margin: 0 auto; display: grid; gap: 24px; }
.wrap.wide { max-width: 1240px; }

/* Site header */
.site-header { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; font: 700 1.05rem/1 var(--font-display); color: var(--ink); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.9rem; }
.site-nav a:hover { color: var(--ink); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page-head h1 { font: 700 1.6rem/1.15 var(--font-display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; max-width: 70ch; text-wrap: pretty; }

/* Panels and sections */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 20px; min-width: 0; align-content: start; }
.section { display: grid; gap: 12px; min-width: 0; }
.section + .section { border-top: 1px solid var(--line); padding-top: 20px; }
h2 { font: 600 0.72rem/1 var(--font-body); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin: 0; }

/* Pill choices (radio groups) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  font-weight: 500; font-size: 0.88rem; color: var(--ink); background: var(--surface);
  transition: background .12s, border-color .12s;
}
.chips label:hover { border-color: var(--accent); }
.chips input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Form fields */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 0.85rem; font-weight: 500; }
.field small, .hint { color: var(--muted); font-size: 0.8rem; }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
}
textarea { resize: vertical; min-height: 92px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.check input { margin: 0; accent-color: var(--accent); }

/* Buttons */
button {
  font: 500 0.9rem var(--font-body); border-radius: 7px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.small { padding: 5px 10px; font-size: 0.82rem; }

/* Notes, readouts, tips */
.notes { display: grid; gap: 6px; }
.note { font-size: 0.83rem; padding: 8px 10px; border-radius: 7px; background: var(--warn-soft); color: var(--warn); }
.note.error { background: transparent; border: 1px solid var(--error); color: var(--error); }
.meta { font: 0.78rem/1.5 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
details { font-size: 0.85rem; }
summary { cursor: pointer; color: var(--muted); }
pre { font: 0.78rem/1.5 var(--font-mono); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto; }
.tips { color: var(--muted); font-size: 0.85rem; display: grid; gap: 4px; max-width: 75ch; }
.tips strong { color: var(--ink); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 0.88rem;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 32px); z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
