@font-face {
  font-family: "Helvetica Now Display";
  src: url("/fonts/HelveticaNowDisplayMedium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fafafa;
  --ink: #111;
  --grey: #767676;
  --faint: #b4b4b4;
  --line: #e3e3e3;
  --hot: #ff4a1c;
  --gutter: 40px;
  --small: 12px;
  --text: 15px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 var(--text)/1.35 "Helvetica Now Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, p, ul, ol { margin: 0; padding: 0; font-weight: 500; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--faint); }
a:hover { text-decoration-color: var(--ink); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { color: var(--faint); cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

.top, main, footer { max-width: 1320px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.top { display: flex; align-items: baseline; gap: 32px; padding-top: 28px; }
.mark { text-decoration: none; font-size: var(--text); }
.about { color: var(--grey); max-width: 56ch; text-wrap: balance; }

/* asking */
.ask { padding: 96px 0 72px; }
#form { display: flex; align-items: flex-end; gap: 24px; border-bottom: 1px solid var(--ink); padding-bottom: 14px; }
#prompt {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; padding: 0; overflow: hidden;
  font: inherit; font-size: clamp(30px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.02em; color: var(--ink);
}
#prompt::placeholder { color: var(--faint); opacity: 1; }
#go { font-size: var(--text); line-height: 1; height: 44px; padding: 0 20px; background: var(--ink); color: var(--bg); border-radius: 8px; white-space: nowrap; flex: none; }
#go:disabled { background: var(--line); color: var(--grey); }
.note { color: var(--grey); font-size: var(--small); line-height: 1.4; margin-top: 12px; text-wrap: pretty; }

/* a sound */
.sound { padding: 96px 0 56px; }
.sound h1 { font-size: clamp(30px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
.working .sound h1::after { content: ""; display: inline-block; width: 0.16em; height: 0.16em; margin-left: 0.16em; border-radius: 50%; background: var(--hot); animation: breathe 1.4s var(--ease) infinite alternate; }
@keyframes breathe { from { opacity: 0.2; } to { opacity: 1; } }
.words { margin-top: 16px; color: var(--grey); max-width: 60ch; text-wrap: pretty; }
.desc { margin-top: 4px; max-width: 60ch; text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 28px; }
.actions button, .actions a, .keys-head button, .feed li button, .heard button {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--faint);
}
.actions button:hover, .keys-head button:hover, .feed li button:hover:not(:disabled), .heard button:hover { text-decoration-color: var(--ink); }

/* instrument and steps */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 56px; align-items: start; }
.work:has(.steps[hidden]) { grid-template-columns: minmax(0, 1fr); }
.instrument { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 32px; }
.sec { grid-column: span var(--span, 1); border-top: 1px solid var(--line); padding: 14px 0 28px; min-width: 0; transition: opacity 0.4s var(--ease); }
.sec.off > :not(.sec-head) { opacity: 0.28; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
h2 { font-size: var(--text); line-height: 1.35; }
.state { color: var(--grey); font-size: var(--small); }
.sec:not(.off) .state { color: var(--ink); }
.view { display: block; width: 100%; height: 72px; margin-top: 12px; }
.view-env, .view-lfo { height: 48px; }
.extra { color: var(--grey); font-size: var(--small); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dials { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 16px 6px; margin-top: 16px; }
.dial { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.dial svg { display: block; overflow: visible; }
.dial path, .dial line { fill: none; stroke-linecap: round; }
.dial .track { stroke: var(--line); stroke-width: 1.5; }
.dial .fill { stroke: var(--ink); stroke-width: 1.5; }
.dial .hand { stroke: var(--ink); stroke-width: 1.5; }
.dial .modarc { stroke: var(--hot); stroke-width: 1.5; }
.dial .live { fill: var(--hot); display: none; }
.label, .value { display: block; font-size: var(--small); line-height: 1.25; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dial .label { margin-top: 5px; }
.value { color: var(--grey); font-variant-numeric: tabular-nums; }
.dial.changed .label, .choice.changed .label { animation: touched 2.2s var(--ease); }
@keyframes touched { 0%, 55% { color: var(--hot); } 100% { color: var(--ink); } }
.texts { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 16px; }
.choice { text-align: left; }
.macros { --span: 4; }
.instrument { border-top: 1px solid var(--ink); }
.instrument > .sec:nth-child(-n + 3) { border-top-color: transparent; }
.macros .dials { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 420px; }
.macros .unused { display: none; }
.mods ul { margin-top: 10px; columns: 2; column-gap: 32px; }
.mods li { display: flex; gap: 6px; padding: 5px 0; break-inside: avoid; font-size: var(--small); line-height: 1.4; }
.mods .to { color: var(--faint); }
.mods .amt { color: var(--hot); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mods .none { color: var(--grey); }

.steps { position: sticky; top: 0; border-top: 1px solid var(--ink); padding: 14px 0 0; max-height: 100vh; display: flex; flex-direction: column; }
.steps ol { overflow-y: auto; margin-top: 10px; padding-bottom: 24px; scrollbar-width: thin; }
.steps li { padding: 7px 0; font-size: var(--small); line-height: 1.4; display: grid; grid-template-columns: 22px minmax(0, 1fr); animation: arrive 0.5s var(--ease); }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.steps .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.steps .did .body { color: var(--grey); }
.steps .say { grid-template-columns: minmax(0, 1fr); font-size: var(--text); line-height: 1.35; padding: 12px 0 8px; text-wrap: pretty; }
.steps .miss { color: var(--faint); }
.heard .body { display: grid; gap: 4px; }
.heard button { justify-self: start; font-size: var(--text); line-height: 1.35; }
.heard .meta { color: var(--grey); }
.heard img { display: block; width: 100%; height: auto; margin-top: 6px; mix-blend-mode: multiply; }

/* keyboard */
.keys-box { border-top: 1px solid var(--ink); padding: 14px 0 0; margin-top: 28px; }
.keys-head { display: flex; align-items: baseline; gap: 24px; }
.keys-head .note { margin: 0; flex: 1; }
.keys { --w: calc(100% / var(--whites)); position: relative; display: flex; height: 132px; margin-top: 16px; touch-action: none; user-select: none; -webkit-user-select: none; }
.key { flex: 1; border: 1px solid var(--ink); border-left-width: 0; background: var(--bg); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; transition: background 0.12s var(--ease); }
.key:first-child { border-left-width: 1px; }
.key span { font-size: var(--small); color: var(--faint); pointer-events: none; }
.key.black { position: absolute; top: 0; left: calc(var(--at) * var(--w) - var(--w) * 0.3); width: calc(var(--w) * 0.6); height: 60%; flex: none; background: var(--ink); border: 0; z-index: 1; padding: 0; }
.key.down { background: var(--hot); }

/* stream */
.feed { border-top: 1px solid var(--ink); padding: 14px 0 0; margin-top: 72px; }
.feed ul { margin-top: 10px; }
.feed li { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: baseline; border-top: 1px solid var(--line); padding: 11px 0; }
.feed li:first-child { border-top: 0; }
.feed li.arrived { animation: arrive 0.6s var(--ease); }
.feed li button { text-align: left; }
.feed .what { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; text-decoration: none; }
.feed .prompt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .what:hover .prompt { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.feed .name { color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .name.now { color: var(--hot); }

footer { padding-top: 72px; padding-bottom: 56px; color: var(--grey); font-size: var(--small); line-height: 1.4; }
footer p { max-width: 70ch; text-wrap: pretty; }

@media (max-width: 1080px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .steps { position: static; max-height: none; margin-top: 28px; }
  .working .steps { max-height: 46vh; order: -1; margin: 0 0 40px; }
  .work { display: flex; flex-direction: column; align-items: stretch; }
}
@media (max-width: 720px) {
  :root { --gutter: 20px; }
  .top { flex-direction: column; gap: 6px; padding-top: 20px; }
  .ask, .sound { padding: 56px 0 44px; }
  #form { flex-direction: column; align-items: stretch; gap: 20px; border-bottom: 0; padding-bottom: 0; }
  #prompt { border-bottom: 1px solid var(--ink); padding-bottom: 12px; }
  .instrument { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .sec { grid-column: span min(var(--span, 1), 2); }
  .macros, .mods { grid-column: span 2 !important; }
  .mods ul { columns: 1; }
  .keys { height: 112px; overflow: hidden; }
  .keys .key:nth-child(n + 26) { display: none; }
  .keys { --whites: 15 !important; }
  .keys-head { flex-wrap: wrap; gap: 4px 20px; }
  .keys-head .note { flex-basis: 100%; order: 3; }
  .feed .what { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .feed .prompt { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
