/* PVV v5 — widget styles. Same-origin CSS enqueued by the plugin so kses
   never strips attributes, wpautop never wraps, and the theme doesn't
   need to know what's inside the content HTML. */

/* ───── Shared tokens ───── */
.pvv-widget { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.pvv-widget * { box-sizing: border-box; }

/* ───── Per-claim source viewer (invention #1) ───── */
[data-claim] {
  border-bottom: 1px dotted #94a3b8;
  cursor: help;
  transition: background-color 0.15s ease;
}
[data-claim]:hover,
[data-claim][data-claim-open="1"] {
  background-color: #fef3c7;
  border-bottom-color: #f59e0b;
}
.pvv-claim-popover {
  position: absolute;
  z-index: 9999;
  max-width: 420px;
  min-width: 260px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #0f172a;
  animation: pvv-fade-in 0.15s ease;
}
@keyframes pvv-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pvv-claim-popover h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 6px;
}
.pvv-claim-popover blockquote {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  font-size: 13px;
  color: #1e293b;
  font-style: normal;
}
.pvv-claim-popover .pvv-pop-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 12px;
  color: #475569;
  margin: 10px 0 10px;
}
.pvv-claim-popover .pvv-pop-meta dt { font-weight: 600; color: #334155; }
.pvv-claim-popover .pvv-pop-meta dd { margin: 0; word-break: break-word; }
.pvv-claim-popover .pvv-pop-actions {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}
.pvv-claim-popover .pvv-pop-actions a {
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  text-decoration: none;
}
.pvv-claim-popover .pvv-pop-actions a:hover { text-decoration: underline; }
.pvv-claim-popover .pvv-pop-verified {
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pvv-claim-popover .pvv-pop-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
}

/* ───── Reading progress + live time ───── */
.pvv-read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(59, 130, 246, 0.15);
  z-index: 9998;
  pointer-events: none;
}
.pvv-read-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  width: 0%;
  transition: width 120ms linear;
}
.pvv-read-time-live {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 12px;
  border-radius: 20px;
  z-index: 9997;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}
.pvv-read-time-live[data-visible="1"] { opacity: 1; }
@media (max-width: 560px) {
  .pvv-read-time-live { bottom: 10px; right: 10px; font-size: 11px; padding: 6px 10px; }
}

/* ───── Calculator (interactive) ───── */
.pvv-calc {
  margin: 28px 0;
  padding: 22px 26px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
}
.pvv-calc h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #166534;
  border: 0;
  padding: 0;
}
.pvv-calc > p.pvv-calc-dek { margin: 0 0 16px; font-size: 14px; color: #166534; }
.pvv-calc-form { display: grid; gap: 14px; }
.pvv-calc-field { display: grid; gap: 4px; }
.pvv-calc-field label {
  font-weight: 600;
  font-size: 14px;
  color: #14532d;
}
.pvv-calc-field .pvv-calc-help {
  font-size: 12px;
  color: #166534;
  opacity: 0.85;
}
.pvv-calc-field input,
.pvv-calc-field select {
  padding: 10px 12px;
  border: 1px solid #86efac;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #14532d;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pvv-calc-field input:focus,
.pvv-calc-field select:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.pvv-calc-output {
  margin-top: 18px;
  padding: 16px 20px;
  background: #fff;
  border: 2px solid #16a34a;
  border-radius: 10px;
}
.pvv-calc-output-amount {
  font-size: 28px;
  font-weight: 800;
  color: #14532d;
  margin: 0 0 6px;
}
.pvv-calc-output-breakdown {
  font-size: 13px;
  color: #166534;
  line-height: 1.55;
}
.pvv-calc-output-breakdown ul {
  margin: 6px 0 0;
  padding-left: 20px;
}
.pvv-calc-output-breakdown li { margin-bottom: 2px; }
.pvv-calc-sources {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #bbf7d0;
  font-size: 12px;
  color: #166534;
}
.pvv-calc-sources a { color: #166534; }

/* ───── Source Density badge ───── */
.pvv-source-density {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 20px;
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 13px;
  color: #1e40af;
}
.pvv-source-density strong { font-weight: 700; }
.pvv-source-density svg { width: 14px; height: 14px; flex: 0 0 14px; }

/* ───── Correction flag inline ───── */
.pvv-flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.15s ease;
}
.pvv-flag-btn:hover { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.pvv-flag-btn[aria-pressed="true"] { background: #fef2f2; color: #b91c1c; }
.pvv-flag-modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pvv-flag-modal-inner {
  background: #fff;
  border-radius: 14px;
  padding: 24px 28px;
  max-width: 480px;
  width: 100%;
}
.pvv-flag-modal-inner textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  margin: 10px 0;
  resize: vertical;
}
.pvv-flag-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
}
.pvv-flag-modal-actions button {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
}
.pvv-flag-modal-actions button.pvv-flag-submit {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

/* ───── Print stylesheet ───── */
@media print {
  header, footer, aside, nav,
  .sidebar, #sidebar, .mml-sidebar, #secondary,
  .pvv-read-progress, .pvv-read-time-live,
  .pvv-flag-btn, .pvv-claim-popover,
  .pvv-preferred-sources, .pvv-claim-verify,
  .adsbygoogle, ins.adsbygoogle,
  iframe, video { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt !important; }
  .entry-content { max-width: 100% !important; width: 100% !important; margin: 0 !important; }
  [data-claim] { border-bottom: 0 !important; background: transparent !important; }
  details { display: block !important; }
  details > summary { display: none !important; }
  details > *:not(summary) { display: block !important; }
  a { color: #000 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  h1, h2, h3 { page-break-after: avoid; }
  figure, table, .pvv-widget { page-break-inside: avoid; }
  canvas[data-3d-canvas] { display: none !important; } /* 3D doesn't print */
}

/* ───── Ask-a-Question widget (intelligence layer) ───── */
.pvv-ask {
  margin: 40px 0;
  padding: 26px 28px;
  background: linear-gradient(180deg, #fef3c7 0%, #fffbeb 100%);
  border: 1px solid #fde68a;
  border-radius: 14px;
}
.pvv-ask-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #78350f;
  border: 0;
  padding: 0;
}
.pvv-ask-dek {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: #92400e;
}
.pvv-ask-form { display: flex; flex-direction: column; gap: 8px; }
.pvv-ask-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #fbbf24;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  resize: vertical;
  min-height: 52px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pvv-ask-input:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}
.pvv-ask-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.pvv-ask-count { font-size: 12px; color: #92400e; }
.pvv-ask-submit {
  padding: 10px 22px;
  background: #d97706;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.pvv-ask-submit:hover:not(:disabled) { background: #b45309; }
.pvv-ask-submit:disabled { opacity: 0.7; cursor: wait; }

.pvv-ask-results { margin-top: 16px; }
.pvv-ask-loading {
  padding: 14px 16px;
  background: #fff;
  border: 1px dashed #fcd34d;
  border-radius: 8px;
  color: #78350f;
  font-style: italic;
}
.pvv-ask-error {
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #b91c1c;
}
.pvv-ask-empty {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #78350f;
  font-size: 14px;
  line-height: 1.5;
}
.pvv-ask-empty strong { display: block; margin-bottom: 6px; color: #92400e; }

.pvv-ask-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #78350f;
}
.pvv-ask-cached {
  padding: 2px 8px;
  background: #fde68a;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.pvv-ask-confidence {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.pvv-ask-conf-high   { background: #d1fae5; color: #065f46; }
.pvv-ask-conf-medium { background: #fef3c7; color: #92400e; }
.pvv-ask-conf-low    { background: #fee2e2; color: #991b1b; }
.pvv-ask-conf-none   { background: #f1f5f9; color: #475569; }

.pvv-ask-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.pvv-ask-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
}
.pvv-ask-agency {
  padding: 2px 8px;
  background: #1e293b;
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pvv-ask-citation { color: #64748b; font-style: italic; text-align: right; }
.pvv-ask-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: #0f172a;
  font-weight: 700;
}
.pvv-ask-highlight {
  margin: 0 0 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
}
.pvv-ask-fullpassage {
  margin: 0 0 10px;
  font-size: 13px;
}
.pvv-ask-fullpassage summary {
  cursor: pointer;
  color: #64748b;
  font-weight: 600;
  padding: 4px 0;
}
.pvv-ask-body {
  margin-top: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 4px;
  line-height: 1.55;
  color: #334155;
}
.pvv-ask-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  flex-wrap: wrap;
}
.pvv-ask-source-link {
  color: #0ea5e9;
  font-weight: 600;
  text-decoration: none;
}
.pvv-ask-source-link:hover { text-decoration: underline; }
.pvv-ask-date { color: #64748b; }

.pvv-ask-disclaimer {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed #fde68a;
  font-size: 11px;
  line-height: 1.5;
  color: #92400e;
  text-align: center;
}
