/* ============================================================
 * Utilities Bunker — Capacitive Reactance (Xc) v2.1
 * File: /assets/css/modules/electronics/capacitive-reactance.v2.1.css
 * Purpose:
 * - Tool-only layout + diagram visuals + work formatting
 * - No changes to ub-toolkit.v2.1.css
 * - Mobile-first, clamp typography, 44x44 touch targets
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --xc-radius: 16px;
  --xc-gap: 14px;
  --xc-soft: rgba(0,0,0,.06);
}

/* ============================== Tool layout: lab + controls ============================== */
.ub-tool{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--xc-gap);
}

/* Stack on tablet/mobile */
@media (max-width: 980px){
  .ub-tool{ grid-template-columns: 1fr; }
}

/* ============================== Lab panel ============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--xc-radius);
  padding: 12px;
}

.ub-lab-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}

.ub-lab-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}

.ub-lab-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* ============================== KPI tiles ============================== */
.ub-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}

.ub-kpi{
  min-width: 112px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}

.ub-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}

.ub-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
  margin-top: 2px;
}

/* Slightly tighter on very small screens */
@media (max-width: 520px){
  .ub-kpi{ min-width: 98px; }
}

/* ============================== Diagram SVG ============================== */
.ub-diagram{
  width: 100%;
  height: auto;
  margin-top: 10px;
  display:block;
  border-radius: 14px;
}

/* Make the wave feel alive but subtle (JS adjusts opacity/dashoffset) */
@keyframes ub-xc-wave{
  from{ stroke-dashoffset: 60; }
  to{ stroke-dashoffset: 0; }
}
#wavePath{
  animation: ub-xc-wave 900ms linear infinite;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  #wavePath{ animation: none; }
}

/* In dark mode, keep diagram readable */
html.ub-theme-dark .ub-diagram text{
  fill: rgba(255,255,255,.70) !important;
}
html.ub-theme-dark .ub-diagram rect{
  fill: rgba(255,255,255,.03) !important;
  stroke: rgba(255,255,255,.12) !important;
}

/* ============================== Presets row ============================== */
.ub-preset-row{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 10px;
}
.ub-preset-row .ub-chip{
  min-height: 44px;
  padding: 10px 12px;
}

/* ============================== Inputs: small enhancements ============================== */
.hint{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-muted);
}

.ub-inline-error{
  margin-top: 6px;
  font-size: 12px;
  color: var(--ub-danger);
  font-weight: 800;
  min-height: 16px; /* stable layout */
}

/* ============================== Work area ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Details polish (safe; toolkit already styles collapsible) */
.ub-collapsible summary{
  cursor:pointer;
  font-weight: 950;
  min-height: 44px;
  display:flex;
  align-items:center;
}

.ub-collapsible summary:focus{
  outline: none;
  box-shadow: 0 0 0 4px var(--ub-focus);
  border-radius: 12px;
}

/* ============================== Rail helper (tool-only) ============================== */
.ub-btn--block{ width: 100%; }
