/* The tools shelf — shared paint for every tool that lives under /tools/<id>/.
 *
 * Loaded by Loop Forge, Audio Budget and GLB Inspector. PixVox and the GDD Builder
 * predate it and carry their own stylesheets; they are not broken and are not being
 * rewritten to match this.
 *
 * Same palette as the site (cream paper, ink outlines, orange), so a tool looks like the
 * page it is linked from. A tool is a page you read or work on, not a dark editor — the
 * exception is anything that judges colour on screen, which is why PixVox is dark.
 *
 * Everything here is a local custom property. These pages are static documents that never
 * boot the site's React app, so they cannot rely on src/index.css.
 */

:root {
  --ink: #1d0b33;
  --paper: #fff3d6;
  --surface: #fffdf8;
  --orange: #ff7a18;
  --orange-dark: #d9530a;
  --yellow: #ffce00;
  --slime: #7de22b;
  --slime-dark: #4ca80f;
  --pink: #ff3da6;
  --purple: #8b47e8;
  --purple-dark: #5e23b5;
  --cyan: #22d3ee;
  --cyan-dark: #0e9bb5;
  --red: #d92b2b;
  --green-dark: #1f6e00;
  --muted: #6b5a8a;
  --dim: #8f7fa8;
  --line: #e4d7c2;
  --radius: 12px;
  --font-display: 'Bungee', 'Impact', sans-serif;
  --font-ui: 'Baloo 2', 'Trebuchet MS', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background:
    radial-gradient(circle at 50% -10%, #fff9ea 0%, var(--paper) 55%, #f6e9d0 100%);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-dark); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* ── top bar ─────────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--ink);
}

.brand:hover .brand-name { color: var(--orange-dark); }

.bar-spacer { flex: 1 1 auto; }

.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── buttons ─────────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.12s ease;
  box-shadow: 3px 3px 0 var(--ink);
}

.btn:hover { background: #fff8e8; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: 3px 3px 0 var(--ink); transform: none; }

.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #ff8c33; }

.btn-ghost { background: transparent; box-shadow: none; border-color: var(--ink); }
.btn-ghost:hover { background: #fff3d6; }
.btn-ghost:active { transform: none; }

/* ── page shell ──────────────────────────────────────────────────────────── */

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 18px 56px;
}

.lede {
  max-width: 720px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1rem;
}

.lede strong { color: var(--ink); }

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.5px;
  margin: 4px 0 10px;
}

.panel {
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px 18px;
}

.panel + .panel { margin-top: 20px; }

.panel-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: var(--ink);
}

/* ── form controls ───────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field > span {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

select, input[type='number'], input[type='text'] {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

.seg {
  display: flex;
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.seg button {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 8px 4px;
  border: 0;
  border-right: 2px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--yellow); }
.seg button:hover:not([aria-pressed='true']) { background: #fff3d6; }

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

.pill:hover { background: #fff3d6; }
.pill[aria-pressed='true'] { background: var(--ink); color: var(--yellow); }

/* ── readouts ────────────────────────────────────────────────────────────── */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.stat { display: flex; flex-direction: column; gap: 0; }
.stat-label {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 10px 0 0;
}

.status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-height: 1.2em;
}

.status[data-tone='work'] { color: var(--purple-dark); }
.status[data-tone='ok'] { color: var(--green-dark); }
.status[data-tone='warn'] { color: var(--orange-dark); }

/* ── badges and tables ───────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  white-space: nowrap;
}

.badge-pass { background: var(--slime); color: var(--ink); }
.badge-warn { background: var(--yellow); color: var(--ink); }
.badge-fail { background: var(--red); color: #fff; }
.badge-info { background: #e9e2d0; color: var(--ink); }

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

table.data th {
  text-align: left;
  font-size: 0.66rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border-bottom: 3px solid var(--ink);
  white-space: nowrap;
}

table.data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
table.data tr[data-verdict='fail'] { background: #fdf1f1; }
table.data tr[data-verdict='warn'] { background: #fdf8e8; }

/* ── file drop ───────────────────────────────────────────────────────────── */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 34px 20px;
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: #fffdf5;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.drop:hover, .drop[data-over='true'] { background: #fff3d6; border-color: var(--orange); }
.drop-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.drop small { font-size: 0.8rem; }

/* ── footer ──────────────────────────────────────────────────────────────── */

.shelf-foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 18px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 3px solid var(--ink);
  padding-top: 16px;
}

.shelf-foot a { font-weight: 800; color: var(--orange-dark); text-decoration: none; }
.shelf-foot a:hover { text-decoration: underline; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .bar { padding: 8px 12px; gap: 8px; }
  .wrap { padding: 16px 12px 40px; }
  .panel { padding: 14px; box-shadow: 4px 4px 0 var(--ink); }
  .btn { padding: 9px 12px; font-size: 0.75rem; }
}
