/* Frequency Generator — brutalist mono design system
   Instrument Serif (display) + Inter (body)
   #ffffff bg / #ff2d20 accent / #000000 text
   Editorial center: narrow column, tool framed like a figure.
   Hard edges, 4px radius, flat fills, no shadows. */

:root {
  --bg: #ffffff;
  --ink: #000000;
  --accent: #ff2d20;
  --muted: #555555;
  --faint: #8a8a8a;
  --wash: #f6f6f4;
  --line: #000000;
  --line-soft: #d9d9d4;
  --radius: 4px;
  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 18px 72px; }

h1, h2, h3, .serif {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
}

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

.num { font-variant-numeric: tabular-nums; }

/* ---------- masthead ---------- */

.masthead {
  text-align: center;
  padding: 34px 0 20px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 26px;
}
.masthead h1 { font-size: 3rem; margin: 0; }
.masthead h1 em { color: var(--accent); font-style: italic; }
.masthead .dek { color: var(--muted); font-size: 1.02rem; margin: 8px auto 0; max-width: 34em; }
.masthead .kicker {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 3px 10px;
  margin-bottom: 14px;
}

/* ---------- the instrument (tool as a figure) ---------- */

.instrument {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
  margin: 0 0 10px;
}
.figcap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  padding: 8px 14px;
}
.figcap .live { color: var(--accent); font-weight: 600; display: none; }
.figcap .live.on { display: inline; }

.instrument-body { padding: 16px 14px 18px; }
@media (min-width: 560px) { .instrument-body { padding: 20px 22px 24px; } }

/* mode tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  flex: 1;
  min-width: 76px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--ink);
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tab:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode { display: none; }
.mode.active { display: block; }

/* big frequency readout */
.freq-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 6px 0 0; }
.freq-input {
  font-family: var(--display);
  font-size: 3.4rem;
  width: 240px;
  text-align: center;
  border: none;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  background: transparent;
  padding: 0 0 2px;
}
.freq-row .unit { font-family: var(--display); font-size: 1.4rem; color: var(--muted); }
.note-hint { text-align: center; color: var(--muted); font-size: 0.85rem; min-height: 1.4em; margin-top: 4px; }

.slider-row { margin: 14px 0 4px; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--faint);
  margin-top: 2px;
}

/* generic field rows */
.field-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.field-row label { font-size: 0.8rem; font-weight: 600; min-width: 84px; }
.field-row input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 120px; }
.field-row input[type="number"], .field-row select {
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 7px 9px;
  width: 108px;
}
.field-row select { width: auto; }
.field-note { font-size: 0.78rem; color: var(--muted); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-size: 0.8rem;
  padding: 6px 11px;
  cursor: pointer;
  font-family: var(--body);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip.accent { border-color: var(--accent); color: var(--accent); }
.chip.accent:hover { background: var(--accent); color: #fff; }

/* dual/binaural grids */
.ch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.ch-box { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 10px 12px; }
.ch-box h4 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.ch-box input[type="number"] {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-size: 1.05rem;
  padding: 7px 9px;
  font-family: var(--body);
}
.ch-box .mute { margin-top: 8px; font-size: 0.78rem; display: flex; gap: 6px; align-items: center; }

/* play + volume */
.play-row { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.btn-play {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--body);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 13px 18px;
  cursor: pointer;
}
.btn-play:hover { background: #e2200f; }
.btn-play.playing { background: var(--bg); color: var(--accent); }
.btn-ghost {
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: 0.35; cursor: default; }

.vol-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.vol-row label { font-size: 0.8rem; font-weight: 600; }
.vol-row input { flex: 1; accent-color: var(--accent); }
.vol-val { font-size: 0.82rem; width: 42px; text-align: right; }

.warn {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: #fff5f4;
  font-size: 0.85rem;
  padding: 9px 12px;
  margin-top: 12px;
  display: none;
}
.warn.show { display: block; }

/* scope */
.scope-wrap { border: 1.5px solid var(--ink); border-radius: var(--radius); margin-top: 16px; }
.scope-wrap canvas { width: 100%; height: 90px; display: block; }

/* tool sections */
.tool-section { border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 14px; }
.tool-section h3 {
  font-size: 0.72rem;
  font-family: var(--body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 10px;
}
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* saved presets */
.saved-list { list-style: none; margin: 8px 0 0; padding: 0; }
.saved-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.88rem;
}
.saved-list li b { flex: 1; font-weight: 600; }
.saved-list .mini {
  border: 1px solid var(--ink);
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
}
.saved-list .mini:hover { border-color: var(--accent); color: var(--accent); }
.saved-empty { color: var(--faint); font-size: 0.82rem; }

/* speaker check */
details.check { border: 1.5px solid var(--ink); border-radius: var(--radius); }
details.check summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
details.check summary::after { content: "+"; color: var(--accent); }
details.check[open] summary::after { content: "–"; }
.check-body { padding: 0 14px 14px; font-size: 0.88rem; color: var(--muted); }
.check-result { margin-top: 10px; font-size: 0.95rem; color: var(--ink); }
.check-result b { color: var(--accent); }
.check-bars { display: flex; gap: 3px; align-items: flex-end; height: 46px; margin-top: 10px; }
.check-bars .bar { flex: 1; background: var(--wash); border: 1px solid var(--line-soft); position: relative; }
.check-bars .bar.ok { background: var(--ink); border-color: var(--ink); }
.check-bars .bar.fail { background: #fff; }
.check-labels { display: flex; gap: 3px; font-size: 0.6rem; color: var(--faint); margin-top: 3px; }
.check-labels span { flex: 1; text-align: center; }

.kbd-hints { font-size: 0.75rem; color: var(--faint); margin-top: 16px; text-align: center; }
kbd {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0 5px;
  font-family: var(--body);
  font-size: 0.72rem;
  background: var(--wash);
}

/* ---------- article content below the tool ---------- */

.content h2 { font-size: 1.9rem; margin: 44px 0 12px; }
.content p { color: #222; }
.content .aside { color: var(--muted); font-size: 0.92rem; }

ol.steps { list-style: none; counter-reset: s; margin: 14px 0 0; padding: 0; }
ol.steps li {
  counter-increment: s;
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--line-soft);
  padding: 12px 0;
}
ol.steps li::before {
  content: counter(s);
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--accent);
  min-width: 22px;
  line-height: 1.2;
}

.feature-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 14px; }
.feature h3 { font-size: 1.15rem; margin: 0 0 5px; }
.feature p { font-size: 0.86rem; color: var(--muted); margin: 0; }

/* FAQ */
.faq details { border: 1.5px solid var(--ink); border-radius: var(--radius); margin-top: 8px; background: var(--bg); }
.faq summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.faq summary::after { content: "+"; color: var(--accent); flex: 0 0 auto; }
.faq details[open] summary::after { content: "–"; }
.faq .a { padding: 0 14px 12px; color: var(--muted); font-size: 0.9rem; }
.faq .a p { margin: 0 0 8px; }

/* cards */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .card-grid { grid-template-columns: 1fr 1fr; } }
a.card {
  display: block;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  color: var(--ink);
}
a.card:hover { border-color: var(--accent); }
a.card:hover h3 { color: var(--accent); }
a.card h3 { font-size: 1.15rem; margin: 2px 0 5px; }
a.card p { font-size: 0.84rem; color: var(--muted); margin: 0; }
a.card .tag {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}

/* footer */
.site-footer {
  border-top: 2px solid var(--ink);
  margin-top: 56px;
  padding-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
}
.site-footer p { margin: 0 0 6px; }

/* ---------- blog ---------- */

.blog-topbar {
  display: flex;
  justify-content: space-between;
  padding: 18px 0 14px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 26px;
  font-size: 0.85rem;
}
.blog-topbar a { text-decoration: none; font-weight: 600; }
.blog-wrap h1 { font-size: 2.4rem; margin: 0 0 6px; }
.blog-meta { color: var(--faint); font-size: 0.8rem; margin-bottom: 22px; }
.blog-wrap h2 { font-size: 1.7rem; margin: 36px 0 10px; }
.blog-wrap p { color: #222; }
.blog-wrap li { color: #222; }
.blog-illo { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 12px; margin: 22px 0; }
.blog-illo svg { width: 100%; height: auto; display: block; }
.blog-cta {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: #fff5f4;
  padding: 14px 16px;
  margin: 28px 0;
  font-size: 0.94rem;
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
