/* ============================================================
   Utilities Bunker — SPL (Sound Pressure Level) v2.1
   File: /assets/css/modules/electronics/spl.v2.1.css
   Purpose:
   - Tool-only layout + SPL readout/meter visuals + work formatting
   - Mobile-first, 44x44 touch targets, clamp typography
   - NO changes to ub-toolkit.v2.1.css
   ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --spl-radius: 16px;
  --spl-gap: 14px;
}

/* ============================== Tool hero layout ============================== */
.ub-spl-hero{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--spl-gap);
}
@media (max-width: 980px){
  .ub-spl-hero{ grid-template-columns: 1fr; }
}

/* ============================== Readout/Lab panel ============================== */
.ub-spl-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--spl-radius);
  padding: 12px;
}
.ub-spl-labtop{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}
.ub-spl-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}
.ub-spl-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* ============================== KPI tiles ============================== */
.ub-spl-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}
.ub-spl-kpi{
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.ub-spl-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.ub-spl-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
  margin-top: 2px;
  overflow-wrap:anywhere;
}

/* ============================== Meter ============================== */
.ub-spl-meter{
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.ub-spl-meterbar{
  height: 16px;
  border-radius: 999px;
  background: var(--ub-surface-3);
  border: 1px solid var(--ub-border);
  overflow:hidden;
}
.ub-spl-fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(92deg, var(--ub-btn-grad-a), var(--ub-btn-grad-b));
  box-shadow: 0 8px 18px var(--ub-btn-glow);
  transition: width 140ms ease;
}
@media (prefers-reduced-motion: reduce){
  .ub-spl-fill{ transition: none; }
}
.ub-spl-meterlabels{
  margin-top: 8px;
  display:flex;
  justify-content:space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ub-muted);
  font-weight: 900;
  letter-spacing: .03em;
}
.ub-spl-note{
  margin-top: 10px;
  font-size: 12px;
  color: var(--ub-muted);
}

/* ============================== Mode chips row ============================== */
.ub-spl-modes{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.ub-spl-modes .ub-chip{
  min-height: var(--ub-hit);
  padding: 10px 12px;
}

/* ============================== Presets row ============================== */
.ub-spl-presetrow{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 12px;
}
.ub-spl-presetrow .ub-chip{
  min-height: var(--ub-hit);
  padding: 10px 12px;
}

/* ============================== Panels ============================== */
.ub-spl-panel[hidden]{
  display:none !important;
}

/* ============================== Work area formatting ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* ============================== Textarea sizing ============================== */
textarea{
  min-height: 120px;
}

/* ============================== Focus ring polish for chips ============================== */
.ub-spl-modes .ub-chip:focus,
.ub-spl-presetrow .ub-chip:focus{
  outline: none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 999px;
}

/* ============================== Small screens tweaks ============================== */
@media (max-width: 520px){
  .ub-spl-kpi{ min-width: 120px; }
  .ub-spl-modes{ grid-template-columns: 1fr; }
}
