/*
 * Ultimate 808 design pass, owned by the site (like host-navigation.css).
 * The instrument bundle in ./assets is pinned from the 808 source, so these
 * rules only restyle it: no ids, classes or behaviour change.
 */

@font-face {
  font-family: '808 Mono';
  src: url('./fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2022, U+2212;
}

:root {
  --mono: '808 Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: #202328;
  --bg: var(--st-background);
  --panel: var(--st-surface);
  --panel-2: var(--st-raised);
  --sunk: #202328;
  --ink: var(--st-text);
  --muted: var(--st-muted);
  --dim: #a2a8af;
  --hot: var(--st-action);
  --ready: var(--st-success);
  --line: #4b5159;
  --track: #4b5159;
  --radius: var(--st-radius-panel);
  /* The TR-808's step keys run red, orange, yellow, cream, one colour per beat. */
  --beat-1: #ec5a3c;
  --beat-2: #f28a2e;
  --beat-3: #ecc444;
  --beat-4: #e8dfd0;
  --on-ink: #17120f;
}

/* ---------- Type ---------- */

button {
  letter-spacing: 0.01em;
}

.topbar > .brand > .tools-return {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

:is(.perf__readout, .octave b, .field--bpm input) {
  font-family: var(--mono);
  font-weight: 500;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* ---------- Performance surface ---------- */

.pad {
  box-shadow: inset 0 -3px 0 #0000001f;
  transition:
    background-color 0.08s ease,
    box-shadow 0.08s ease,
    transform 0.08s ease;
}

.pad--sharp {
  box-shadow: inset 0 -3px 0 #00000059;
}

.pad.playing {
  box-shadow: inset 0 1px 0 #0000002e;
}

@media (hover: hover) {
  .pad:not(.pad--sharp):not(.pad--accent):not(.playing):hover {
    background: #ebe6e0;
    border-color: #ebe6e0;
  }

  .pad--sharp:not(.playing):hover {
    background: #3e3b44;
  }
}

.octave {
  font-size: 11px;
}

.octave b {
  display: inline-block;
  min-width: 3ch;
  font-size: 13px;
}

.transport {
  align-items: center;
}

.transport .field--bpm {
  display: grid;
  grid-template-columns: auto 76px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* The meter and the readout read as one small display. */
.perf__readout {
  display: block;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--display);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 801px) {
  .perf__side .meter {
    position: relative;
    z-index: 1;
    height: 3px;
    margin-inline: 9px;
    border-radius: 0 0 2px 2px;
    background: transparent;
    /* Drawn along the top inside edge of the readout below it. */
    transform: translateY(14px);
  }

  .perf__readout {
    padding-top: 11px;
  }
}

/* ---------- Pattern ---------- */

/* Labels sit on the same left edge as the fields they name. */
.deck--sequencer :is(.picker, .stepper, .field) {
  justify-items: stretch;
  text-align: left;
}

.deck--sequencer .control__label {
  justify-self: start;
  text-align: left;
}

/* Swing: dial and value side by side, so it lines up with the fields beside it. */
.deck--sequencer .knob {
  grid-template-columns: var(--dial) minmax(0, 1fr);
  grid-template-rows: 16px var(--dial);
  justify-items: start;
  column-gap: 10px;
}

.deck--sequencer .knob .control__label {
  grid-column: 1 / -1;
}

.deck--sequencer .knob__value {
  text-align: left;
}

@media (min-width: 1101px) {
  .deck--sequencer .knob {
    --dial: 40px;
    grid-template-rows: 16px 40px;
  }
}

@media (max-width: 520px) {
  .deck--sequencer .knob {
    grid-template-rows: 20px var(--dial);
  }
}

.step {
  --beat: var(--beat-1);
  overflow: hidden;
}

.step:nth-child(16n + 5),
.step:nth-child(16n + 6),
.step:nth-child(16n + 7),
.step:nth-child(16n + 8) {
  --beat: var(--beat-2);
}

.step:nth-child(16n + 9),
.step:nth-child(16n + 10),
.step:nth-child(16n + 11),
.step:nth-child(16n + 12) {
  --beat: var(--beat-3);
}

.step:nth-child(16n + 13),
.step:nth-child(16n + 14),
.step:nth-child(16n + 15),
.step:nth-child(16n + 16) {
  --beat: var(--beat-4);
}

/* Beat colour strip on every key; the colours already mark each beat,
   so the old left-edge beat rule goes. */
.steps .step,
.steps .step:not(.on):nth-child(4n + 1) {
  border-left-width: 1px;
  border-left-color: #383942;
}

.step::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--beat);
  opacity: 0.6;
}

.steps .step.on {
  color: var(--on-ink);
  background: var(--beat);
  border-color: var(--beat);
  box-shadow: inset 0 -3px 0 #00000026;
}

.step.on::before {
  display: none;
}

@media (hover: hover) {
  .steps .step:not(.on):hover {
    color: var(--ink);
    background: #30313a;
  }

  .step:not(.on):hover::before {
    opacity: 1;
  }
}

.step.accent::after {
  content: '';
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Sound ---------- */

@media (hover: hover) {
  .knob:hover .knob__cap {
    background: radial-gradient(circle at 35% 25%, #52535e, #30313a 65%, #24252c);
  }
}

/* ---------- Desktop edition ---------- */
/* Quieter than the instrument above it: no glows, no tilted visual. */

.desktop-edition__intro {
  background: var(--panel);
}

.desktop-edition__intro h2 {
  max-width: 14ch;
  margin: 16px 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.desktop-edition__formats span {
  border-color: var(--line);
  color: var(--muted);
}

.desktop-edition__visual {
  min-height: 280px;
  border-color: var(--line);
  background: var(--sunk);
}

.desktop-edition__wave {
  transform: none;
}

.desktop-edition__wave i {
  width: 3px;
  background: var(--hot);
  box-shadow: none;
  opacity: calc(0.35 + 0.65 * var(--wave));
}

.desktop-edition__offer--featured {
  background: var(--sunk);
}

@media (max-width: 520px) {
  .desktop-edition__visual {
    min-height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pad {
    transition: none;
  }
}

/* Shared SuperTime identity; the four beat-bank colors still identify rhythm groups. */
body { font-family: var(--st-font-ui); }
button { border-radius: var(--st-radius-control); }
.topbar > .brand > .tools-return { gap: 8px; }
.tools-return img { width: 24px; height: 24px; flex: none; }
.power:not(:disabled), .transport__play { background: var(--st-action); color: var(--st-on-action); }
.power:not(:disabled):hover, .transport__play:hover { background: var(--st-action-hover); }
:where(button, input, select, summary, a):focus-visible { outline-color: var(--st-focus); }
