/* =============================================================
   SP-1, every control on one horizontal plane.
   Large artwork on the left, groups scrolling left to right.
============================================================= */
*, *::before, *::after { box-sizing: border-box; }

body.sp1 {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--red) 45%, transparent); }
a:hover { text-decoration-color: var(--red); }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }
.wrap { width: min(100% - 32px, 1440px); margin-inline: auto; }
.mono { font-family: var(--mono); }

/* ---- header ------------------------------------------------ */
.hd {
  border-bottom: 1px solid var(--line); flex: none;
  position: relative; z-index: 60;   /* above the sticky artwork on mobile */
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.hd__bar {
  height: 56px; display: grid; align-items: center; gap: 16px;
  grid-template-columns: 1fr auto 1fr;   /* the mark sits dead centre */
}
.hd__right { display: flex; align-items: center; gap: 8px; justify-self: end; }

/* ---- the plane --------------------------------------------- */
/* The plane fills the viewport under the header. The footer sits below it. */
.sp1page {
  height: calc(100dvh - 57px);
  display: flex; flex-direction: column; min-height: 0;
}
.stage {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr;
}
@media (min-width: 1000px) { .stage { grid-template-columns: minmax(380px, 32vw) 1fr; } }

/* ---- the artwork ------------------------------------------- */
.art {
  border-bottom: 1px solid var(--line);
  padding: 20px 24px; display: flex; align-items: center; justify-content: center;
}
@media (min-width: 1000px) {
  .art { border-bottom: 0; border-right: 1px solid var(--line); padding: 28px 34px; }
}
.art__inner { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 18px; }
.art .device { width: 100%; height: auto; display: block; }
.art__read { border-top: 1px solid var(--line-2); padding-top: 14px; min-height: 68px; }
.art__name { font-size: 1.05rem; font-weight: 650; letter-spacing: -.015em; margin-bottom: .2rem; }
.art__what { font-size: .88rem; color: var(--ink-3); line-height: 1.5; }

/* the device, drawn from /theme.css tokens */
.device .body { fill: var(--paper-3); stroke: var(--line); stroke-width: 1.4; }
.device .body-panel { fill: color-mix(in srgb, var(--paper-2) 70%, var(--paper-3)); stroke: var(--line); stroke-width: 1.4; }
.device .slot { fill: color-mix(in srgb, var(--ink) 9%, transparent); }
.device .usb { fill: color-mix(in srgb, var(--ink) 16%, transparent); }
.device .vu circle { fill: color-mix(in srgb, var(--ink) 18%, transparent); }
.device .num { fill: var(--ink-3); font: 600 11px var(--sans); text-anchor: middle; }
.device .part {
  fill: color-mix(in srgb, var(--ink) 20%, var(--paper-3));
  stroke: var(--line); stroke-width: 1;
  transition: fill .2s var(--ease), stroke .2s var(--ease), filter .2s var(--ease);
}
.device .knob { fill: var(--paper-2); }
.device .btn  { fill: color-mix(in srgb, var(--ink) 12%, var(--paper-3)); }
.device .led  { fill: color-mix(in srgb, var(--ink) 22%, transparent); stroke: none; }
.device .marker { fill: color-mix(in srgb, var(--red) 55%, var(--paper-3)); stroke: none; }
.device .part.is-hot {
  fill: var(--red); stroke: var(--red);
  filter: drop-shadow(0 0 9px color-mix(in srgb, var(--red) 55%, transparent));
}
.device .marker.is-hot { fill: var(--red); }

/* ---- the tape, running -------------------------------------
   The reels turn, the VU steps and a lit control breathes, so the plate
   reads as a machine that is on rather than a diagram of one. Slow enough
   to sit beside text you are reading.
------------------------------------------------------------- */
.device .reel-well { fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.device .reel-rim  { fill: none; stroke: var(--line-strong); stroke-width: 1.2; }
.device .reel-spoke { stroke: color-mix(in srgb, var(--ink) 22%, transparent); stroke-width: 1.4; stroke-linecap: round; }
.device .reel-hub  { fill: var(--ink-3); }
.device .tape { fill: none; stroke: color-mix(in srgb, var(--ink) 26%, transparent); stroke-width: 1.6; }
.device .reel { animation: reel 7s linear infinite; }
.device .reel:nth-of-type(2) { animation-duration: 9s; }
@keyframes reel { to { transform: rotate(360deg); } }

.device .vu circle { animation: vu 1.9s var(--ease) infinite; }
.device .vu circle:nth-child(2) { animation-delay: .12s; }
.device .vu circle:nth-child(3) { animation-delay: .24s; }
.device .vu circle:nth-child(4) { animation-delay: .36s; }
.device .vu circle:nth-child(5) { animation-delay: .48s; }
@keyframes vu {
  0%, 62%, 100% { fill: color-mix(in srgb, var(--ink) 18%, transparent); }
  20%, 40%      { fill: color-mix(in srgb, var(--red) 62%, transparent); }
}

.device .part.is-hot { animation: hot 1.6s var(--ease) infinite; }
@keyframes hot {
  50% { filter: drop-shadow(0 0 16px color-mix(in srgb, var(--red) 75%, transparent)); }
}

@media (prefers-reduced-motion: reduce) {
  .device .reel, .device .vu circle, .device .part.is-hot { animation: none; }
}

.device .label text { fill: var(--ink-3); font: 700 9.5px var(--sans); letter-spacing: .1em; }
.device .leader line { stroke: var(--line); stroke-width: 1; }

/* ---- the horizontal track ---------------------------------- */
.track {
  display: flex; gap: 0; min-height: 0;
  overflow-x: auto; overflow-y: hidden;
  /* No smooth behaviour and no snap here: both fight a wheel handler that
     writes scrollLeft every event, which is what made this stutter. */
  scroll-behavior: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none; outline-offset: -3px;
}
.track::-webkit-scrollbar { display: none; }

.panel {
  flex: 0 0 auto; width: clamp(272px, 25vw, 340px);
  scroll-snap-align: start;
  border-right: 1px solid var(--line-2);
  padding: 22px 20px 26px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; scrollbar-width: thin;
}
.panel[hidden] { display: none; }
.panel__head { flex: none; }
.panel__n { font-family: var(--mono); font-size: .66rem; font-weight: 700; color: var(--red); letter-spacing: .1em; }
.panel__name { font-size: 1.12rem; margin: .3rem 0 .2rem; }
.panel__intent { font-size: .8rem; color: var(--ink-3); line-height: 1.45; }
.panel__moves { display: flex; flex-direction: column; gap: 9px; }

/* ---- a move ------------------------------------------------ */
.move {
  position: relative; isolation: isolate;
  border: 1px solid var(--line); border-radius: 13px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-2) 82%, #fff) 0%, var(--paper-2) 42%, var(--paper-3) 100%);
  padding: 13px 15px 14px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .03), 0 10px 20px -18px rgba(0, 0, 0, .5);
  transition: border-color .18s var(--ease), transform .18s var(--ease),
              box-shadow .18s var(--ease), background .18s var(--ease);
  outline-offset: 2px;
}
/* The gloss: one highlight across the top edge, and a rail down the left that
   fills red when the card is the one you are reading. */
.move::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 1px; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85) 22%, rgba(255, 255, 255, .85) 78%, transparent);
  opacity: .7; pointer-events: none;
}
:root[data-theme='dark'] .move::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .13) 30%, rgba(255, 255, 255, .13) 70%, transparent); }
.move::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; z-index: 1;
  background: var(--red); transform: scaleY(0); transform-origin: 50% 0;
  transition: transform .22s var(--ease); pointer-events: none;
}
.move[hidden] { display: none; }
.move:hover, .move:focus-visible {
  border-color: color-mix(in srgb, var(--red) 55%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .04), 0 18px 30px -22px color-mix(in srgb, var(--red) 70%, #000);
}
.move:hover::after, .move:focus-visible::after, .move.is-picked::after { transform: scaleY(1); }

.move__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.move__name { font-size: .92rem; font-weight: 650; letter-spacing: -.01em; }

/* The one number you have to count, in the corner the eye reaches first. */
.move__time {
  flex: none; margin-top: -1px;
  font-family: var(--mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .06em; color: var(--red);
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  border-radius: 999px; padding: .28em .6em .3em;
}
.move__time b { font-size: 1.16em; font-weight: 700; }

/* ---- how to read a move ------------------------------------ */
.key {
  list-style: none; display: grid; gap: 6px; margin: 12px 0 0;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--paper-2);
  font-size: .68rem; color: var(--ink-3);
}
.key li { display: flex; align-items: center; gap: 9px; }
.key__bar { flex: none; width: 34px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--red) 55%, transparent); }
.key__tap { flex: none; width: 9px; height: 7px; border-radius: 3px; background: var(--ink-2); margin-left: 12px; margin-right: 13px; }
.key__t {
  flex: none; font-family: var(--mono); font-size: .56rem; font-weight: 700; color: var(--red);
  background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  border-radius: 999px; padding: .2em .5em;
}
/* On a phone the plate is a pinned strip, so the key lies across it in one
   row rather than stacking and pushing the moves down the page. */
@media (max-width: 999px) {
  .key {
    grid-column: 1 / -1; margin: 10px 0 0;
    display: flex; flex-wrap: wrap; gap: 8px 16px;
    padding: 8px 11px; font-size: .64rem;
  }
  .key li { gap: 7px; }
  .key__tap { margin-left: 6px; margin-right: 7px; }
}
.move__new {
  margin-left: 7px; font-family: var(--mono); font-size: .56rem; font-weight: 700;
  color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  border-radius: 4px; padding: .1em .3em; vertical-align: middle;
}
.move__seq { margin: .45rem 0 .4rem; }
.move__what { font-size: .8rem; color: var(--ink-3); line-height: 1.45; }

.combo { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .24em; line-height: 1.85; }
.combo__word { color: var(--ink-2); font-size: .82em; }
.combo__op { color: var(--ink-3); font-weight: 600; font-size: .78em; }
.combo__op--then { font-size: .6em; letter-spacing: .1em; text-transform: uppercase; }

.track__empty { padding: 40px 24px; color: var(--ink-3); align-self: center; }
.track__empty[hidden] { display: none; }

/* ---- the bar ----------------------------------------------- */
.bar { flex: none; border-top: 1px solid var(--line); background: var(--paper-2); }
.bar__wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 0; }
.bar__lead {
  font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); flex: none;
}
.bar__chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper);
  font: inherit; font-family: var(--mono); font-size: .68rem; font-weight: 700;
  letter-spacing: .05em; color: var(--ink-2);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--red); border-color: var(--red); color: #fff; }

.bar__search { margin-left: auto; }
.bar__search input {
  height: 32px; width: clamp(110px, 16vw, 190px); padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  font: inherit; font-size: .84rem; color: var(--ink); outline: none;
}
.bar__search input:focus { border-color: var(--red); }
.bar__count { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); flex: none; }
.bar__reset {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: none; font: inherit;
  font-size: .76rem; font-weight: 600; color: var(--ink-2);
}
.bar__reset:hover { border-color: var(--red); color: var(--red); }
.bar__reset[hidden] { display: none; }

.bar__rail { height: 2px; background: var(--line-2); }
.bar__rail span { display: block; height: 100%; width: 0; background: var(--red); transition: width .12s linear; }

/* ---- footer ------------------------------------------------ */
.ft { flex: none; border-top: 1px solid var(--line); padding: 20px 0 26px; }
.ft__in { display: grid; gap: 14px; }
@media (min-width: 800px) { .ft__in { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.ft__note { font-size: .78rem; color: var(--ink-3); line-height: 1.5; max-width: 62ch; }
.ft__links { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: .78rem; }
.ft__links a { color: var(--ink-2); }

/* ---- small screens -----------------------------------------
   Phones get a different view: the device pins to the top and stays
   lit while the groups run down the page under your thumb. Tapping a
   move lights the controls it needs.
------------------------------------------------------------- */
@media (max-width: 999px) {
  .sp1page { height: auto; }
  .stage { grid-template-columns: 1fr; grid-template-rows: auto auto; }

  .art {
    position: sticky; top: 0; z-index: 6;
    padding: 12px 16px 10px;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .art__inner {
    max-width: none; display: grid; gap: 12px;
    grid-template-columns: 132px minmax(0, 1fr); align-items: center;
  }
  .art__head { grid-column: 1 / -1; border-bottom: 0; padding-bottom: 0; }
  .art__title { font-size: 1.15rem; }
  .art .device { grid-row: 2; }
  .art__read { grid-row: 2; border-top: 0; padding-top: 0; min-height: 0; }
  .art__name { font-size: .95rem; }
  .art__what { font-size: .8rem; }

  /* the groups stack and scroll vertically */
  .track {
    flex-direction: column; overflow: visible; min-height: 0;
  }
  .panel {
    width: auto; max-height: none;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 18px 16px 22px;
  }
  .panel__moves { gap: 8px; }

  /* the filter stays under the thumb */
  .bar { position: sticky; bottom: 0; z-index: 7; }
  .bar__wrap { gap: 8px; padding: 9px 0; }
  .bar__lead { display: none; }
  .bar__chips { flex: 1 1 auto; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .bar__chips .chip { white-space: nowrap; flex: none; }
  .bar__chips::-webkit-scrollbar { display: none; }
  .bar__search { margin-left: 0; }
  .bar__search input { width: 92px; }
  .bar__count { display: none; }
}

/* a tapped move stays lit, so the device reading survives the finger lifting */
.move.is-picked {
  border-color: var(--red);
  background: linear-gradient(180deg, color-mix(in srgb, var(--red-soft) 60%, #fff) 0%, var(--red-soft) 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, .04), 0 18px 30px -22px color-mix(in srgb, var(--red) 70%, #000);
}
:root[data-theme='dark'] .move.is-picked { background: var(--red-soft); }

/* ---- the plate title --------------------------------------- */
.art__head { border-bottom: 1px solid var(--line-2); padding-bottom: 12px; }
.art__eyebrow {
  font-size: .64rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red); margin-bottom: .3rem;
}
.art__title { font-size: clamp(1.3rem, 2.2vw, 1.75rem); letter-spacing: -.028em; }

/* ---- the gesture score --------------------------------------
   One lane per control, time left to right. A hold is a bar as long
   as the hold lasts, a tap is a block, and a hold carries on under
   the taps that follow it. Reading the shape is faster than reading
   the sentence.
------------------------------------------------------------- */
.move__score { margin: .5rem 0 .35rem; }
.score { width: 100%; height: auto; display: block; overflow: visible; }

.g-rail { fill: var(--line); }
.g-label {
  font-family: var(--mono); font-size: 4.4px; font-weight: 700;
  letter-spacing: .06em; text-anchor: end; fill: var(--ink-3);
}
.g-hold, .g-tap, .g-rel { fill: var(--lane-c, var(--ink-3)); }
.g-hold { opacity: .34; }
.g-rel  { opacity: .9; }

[data-lane='fn']      { --lane-c: #c43e2a; }
[data-lane='play']    { --lane-c: #2f2d29; }
[data-lane='rocker']  { --lane-c: #8a5f11; }
[data-lane='volup']   { --lane-c: #37603f; }
[data-lane='voldown'] { --lane-c: #3f5c6d; }
[data-lane='tracks']  { --lane-c: #5d4175; }
[data-lane='faders']  { --lane-c: #825232; }
:root[data-theme='dark'] [data-lane='fn']      { --lane-c: #ff6a4d; }
:root[data-theme='dark'] [data-lane='play']    { --lane-c: #cfc9bc; }
:root[data-theme='dark'] [data-lane='rocker']  { --lane-c: #e0a842; }
:root[data-theme='dark'] [data-lane='volup']   { --lane-c: #7fbd92; }
:root[data-theme='dark'] [data-lane='voldown'] { --lane-c: #86b3ca; }
:root[data-theme='dark'] [data-lane='tracks']  { --lane-c: #c3a7d9; }
:root[data-theme='dark'] [data-lane='faders']  { --lane-c: #d2a385; }

/* the written form stays, as the exact reading and for screen readers */
.move__seq { margin-bottom: .35rem; opacity: .75; }
.move__seq .kbd { font-size: .68em; }

/* ---- stem loader ------------------------------------------- */
.move--warn { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); background: var(--amber-soft); }
.move--warn .move__name::before { content: '! '; color: var(--amber); font-weight: 700; }
.bar__out {
  margin-left: auto; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--red); background: var(--red); color: #fff;
  font-size: .78rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.bar__out:hover { filter: brightness(1.08); }
@media (max-width: 999px) { .bar__out { margin-left: 0; } }

/* the mark is the centre of every header */
.hd .mark-link { justify-self: center; }
@media (max-width: 620px) {
  .hd__bar { gap: 10px; }
    .hd__top::-webkit-scrollbar { display: none; }
  }
/* interactive boundaries need to be visible, not just decorative */
.bar__search input, .chip, .bar__reset, .theme-toggle { border-color: var(--line-strong); }

/* the filter bar owns the bottom edge on a phone, so the mark sits above it */
@media (max-width: 899px) { :root { --mark-bottom: 104px; } }
