/* SHIELD/ATLAS — PHASE 1 Safety + Readability overlay
 * Doctrine: docs/UX_BUILD_PHASE_0.md, docs/UX_AUDIT_CONSOLIDATED.md
 * Scope: items 1-6 (font floor, focus outlines, kill-chain confirm, WCAG quick wins)
 * Loaded by: cop, cram-dashboard, dod-cop, kill-chain-simulation
 * No structural changes to host pages; pure overlay.
 */

:root {
  --sa-min-font: 12px;
  --sa-focus: #06b6d4;
  --sa-confirm-red: #ef4444;
  --sa-confirm-red-deep: #b91c1c;
}

/* 1. FONT FLOOR — known small classes raised to 12px minimum.
 * Targeted by class to avoid blowing up dense layouts. */
.kc-detail-item .label,
.threat-group-header,
.threat-count,
.threat-cal,
.live-stats,
.live-classify-results,
.dd-meta,
.empty-state,
.legend-item,
.coord-bar,
.classification-ribbon-label {
  font-size: var(--sa-min-font) !important;
  line-height: 1.4 !important;
}

/* 2. HIGH-CONTRAST :focus-visible OUTLINES — keyboard nav visibility */
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.eng-opt-tile:focus-visible {
  outline: 2px solid var(--sa-focus) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(6,182,212,0.28) !important;
}

/* 3. SKIP-NAV link (injected by JS) */
.sa-skip-nav {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--sa-focus);
  color: #000;
  padding: 10px 18px;
  z-index: 100001;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  letter-spacing: 0.5px;
  border-radius: 0 0 6px 0;
  transition: top 0.15s ease-out;
}
.sa-skip-nav:focus,
.sa-skip-nav:focus-visible {
  top: 0;
  outline: 3px solid #fff;
}

/* 4. KILL-CHAIN CONFIRM MODAL — press-and-hold 1s safety gate */
.sa-confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.sa-confirm-modal.open { display: flex; }
.sa-confirm-box {
  background: #1a1f2e;
  border: 2px solid var(--sa-confirm-red);
  border-radius: 8px;
  padding: 22px 24px;
  max-width: 480px;
  width: 100%;
  color: #fff;
  box-shadow: 0 20px 60px rgba(239,68,68,0.35);
}
.sa-confirm-box h3 {
  color: var(--sa-confirm-red);
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 800;
}
.sa-confirm-action {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 4px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 14px;
  word-break: break-word;
}
.sa-confirm-box p {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 14px;
}
.sa-confirm-hint {
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-top: 6px;
  text-align: center;
}
.sa-confirm-hold-bar {
  height: 6px;
  background: #334155;
  border-radius: 3px;
  margin: 4px 0 14px;
  overflow: hidden;
}
.sa-confirm-hold-fill {
  height: 100%;
  background: var(--sa-confirm-red);
  width: 0%;
  transition: width 80ms linear;
}
.sa-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.sa-confirm-actions button {
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  border: 1px solid;
  min-height: 44px;
  min-width: 110px;
  font-family: inherit;
  text-transform: uppercase;
}
.sa-confirm-cancel {
  background: transparent;
  color: #94a3b8;
  border-color: #94a3b8;
}
.sa-confirm-cancel:hover { color: #fff; border-color: #fff; }
.sa-confirm-go {
  background: var(--sa-confirm-red);
  color: #fff;
  border-color: var(--sa-confirm-red);
  user-select: none;
  -webkit-user-select: none;
}
.sa-confirm-go.holding { background: var(--sa-confirm-red-deep); border-color: var(--sa-confirm-red-deep); }

/* 5. HELP BADGE — bottom-right hint to press ? */
.sa-help-badge {
  position: fixed;
  bottom: 14px;
  right: 14px;
  background: rgba(6,182,212,0.14);
  border: 1px solid rgba(6,182,212,0.5);
  color: var(--sa-focus);
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  z-index: 9998;
  pointer-events: none;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 6. HELP OVERLAY (used when host page has no #helpOverlay of its own) */
.sa-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.sa-help-overlay.open { display: flex; }
.sa-help-card {
  background: #0f1419;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 22px 26px;
  max-width: 560px;
  width: 100%;
  color: #e2e8f0;
  max-height: 85vh;
  overflow-y: auto;
}
.sa-help-card h3 {
  color: var(--sa-focus);
  margin: 0 0 14px;
  font-size: 14px;
  letter-spacing: 1.5px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sa-help-card h3 .sa-help-close {
  cursor: pointer;
  color: #64748b;
  font-size: 18px;
  font-weight: 400;
}
.sa-help-card h3 .sa-help-close:hover { color: #fff; }
.sa-help-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #1e293b;
}
.sa-help-row:last-child { border-bottom: 0; }
.sa-help-key {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 3px;
  padding: 2px 8px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  color: var(--sa-focus);
  font-weight: 700;
  min-width: 36px;
  text-align: center;
}
.sa-help-desc { color: #cbd5e1; flex: 1; }
.sa-help-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #1e293b;
  font-size: 11px;
  color: #64748b;
  text-align: center;
  letter-spacing: 0.5px;
}

/* 7. Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  .sa-skip-nav { transition: none; }
  .sa-confirm-hold-fill { transition: none; }
}
