/* The drum practice app. It starts from the site's own tokens and glass (/css/tokens.css,
   /css/site.css) and adds only what an app needs that a page does not: one sheet that is the
   whole window, with what is being worked on in its middle and the dock at its foot. One
   surface, no cards, one accent. */

/* The sheet: the stage takes what room there is, and the dock keeps to the foot. */

.drums { flex-direction: column; }
.drums .stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.drums .docks { flex: none; width: 100%; }

/* The big line: one thing said, sized from the window both ways. A figure in it is in the
   accent, in digits that keep their width. */

.drums .block { --s: max(1.5rem, min(6.2vw, 15vh)); }
.drums .block > .display { text-wrap: balance; }
.drums .display b { font-weight: inherit; color: var(--accent); font-variant-numeric: tabular-nums; }

/* The one sentence under it, where a sentence is called for. A figure in it is in the accent. */
.drums .block > .lead { text-align: center; text-wrap: balance; }
.drums .block > .lead:empty { display: none; }
.drums .lead b { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }


/* The click. Its tempo is the big line, a number as big as the window allows. Over it, the bar
   being counted: thin lines in the text colour, the first of the bar the tallest and a part of a
   beat the shortest, and the one being heard in the accent (in the text colour while a bar is
   only being counted in). */
.drums[data-state="click"]:not(.keyed) .block { --s: max(2.5rem, min(14.2vw, 24vh)); }
.drums .beats {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: max(10px, calc(var(--s) * 0.16));
  height: max(18px, calc(var(--s) * 0.42));
  margin-bottom: max(var(--gap), calc(var(--s) * 0.24));
}
.drums .beats > i { position: relative; width: 2px; height: 62%; border-radius: 1px; background: var(--text-soft); opacity: 0.5; }
.drums .beats > i.one { height: 100%; }
.drums .beats > i.part { height: 34%; }
.drums .beats > i.on { background: var(--accent); opacity: 1; }
.drums .beats.in > i.on { background: var(--text); }

/* An exercise's bar: a line for each slot, and under it the hand that plays it. A slot with
   nothing in it is fainter. */
.drums .beats.hands { gap: max(18px, calc(var(--s) * 0.3)); margin-bottom: calc(max(var(--gap), var(--s) * 0.24) + 18px); }
.drums .beats > i[data-hand]::after {
  content: attr(data-hand);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font: 600 12px/1 var(--body);
  color: var(--text);
}
.drums .beats > i.on[data-hand]::after { color: var(--accent); }
.drums .beats.in > i.on[data-hand]::after { color: var(--text); }
.drums .beats > i.rest { opacity: 0.2; }

/* Playing along to a song: there is no bar to count, and nothing of the click to set. */
.drums.along .beats, .drums.along .info-panel > [data-for] { display: none; }

/* How a take went. The big line is smaller, for the sentences under it and the charts under
   those to have the room. The charts are drawn to the size they are given (app/charts.js): thin
   lines in the text colour, what was played in the accent, digits that keep their width. */
.drums[data-state="told"] .stage { flex-direction: column; gap: calc(var(--gap) * 1.5); }
.drums[data-state="told"] .block { flex: none; --s: max(1.5rem, min(4.4vw, 7.5vh)); }
.drums .charts {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: min(100%, 880px);
  min-height: 0;
}
.drums .chart { display: block; width: 100%; overflow: visible; }
.drums #timeline { height: clamp(96px, 22vh, 200px); }
.chart text { font: 12px/1 var(--body); fill: var(--text-soft); font-variant-numeric: tabular-nums; }
.chart text.figure { fill: var(--text); }
.chart .grid { stroke: var(--text-soft); stroke-width: 1; }
.chart .landed { fill: var(--accent); }
.chart .extra { fill: var(--text-soft); }
.chart .missed { stroke: var(--text); stroke-width: 1; }
.chart .apart { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }

/* Where things stand, and the log. The big line is smaller, as it is where a take is told, for
   what is under it to have the room. */
.drums[data-state="progress"] .stage, .drums[data-state="log"] .stage { flex-direction: column; gap: calc(var(--gap) * 1.5); }
.drums[data-state="progress"] .block, .drums[data-state="log"] .block { flex: none; --s: max(1.5rem, min(4.4vw, 7.5vh)); }

/* The exercises of a level, side by side with nothing round them: each is its drawing over
   time, its best clean tempo of its goal in the display face, and its name. Where the level is
   open each is pressed to be played, so they are a bar and the lens is under the pointer; where
   it is not they are soft and nothing answers. */
.drums .shelf {
  --h: clamp(170px, 36vh, 300px);
  flex: none;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: min(100%, 1180px);
  height: var(--h);
  padding: 0;
}
.drums .shelf > .item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 250px;
  height: var(--h);
  box-sizing: border-box;
  padding: 16px 16px 14px;
  line-height: 1.2;
  white-space: normal;
  color: var(--text);
}
.drums .shelf > .item > .chart { flex: 1 1 0; min-height: 0; }
.drums .shelf .figure { font: 700 clamp(18px, 2.1vw, 27px)/1 var(--display); letter-spacing: -0.02em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.drums .shelf .figure b { font-weight: inherit; color: var(--accent); }
.drums .shelf .name { font-size: 14px; font-weight: 500; color: var(--text-soft); }
.drums .shelf > .item.shut, .drums .shelf > .item.shut .figure b { color: var(--text-soft); }
.drums .dock [aria-disabled="true"] { opacity: 0.4; }
.chart .tempo { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.chart .wander { fill: none; stroke: var(--text); stroke-width: 1; stroke-linejoin: round; }

/* A session's notes: a place to type with a hairline round it, in the accent while it has the
   keys. */
.drums .notes {
  flex: none;
  box-sizing: border-box;
  width: min(100%, 640px);
  height: clamp(110px, 24vh, 220px);
  margin: 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--text);
  font: 16px/1.5 var(--body);
  resize: none;
  outline: none;
}
.drums .notes::placeholder { color: var(--text-soft); }
.drums .notes:focus-visible { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* A bar of things to do, not of things to pick between, has no lens until the pointer or the
   keys are on it. */
.drums .bar.unpicked:not(:hover):not(:has(:focus-visible)) > .lens { opacity: 0; }

/* The button that starts the click is the main one; while the click runs it is plain glass that
   stops it (the site's .swap, with a second wording that can be pressed). */
.drums .swap.going > .can { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0; visibility: hidden; }
.drums .swap.going > .cannot { position: relative; left: auto; top: auto; transform: none; opacity: 1; visibility: visible; }
.drums .swap.live.going > .can { transition: opacity 200ms ease, visibility 0s linear 200ms; }
.drums .swap.live.going > .cannot { transition: opacity 200ms ease, visibility 0s linear 0s; }
.drums .glass.main.word.going {
  background: var(--glass-solid);
  box-shadow: inset 0 0 0 1px var(--glass-rim), 0 0 0 1px var(--glass-edge), var(--glass-shade);
  color: var(--text);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .drums .glass.main.word.going { background: var(--glass-fill); }
}
.drums .glass.main.word.going::before { background: var(--lens-fill); box-shadow: inset 0 0 0 1px var(--glass-rim), var(--lens-shade); }

/* A pad the kit has answered for is in the text colour; one still to be asked is soft. In the
   day's plan what is still to be played is in the text colour, and what has been played goes soft. */
.drums .bar > .item.set { color: var(--text); }
.drums #plan > .item { color: var(--text); }
.drums #plan > .item.done { color: var(--text-soft); }

/* The settings: a small button at the end of the dock, as the site's info button is, and a
   panel that comes up out of it, since the dock is at the foot. In the panel each rule is its
   name and, bedded in the panel's own glass, a bar of its choices; the bars are one width. */

.tuning .info-button svg circle { fill: none; }
.tuning .info-panel {
  top: auto;
  bottom: calc(100% + var(--gap-in));
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: var(--gap-in) var(--gap);
  padding: var(--gap-in) var(--gap-in) var(--gap-in) var(--gap);
  transform-origin: calc(100% - 22px) 100%;
}
.tuning .info-panel > .name { color: var(--text); }
.tuning .info-panel > .bar {
  --h: 30px;
  display: flex;
  height: var(--h);
  border-radius: min(calc(var(--h) * 0.3), 14px);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.tuning .info-panel > .bar > .item { flex: 1 1 auto; padding: 0 12px; font-size: 13px; text-align: center; }
.tuning .info-panel > .bar > .lens { border-radius: calc(min(var(--h) * 0.3, 14px) - 3px); }
.tuning .info-panel > [hidden] { display: none; }

/* The bar of pads is the widest thing in the dock, so the room between its pads is taken from
   the window's width, and the dock stays one row on a laptop. In a window narrower than a
   laptop's its words are smaller; in a phone's it goes across under the finger. */
.drums .dock > .bar > .item { padding: 0 clamp(8px, 1.1vw, 16px); }
.drums .dock > #plan > .item { padding: 0 clamp(7px, 0.8vw, 12px); }      /* (the day's plan is names, and they are long) */
@media (max-width: 1180px) {
  .drums .dock > .bar > .item { font-size: 13px; }
  .drums .dock > #plan > .item { padding: 0 7px; }
}
@media (max-width: 600px) {
  .drums .dock > .bar { max-width: 100%; overflow-x: auto; }
}

/* The kit played from the keys (?sim): drawn in the stage over the big line, which is smaller
   for it. A line drawing in the text colour, a key on each pad: no fills, no shade. A drum's
   edge is heavier than a cymbal's, and a cymbal has its bell. A pad that is struck shows it in
   the accent for a moment, as does a roll for as long as it runs; a hand on a cymbal is a ring
   in the text colour, heavier the harder it holds. The engine draws the pads and sets some of
   their paint itself (kit/app.js); these rules are the last word on it. */

.drums.keyed .stage { flex-direction: column; gap: var(--gap); }
.drums.keyed .block { flex: none; --s: max(1.25rem, min(3.6vw, 7.5vh)); }
.drums .kit {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  overflow: visible;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.drums:not([data-state="pads"]):not([data-state="click"]):not([data-state="lag"]):not([data-state="drill"]) .kit { display: none; }      /* (it is there wherever it can be played) */

.kit .pad { cursor: pointer; filter: none; transform-box: fill-box; transform-origin: center; transition: transform 60ms ease-out; }
.kit .pad circle, .kit .pad rect { fill: transparent; stroke: var(--text-soft); stroke-width: 1.2; stroke-dasharray: none; transition: stroke 160ms ease-out; }
.kit .pad circle[stroke-width="6"] { stroke-width: 2.6; }
/* (one circle a pad: the engine's inner rings, its bell and its key chips are not drawn) */
.kit .pad circle:not(:first-of-type):not(.rollfx):not(.choke):not(.badge), .kit .pad .chip { display: none; }
.kit .pad circle:not(:first-of-type) { pointer-events: none; }
.kit .pad .badge { fill: var(--text-soft); stroke: none; }

.kit .pad.hit { transform: scale(0.96); }
.kit .pad.hit circle, .kit .pad.hit rect { stroke: var(--accent); transition: none; }
.kit .pad.hit .badge { fill: var(--accent); }

.kit .pad .rollfx { fill: none; stroke: var(--accent); opacity: 0; transition: opacity 180ms ease-out; }
.kit .pad .rollfx[stroke-width="0"] { stroke-width: 2; }
.kit .pad .choke { fill: none; stroke: var(--text); opacity: 0; transition: opacity 260ms ease-out; }
.kit .pad .choke[stroke="#ff8a80"] { stroke-opacity: 0.4; }
.kit .pad .choke[stroke="#e03131"] { stroke-opacity: 0.7; }

.kit .pad text { font-family: var(--body); stroke: none; text-anchor: middle; pointer-events: none; }
.kit .pad .key { font-size: 20px; font-weight: 600; fill: var(--text); dominant-baseline: central; transition: fill 160ms ease-out; }
.kit .pad .key.mid { font-size: 17px; }
.kit .pad .key.small, .kit .pad .key.chip-key { font-size: 14px; }
.kit .pad.kb .key { font-size: 18px; }
.kit .pad .zname { font-size: 9px; fill: var(--text-soft); }
.kit .pad .chip ~ .zname { transform: translateY(-5px); }      /* (the name of a key at the rim sits up under its key) */
.kit .pad .zname.big { font-size: 11px; dominant-baseline: central; }
.kit .pad .name { font-size: 11.5px; fill: var(--text-soft); }
.kit .pad.hit .key, .kit .pad .zone.zhit .key { fill: var(--accent); transition: none; }
.kit .pad .zone { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .kit .pad, .kit .pad * { transition: none; } }

/* Glass is see-through, and the settings come up over the stage: what they would lie on goes
   while they are out, and comes back when they are put away. */
.drums .stage, .drums .caption { transition: opacity 160ms ease; }
.drums:has(.tuning.open) .stage, .drums:has(.tuning.open) .caption { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .drums .stage, .drums .caption { transition: none; } }

/* What belongs to a state shows in that state: data-for names the states a thing is for, and in
   any other it is not there. (Last in the file, so that no rule above that lays a thing out
   brings it back.) */
.drums[data-state="starting"] [data-for],
.drums[data-state="asking"] [data-for],
.drums[data-state="nomidi"] [data-for],
.drums[data-state="blocked"] [data-for],
.drums[data-state="nokit"] [data-for],
.drums[data-state="pads"] [data-for]:not([data-for~="pads"]),
.drums[data-state="click"] [data-for]:not([data-for~="click"]),
.drums[data-state="lag"] [data-for]:not([data-for~="lag"]),
.drums[data-state="drill"] [data-for]:not([data-for~="drill"]),
.drums[data-state="told"] [data-for]:not([data-for~="told"]),
.drums[data-state="progress"] [data-for]:not([data-for~="progress"]),
.drums[data-state="log"] [data-for]:not([data-for~="log"]) { display: none; }
