:root {
  --ink: #161616;
  --bone: #e7e0cd;
  --page: #141414;
  --panel: rgba(10, 10, 10, 0.3);
  --control: rgba(0, 0, 0, 0.25);
  --lane: rgba(10, 10, 8, 0.45);
  --glass-blur: blur(10px) saturate(70%);
  --contour: #4a4940;
  --led: #d8261c;
  --orange: #e2672b;
  --mustard: #d9a62e;
  --teal: #4fa39a;
  --muted: #c2bcab;
  --line: 2px;
  --gap: 28px;

  --font-display: "Bowlby One", sans-serif;
  --font-label: "Staatliches", sans-serif;
  --font-text: "Staatliches", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page) url("../assets/topo.svg") center / cover fixed;
  color: var(--bone);
  font-family: var(--font-label);
  font-weight: 400;
  letter-spacing: 0.03em;
  -webkit-font-smoothing: antialiased;
}

.box-note,
.status {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--muted);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.svg-defs { position: absolute; width: 0; height: 0; }

.box-note,
.status,
.scope-key,
.output-empty p,
.site-footer p,
.btn,
.knob-label,
.knob-value { filter: url(#warp-xs); }

.masthead,
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

.masthead {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 48px;
  padding-bottom: 40px;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: clamp(64px, 12vw, 160px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--orange);
  filter: url(#warp);
  text-shadow: 0.04em 0.05em 0 rgba(0, 0, 0, 0.85), 0 0.1em 0.3em rgba(0, 0, 0, 0.55);
}

.tagline {
  margin: 18px 0 0;
  max-width: 44ch;
  font-size: clamp(24px, 2.1vw, 28px);
  line-height: 1.35;
  letter-spacing: 0.03em;
  text-wrap: balance;
  filter: url(#warp-sm);
}

.title { position: relative; }

.signature {
  position: absolute;
  right: -9%;
  bottom: -26%;
  width: 28%;
  height: auto;
  transform: rotate(-6deg);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.site-footer {
  padding: 20px 32px;
  text-align: center;
  font-family: var(--font-text);
  font-size: 16px;
  letter-spacing: 0.08em;
  line-height: 1.8;
  color: var(--bone);
  background: var(--panel);
  border-top: 1px solid var(--contour);
}
.site-footer p { margin: 0; }
.site-footer span { white-space: nowrap; }

.daw,
.board-section,
.box {
  min-width: 0;
  border: var(--line) solid var(--bone);
  background: var(--panel);
  padding: 20px 24px;

  box-shadow: 0 28px 50px -18px rgba(0, 0, 0, 0.8), 0 8px 18px rgba(0, 0, 0, 0.45);
}

.float {
  transform: translateY(calc(var(--drift, 0px) * var(--k, 1)));
  transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
}

.has-motion .float {
  transition: transform 0.4s ease-out, box-shadow 0.4s ease-out,
    translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.9s ease-out;
  transition-delay: 0s, 0s, var(--reveal-delay, 0s), var(--reveal-delay, 0s);
}
.has-motion .float:not(.is-inview) {
  opacity: 0;
  translate: 0 48px;
}

@media (prefers-reduced-motion: reduce) {
  .float { transform: none; transition: none; }
  .has-motion .float:not(.is-inview) { opacity: 1; translate: none; }
}

.box-label {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: inherit;
  letter-spacing: 0.05em;
  color: var(--mustard);
  filter: url(#warp-sm);
}

.box-note { margin: 12px 0 0; }

.btn {
  font: inherit;
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--bone);
  background: var(--control);
  border: var(--line) solid var(--bone);
  border-radius: 0;
  padding: 9px 16px;
  cursor: pointer;
}

.btn:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--bone); }
.btn:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn.is-active,
.btn--solid {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink);
}
.btn--solid:disabled {
  background: transparent;
  border-color: var(--contour);
  color: var(--muted);
  opacity: 0.7;
  cursor: not-allowed;
}

.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  padding-right: 40px;
}

.wave {
  width: 100%;
  height: 48px;
  display: block;
}

.board-section {
  margin-top: var(--gap);
}

.board-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.board-bar p { margin: 0; font-size: 16px; letter-spacing: 0.06em; filter: url(#warp-sm); }
.chain { color: var(--teal); }

.status {
  margin: 0;
  min-height: 1.6em;
}

.outputs {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}
.outputs .box { display: flex; flex-direction: column; }
.outputs .wave { flex: 1; min-height: 110px; }
.outputs .sine { flex: 1 1 220px; height: auto; min-height: 220px; }

.sine {
  width: 100%;
  height: 220px;
  display: block;
}

.scope-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 24px;
  margin-top: 12px;
}
.scope-foot .box-note { margin: 0; }

.scope-key {
  display: flex;
  gap: 18px;
  margin: 0;
  font-family: var(--font-text);
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.scope-key span::before {
  content: "";
  display: inline-block;
  width: 22px;
  margin-right: 8px;
  vertical-align: middle;
}
.key-clean::before { border-top: 2px dashed var(--bone); opacity: 0.55; }
.key-wet::before { border-top: 2px solid var(--teal); }

.download { width: 100%; margin-top: 14px; }

.ab {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.ab-btn { padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.outputs .download { margin-top: auto; }
.outputs #levels { margin: 12px 0 16px; }

.output-empty { display: none; }
.output-box.is-empty .output-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 8px;
  text-align: center;
}
.output-empty p {
  margin: 0;
  max-width: 26ch;
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--muted);
}
.output-box.is-empty :is(.wave, .ab, #levels, .download) { display: none; }

main { padding-bottom: 48px; }

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 22px;
  padding: 48px 0 56px;
  align-items: start;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 24px;
  filter: url(#warp-sm);
  letter-spacing: 0.08em;
  padding: 80px 0;
  animation: blink 1.2s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.pedal {
  container-type: inline-size;
  position: relative;
  aspect-ratio: 74 / 120;
  border-radius: 6% / 3.7%;
  background: var(--body);
  color: var(--print);
  transform: translateY(var(--drop)) rotate(calc(var(--tilt) + var(--shake, 0deg) * var(--wobble, 0)));
  transition: transform 0.25s ease-out, filter 0.25s ease, opacity 0.25s ease;
  box-shadow: 0 0 0 1px var(--contour), 0 12px 22px rgba(0, 0, 0, 0.55);
}

.pedal:not(.is-on) {
  filter: saturate(0.5) brightness(0.72);
  opacity: 0.88;
}
.pedal:not(.is-on):hover,
.pedal:not(.is-on):focus-within {
  filter: saturate(0.75) brightness(0.88);
  opacity: 1;
}

.pedal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 30% 15%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(120% 90% at 70% 100%, rgba(0, 0, 0, 0.22), transparent 65%);
  background-size: 160px 160px, 100% 100%, 100% 100%;
  mix-blend-mode: overlay;
  opacity: 0.55;
}

.face {
  position: absolute;
  top: 5cqw;
  left: 6cqw;
  right: 6cqw;
  height: 101cqw;
  border: 1.2cqw solid var(--print);
  border-radius: 2cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 17cqw 2cqw 5cqw;
}

.led {
  position: absolute;
  top: 9cqw;
  left: 50%;
  width: 8cqw;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1.4cqw solid var(--contour);
  background: #3b1412;
  z-index: 1;
}
.pedal.is-on .led {
  background: var(--led);
  box-shadow: 0 0 4cqw var(--led);
}

.knobs {
  display: flex;
  justify-content: space-around;
  width: 100%;
}

.knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5cqw;
}

.knob {
  position: relative;
  width: 18cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--print);
  transform: rotate(var(--angle, 0deg));
  cursor: ns-resize;
  touch-action: none;
}
.knobs--2 .knob { width: 21cqw; }
.knobs--1 .knob { width: 22cqw; }

.knob-pointer {
  position: absolute;
  left: 50%;
  top: 7%;
  width: 11%;
  height: 40%;
  transform: translateX(-50%);
  border-radius: 1cqw;
  background: var(--body);
}

.knob:focus-visible { outline: 1cqw solid var(--print); outline-offset: 1.5cqw; }

.knob-label { font-size: max(9px, 6.6cqw); letter-spacing: 0.04em; line-height: 1; }
.knob-value {
  font-family: var(--font-text);
  font-size: max(9px, 6.6cqw);
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.25em 0.2em;
  border-radius: 4px;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.knob-wrap:has(.knob:focus-visible) .knob-value,
.knob-wrap:has(.is-dragging) .knob-value { background: var(--print); color: var(--body); }

.pedal-name {
  margin: auto 0 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 15cqw;
  letter-spacing: 0.02em;
  line-height: 1;
  filter: url(#warp);
}
.pedal-name[data-long] { font-size: 12cqw; }

.pedal-sub {
  margin: 2.5cqw 0 0;
  font-size: 7cqw;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  filter: url(#warp-sm);
}

.treadle {
  position: absolute;
  left: 8cqw;
  right: 8cqw;
  top: 110cqw;
  bottom: 7cqw;
  font: inherit;
  font-size: 10cqw;
  letter-spacing: 0.1em;
  color: var(--print);
  background: var(--body);
  border: 1.2cqw solid var(--print);
  border-radius: 2cqw;
  cursor: pointer;
}
.treadle-text { display: inline-block; filter: url(#warp-sm); }
.treadle[aria-pressed="true"] { background: var(--print); color: var(--body); }
.treadle:active { transform: translateY(0.8cqw); }
.treadle:focus-visible { outline: 1cqw solid var(--print); outline-offset: 1.5cqw; }

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(4, 1fr); row-gap: 48px; }
  .outputs { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .masthead, main, .site-footer { padding-left: 16px; padding-right: 16px; }
  .tagline { font-size: 22px; }
  .outputs { grid-template-columns: 1fr; }
  .daw, .board-section, .box { padding: 16px; }
  .sine, .outputs .sine { height: 170px; min-height: 170px; flex-basis: 170px; }
  .chain { display: none; }

  .board {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 12px;
    padding: 36px 12px 56px;
    scrollbar-width: none;
  }
  .board::-webkit-scrollbar { display: none; }
  .pedal-slot {
    flex: 0 0 min(42%, 180px);
    scroll-snap-align: start;
    transform: none !important;
  }
}
