/* ============================================================
 * Tool Styles — Schmitt Trigger Threshold Helper v2.1
 * File: /assets/css/modules/electronics/schmitt-trigger.v2.1.css
 * Purpose:
 * - Tool-only layout + threshold plot visuals + work formatting
 * - No changes to ub-toolkit.v2.1.css
 * - Mobile-first, clamp typography, 44x44 touch targets
 * ============================================================ */

/* ==============================
   Local tokens (tool-scoped)
============================== */
:root{
  --st-radius: 16px;
  --st-gap: 14px;
}

/* ==============================
   Hero layout (lab + controls)
============================== */
.ub-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--st-gap);
}

@media (max-width: 980px){
  .ub-hero{ grid-template-columns: 1fr; }
}

/* ==============================
   Lab panel (left)
============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--st-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 (threshold readout)
============================== */
.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;
}

/* Better fit on tiny screens */
@media (max-width: 520px){
  .ub-kpi{ min-width: 98px; }
}

/* ==============================
   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; /* touch target */
  margin-top: 6px;
}

.ub-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ub-muted);
}

/* ==============================
   SVG plot styling
============================== */
.ub-st-svg{
  width:100%;
  height:auto;
  display:block;
  margin-top: 10px;
  border-radius: 14px;
}

/* Marker group focus (if made focusable later) */
.ub-st-mark:focus{
  outline:none;
  filter: drop-shadow(0 0 0.35rem rgba(249,58,19,.25));
}

/* In dark mode, increase marker visibility a bit */
html.ub-theme-dark .ub-st-svg text{
  fill: rgba(255,255,255,.72);
}
html.ub-theme-dark .ub-st-svg rect{
  stroke: rgba(255,255,255,.14);
}
html.ub-theme-dark .ub-st-svg path{
  stroke: rgba(255,255,255,.22);
}

/* ==============================
   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;
}

/* ==============================
   Form polish (tool scoped)
============================== */
.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; /* keeps layout stable */
}

/* ==============================
   Work area formatting
============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* Collapsible summary touch target + focus ring */
.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
============================== */
.ub-btn--block{
  width:100%;
}
