/* Notch — product styles. Loads AFTER supercala-app-tokens.css +
   supercala-topbar.css, so it inherits the studio palette + the icon-button
   and popover styling and only adds Notch's own layout + controls. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ---- Topbar brand (matches the other utility tools) ---- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand-mark { display: block; border-radius: 7px; }
.brand-stack { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-studio { font-size: 11px; color: var(--fg-dim); }

/* ---- Base buttons (topbar CSS only covers .btn.icon-only) ---- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 16px;
  background: var(--bg-elev-2);
  color: var(--fg);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
}
.btn:hover { background: var(--bg-elev-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-elev-3); }
.btn.tiny { padding: 4px 10px; border-radius: 7px; font-size: 15px; line-height: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Active toggle (e.g. "Stop background") — drop the primary azure so it reads
   as a stop affordance rather than a call to action. */
.btn.primary.playing {
  background: var(--bg-elev-3);
  color: var(--fg);
  border-color: var(--border);
}
.btn.primary.playing:hover { background: var(--bg-elev-2); }

/* ---- Layout ---- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 18px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.intro { text-align: center; padding: 8px 0 2px; }
.intro h1 { margin: 0 0 6px; font-size: clamp(22px, 4.5vw, 30px); letter-spacing: -0.02em; }
.intro .sub { margin: 0 auto; max-width: 52ch; color: var(--fg-dim); font-size: 15px; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.muted { color: var(--fg-dim); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---- Stage ---- */
.stage { display: flex; flex-direction: column; gap: 14px; }
.spectrum {
  width: 100%;
  height: 160px;
  display: block;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.stage-controls { display: flex; align-items: center; gap: 18px; }
.stage-readout { min-width: 0; }
.freq-readout { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.freq-readout .unit { font-size: 15px; color: var(--fg-dim); margin-left: 4px; font-weight: 600; }
.status { color: var(--fg-dim); font-size: 14px; margin-top: 6px; }

.play-btn {
  flex-shrink: 0;
  width: 76px; height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 162, 232, 0.35);
  transition: transform 80ms ease, background 120ms ease;
}
.play-btn:hover { background: var(--accent-strong); }
.play-btn:active { transform: scale(0.96); }
.play-btn svg { width: 26px; height: 26px; fill: currentColor; }
.play-btn .play-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.play-btn .ic-stop { display: none; }
.play-btn.playing .ic-play { display: none; }
.play-btn.playing .ic-stop { display: block; }

/* ---- Segmented controls ---- */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.seg-btn {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.seg-btn:hover { color: var(--fg); }
.seg-btn.is-active { background: var(--accent); color: var(--accent-fg); }
.seg-sm .seg-btn { font-size: 13px; padding: 7px 6px; }
.mode-help { margin: 12px 2px 0; color: var(--fg-dim); font-size: 14px; }

/* ---- Controls ---- */
.controls { display: flex; flex-direction: column; gap: 18px; }
.ctl { display: flex; flex-direction: column; gap: 8px; }
.ctl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ctl-head label { font-weight: 600; font-size: 14px; }
.ctl-val { color: var(--fg-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.ctl-sub { display: flex; justify-content: space-between; color: var(--fg-faint); font-size: 11px; }
.nudge { display: flex; align-items: center; gap: 8px; }

/* Range inputs — themed track + accent fill via color-scheme + accent-color. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--slider-track);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--slider-track);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.caution {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--amber);
}

/* Switch row */
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

#tone-actions { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- Bake + presets ---- */
.bake-head h2, .presets h2 { margin: 0 0 4px; font-size: 17px; }
.bake-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-dim); }
select, input[type="text"] {
  font: inherit;
  color: var(--fg);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
}
input[type="text"] { flex: 1; min-width: 160px; }
select { cursor: pointer; }

.preset-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.preset-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px 8px 14px;
}
.preset-item .pi-name { flex: 1; font-weight: 600; font-size: 14px; }
.preset-item .pi-meta { color: var(--fg-dim); font-size: 12px; }
.preset-item .btn { padding: 6px 12px; font-size: 13px; }

.foot { text-align: center; padding: 8px 4px 0; }
.foot a { color: var(--accent); }

@media (max-width: 520px) {
  .stage-controls { flex-direction: column; align-items: flex-start; gap: 14px; }
  .freq-readout { font-size: 26px; }
}
