/* ============================================================
 * Utilities Bunker — Color Blindness Simulator (v2.1)
 * File: /assets/css/modules/colors/color-blindness-simulator.v2.1.css
 * Purpose:
 * - Tool-only layout + preview lab + canvas stage + split slider UI
 * - Mobile-first, 44×44 touch targets, clamp typography
 * Notes:
 * - Do NOT modify ub-toolkit.v2.1.css
 * ============================================================ */

/* ============================== Local tokens (tool-scoped) ============================== */
:root{
  --cb-radius: 16px;
  --cb-gap: 14px;
  --cb-soft: rgba(0,0,0,.06);
}

/* ============================== Header row (safe helper) ============================== */
.ub-headrow{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}

/* ============================== Hero layout ============================== */
.cb-hero{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--cb-gap);
}
@media (max-width: 980px){
  .cb-hero{ grid-template-columns: 1fr; }
}

/* ============================== Lab panel ============================== */
.cb-lab{
  background: var(--ub-surface-2);
  border: 1px solid var(--ub-border);
  border-radius: var(--cb-radius);
  padding: 12px;
}
.cb-lab-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}
.cb-lab-title{
  font-size: clamp(13px, 1.2vw, 14px);
  font-weight: 950;
  letter-spacing: .01em;
}
.cb-lab-sub{
  font-size: 12px;
  color: var(--ub-muted);
  margin-top: 2px;
}

/* ============================== KPI tiles ============================== */
.cb-kpis{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}
.cb-kpi{
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
}
.cb-kpi .k{
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ub-muted);
}
.cb-kpi .v{
  font-family: var(--ub-mono);
  font-weight: 950;
  font-size: 13px;
  margin-top: 2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 180px;
}

/* ============================== Stage ============================== */
.cb-stage{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.cb-canvaswrap{
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--ub-border);
  background: var(--ub-card-bg);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.02);
  overflow: hidden;

  /* CRITICAL: JS controls height, CSS does NOT */
  height: 0;
}

.cb-canvas{
  display:block;
  width: 100%;
  height: 100%;
}
.cb-canvas--overlay{
  position:absolute;
  inset:0;
  pointer-events:none;
}

/* hide helper used by JS */
.cb-hidden{
  display:none !important;
}

/* Clip helpers (JS uses clip-path inline; these are here for fallback) */
.cb-clip-left{ clip-path: inset(0 50% 0 0); }
.cb-clip-right{ clip-path: inset(0 0 0 50%); }

/* Empty state */
.cb-empty{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap: 6px;
  text-align:center;
  padding: 18px;
  background: linear-gradient(180deg, var(--ub-card-bg), var(--ub-surface-2));
}
.cb-empty-title{
  font-weight: 950;
  font-size: clamp(16px, 1.4vw, 18px);
}
.cb-empty-sub{
  color: var(--ub-muted);
  font-size: 13px;
  max-width: 42ch;
}

/* Stage footer */
.cb-stage-foot{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}

/* Note pill */
.cb-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;
}
.cb-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(249,58,19,.55);
}

/* Quick chips cluster */
.cb-quick{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}
.cb-quick .ub-chip{
  min-height: 44px;
  padding: 10px 14px;
}

/* Presets row */
.cb-presets{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 10px;
}
.cb-presets .ub-chip{
  min-height: 44px;
  padding: 10px 14px;
}

/* ============================== Split bar overlay ============================== */
.cb-splitbar{
  position:absolute;
  inset:0;
  pointer-events:auto;
  touch-action:none;
  --cb-split: 50%;
}
.cb-splitline{
  position:absolute;
  top:0;
  bottom:0;
  left: var(--cb-split);
  width: 2px;
  transform: translateX(-1px);
  background: rgba(249,58,19,.65);
  box-shadow: 0 0 0 3px rgba(249,58,19,.14);
}
.cb-splithandle{
  position:absolute;
  top: 50%;
  left: var(--cb-split);
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  border: 1px solid rgba(249,58,19,.55);
  background: var(--ub-card-bg);
  font-weight: 950;
  font-family: var(--ub-mono);
  user-select:none;
}

/* Focus ring for split handle area */
.cb-splitbar:focus,
.cb-splitbar:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--ub-focus);
}

/* ============================== Controls panel tweaks ============================== */
.cb-controls .ub-range{
  height: 44px; /* touch target */
}
.cb-comparebar{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}
.cb-comparelabel{
  min-width: 120px;
  font-weight: 950;
}
.cb-compareout{
  font-family: var(--ub-mono);
  font-weight: 950;
  min-width: 64px;
  text-align:right;
}

/* ============================== Lists + FAQ text helpers ============================== */
.ub-ol{ margin:0; padding-left:18px; }
.ub-ul{ margin:0; padding-left:18px; }

.cb-h3{
  margin:12px 0 6px;
  font-size: 15px;
  font-weight: 950;
}
.cb-p{
  margin:0 0 10px;
  color: var(--ub-text);
}

/* ============================== Work area ============================== */
.cb-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap:anywhere;
}

/* ============================== Small screens polish ============================== */
@media (max-width: 520px){
  .cb-kpi{ min-width: 108px; }
  .cb-kpi .v{ max-width: 140px; }
  .cb-comparelabel{ min-width: 100px; }
}
