/* Decorative boombox speaker (shared/_speaker) — the owner's vintage-panel
   design. The cabinet now themes with washi/sumi (owner direction,
   2026-07-09, supersedes the ADR-015 "always dark hardware" stance): sumi
   keeps the original dark reference values; washi is its negative — paper
   cabinet, linen mesh with ink speckle, pale dust cap. The metal bezel, the
   steel pin, and the VU faces/needles are physical constants on both.
   --speaker-pump (0..1, set per frame from the player's bass energy) drives
   the mesh, dust cap and VU needles. Sizing is the layout column's job
   (.detail-side / .deck-speaker); the woofer measures itself against the
   cabinet's free width AND height via container-query units. */

.speaker-chassis {
  /* washi (default theme) — the negative of the sumi reference below */
  --cab-panel: #f6f1e7;
  --cab-strip: #fdfbf4;
  --cab-strip-dot: rgba(30, 28, 25, 0.18);
  --cab-recess: #faf7ec;
  --cab-edge: #d9d2c0;
  --cab-dial: #faf6ec;
  --cab-dial-tick-a: #f1ebdd;
  --cab-dial-tick-b: #ddd6c4;
  --cab-dial-hub-a: #cfc8b6;
  --cab-dial-hub-b: #f4efe3;
  --cab-ring: #e9e2d2;
  --cab-mesh: #efe9db;
  --cab-mesh-dot-a: rgba(255, 255, 255, 0.92);
  --cab-mesh-dot-b: rgba(30, 28, 25, 0.15);
  --cab-cone: rgba(30, 28, 25, 0.28);
  --cab-cap-1: #f4eee1;
  --cab-cap-2: #d8d1bf;
  --cab-cap-3: #ece5d4;
  --cab-gloss-end: rgba(30, 28, 25, 0.18);
  --cab-shadow: rgba(30, 28, 25, 0.18);
  --cab-shadow-strong: rgba(30, 28, 25, 0.2);
}

html[data-theme="mobayilo"] .speaker-chassis {
  /* the sumi reference cabinet translated into mobayilo's slate family —
     it blends with the slate page the way sumi's blends with ink */
  --cab-panel: #0f172a;
  --cab-strip: #0a1122;
  --cab-strip-dot: rgba(241, 245, 249, 0.15);
  --cab-recess: #0a0f1e;
  --cab-edge: #263349;
  --cab-dial: #101b31;
  --cab-dial-tick-a: #1b2740;
  --cab-dial-tick-b: #0b1225;
  --cab-dial-hub-a: #64748b;
  --cab-dial-hub-b: #111a2e;
  --cab-ring: #0d1526;
  --cab-mesh: #070d1a;
  --cab-mesh-dot-a: rgba(0, 0, 0, 0.95);
  --cab-mesh-dot-b: rgba(241, 245, 249, 0.12);
  --cab-cone: rgba(0, 0, 0, 0.85);
  --cab-cap-1: #111a2c;
  --cab-cap-2: #33415c;
  --cab-cap-3: #0a1120;
  --cab-gloss-end: rgba(0, 0, 0, 0.6);
  --cab-shadow: rgba(0, 0, 0, 0.5);
  --cab-shadow-strong: rgba(0, 0, 0, 0.8);
}

html[data-theme="sumi"] .speaker-chassis {
  /* the reference cabinet — the owner's original dark values, unchanged */
  --cab-panel: #1a1916;
  --cab-strip: #0f1011;
  --cab-strip-dot: rgba(255, 255, 255, 0.15);
  --cab-recess: #0d0d11;
  --cab-edge: #252627;
  --cab-dial: #111213;
  --cab-dial-tick-a: #1f2022;
  --cab-dial-tick-b: #0b0c0d;
  --cab-dial-hub-a: #555;
  --cab-dial-hub-b: #111;
  --cab-ring: #141517;
  --cab-mesh: #090a0a;
  --cab-mesh-dot-a: rgba(0, 0, 0, 0.95);
  --cab-mesh-dot-b: rgba(255, 255, 255, 0.12);
  --cab-cone: rgba(0, 0, 0, 0.85);
  --cab-cap-1: #151618;
  --cab-cap-2: #3a3d40;
  --cab-cap-3: #0d0e10;
  --cab-gloss-end: rgba(0, 0, 0, 0.6);
  --cab-shadow: rgba(0, 0, 0, 0.5);
  --cab-shadow-strong: rgba(0, 0, 0, 0.8);
}

/* Main cabinet panel — fills whatever column the layout gives it. */
.speaker-chassis {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 480px;
  flex-direction: column;
  gap: 12px;
  background: var(--cab-panel);
  padding: 16px;
}

/* --- top tweeter / vent bar ---------------------------------------------- */
.top-tweeter {
  width: 100%;
  height: 65px;
  flex: 0 0 auto;
  background: var(--cab-strip);
  display: flex;
  overflow: hidden;
  border-radius: 3px;
}

/* Ridged plastic side endcaps */
.side-ridge {
  width: 40px;
  height: 100%;
  background: var(--cab-panel);
}

/* Perforated mesh strip across the top */
.center-grill {
  flex: 1;
  height: 100%;
  background-color: var(--cab-strip);
  background-image:
    radial-gradient(var(--cab-strip-dot) 15%, transparent 20%),
    radial-gradient(var(--cab-strip-dot) 15%, transparent 20%);
  background-size: 6px 6px;
  background-position: 0 0, 3px 3px;
  box-shadow:
    inset 0 10px 15px var(--cab-shadow-strong),
    inset 0 -10px 15px var(--cab-shadow-strong),
    0 2px 2px rgba(255, 255, 255, 0.05);
  position: relative;
}

.center-grill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.08) 50%, transparent);
  pointer-events: none;
}

/* --- main body ------------------------------------------------------------ */
.main-body {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  container-type: size; /* lets the woofer size against the free height too */
}

/* Small vintage selector dial, top-left */
.small-dial {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: var(--cab-dial);
  border: 2px solid var(--cab-edge);
  box-shadow: inset 0 2px 5px var(--cab-shadow-strong), 0 1px 2px rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

/* Mirrored hardware: cabinets on the right side of the stage carry the
   dial top-right (deck right flank; the detail page's right column). */
.deck-speaker--right .small-dial,
.detail-side:not(.detail-side--left) .small-dial {
  left: auto;
  right: 8px;
}

.dial-inner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  /* vintage multi-toothed radial ticks */
  background:
    repeating-conic-gradient(from 0deg, var(--cab-dial-tick-a) 0deg 10deg, var(--cab-dial-tick-b) 10deg 20deg),
    radial-gradient(circle, var(--cab-dial-hub-a) 20%, var(--cab-dial-hub-b) 25%);
  border: 1px solid var(--cab-edge);
  box-shadow: 2px 2px 5px var(--cab-shadow);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* steel pin — a physical constant on both themes */
.dial-inner::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, #999 40%, #444 80%);
  border: 1px solid #ede7da;
}

/* --- large woofer assembly ------------------------------------------------ */

/* Metallic outermost bezel — fills the cabinet's free space, bounded by
   width AND height so it never collides with the tweeter bar or VU panel.
   The metal is a physical constant on both themes. */
.woofer-outer-ring {
  width: clamp(160px, min(96cqw, 96cqh), 900px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, #a6a8ab 0%, #5d6063 45%, #8a8d90 55%, #404244 100%);
  padding: 4px; /* outer ring thickness */
  box-shadow:
    0 4px 10px var(--cab-shadow),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Inside bezel step */
.woofer-inner-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--cab-ring);
  padding: 6px;
  box-shadow: inset 0 4px 8px var(--cab-shadow-strong);
}

/* Dense mesh shield — dark screen with light speckle in sumi, linen with
   ink speckle in washi */
.mesh-grill {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--cab-mesh);
  background-image:
    radial-gradient(var(--cab-mesh-dot-a) 40%, transparent 45%),
    radial-gradient(var(--cab-mesh-dot-b) 20%, transparent 40%);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
  box-shadow: inset 0 15px 25px var(--cab-shadow-strong);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  /* the whole shield breathes with the bass */
  transform: scale(calc(1 + var(--speaker-pump, 0) * 0.03));
  transition: transform 0.08s ease-out;
}

/* Depth overlay: cone-curve shadow over the mesh */
.mesh-grill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 30%, var(--cab-cone) 75%);
  z-index: 2;
  pointer-events: none;
}

/* Reflective dust cap under the mesh */
.dust-cap {
  position: absolute;
  width: 27%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.5) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--cab-cap-1) 10%, var(--cab-cap-2) 40%, var(--cab-cap-3) 70%);
  box-shadow:
    0 0 20px var(--cab-shadow-strong),
    inset -2px -2px 5px rgba(255, 255, 255, 0.1);
  opacity: 0.75; /* subdued: it sits behind the wire mesh */
  z-index: 1;
  transform: scale(calc(1 + var(--speaker-pump, 0) * 0.25));
  transition: transform 0.08s ease-out;
}

/* Gloss highlight across the inner cone */
.dust-cap::after {
  content: "";
  position: absolute;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, transparent 40%, var(--cab-gloss-end) 100%);
}

/* --- recessed VU-meter panel (kept from the ADR-015 hardware) ------------- */
/* The meter faces, arcs, needles and pivot are physical constants. */
.vu-panel {
  flex: 0 0 auto;
  background: var(--cab-recess);
  border: 2px solid var(--cab-edge);
  border-radius: 8px;
  padding: 0.6rem 0.6rem 0.35rem;
  box-shadow: inset 0 2px 10px var(--cab-shadow-strong);
}

.vu-meters {
  display: flex;
  gap: 0.6rem;
}

.vu-meter {
  position: relative;
  flex: 1;
  aspect-ratio: 2 / 1;
  background: linear-gradient(180deg, #f4f1e4 0%, #e7e2d0 100%);
  border: 2px solid #17181d;
  border-radius: 3px;
  overflow: hidden;
}

/* Scale arcs: circles centred on the needle pivot; only the top border
   shows inside the face. Dashed = tick marks, solid = the green band.
   Anchored from the top: the 2:1 face makes height-percentage bottoms
   push the visible crown out of the box. */
.vu-arc {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 108%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 3px solid transparent;
}

.vu-arc--green {
  border-top-color: #3f8f5f;
}

.vu-arc--ticks {
  width: 88%;
  top: 38%;
  border-width: 2px;
  border-style: dashed;
  border-top-color: #26282f;
}

.vu-redzone {
  position: absolute;
  top: 26%;
  right: 12%;
  width: 3px;
  height: 14%;
  background: #c43c33;
  transform: rotate(32deg);
}

.vu-label {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  font-family: "Lato", sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #26282f;
}

.vu-needle {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 2px;
  height: 78%;
  background: #e0342b;
  border-radius: 1px;
  transform-origin: 50% 100%;
  transform: rotate(calc(-48deg + var(--speaker-pump, 0) * 90deg));
  transition: transform 0.08s ease-out;
}

.vu-meter--right .vu-needle {
  transform: rotate(calc(-48deg + var(--speaker-pump, 0) * 82deg));
}

.vu-pivot {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  background: #17181d;
  border-radius: 50%;
}
