/* ============================================================
   Utilities Bunker — Nyquist Sampling Check (v2.1)
   File: /assets/css/modules/electronics/nyquist.v2.1.css
   Purpose:
   - Tool-only layout + sampling gauge visuals + work formatting
   - No changes to ub-toolkit.v2.1.css
   - Mobile-first, 44x44 touch targets, clamp typography
   ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --nyq-radius: 16px;
  --nyq-gap: 14px;
}

/* ============================== Tool hero layout ============================== */
.ub-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--nyq-gap);
}

/* Stack on tablet/mobile */
@media (max-width: 980px){
  .ub-hero{ grid-template-columns: 1fr; }
}

/* ============================== Lab panel ============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--nyq-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: 124px;
  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;
}

/* ============================== Status pill ============================== */
.ub-risk{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  font-size: 12px;
  font-weight: 950;
  min-height: 44px;
}

.ub-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ub-muted);
}

/* Dot state colors (set by JS class) */
.ub-dot.is-success{ background: var(--ub-success); }
.ub-dot.is-warning{ background: var(--ub-warning); }
.ub-dot.is-danger{ background: var(--ub-danger); }

/* ============================== Mode chips (tool) ============================== */
.ub-wheel{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-top: 10px;
}

.ub-wheel .ub-chip{
  min-height: 44px;
  padding: 10px 12px;
}

.ub-wheel .ub-chip[aria-pressed="true"]{
  border-color: rgba(249,58,19,.55);
  box-shadow: 0 0 0 4px rgba(249,58,19,.12);
}

/* ============================== Gauge ============================== */
.nyq-gauge{
  margin-top: 12px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  border-radius: var(--nyq-radius);
  padding: 12px;
}

.nyq-gauge-top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
}

.nyq-gauge-title{
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ub-muted);
}

.nyq-gauge-readout{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: clamp(16px, 1.2rem + 0.6vw, 22px);
}

.nyq-bar{
  margin-top: 10px;
  height: 16px;
  border-radius: 999px;
  background: var(--ub-surface-3);
  border: 1px solid var(--ub-border);
  position: relative;
  overflow: hidden;
}

/* Marker showing r=1.0 (Nyquist). JS maps ratio to width; marker is fixed at 40% (since fill maps 0..2.5 to 0..100) */
.nyq-bar-mark{
  position:absolute;
  top: -6px;
  width: 2px;
  height: 28px;
  background: rgba(0,0,0,.35);
  opacity: .75;
}

html.ub-theme-dark .nyq-bar-mark{
  background: rgba(255,255,255,.35);
}

/* r=1.0 => 1/2.5 = 40% */
.nyq-bar-mark--nyq{ left: 40%; }

/* Fill: no inline colors; uses UB brand gradient */
.nyq-bar-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 10px 22px var(--ub-btn-glow);
  transition: width 160ms ease;
}

@media (prefers-reduced-motion: reduce){
  .nyq-bar-fill{ transition: none; }
}

.nyq-gauge-foot{
  margin-top: 10px;
  display:grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px){
  .nyq-gauge-foot{ grid-template-columns: 1fr 1fr; }
}

.nyq-foot-item{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-2);
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 10px;
}

.nyq-foot-item .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}

.nyq-foot-item .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 13px;
}

/* ============================== 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;
}

/* ============================== Work area (tool) ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* ============================== Rail button block helper ============================== */
.ub-btn--block{ width: 100%; }

/* ============================== Small screens polish ============================== */
@media (max-width: 520px){
  .ub-kpi{ min-width: 108px; }
}

/* Optional: slightly tighter KPI row on very narrow devices */
@media (max-width: 360px){
  .ub-kpi{ min-width: 98px; }
}
