/* BOFTK — Break Lab.
   Cutting-desk direction: cool paper, ink type, one signal-red accent,
   dark video "chips" as the only imagery. */

:root {
  --paper: #edefec;
  --panel: #e2e5e1;
  --ink: #141613;
  --gray: #757b76;
  --tile: #101210;
  --accent: #e63312;
  --disp: "Big Shoulders", "Archivo Black", Impact, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; }

/* ---------- header / footer ---------- */

.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--ink);
}
.mark {
  font-family: var(--disp);
  font-weight: 800; font-size: 24px; letter-spacing: .04em;
  text-decoration: none; display: inline-flex; align-items: baseline; gap: 3px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.btn {
  display: inline-block; text-decoration: none; text-align: center;
  font-weight: 600; font-size: 14px; letter-spacing: .02em;
  padding: 10px 22px; border-radius: 3px;
  transition: background .15s, color .15s;
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--accent); }
.btn.big { width: 100%; padding: 14px; font-size: 15px; }
.btn.live { background: var(--accent); }

.foot {
  margin-top: clamp(24px, 4vw, 48px);
  background: var(--ink); color: var(--paper);
  padding: 24px clamp(16px, 4vw, 48px);
  display: flex; flex-wrap: wrap; gap: 12px 36px; align-items: center; justify-content: space-between;
  font-size: 14px;
}
.foot .mark { font-size: 20px; }
.foot .mono { opacity: .6; }

/* ---------- hero: one dark stage — video left, controls right, strip below,
     everything on one screen ---------- */

.hero {
  background: var(--ink); color: var(--paper);
  padding: clamp(18px, 2.5vw, 32px) clamp(16px, 4vw, 48px) clamp(22px, 3vw, 34px);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px;
  gap: clamp(16px, 2.5vw, 30px);
  max-width: 1240px; margin: 0 auto;
  align-items: start;
}
.kicker { color: #97a09a; font-size: 12px; text-transform: uppercase; letter-spacing: .16em; }
.kicker::before {
  content: ""; display: inline-block; width: 9px; height: 9px;
  background: var(--accent); margin-right: 10px;
}
.herotitle {
  font-family: var(--disp); font-weight: 800; text-transform: uppercase;
  font-size: clamp(40px, 4.6vw, 66px); line-height: .92; letter-spacing: .01em;
  margin: 8px 0 10px;
}
.tdot { color: var(--accent); }
.hero .monitor {
  border: 1px solid rgba(237, 239, 236, .14);
  /* keep the whole lab on one screen: size the video off the viewport height */
  max-width: calc((100vh - 540px) * 1.7778);
  min-width: min(100%, 460px);
}
.deck { display: flex; flex-direction: column; gap: 12px; }
.transport { display: flex; gap: 8px; align-items: stretch; }
.transport .btn.big {
  width: auto; flex: 1; padding: 12px 32px;
  background: var(--accent); color: #fff;
}
.transport .btn.big:hover { background: var(--paper); color: var(--ink); }
.transport .btn.live { background: var(--paper); color: var(--ink); }
.hero .pill { border-color: rgba(237, 239, 236, .45); color: var(--paper); }
.hero .pill:hover { border-color: var(--accent); color: var(--accent); }
.hero .pill.on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.hero .pill:disabled { opacity: .35; cursor: default; }
.hero .pairline { color: #b9c2ba; }
.hero .keys { color: #97a09a; border-color: #97a09a; }
.subrow { align-items: center; justify-content: space-between; }
.hero .vsep { background: rgba(237, 239, 236, .25); }
.hero .leg { color: #b9c2ba; }
.hero .leg i { box-shadow: inset 0 0 0 1px rgba(237, 239, 236, .3); }
.hero .strip-head { max-width: 1240px; margin: clamp(14px, 2vw, 20px) auto 0; }
.hero .strip { max-width: 1240px; margin: 10px auto 0; }

/* source shelf: blocks of the selected loop, ready to be pulled down */
.shelf {
  max-width: 1240px; margin: 10px auto 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 6px;
  padding: 7px 10px;
  touch-action: pan-y;
}
.shelf-tag { color: var(--gray); font-size: 10px; letter-spacing: .12em; flex: none; }
.shelf-lane { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 42px; min-width: 0; }
.schip {
  position: relative; display: flex; align-items: flex-end; gap: 2px;
  flex: 1 1 0; min-width: 8px; height: 100%;
  padding: 0; cursor: grab;
  transition: transform .1s;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.schip:hover { transform: translateY(-2px); }
.schip.armed { transform: scale(1.15); }
.schip .fill { width: 100%; border-radius: 2px 2px 0 0; }
.schip.v-kick .fill { background: var(--v-kick); }
.schip.v-snare .fill { background: var(--v-snare); }
.schip.v-ride .fill { background: var(--v-ride); }
.schip.v-ghost .fill { background: transparent; border: 2px solid var(--v-snare); border-bottom: none; }
.schip.v-soft .fill { background: transparent; border: 2px solid var(--v-kick); border-bottom: none; }
.schip.v-pair .f-ride { background: var(--v-ride); }
.schip.v-pair .f-ghost { background: transparent; border: 2px solid var(--v-snare); border-bottom: none; }
/* the shelf card is light, so its pill keeps ink styling even inside the hero */
.hero .shelf .pill { border-color: var(--ink); color: var(--ink); padding: 4px 10px; font-size: 12px; flex: none; }
.hero .shelf .pill:hover { border-color: var(--accent); color: var(--accent); }

.monitor { background: var(--tile); border-radius: 6px; padding: 10px 10px 0; }
.screen { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; border-radius: 3px; }
.screen video { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.screen video.on { opacity: 1; }
.bigplay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 9, 8, .35);
  transition: background .2s;
}
.bigplay:hover { background: rgba(8, 9, 8, .15); }
.bigplay .tri {
  width: 0; height: 0; border-left: 42px solid var(--accent);
  border-top: 26px solid transparent; border-bottom: 26px solid transparent;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, .5));
  transition: transform .15s;
}
.bigplay:hover .tri { transform: scale(1.08); }
.bigplay.gone { display: none; }
.rec {
  position: absolute; left: 12px; bottom: 10px; z-index: 2;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255, 255, 255, .85);
  display: flex; align-items: center; gap: 8px;
}
.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
.monitor.rolling .rec::before { background: var(--accent); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.monitor-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 4px; color: var(--paper);
}
.monitor-foot .mono { color: rgba(237, 239, 236, .55); }
.linkbtn {
  color: var(--paper); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid var(--accent); padding-bottom: 1px;
}
.linkbtn:hover { color: #fff; }

.presets, .row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  transition: background .12s, color .12s, border-color .12s;
}
.pill svg { width: 14px; height: 14px; flex: none; }
.pill.icon { padding: 8px; }
.pill.icon svg { width: 16px; height: 16px; }
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pairline { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.pairline input { accent-color: var(--accent); width: 16px; height: 16px; }
.keys { cursor: help; color: var(--gray); border-bottom: 1px dotted var(--gray); }

/* ---------- the strip (signature element): bars as rows, hits as sound-blocks
     color = drum · width = duration · height = loudness ---------- */

:root {
  --v-kick: #141613;
  --v-snare: #e63312;
  --v-ride: #97a09a;
}

.strip-head {
  margin-top: clamp(18px, 2.5vw, 26px);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.scopes { display: flex; gap: 6px; flex-wrap: wrap; }
.strip-right { display: flex; align-items: center; gap: 16px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.leg {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray); cursor: default;
}
.leg b { font-weight: 400; opacity: .7; }
.leg i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.leg.v-kick i { background: var(--v-kick); }
.leg.v-snare i { background: var(--v-snare); }
.leg.v-ride i { background: var(--v-ride); }
.leg.v-ghost i { background: transparent; border: 2px solid var(--v-snare); }
.leg.v-soft i { background: transparent; border: 2px solid var(--v-kick); }

.strip {
  position: relative; /* anchors the playhead */
  margin-top: 10px;
  background: var(--panel);
  border: 2px solid var(--ink); border-radius: 6px;
  padding: 10px 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
  touch-action: pan-y; /* vertical swipes scroll the page; long-press picks a block up */
}
.chip.armed { transform: scale(1.07); }
.bar-row { display: flex; align-items: flex-end; gap: 10px; }
.bar-tag {
  flex: none; width: 44px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--gray); padding-bottom: 20px;
}
.bar-lane {
  flex: 1; display: flex; align-items: flex-end; gap: 4px;
  border-bottom: 2px solid var(--ink);
  min-height: 96px; padding-top: 6px;
}
.strip.big .bar-lane { min-height: 130px; }

.chip {
  position: relative;
  flex: 0 1 var(--w, 60px); width: auto; min-width: 24px;
  display: flex; flex-direction: column; justify-content: flex-end;
  align-self: stretch;
  padding: 0; border-radius: 0;
  transition: transform .1s;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;   /* no iOS long-press callout while picking up */
}
.chip:hover { transform: translateY(-3px); }
.chip:hover .fill { filter: brightness(1.12); }
.fillwrap {
  flex: 1; display: flex; align-items: flex-end; gap: 2px;
  position: relative;
}
.fill { display: block; width: 100%; border-radius: 3px 3px 0 0; }
.v-kick .fill { background: var(--v-kick); }
.v-snare .fill { background: var(--v-snare); }
.v-ride .fill { background: var(--v-ride); }
.v-ghost .fill { background: transparent; border: 2px solid var(--v-snare); border-bottom: none; }
.v-soft .fill { background: transparent; border: 2px solid var(--v-kick); border-bottom: none; }
.v-pair .f-ride { background: var(--v-ride); }
.v-pair .f-ghost { background: transparent; border: 2px solid var(--v-snare); border-bottom: none; }
.btag {
  height: 18px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gray); overflow: hidden; white-space: nowrap;
}
.chip.sel { transform: translateY(-3px); }
.chip.sel .btag { color: var(--accent); font-weight: 700; }
.chip.sel .fillwrap { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* voice highlight from the legend */
.strip[data-hl] .chip { opacity: .22; }
.strip[data-hl="kick"] .v-kick, .strip[data-hl="snare"] .v-snare,
.strip[data-hl="ride"] .v-ride, .strip[data-hl="ride"] .v-pair,
.strip[data-hl="ghost"] .v-ghost, .strip[data-hl="ghost"] .v-pair,
.strip[data-hl="kick_soft"] .v-soft { opacity: 1; }

/* playhead: one line travelling across the lanes, DAW-style */
.playhead {
  position: absolute; left: 0; top: 0; z-index: 4;
  width: 3px; background: var(--accent);
  box-shadow: 0 0 10px rgba(230, 51, 18, .85);
  pointer-events: none; opacity: 0;
  will-change: transform;
}
.playhead::after {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 8px solid var(--accent);
}
.playhead.on { opacity: 1; }

/* the block being heard right now */
.chip.playing { transform: translateY(-3px); }
.chip.playing .fillwrap::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(230, 51, 18, .2);
  border-radius: 3px 3px 0 0;
}
.chip.playing .btag { color: var(--accent); font-weight: 700; }

/* selected-block actions */
.handles {
  position: absolute; top: -6px; right: -6px; z-index: 5;
  display: flex; gap: 3px;
}
.h-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 14px; line-height: 1; display: grid; place-items: center;
  border: 2px solid var(--paper);
  box-shadow: 0 2px 6px rgba(20, 22, 19, .3);
}
.h-btn:hover { background: var(--accent); }

.chip.lifting { opacity: .2; }
.chip.ghosted {
  position: fixed; z-index: 100; pointer-events: none;
  height: 90px;
  transform: translate(-50%, -60%) rotate(3deg);
  filter: drop-shadow(0 12px 22px rgba(20, 22, 19, .4));
  opacity: .95;
}
.ins { width: 4px; border-radius: 2px; background: var(--accent); flex: none; align-self: stretch; }

/* speed pills */
.rates { display: flex; gap: 4px; align-items: center; }
.rates .pill { padding: 6px 10px; font-family: var(--mono); font-size: 13px; }

.vsep { width: 2px; align-self: stretch; background: var(--panel); margin: 0 4px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 200;
  transform: translate(-50%, 12px);
  background: var(--ink); color: var(--paper);
  font-size: 13px; padding: 9px 16px; border-radius: 4px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero .monitor { max-width: 100%; min-width: 0; }
  .monitor-foot { padding: 6px 4px; }
}
@media (pointer: coarse) {
  .h-btn { width: 27px; height: 27px; font-size: 16px; }
  .handles { top: -10px; right: -8px; }
}
@media (max-width: 560px) {
  .top { gap: 14px; }
  .bar-tag { width: 30px; font-size: 9px; }
  .bar-lane { min-height: 72px; gap: 3px; }
  .strip.big .bar-lane { min-height: 96px; }
  .btag { font-size: 9px; }
  .monitor-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip, .btn, .pill, .pattern { transition: none; }
  .chip.playing { transform: none; }
  .monitor.rolling .rec::before { animation: none; }
}
