/*
 * base.css — the design system: tokens, reset, and the layout primitives that every
 * milestone shares. This file is copied forward unchanged; a milestone that needs a
 * new colour or a new control shape adds a token here rather than a one-off rule in
 * app.css, so ten apps keep looking like one machine.
 *
 * The aesthetic target is studio hardware, not a web form: dark anodised panels,
 * silk-screened labels, backlit rubber pads and an LCD for anything numeric.
 */

:root {
  /* surfaces */
  --bg: #0e0f13;
  --panel: #171922;
  --panel-2: #1f2230;
  --edge: #2b2f40;

  /* type */
  --text: #e7e9f0;
  --muted: #8a90a6;

  /* signals */
  --accent: #ff5a3c;      /* transport, active step, anything "hot" */
  --accent-2: #33d1a0;    /* alternate highlight, the tutorial */
  --warn: #ffcc44;        /* the deliberately naive clock lives on this colour */

  /* one hue per track, used for pads, labels and meters alike */
  --track-1: #ff6b4a;
  --track-2: #ffc247;
  --track-3: #47d3ff;
  --track-4: #b98cff;
  --track-5: #4ade80;
  --track-6: #ff8fd0;
  --track-7: #7dd3fc;
  --track-8: #fbbf24;

  /* geometry */
  --radius: 10px;
  --gap: 10px;

  /* stacking: the tour must out-stack the manual, which must out-stack the app */
  --z-panel: 10;
  --z-modal: 900;
  --z-tour: 1000;

  /* Monospace for anything numeric (digits must not jiggle), system sans for prose.
     No webfonts anywhere: a @font-face URL would be a network request. */
  --font: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 620px at 50% -160px, #1a1d29 0%, var(--bg) 62%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, output, select { font: inherit; color: inherit; }

code {
  font-family: var(--font);
  font-size: .92em;
  color: var(--warn);
}

/* Keyboard users must always be able to see where they are. Every interactive
   control in DRUMLAB opts into this one ring; nothing suppresses it. */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: var(--z-modal);
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  color: var(--text);
}
.skip-link:focus { left: 8px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* --------------------------------------------------------------- primitives */

/*
 * A panel is a piece of the machine's front plate: a slightly lifted, slightly
 * lit slab with a hairline edge. The inset highlight along the top is what reads
 * as "metal" rather than "div".
 */
.panel {
  position: relative;
  z-index: var(--z-panel);
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .045),
    0 10px 24px rgba(0, 0, 0, .35);
}

/* Silk-screened label above a group of controls. */
.unit__label,
.readout__label,
.field__label {
  display: block;
  font: 10px/1 var(--font);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  min-height: 36px;
  background: linear-gradient(180deg, #2a2f42 0%, #1d2130 100%);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 2px 0 rgba(0, 0, 0, .5);
  font: 600 13px/1 var(--font-ui);
  cursor: pointer;
  transition: transform .06s ease, filter .12s ease, background-color .12s ease;
}
.btn:hover { filter: brightness(1.14); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .55); }
.btn[disabled] { opacity: .45; cursor: default; }

.btn__glyph { font-size: 11px; line-height: 1; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.btn--ghost:hover { color: var(--text); }

.btn--primary {
  background: linear-gradient(180deg, #3ee0ac 0%, #23a37c 100%);
  border-color: #1d7f61;
  color: #06110d;
}

.btn--round {
  width: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  font: 700 16px/1 var(--font-ui);
}

/* A chip is a status legend, not a control. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, .03);
  font: 11px/1 var(--font);
  letter-spacing: .06em;
  color: var(--muted);
}
.chip--warn {
  border-color: rgba(255, 204, 68, .5);
  background: rgba(255, 204, 68, .1);
  color: var(--warn);
}

/*
 * The LCD. Numbers live here: monospace, tabular figures, faint scan glow. It is a
 * readout, never an input — that separation is what makes hardware legible.
 */
.lcd {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 10px;
  min-width: 92px;
  justify-content: center;
  background: #0a0c11;
  border: 1px solid #000;
  border-radius: 6px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8);
  font: 600 16px/1.2 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
  text-shadow: 0 0 12px rgba(51, 209, 160, .35);
}
.lcd--wide { min-width: 190px; font-size: 13px; }
.lcd__unit { font-size: 10px; letter-spacing: .1em; color: var(--muted); text-shadow: none; }

/*
 * The slider is a real <input type="range">. Rotating or restyling one is fine;
 * replacing it with divs is not — arrow keys, Shift+arrow, focus and screen-reader
 * support all come free from the platform and cost 200 lines of ARIA to rebuild.
 */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, #05070b, #14172180);
  border: 1px solid #000;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9);
}
.slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #05070b;
  border: 1px solid #000;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -8px;
  width: 16px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f4f6ff 0%, #aab1c8 48%, #6f778f 52%, #333a4d 100%);
  border: 1px solid #0a0c11;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.slider::-moz-range-thumb {
  width: 16px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f4f6ff 0%, #6f778f 52%, #333a4d 100%);
  border: 1px solid #0a0c11;
}

.field { display: inline-flex; flex-direction: column; gap: 5px; }
.field__input {
  width: 110px;
  padding: 7px 9px;
  background: #0a0c11;
  border: 1px solid var(--edge);
  border-radius: 6px;
  color: var(--text);
  font: 14px/1 var(--font);
  font-variant-numeric: tabular-nums;
}

/*
 * Inline coach mark (SPEC §5c). One sentence, one tap, no modal. Built by
 * DM.UI.coach() so that every milestone's explanations look and behave the same.
 */
.coach {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font: 700 11px/1 var(--font-ui);
  cursor: pointer;
}
.coach:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* Transient one-line feedback: "Demo beat loaded". Never used for errors. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: var(--z-modal);
  padding: 9px 16px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
  font: 13px/1 var(--font-ui);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .btn { transition: none; }
}
