/* Public outliers: shared theme and overlay guardrails.
   Loaded after legacy page styles so each page respects WEEM tokens in both themes. */

body[data-weem-page] {
  background: var(--v-bg);
  color: var(--v-text);
}

/* An invisible modal must never dim or intercept the page behind it. */
body[data-weem-page] .exit-overlay,
body[data-weem-page] .popup-overlay {
  visibility: hidden;
  pointer-events: none;
}
body[data-weem-page] .exit-overlay.active,
body[data-weem-page] .popup-overlay.active,
body[data-weem-page] .popup-overlay[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}

/* Legacy API documentation used a separate black palette. */
html[data-theme="light"] body[data-weem-page="api-docs"] {
  background: var(--v-bg) !important;
  color: var(--v-text) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .navbar {
  background: rgba(18, 62, 69, .96);
  border-color: rgba(246, 240, 230, .18);
}
html[data-theme="light"] body[data-weem-page="api-docs"] .base-url,
html[data-theme="light"] body[data-weem-page="api-docs"] .endpoint,
html[data-theme="light"] body[data-weem-page="api-docs"] .code-block,
html[data-theme="light"] body[data-weem-page="api-docs"] .live-result,
html[data-theme="light"] body[data-weem-page="api-docs"] .limit-card,
html[data-theme="light"] body[data-weem-page="api-docs"] [style*="background:#0f0f16"] {
  background: var(--v-surface-1) !important;
  border-color: var(--v-border) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .code-header,
html[data-theme="light"] body[data-weem-page="api-docs"] .aranceles-table th,
html[data-theme="light"] body[data-weem-page="api-docs"] .aranceles-table tr:hover td {
  background: var(--v-surface-2) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .hero h1,
html[data-theme="light"] body[data-weem-page="api-docs"] .endpoint-path,
html[data-theme="light"] body[data-weem-page="api-docs"] .limit-card .limit-value,
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-row span:last-child,
html[data-theme="light"] body[data-weem-page="api-docs"] [style*="color:#fff"] {
  color: var(--v-text) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .hero p,
html[data-theme="light"] body[data-weem-page="api-docs"] .endpoint-desc,
html[data-theme="light"] body[data-weem-page="api-docs"] .params-table td:nth-child(2),
html[data-theme="light"] body[data-weem-page="api-docs"] .status-latency,
html[data-theme="light"] body[data-weem-page="api-docs"] .code-lang,
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-field label,
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-row span:first-child,
html[data-theme="light"] body[data-weem-page="api-docs"] .limit-card .limit-label,
html[data-theme="light"] body[data-weem-page="api-docs"] .footer p,
html[data-theme="light"] body[data-weem-page="api-docs"] .params-table th,
html[data-theme="light"] body[data-weem-page="api-docs"] .copy-btn {
  color: var(--v-text-muted) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .code-body pre,
html[data-theme="light"] body[data-weem-page="api-docs"] .live-result pre,
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-field input,
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-field select {
  background: var(--v-surface-2) !important;
  color: var(--v-text) !important;
  border-color: var(--v-border) !important;
}
html[data-theme="light"] body[data-weem-page="api-docs"] .calc-field select option { background: var(--v-surface-1); color: var(--v-text); }
html[data-theme="light"] body[data-weem-page="api-docs"] .try-btn { color: #123E45; }

/* Intelligence has local variables, so map them back to the shared light palette. */
html[data-theme="light"] body[data-weem-page="intelligence"] {
  --bg: var(--v-bg);
  --surface: var(--v-surface-1);
  --surface-2: var(--v-surface-2);
  --border: var(--v-border);
  --border-2: var(--v-border-hover);
  --text: var(--v-text);
  --text-muted: var(--v-text-muted);
  --text-dim: var(--v-text-faint);
  --accent: var(--v-brand-700);
  --accent-glow: rgba(184, 149, 98, .18);
  --green: var(--v-success);
  --green-dim: var(--v-success-soft);
  --blue: var(--v-info);
  --blue-dim: var(--v-info-soft);
  --amber: var(--v-warning);
  --amber-dim: var(--v-warning-soft);
  --purple: var(--v-primary);
  --purple-dim: var(--v-primary-soft);
  --red: var(--v-error);
  --red-dim: var(--v-error-soft);
}
html[data-theme="light"] body[data-weem-page="intelligence"] .topbar {
  background: rgba(18, 62, 69, .96);
  --text: #F6F0E6;
  --text-muted: #E9DFD0;
  --text-dim: #C9C2B6;
  --surface: rgba(246, 240, 230, .10);
  --surface-2: rgba(246, 240, 230, .16);
  --border: rgba(246, 240, 230, .18);
}
html[data-theme="light"] body[data-weem-page="intelligence"] .progress-track,
html[data-theme="light"] body[data-weem-page="intelligence"] .feed::-webkit-scrollbar-thumb { background: var(--v-border); }

/* Error and offline actions remain readable in light mode. */
html[data-theme="light"] body[data-weem-page="404"] .btn-outline { color: var(--v-text); }
html[data-theme="light"] body[data-weem-page="offline"] .tool-card {
  background: var(--v-surface-1);
  border-color: var(--v-border);
  color: var(--v-text-secondary);
}
html[data-theme="light"] body[data-weem-page="offline"] .tool-card:hover { background: var(--v-surface-2); color: var(--v-text); }
html[data-theme="light"] body[data-weem-page="offline"] .btn-retry { color: #123E45; }

/* Mobile dialog geometry is owned by shared/dialogs.css. */

@media (prefers-reduced-motion: reduce) {
  body[data-weem-page] *, body[data-weem-page] *::before, body[data-weem-page] *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
