/*
 * Cassette player. Every rule is scoped under .dsp-cassette, and every length
 * is in cqw: the stage is 100cqw square, and the SVG layers use 10 units per cqw.
 */

.dsp-cassette {
  background: #4a2b14;
  font-family: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  color: #1a1918;
}

.dsp-cassette svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dsp-cassette .cs-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100cqw;
  height: 100cqw;
}

.dsp-cassette .cs-front {
  position: absolute;
  left: 12.6cqw;
  top: 7.8cqw;
  width: 74.8cqw;
  height: 51.8cqw;
  pointer-events: none;
}

.dsp-cassette .cs-grain {
  position: absolute;
  left: 0;
  top: 0;
  width: 100cqw;
  height: 100cqw;
  opacity: 0.07;
  pointer-events: none;
}

/* ---- tape mechanism, placed from the cassette's top-left corner ---------- */

.dsp-cassette .cs-well {
  position: absolute;
  left: 16cqw;
  top: 10.2cqw;
  width: 68cqw;
  height: 46.4cqw;
  border-radius: 0.8cqw;
  overflow: hidden;
  pointer-events: none;
}

.dsp-cassette .cs-mech {
  position: absolute;
  left: 1.85cqw;
  top: 0.8cqw;
  width: 0;
  height: 0;
}

.dsp-cassette .cs-pack {
  position: absolute;
  width: 32.256cqw;
  height: 32.256cqw;
  border-radius: 50%;
  will-change: transform;
  background:
    conic-gradient(
      from 296deg,
      rgba(255, 226, 190, 0) 0deg,
      rgba(255, 226, 190, 0.26) 20deg,
      rgba(255, 226, 190, 0) 46deg,
      rgba(255, 226, 190, 0) 176deg,
      rgba(255, 226, 190, 0.13) 198deg,
      rgba(255, 226, 190, 0) 226deg,
      rgba(255, 226, 190, 0) 360deg
    ),
    repeating-radial-gradient(
      circle,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 0.2cqw,
      rgba(255, 240, 220, 0.05) 0.26cqw,
      rgba(0, 0, 0, 0.12) 0.34cqw,
      rgba(0, 0, 0, 0) 0.42cqw
    ),
    radial-gradient(circle, #3d2719 0, #33200f 55%, #25160b 100%);
  box-shadow:
    inset 0 0 0 0.09cqw rgba(150, 110, 78, 0.55),
    inset 0 0 0.9cqw rgba(0, 0, 0, 0.45),
    0.15cqw 0.3cqw 0.8cqw rgba(0, 0, 0, 0.6);
}

.dsp-cassette .cs-seg {
  position: absolute;
  left: 0;
  top: -0.16cqw;
  width: 10cqw;
  height: max(1px, 0.32cqw);
  transform-origin: 0 50%;
  will-change: transform;
  background: linear-gradient(180deg, #6a4930 0, #2a180d 45%, #1d1008 100%);
}

.dsp-cassette .cs-hub {
  position: absolute;
  width: 14.72cqw;
  height: 14.72cqw;
}

.dsp-cassette .cs-hub-rot,
.dsp-cassette .cs-hub-blur,
.dsp-cassette .cs-hub-gloss {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.dsp-cassette .cs-hub-rot {
  will-change: transform, opacity;
}

.dsp-cassette .cs-hub-blur {
  opacity: 0;
  will-change: opacity;
}

/* The light does not turn with the hub. */
.dsp-cassette .cs-hub-gloss {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 72% 78%, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 44%);
  -webkit-mask: radial-gradient(circle, #000 0, #000 67%, transparent 68.5%);
  mask: radial-gradient(circle, #000 0, #000 67%, transparent 68.5%);
}

.dsp-cassette .cs-plate {
  position: absolute;
  will-change: transform;
}

.dsp-cassette .cs-pinch {
  position: absolute;
  width: 7.168cqw;
  height: 7.168cqw;
}

.dsp-cassette .cs-pinch-rot,
.dsp-cassette .cs-pinch-gloss {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.dsp-cassette .cs-pinch-rot {
  will-change: transform;
}

.dsp-cassette .cs-pinch-gloss {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.34) 0, rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 74% 80%, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0) 50%);
}

/* ---- transport keys ------------------------------------------------------ */

.dsp-cassette .cs-keys {
  position: absolute;
  left: 14cqw;
  top: 71.4cqw;
  width: 72cqw;
  height: 17.3cqw;
}

.dsp-cassette .cs-key {
  --cap-top: #d2ccbf;
  --cap-mid: #e7e2d7;
  --cap-low: #f4f0e8;
  --wall-top: #a59e8f;
  --wall-low: #5b5549;
  --ink: #26221e;
  --hi: rgba(255, 255, 255, 0.8);
  position: absolute;
  top: 0;
  height: 17.3cqw;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-touch-callout: none;
}

.dsp-cassette .cs-key--play {
  --cap-top: #d9541a;
  --cap-mid: #ec6a26;
  --cap-low: #f78a45;
  --wall-top: #b3400f;
  --wall-low: #5e1f05;
  --ink: #fff6e8;
  --hi: rgba(255, 196, 150, 0.7);
}

/* REPLAY: a narrower graphite key, set apart at the far end from PLAY. */
.dsp-cassette .cs-key--replay {
  --cap-top: #2f2e2c;
  --cap-mid: #3c3a37;
  --cap-low: #4a4844;
  --wall-top: #2a2826;
  --wall-low: #0c0b0a;
  --ink: #f1ebdd;
  --hi: rgba(255, 255, 255, 0.3);
}

.dsp-cassette .cs-key--rew,
.dsp-cassette .cs-key--ff {
  touch-action: none;
}

/* The front face of the key, seen because the camera sits a little forward. */
.dsp-cassette .cs-key-wall {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.2cqw;
  border-radius: 0 0 0.55cqw 0.55cqw;
  transform-origin: 50% 100%;
  will-change: transform;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0, rgba(255, 255, 255, 0) 12%, rgba(0, 0, 0, 0) 82%, rgba(0, 0, 0, 0.3) 100%),
    linear-gradient(180deg, var(--wall-top) 0, var(--wall-low) 100%);
  box-shadow:
    0 0.35cqw 0.5cqw rgba(0, 0, 0, 0.65),
    0 0 0 max(1px, 0.07cqw) rgba(0, 0, 0, 0.5);
}

.dsp-cassette .cs-key-cap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 15.25cqw;
  border-radius: 0.9cqw 0.9cqw 0.6cqw 0.6cqw;
  overflow: hidden;
  will-change: transform;
  /*
   * A moulded cap under a light from the upper left: bright top and left
   * bevels, a shaded right bevel, and a dark chamfer where the front edge
   * turns away from the light.
   */
  background:
    linear-gradient(180deg, var(--hi) 0, rgba(255, 255, 255, 0) 0.4cqw),
    linear-gradient(90deg, var(--hi) 0, rgba(255, 255, 255, 0) 0.4cqw),
    linear-gradient(270deg, rgba(0, 0, 0, 0.36) 0, rgba(0, 0, 0, 0) 0.5cqw),
    linear-gradient(0deg, rgba(0, 0, 0, 0.42) 0, rgba(0, 0, 0, 0) 0.32cqw),
    linear-gradient(180deg, var(--cap-top) 0, var(--cap-mid) 55%, var(--cap-low) 100%);
  box-shadow:
    0 0 0 max(1px, 0.07cqw) rgba(0, 0, 0, 0.6),
    0.3cqw 0.25cqw 0.55cqw rgba(0, 0, 0, 0.55);
}

.dsp-cassette .cs-key-grain {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.06;
}

/* The finger scoop: its upper-left wall is in shade, its lower-right wall lit. */
.dsp-cassette .cs-key-dish {
  position: absolute;
  left: 0.95cqw;
  right: 0.95cqw;
  top: 1.05cqw;
  height: 11.9cqw;
  border-radius: 1.3cqw;
  background: linear-gradient(170deg, rgba(0, 0, 0, 0.13) 0, rgba(0, 0, 0, 0.03) 55%, rgba(255, 255, 255, 0.16) 100%);
  box-shadow:
    inset 0.22cqw 0.32cqw 0.6cqw rgba(0, 0, 0, 0.36),
    inset -0.14cqw -0.22cqw 0.4cqw var(--hi),
    0.07cqw 0.11cqw 0 var(--hi),
    -0.05cqw -0.08cqw 0 rgba(0, 0, 0, 0.14);
}

.dsp-cassette .cs-key-glyph {
  position: absolute;
  left: 50%;
  top: 4.3cqw;
  width: 7.4cqw;
  height: 4.1cqw;
  margin-left: -3.7cqw;
  fill: var(--ink);
  filter: drop-shadow(0 0.09cqw 0 rgba(255, 255, 255, 0.55));
}

.dsp-cassette .cs-key--play .cs-key-glyph {
  top: 3.5cqw;
  width: 6cqw;
  height: 6cqw;
  margin-left: -2.7cqw;
  filter: drop-shadow(0 0.1cqw 0 rgba(90, 30, 0, 0.55));
}

.dsp-cassette .cs-key--stop .cs-key-glyph {
  top: 4.2cqw;
  width: 4.4cqw;
  height: 4.4cqw;
  margin-left: -2.2cqw;
}

.dsp-cassette .cs-key--replay .cs-key-glyph {
  top: 4.5cqw;
  width: 5.6cqw;
  height: 3.9cqw;
  margin-left: -2.8cqw;
  filter: drop-shadow(0 -0.08cqw 0 rgba(0, 0, 0, 0.6));
}

.dsp-cassette .cs-key--replay .cs-key-dish {
  left: 0.8cqw;
  right: 0.8cqw;
}

.dsp-cassette .cs-key--replay .cs-key-word {
  font-size: 1.8cqw;
  letter-spacing: 0.12cqw;
}

.dsp-cassette .cs-key-word {
  position: absolute;
  left: 0;
  right: 0;
  top: 9.7cqw;
  text-align: center;
  font-size: 2.05cqw;
  font-weight: 600;
  letter-spacing: 0.22cqw;
  line-height: 1;
  opacity: 0.88;
}

/* A key that is down sits in the shade of the well. */
.dsp-cassette .cs-key-dim {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  will-change: opacity;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0, rgba(0, 0, 0, 0.2) 22%, rgba(0, 0, 0, 0.13) 100%);
}

.dsp-cassette .cs-key:focus-visible .cs-key-cap {
  outline: 0.45cqw solid #c2410c;
  outline-offset: -0.75cqw;
}

.dsp-cassette .cs-key--play:focus-visible .cs-key-cap {
  outline-color: #fff;
}

/* ---- tape counter -------------------------------------------------------- */

.dsp-cassette .cs-counter {
  position: absolute;
  left: 15cqw;
  top: 60.3cqw;
  width: 12.6cqw;
  height: 5.6cqw;
  display: flex;
  gap: 0.22cqw;
  padding: 0 0.4cqw;
  border-radius: 0.45cqw;
  overflow: hidden;
  background: #030303;
  box-shadow:
    0 0 0 0.24cqw #171717,
    0.06cqw 0.1cqw 0 0.36cqw rgba(255, 255, 255, 0.62),
    -0.05cqw -0.08cqw 0 0.36cqw rgba(0, 0, 0, 0.4);
}

.dsp-cassette .cs-drum {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  overflow: hidden;
  background: #181716;
  color: #f4f0e6;
}

.dsp-cassette .cs-drum--u {
  background: #efe9da;
  color: #b3200f;
}

.dsp-cassette .cs-drum-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.dsp-cassette .cs-drum-strip span {
  display: block;
  height: 4.6cqw;
  font-size: 4.5cqw;
  font-weight: 600;
  line-height: 4.6cqw;
  text-align: center;
}

/* The drums are cylinders: they fall into shadow above and below the window. */
.dsp-cassette .cs-counter-glass {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.2) 0, rgba(255, 255, 255, 0) 30%),
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.92) 0,
      rgba(0, 0, 0, 0.34) 20%,
      rgba(255, 255, 255, 0.1) 38%,
      rgba(0, 0, 0, 0) 54%,
      rgba(0, 0, 0, 0.36) 80%,
      rgba(0, 0, 0, 0.94) 100%
    );
}

.dsp-cassette .cs-reset {
  position: absolute;
  left: 28.2cqw;
  top: 60.9cqw;
  width: 4.4cqw;
  height: 4.4cqw;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.dsp-cassette .cs-reset::before {
  content: "";
  position: absolute;
  left: 0.5cqw;
  top: 0.5cqw;
  width: 3.4cqw;
  height: 3.4cqw;
  border-radius: 50%;
  background: #050505;
  box-shadow:
    0.05cqw 0.08cqw 0 0.12cqw rgba(255, 255, 255, 0.6),
    -0.05cqw -0.07cqw 0 0.12cqw rgba(0, 0, 0, 0.35);
}

.dsp-cassette .cs-reset-cap {
  position: absolute;
  left: 0.75cqw;
  top: 0.75cqw;
  width: 2.9cqw;
  height: 2.9cqw;
  border-radius: 50%;
  will-change: transform;
  background: radial-gradient(circle at 36% 30%, #6b6966 0, #3a3836 38%, #1b1a19 78%, #0c0c0b 100%);
  box-shadow:
    0.1cqw 0.16cqw 0.3cqw rgba(0, 0, 0, 0.75),
    inset 0 0.08cqw 0 rgba(255, 255, 255, 0.25);
}

.dsp-cassette .cs-reset:focus-visible::before {
  outline: 0.4cqw solid #c2410c;
  outline-offset: 0.25cqw;
}

/* ---- level meter and lamp ------------------------------------------------ */

.dsp-cassette .cs-meter {
  position: absolute;
  left: 35.2cqw;
  top: 59.6cqw;
  width: 20cqw;
  height: 8cqw;
  border-radius: 0.7cqw;
  overflow: hidden;
  box-shadow:
    0.06cqw 0.1cqw 0 0.14cqw rgba(255, 255, 255, 0.62),
    -0.05cqw -0.08cqw 0 0.14cqw rgba(0, 0, 0, 0.4);
}

.dsp-cassette .cs-meter-off,
.dsp-cassette .cs-meter-glow,
.dsp-cassette .cs-meter-glass {
  position: absolute;
  left: 0.7cqw;
  top: 0.7cqw;
  width: 18.6cqw;
  height: 6.6cqw;
  border-radius: 0.3cqw;
}

/* Unlit, the scale is dull card. With the lamp on, it glows from below. */
.dsp-cassette .cs-meter-off {
  background: rgba(48, 34, 12, 0.46);
  transition: opacity 0.35s ease-out;
}

.dsp-cassette .cs-meter-glow {
  opacity: 0;
  background: radial-gradient(70% 120% at 50% 108%, rgba(255, 196, 92, 0.6) 0, rgba(255, 214, 130, 0.2) 55%, rgba(255, 214, 130, 0) 100%);
  transition: opacity 0.35s ease-out;
}

.dsp-cassette.cs-on .cs-meter-off {
  opacity: 0;
}

.dsp-cassette.cs-on .cs-meter-glow {
  opacity: 1;
}

.dsp-cassette .cs-needle {
  position: absolute;
  left: 9.88cqw;
  top: 3.1cqw;
  width: max(1px, 0.24cqw);
  height: 7.3cqw;
  transform-origin: 50% 100%;
  transform: rotate(-42deg);
  will-change: transform;
  background: linear-gradient(90deg, #5a1208, #17120f 60%);
  box-shadow: 0.18cqw 0.12cqw 0.12cqw rgba(60, 35, 5, 0.35);
}

.dsp-cassette .cs-meter-hub {
  position: absolute;
  left: 7.2cqw;
  top: 6.25cqw;
  width: 5.6cqw;
  height: 2.2cqw;
  border-radius: 2.8cqw 2.8cqw 0 0 / 1.6cqw 1.6cqw 0 0;
  background: linear-gradient(180deg, #3b3936 0, #131211 70%);
}

.dsp-cassette .cs-meter-glass {
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.34) 0, rgba(255, 255, 255, 0.06) 26%, rgba(255, 255, 255, 0) 27%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0, rgba(0, 0, 0, 0) 16%);
  box-shadow: inset 0 0 0.5cqw rgba(0, 0, 0, 0.45);
}

.dsp-cassette .cs-led {
  position: absolute;
  left: 57.95cqw;
  top: 62.3cqw;
  width: 1.9cqw;
  height: 1.9cqw;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #8a3a30 0, #54160f 55%, #2a0705 100%);
  box-shadow:
    0 0 0 0.2cqw #232323,
    0.05cqw 0.08cqw 0 0.34cqw rgba(255, 255, 255, 0.62),
    -0.04cqw -0.06cqw 0 0.34cqw rgba(0, 0, 0, 0.35);
}

.dsp-cassette .cs-led i {
  position: absolute;
  left: -1.3cqw;
  top: -1.3cqw;
  width: 4.5cqw;
  height: 4.5cqw;
  border-radius: 50%;
  opacity: 0;
  will-change: opacity;
  background: radial-gradient(circle, #ffd9c2 0, #ff5a36 14%, #ff2a12 22%, rgba(255, 44, 20, 0.42) 34%, rgba(255, 44, 20, 0) 66%);
}

/* ---- volume thumbwheel --------------------------------------------------- */

.dsp-cassette .cs-wheel {
  position: absolute;
  left: 62.6cqw;
  top: 59.3cqw;
  width: 22.4cqw;
  height: 7.6cqw;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: ew-resize;
  touch-action: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.dsp-cassette .cs-wheel-slot {
  position: absolute;
  left: 0;
  right: 0;
  top: 1cqw;
  height: 5.6cqw;
  border-radius: 0.6cqw;
  overflow: hidden;
  background: #050505;
  box-shadow:
    0 0 0 0.2cqw #151515,
    0.06cqw 0.1cqw 0 0.32cqw rgba(255, 255, 255, 0.62),
    -0.05cqw -0.08cqw 0 0.32cqw rgba(0, 0, 0, 0.4);
}

/* The rim of the wheel: knurled above, a smooth printed band below. */
.dsp-cassette .cs-wheel-strip {
  position: absolute;
  left: 0;
  top: 0.3cqw;
  width: 58.4cqw;
  height: 5cqw;
  will-change: transform;
  background: repeating-linear-gradient(90deg, #1b1b1c 0, #5a5a5d 0.2cqw, #2d2d2f 0.36cqw, #0e0e0f 0.52cqw, #1b1b1c 0.6cqw);
}

.dsp-cassette .cs-wheel-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 2.45cqw;
  height: 2.55cqw;
  background: linear-gradient(180deg, #0b0b0b 0, #222223 12%, #1a1a1b 100%);
}

.dsp-cassette .cs-wheel-band i {
  position: absolute;
  top: 0.1cqw;
  width: 3.6cqw;
  font-style: normal;
  font-size: 2.35cqw;
  font-weight: 600;
  line-height: 2.4cqw;
  text-align: center;
  color: #f3efe4;
}

/* The rim curves away into the slot at both ends. */
.dsp-cassette .cs-wheel-shade {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0) 16%, rgba(0, 0, 0, 0) 88%, rgba(0, 0, 0, 0.6) 100%),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.96) 0,
      rgba(0, 0, 0, 0.5) 12%,
      rgba(255, 255, 255, 0.16) 34%,
      rgba(255, 255, 255, 0) 50%,
      rgba(0, 0, 0, 0.45) 84%,
      rgba(0, 0, 0, 0.97) 100%
    );
}

.dsp-cassette .cs-wheel-index {
  position: absolute;
  left: 11.05cqw;
  top: 0;
  width: 0.3cqw;
  height: 2.6cqw;
  background: #ff6a1f;
  box-shadow: 0.1cqw 0 0.15cqw rgba(0, 0, 0, 0.6);
}

.dsp-cassette .cs-wheel:focus-visible .cs-wheel-slot {
  outline: 0.4cqw solid #c2410c;
  outline-offset: 0.5cqw;
}

/* ---- scene: the desk carried out across the band ------------------------- */

/* The backdrop paints the desk and the player's shadow, so the square drops its own. */
.dsp-scene .dsp-cassette .cs-desk {
  display: none;
}

/* The film grain stays on the player; the backdrop lays its own over the desk. */
.dsp-scene .dsp-cassette .cs-grain {
  clip-path: inset(3.6cqw 10cqw 7.8cqw 10cqw round 2.6cqw);
}

.dsp-backdrop-cassette {
  background: #4a2b14;
}

.dsp-backdrop-cassette .cs-bd-ground,
.dsp-backdrop-cassette .cs-bd-shadow,
.dsp-backdrop-cassette .cs-bd-lead,
.dsp-backdrop-cassette .cs-bd-grain {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.dsp-backdrop-cassette .cs-bd-grain {
  opacity: 0.07;
}