/* Shared by the portal and the web tools: colours, type and the common parts. */
:root {
  --bg: #f6f6f9;
  --panel: #ffffff;
  --line: #e4e4ec;
  --text: #17171f;
  --muted: #6c6c7c;
  --accent: #e0407f;
  --accent-soft: #fde4ef;
  --good: #16a34a;
  --warn: #d97706;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e13;
    --panel: #17171f;
    --line: #2a2a36;
    --text: #ececf3;
    --muted: #8d8d9f;
    --accent: #ff5ca8;
    --accent-soft: #3a1628;
    --good: #34d399;
    --warn: #fbbf24;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e13;
  --panel: #17171f;
  --line: #2a2a36;
  --text: #ececf3;
  --muted: #8d8d9f;
  --accent: #ff5ca8;
  --accent-soft: #3a1628;
  --good: #34d399;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
a { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 10px; max-width: 1200px; margin: 0 auto; padding: 16px; font-size: 14px; }
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav .brand { font-weight: 700; letter-spacing: -0.01em; }
.site-nav .sep { color: var(--muted); }
/* The About menu, at the far right of the nav bar. */
.site-menu { margin-left: auto; position: relative; }
.site-menu summary { list-style: none; cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-weight: 600; user-select: none; }
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu[open] summary { border-color: var(--accent); }
.site-menu ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px; margin: 0; padding: 6px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); }
.site-menu li a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
.site-menu li a:hover, .site-menu li a:focus-visible { background: var(--accent-soft); }
/* The app's page, picked out in the accent: the way to get Sequent.app. */
.site-menu li a.menu-download { color: var(--accent); font-weight: 600; }
.site-nav .here { color: var(--muted); }

h1 { font-size: 28px; letter-spacing: -0.02em; margin: 0; }
h1.titled { display: flex; align-items: center; gap: 12px; }
h1.titled img { width: 40px; height: 40px; flex: none; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
section { margin-bottom: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.muted { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }

button {
  font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 7px 14px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
button:focus-visible, [tabindex]:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
}

/* The shared transport (transport.js) */
.transport { padding: 16px; margin-bottom: 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 20px; }
.transport.no-nudge { grid-template-columns: minmax(0, 1fr); }
/* Collapsed, the transport is one line: Play, Stop, tempo and source. */
.transport.collapsed { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
.transport.collapsed :is(.tr-sources, .tr-status, .tr-controls, .tr-graphs) { display: none; }
/* The nudge stays in reach when collapsed: its value, −5 and +5, and Auto, in a row. */
.transport.collapsed .tr-nudge { flex-direction: row; align-items: center; gap: 6px; padding-left: 14px; min-width: 0; }
.transport.collapsed :is(.tr-nudge-label, .tr-nudge-reset) { display: none; }
.transport.collapsed .tr-nudge output { min-width: 52px; order: 1; }
.transport.collapsed .tr-nudge-pair { order: 2; }
.transport.collapsed .tr-auto { order: 3; }
.transport.collapsed .tr-bpm { font-size: 28px; }
.transport.collapsed .tr-play { font-size: 16px; padding: 10px 22px; min-width: 100px; }
.tr-fold { flex: none; }
.tr-fold[hidden] { display: none; }
.transport:not(.collapsed) .tr-fold { transform: rotate(90deg); }
/* On a phone, collapsed is one row: the source line and Listen wait in the
   opened view (and phones have no MIDI clock to listen for). */
@media (max-width: 560px) {
  .transport.collapsed { padding: 8px 10px; grid-template-columns: minmax(0, 1fr); }
  /* On a phone the nudge takes a second row. */
  .transport.collapsed .tr-nudge { padding: 8px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .transport.collapsed .tr-main { flex-wrap: nowrap; gap: 8px; }
  .transport.collapsed :is(.tr-source, .tr-track, .tr-listen) { display: none; }
  /* Wide enough for "Beat 4", so the tempo beside it stays put. */
  .transport.collapsed .tr-play { min-width: 5.5em; padding: 9px 18px; }
  .transport.collapsed .tr-bpm { font-size: 24px; }
}
.tr-main { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.tr-play { font-size: 18px; padding: 14px 30px; min-width: 120px; }
/* The page's own Play while its scripts arrive, replaced when the transport mounts. */
.tr-waiting { padding: 2px 0; }
.tr-waiting .tr-play { opacity: 0.6; }
.tr-pips { display: inline-flex; gap: 5px; align-items: center; }
/* Hidden, the pips keep their place, so stopping doesn't move the tempo. */
.tr-pips[hidden] { display: inline-flex; visibility: hidden; }
.tr-pips i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.tr-pips i.lit { background: var(--accent); }
.tr-pips.on-one i.lit { background: var(--text); }
.tr-play[aria-pressed="true"]:not(.on-one) { background: var(--accent); border-color: var(--accent); }
.tr-tempo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tr-bpm { font: 600 40px/1 var(--mono); font-variant-numeric: tabular-nums; }
.transport[data-locked="true"] .tr-bpm { color: var(--accent); }
.tr-source { color: var(--muted); font-size: 14px; }
/* The track on the followed deck, when the CDJs say. */
.tr-track { font-size: 14px; font-weight: 600; color: var(--text); }
.tr-track:empty { display: none; }
.tr-play { font-variant-numeric: tabular-nums; }
.tr-play.on-one { background: var(--text); border-color: var(--text); color: var(--bg); }
.tr-status { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
/* Why the last set ended, when the page was restarted mid-play: shown even
   with the transport folded away, until dismissed. */
/* Tempo sources, the one in use lit; one that can't be heard is dimmed. */
.tr-sources { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.tr-sources[hidden] { display: none; }
.tr-sources li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
.tr-sources li b { font-size: 14px; color: var(--text); }
.tr-sources li:not(.ready) { opacity: 0.6; }
.tr-sources li.active { border-color: var(--accent); background: var(--accent-soft); opacity: 1; }
.tr-sources li { position: relative; }
.tr-sources li button { align-self: flex-start; margin-top: 4px; font-size: 12px; padding: 4px 10px; }
.tr-sources li .tr-cdj-update { align-self: flex-start; margin-top: 4px; font-size: 12px; font-weight: 600; }
.tr-sources li .tr-cdj-update[hidden] { display: none; }
.tr-sources li .tr-cdj-get { align-self: flex-start; margin-top: 4px; font-size: 12px; }
.tr-sources li .tr-cdj-get[hidden] { display: none; }
.tr-sources li .tr-ignore { position: absolute; top: 6px; right: 8px; margin: 0; padding: 2px 8px; font-size: 11px; }
.tr-sources li.ignored { opacity: 0.5; }
.tr-sources li.ignored .tr-ignore { opacity: 1; }
/* The decks the helper sees, the master and the followed one marked. */
.tr-decks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font: 12px var(--mono); }
.tr-decks[hidden] { display: none; }
.tr-decks li { display: block; padding: 0; border: 0; border-radius: 0; color: var(--muted); }
.tr-decks li.followed { color: var(--text); font-weight: 600; }
.tr-decks li.followed::before { content: "▸ "; color: var(--accent); }
.tr-decks li.master::after { content: " ★"; color: var(--accent); }
.tr-sources li button[hidden] { display: none; }
.tr-sources li.active b::after { content: " · in use"; color: var(--accent); font-weight: 600; font-size: 12px; }
.tr-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; margin-top: 12px; }
.tr-controls label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.tr-controls input[type=range] { width: 140px; accent-color: var(--accent); }
.tr-controls output { font: 12px var(--mono); color: var(--text); min-width: 52px; }
/* The nudge stands in a column on the right: the offset, then behind (−)
   and ahead (+) of the beat side by side. */
.tr-nudge { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding-left: 20px; border-left: 1px solid var(--line); min-width: 84px; }
.tr-nudge[hidden] { display: none; }
.tr-nudge-label { font-size: 12px; color: var(--muted); text-align: center; }
.tr-nudge button { font: 12px var(--mono); padding: 5px 10px; }
.tr-nudge-pair { display: flex; gap: 4px; }
.tr-nudge-pair button { flex: 1; }
.tr-nudge output { font: 600 13px var(--mono); color: var(--text); text-align: center; padding: 4px 0; }
.tr-nudge-reset { margin-top: auto; font-family: var(--sans) !important; }
/* The automatic latency, added to the nudge when following a clock. */
.tr-auto { font: 11px var(--mono) !important; padding: 4px 6px !important; }
.tr-auto[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
@media (max-width: 600px) {
  .transport { grid-template-columns: minmax(0, 1fr); }
  .tr-nudge { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .tr-nudge-reset { margin-top: 0; }
}
.tr-controls [hidden] { display: none; }
.tr-graphs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.tr-graphs figure { margin: 0; }
.tr-graphs figcaption { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tr-graphs figcaption span { color: var(--text); font-family: var(--mono); }
.tr-graphs canvas { display: block; width: 100%; height: 90px; background: var(--bg); border-radius: 8px; }

/* The shared knob (knob.js) */
.knob { width: 72px; display: flex; flex-direction: column; align-items: center; user-select: none; -webkit-user-select: none; }
.knob .dial { width: 52px; height: 52px; touch-action: none; cursor: ns-resize; border-radius: 50%; }
/* The dial being dragged, lit until it's let go, with the drag's cursor
   kept wherever the pointer goes meanwhile. */
.knob .dial.dragging { box-shadow: 0 0 0 2px var(--accent); }
html.knob-dragging, html.knob-dragging * { cursor: ns-resize !important; }
.knob svg { width: 100%; height: 100%; display: block; }
.arc-track { fill: none; stroke: var(--line); stroke-width: 4; stroke-linecap: round; }
.arc-value { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.pointer { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; }
.knob-value { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; margin-top: 2px; }
.knob-label { font-size: 12px; color: var(--muted); }
.knob.small { width: 100%; }
.knob.small .dial { width: 40px; height: 40px; }
.knob.small .knob-label { display: none; }

/* An instrument following the all page's key section says so in place of its own key controls. */
.follows-key { font-size: 13px; color: var(--muted); }
/* Hidden always wins over an instrument's own display rules for its labels. */
.follows-key[hidden], label[hidden] { display: none !important; }

/* Channel strips on the all-instruments page (Transport.strip) */
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.strip label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.strip-name { font-weight: 600; color: var(--text); font-size: 15px; min-width: 84px; }
/* The name, and under it on a phone the volume figure, where the figure
   beside the fader has no room. */
.strip-title { display: flex; flex-direction: column; line-height: 1.15; }
.strip-vol { display: none; font: 11px var(--mono); color: var(--muted); }
/* The echo send sits at the right-hand end of the strip. */
.strip-send { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.strip-send + .strip-send { margin-left: 4px; }
.strip-send-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.strip-send .knob { margin: -6px 0; }
/* No number under the send: the arc shows it, and the dial still reports it. */
.strip-send .knob-value { display: none; }
/* A track's level glows cyan round its icon (glow() in transport.js sets
   --level, 0 to 1): a soft halo that swells with the sound and fades with
   it, in place of a meter bar. */
.instrument { --level: 0; }
.instrument .track-icon :is(img, svg) { border-radius: 9px; box-shadow: 0 0 calc(var(--level) * 22px) calc(var(--level) * 4px) rgb(34 211 238 / calc(var(--level) * 0.95)); transition: box-shadow 40ms linear; }
/* The fader and meter give way on a narrow screen, so the strip fits its card. */
.strip input[type=range] { width: min(160px, 32vw); accent-color: var(--accent); }
.strip output { font: 12px var(--mono); min-width: 40px; }
/* S and M, square, as on a desk. */
/* On, at the end of the strip, lit while the track plays: the same switch
   as the master EQ's and the visuals'. */
.strip-on { font: 600 13px var(--mono); height: 32px; padding: 0 10px; border-radius: 8px; flex: none; }
.strip-on[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.strip.silenced input[type=range] { opacity: 0.4; }

/* The build, at the foot of the menu. */
.site-menu .menu-build { padding: 8px 12px 4px; font: 11px var(--mono); color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }

/* A note across the top of the page: a newer build is out, or this phone's
   saved set has gone. */
.page-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin: 0 0 14px; padding: 12px 16px; font-size: 14px; }
.page-note[hidden] { display: none; }
.page-note button { font-size: 13px; padding: 4px 12px; }

/* The key section (keysection.js), on Play and Compose: one key and
   progression for every melodic track, and the groove. */
.key-section { padding: 14px 16px; margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.key-section h2 { margin: 0 6px 0 0; }
.key-section label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
/* Swing and humanise, the groove, always on a line of their own. */
.key-section .feel { display: flex; flex-wrap: wrap; gap: 10px 16px; flex-basis: 100%; }
.key-section .humanise input { width: 110px; accent-color: var(--accent); }
.key-section .humanise output { font: 12px var(--mono); min-width: 4ch; }
.key-section .key-follow { font-size: 13px; color: var(--muted); }
.key-section .key-follow output { font: 12px var(--mono); color: var(--text); }
.key-chords { display: flex; flex-wrap: wrap; gap: 6px; }
.key-chord { font: 600 14px var(--mono); padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); transition: background 0.3s, border-color 0.3s; }
.key-chord.now { background: var(--accent-soft); border-color: var(--accent); transition: none; }
/* An arrow button that opens and closes something: a track on Play, the
   transport's sources and graphs on every page. It turns when open. */
.track-toggle { width: 34px; height: 34px; padding: 0; border-radius: 8px; display: grid; place-items: center; transition: transform 0.15s; }
.track-toggle svg { width: 14px; height: 14px; }
.track-toggle[aria-expanded="true"] { transform: rotate(90deg); }
