@font-face { font-family: "Source Serif 4"; font-weight: 300; src: url("vendor/fonts/source-serif-4-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 400; src: url("vendor/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 600; src: url("vendor/fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #ffffff;
  --fg: #1c2954;
  --muted: #6b7491;
  --line: #dde1ea;
  --panel: #f5f6f9;
  --accent: #f6862d;
  --density: #2f4a9e;
  --dot-light: 46%;
  --font-head: "Tiempos Headline", "Source Serif 4", Georgia, serif;
  --font-body: "Founders Grotesk", "Hanken Grotesk", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --fg: #e6e8ee;
    --muted: #8d94a8;
    --line: #2a2e38;
    --panel: #1a1d23;
    --density: #9fb4f0;
    --dot-light: 66%;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
}

header {
  padding: 14px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* the sound switch: large, and loud in color while the sound is off */
.sound-button {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(246, 134, 45, 0.35);
}
.sound-button .icon { font-size: 20px; line-height: 1; }
.sound-button:hover { filter: brightness(1.05); }
.sound-button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: none; }

h1 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 300;
  font-size: 26px;
}

.eq { margin: 4px 0 0; font-family: var(--font-head); font-size: 17px; }
.eq i { font-family: var(--font-head); }

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  padding: 8px 20px 20px;
}

.panel {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.group { display: flex; flex-direction: column; gap: 8px; }
.group + .group { padding-top: 14px; border-top: 1px solid var(--line); }

h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
h2 .note { text-transform: none; letter-spacing: 0; font-weight: 400; }

.sliders { display: flex; flex-direction: column; gap: 6px; }

.row {
  display: grid;
  grid-template-columns: 78px 1fr 56px;
  align-items: center;
  gap: 8px;
}

.row[hidden] { display: none; }
.row > span { color: var(--muted); font-size: 14px; }
.row > select { grid-column: 2 / 4; }
.row output { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; }
.row sub, .row sup { font-size: 0.7em; }

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

input[type="range"] { width: 100%; accent-color: var(--accent); }

select, button {
  font: inherit;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

button { cursor: pointer; }

.buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }

.keys { grid-column: 2 / 4; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.keys button { padding: 3px 0; font-size: 13px; }

.toggle[aria-pressed="true"], .keys button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.chain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chain-list:empty { display: none; }
.chain-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}
.chain-list .swatch { width: 10px; height: 10px; border-radius: 50%; }
.chain-list .acc { font-variant-numeric: tabular-nums; }
.chain-list li { padding: 1px 7px; font-size: 12px; gap: 5px; }

.stats { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 2px 6px; text-align: right; }
.stats th { color: var(--muted); font-weight: 400; }
.stats th:first-child, .stats td:first-child { text-align: left; padding-left: 0; }
.stats td:first-child { color: var(--muted); }
.stats .off { color: var(--accent); font-weight: 600; }

.plot-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

#plot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: manipulation;
}

.hint {
  position: absolute;
  top: 8px;
  left: 52px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

@media (max-width: 760px) {
  header { padding: 12px 16px 4px; flex-wrap: wrap; }
  .sound-button { font-size: 15px; padding: 8px 16px; }
  h1 { font-size: 22px; }
  .layout { flex-direction: column; padding: 8px 16px 16px; }
  .panel { flex: none; overflow: visible; padding-right: 0; }
  .plot-wrap { flex: none; height: min(130vw, 85vh); order: -1; }
  body { height: auto; }
}
