/* Layout: rehearsal-room console — a narrow column of panels, readouts set in a mono "display" face,
   cobalt for controls, signal orange for the beat / live state. */
:root {
  --bg: #eceef3;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --ink: #141a2b;
  --muted: #586179;
  --line: #d4d8e2;
  --accent: #2b47d4;
  --accent-ink: #ffffff;
  --accent-soft: #e3e8fd;
  --signal: #e2560b;
  --signal-soft: #fde8db;
  --good: #1f8a4c;
  --bad: #c62f3a;
  --key-white: #ffffff;
  --key-black: #1b2033;

  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Instrument Sans", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --f-mono: "Martian Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --r: 14px;
  --r-sm: 9px;
  --step--1: 0.84rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.6rem;
  --step-3: clamp(1.9rem, 4.5vw, 2.6rem);
  --step-4: clamp(2.3rem, 7vw, 3.6rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1220; --surface: #171c2d; --surface-2: #1d2337; --ink: #e9ecf4; --muted: #9ba4ba;
    --line: #2b3250; --accent: #8096ff; --accent-ink: #0e1220; --accent-soft: #232c52;
    --signal: #ff8a42; --signal-soft: #3a2518; --good: #4cc882; --bad: #ff6b74;
    --key-white: #dfe3ee; --key-black: #0b0e18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1220; --surface: #171c2d; --surface-2: #1d2337; --ink: #e9ecf4; --muted: #9ba4ba;
  --line: #2b3250; --accent: #8096ff; --accent-ink: #0e1220; --accent-soft: #232c52;
  --signal: #ff8a42; --signal-soft: #3a2518; --good: #4cc882; --bad: #ff6b74;
  --key-white: #dfe3ee; --key-black: #0b0e18;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 980px; margin: 0 auto; padding-inline: 16px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand .dot { color: var(--signal); }
.head-link { font-size: var(--step--1); font-weight: 600; text-decoration: none; color: var(--muted); }
.head-link:hover { color: var(--accent); }

/* Page intro */
.intro { padding-block: 36px 20px; display: grid; gap: 10px; }
.eyebrow { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--signal); margin: 0; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -0.02em; text-wrap: balance; margin: 0; line-height: 1.12; }
h1 { font-size: var(--step-3); font-weight: 700; }
.lede { margin: 0; color: var(--muted); max-width: 62ch; font-size: var(--step-1); line-height: 1.45; }

/* Home grid */
.home-intro { padding-block: 48px 28px; }
.home-intro h1 { font-size: var(--step-4); max-width: 16ch; }
.staff { display: block; width: 100%; height: 34px; margin-top: 8px; color: var(--line); }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-bottom: 56px; }
.tile {
  display: grid; gap: 8px; align-content: start;
  padding: 20px; min-height: 168px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px -14px var(--accent); }
.tile svg { width: 40px; height: 40px; color: var(--accent); }
.tile .t-name { font-family: var(--f-display); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.01em; line-height: 1.2; }
.tile .t-desc { color: var(--muted); font-size: var(--step--1); line-height: 1.4; }
.tile .t-cat { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 640px) {
  .tool-grid { gap: 10px; }
  .tile { padding: 14px 10px; min-height: 0; justify-items: center; text-align: center; }
  .tile .t-desc, .tile .t-cat { display: none; }
  .tile .t-name { font-size: 0.95rem; }
  .tile svg { width: 34px; height: 34px; }
}

.promise { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 4px 0 0; list-style: none; color: var(--muted); font-size: var(--step--1); }
.promise li::before { content: "● "; color: var(--signal); font-size: 0.7em; vertical-align: 2px; }

/* Tool panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 4vw, 28px); display: grid; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.spread { justify-content: space-between; }
.stack { display: grid; gap: 8px; }
.label { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.readout { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.readout.xl { font-size: clamp(3.4rem, 15vw, 6.2rem); }
.readout.lg { font-size: clamp(2rem, 8vw, 3rem); }
.sub { color: var(--muted); font-size: var(--step--1); }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: var(--r-sm); padding: 10px 16px; font-weight: 600; cursor: pointer; line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary.live { background: var(--signal); border-color: var(--signal); }
.btn.big { font-size: 1.1rem; padding: 14px 28px; min-width: 140px; }
.btn.sq { width: 44px; padding: 0; font-family: var(--f-mono); font-size: 1.2rem; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-size: var(--step--1); font-weight: 600; cursor: pointer; min-height: 36px;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

input[type="number"], input[type="text"], select, textarea {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 12px; min-height: 44px; max-width: 100%;
}
input[type="number"] { width: 7.5em; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
textarea { width: 100%; font-family: var(--f-mono); font-size: 0.86rem; line-height: 1.6; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 32px; }
select { padding-right: 32px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--f-mono); font-size: 0.88rem; }
tr.hl td { background: var(--accent-soft); }
.copyable { cursor: pointer; }
.copyable:hover { color: var(--accent); }

.notice { background: var(--signal-soft); border-radius: var(--r-sm); padding: 10px 14px; font-size: var(--step--1); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: var(--step--1); font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* Article / SEO text */
.article { padding-block: 36px 8px; display: grid; gap: 14px; max-width: 68ch; }
.article h2 { font-size: var(--step-2); margin-top: 10px; }
.article h3 { font-size: var(--step-1); margin-top: 4px; }
.article p, .article ul, .article ol { margin: 0; }
.article ul, .article ol { padding-left: 1.2em; display: grid; gap: 4px; }

/* More tools */
.more { padding-block: 32px 48px; display: grid; gap: 14px; }
.more h2 { font-size: var(--step-1); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.more-grid a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.92rem; }
.more-grid a:hover { border-color: var(--accent); }
.more-grid svg { width: 24px; height: 24px; color: var(--accent); flex: none; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1); }
.site-foot .wrap { padding-block: 22px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
[hidden] { display: none !important; }
