/* ============================================================
   Utilities Bunker — Heatsink Thermal Resistance (v2.1)
   File: /assets/css/modules/electronics/heatsink.v2.1.css
   Purpose:
   - Tool-only layout + thermal stack visuals + work formatting
   - Mobile-first, 44×44 touch targets, clamp typography
   - NO changes to ub-toolkit.v2.1.css
   ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --hs-radius: 16px;
  --hs-gap: 14px;
}

/* ============================== Header row ============================== */
.ub-headrow{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}
.ub-title{ margin:0; font-size: var(--ub-fs-5); }
.ub-subtitle{ margin:6px 0 0; }

/* ============================== Tool hero layout ============================== */
.ub-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--hs-gap);
}
@media (max-width: 980px){
  .ub-hero{ grid-template-columns: 1fr; }
}

/* ============================== Left panel (Thermal Stack View) ============================== */
.ub-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--hs-radius);
  padding: 12px;
}
.ub-lab-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}
.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: 118px;
  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;
}
@media (max-width: 520px){
  .ub-kpi{ min-width: 104px; }
}

/* ============================== Status + mode chips ============================== */
.ub-statusrow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin: 6px 0 8px;
}

.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);
}

.ub-wheel{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: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);
}

/* ============================== Thermal stack diagram ============================== */
.ub-stack{
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  padding: 12px;
}

.ub-stack-row{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
  align-items:stretch;
  margin-bottom: 10px;
}
@media (max-width: 600px){
  .ub-stack-row{
    grid-template-columns: 1fr;
  }
}

.ub-stack-node,
.ub-stack-link{
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  padding: 10px 10px;
  min-height: 56px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.ub-stack-node{
  background: linear-gradient(180deg, var(--ub-surface-1), var(--ub-surface-2));
}
.ub-stack-link{
  background: var(--ub-surface-2);
}

.ub-stack-node .t{
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ub-muted);
}
.ub-stack-node .v{
  margin-top: 4px;
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
}
.ub-stack-link .k{
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ub-muted);
}
.ub-stack-link .v{
  margin-top: 4px;
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 14px;
}

.ub-stack-note{
  margin-top: 8px;
  font-size: 12px;
  color: var(--ub-muted);
  line-height: 1.4;
}

/* ============================== 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;
}

/* ============================== How-to / lists ============================== */
.ub-steps{
  margin:0;
  padding-left:18px;
}
.ub-formula-list{
  margin:0;
  padding-left:18px;
}

/* ============================== Inputs: keep stacked (like your toolkit override) ============================== */
/* Safety: even if toolkit changes later, keep this tool uniform */
.ub-field .ub-inputrow{
  display:block !important;
}
.ub-field .ub-inputrow > input,
.ub-field .ub-inputrow > select{
  display:block !important;
  width:100% !important;
}
.ub-field .ub-inputrow > select{
  margin-top: 6px;
}

/* Hint + inline error (tool-safe) */
.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 */
}

/* ============================== Toolbar helper ============================== */
.ub-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

/* ============================== Work area (monospace) ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ============================== FAQ polish ============================== */
.ub-faq-q{
  margin: 12px 0 6px;
}
.ub-faq-a{
  margin: 0 0 10px;
  color: var(--ub-text);
}

/* ============================== Rail button block helper (tool-only) ============================== */
.ub-btn--block{ width: 100%; }
