/* explain.css — plain-language explainer layer, static site version.
   Brand: Liberty #4B52A3, Open Sans. Matches InfoTip.tsx visual contract. */

.uv-explain {
  position: relative;
  display: inline-flex;
  align-items: baseline;
}

.uv-explain-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;              /* WCAG 2.5.8 target size */
  min-height: 24px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4B52A3;
  cursor: pointer;
  vertical-align: middle;
  touch-action: manipulation;
}
.uv-explain-btn:hover { background: rgba(75, 82, 163, 0.1); }
.uv-explain-btn:focus-visible {
  outline: 2px solid #4B52A3;
  outline-offset: 2px;
}
@media (pointer: coarse) {
  .uv-explain-btn { width: 32px; height: 32px; }
}

.uv-explain-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(20rem, 85vw);
  margin-top: 8px;
  padding: 16px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(14, 15, 26, 0.15);
  text-align: left;
  font-family: "Open Sans", system-ui, sans-serif;
  outline: none;
}
.uv-explain-panel--above {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 8px;
}

.uv-explain-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.uv-explain-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #17181f;
  line-height: 1.3;
}
.uv-explain-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #737373;
  cursor: pointer;
}
.uv-explain-close:hover { background: #f5f5f5; }
.uv-explain-close:focus-visible { outline: 2px solid #4B52A3; }

.uv-explain-body {
  margin: 8px 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #3d3f4b;
}
.uv-explain-why { font-weight: 600; color: #4B52A3; }

.uv-explain-source {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: #63636e; /* 4.6:1 on white — #8a8a93 failed WCAG AA (a11y review, Jul 2026) */
}

.uv-explain-disclaimer {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid #f0f0f2;
  font-size: 0.75rem;
  font-style: italic;
  color: #63636e; /* WCAG AA contrast fix */
}

@media (prefers-color-scheme: dark) {
  .uv-explain-panel { background: #17181f; border-color: #33343d; }
  .uv-explain-title { color: #f2f2f5; }
  .uv-explain-body { color: #c9cad3; }
  .uv-explain-close:hover { background: #24252e; }
  .uv-explain-disclaimer { border-top-color: #24252e; }
}
