/* Modern UI Phase 10 — Dark Mode | var.23 grafo74 */
:root {
  color-scheme: light;
  --dm-bg: #f6f8f8;
  --dm-surface: #ffffff;
  --dm-surface-soft: #eef6f7;
  --dm-text: #17212b;
  --dm-muted: #52606d;
  --dm-border: rgba(13, 92, 99, .22);
  --dm-shadow: 0 14px 34px rgba(16, 35, 42, .14);
  --dm-accent: #0d5c63;
  --dm-accent-hover: #0d5c63;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --dm-bg: #101719;
  --dm-surface: #172226;
  --dm-surface-soft: #1d2d31;
  --dm-text: #edf5f5;
  --dm-muted: #b7c6c8;
  --dm-border: rgba(143, 207, 211, .24);
  --dm-shadow: 0 16px 36px rgba(0, 0, 0, .42);
  --dm-accent: #0d5c63;
  --dm-accent-hover: #0d5c63;
}
html, body { background-color: var(--dm-bg); color: var(--dm-text); }
body, main, section, article, .w3-content, .content, .container { transition: background-color .24s ease, color .24s ease, border-color .24s ease; }
html[data-theme="dark"] {
  background: #101719 url("../img/parallax0.webp") center center / cover fixed no-repeat;
}
html[data-theme="dark"] body {
  background-color: transparent !important;
  background-image: url("../img/parallax0.webp") !important;
  background-position: center center !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}
html[data-theme="dark"] :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,caption,small,strong,b,span:not(.pdf-label):not(.viewer-page-label)) { color: inherit; }
html[data-theme="dark"] :where(a:not(.w3-button):not(.button):not(.btn):not([class*="button"])) { color: #8fd0d4; }
html[data-theme="dark"] :where(.w3-white,.item,.card,.service-card,.practice-card,.man-card,.content-card,.article-sheet,.article-paper,.article-page,.paper-page,.item_text,.news-item,.journal-item,.viewer-panel,.viewer-toolbar,.viewer-thumbnails,.gallery-strip,.modal-content,.dropdown-content) {
  background-color: var(--dm-surface) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
  box-shadow: var(--dm-shadow);
}
html[data-theme="dark"] :where(input,textarea,select) {
  background: #111b1e !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] :where(input,textarea)::placeholder { color: #91a5a8; }
html[data-theme="dark"] table { color: var(--dm-text); border-color: var(--dm-border); }
html[data-theme="dark"] :where(th,td) { border-color: var(--dm-border) !important; }
html[data-theme="dark"] :where(.article-sheet,.article-paper,.article-page,.paper-page,.readmore-sheet,.readmore-expanded) {
  background: linear-gradient(145deg, #1c2a2e, #172226) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] :where(.article-sheet,.article-paper,.article-page,.paper-page,.readmore-sheet,.readmore-expanded)::before {
  filter: brightness(.74);
}
/* Documents and scanned pages must remain visually authentic. */
html[data-theme="dark"] :where(.viewer-stage,.document-stage,.pdf-stage,.main-document,.page-canvas) { background: #0a0e10 !important; }
html[data-theme="dark"] :where(.viewer-stage img,.document-stage img,.pdf-stage img,.main-document img,canvas) { filter: none !important; }
html[data-theme="dark"] footer, html[data-theme="dark"] .footer, html[data-theme="dark"] #footer {
  background: #0d5c63 !important;
  color: #fff !important;
}
html[data-theme="dark"] footer a, html[data-theme="dark"] .footer a, html[data-theme="dark"] #footer a { color: #fff !important; }
/* Keep all action buttons in the approved footer green in both themes. */
:where(button,.button,.btn,.w3-button,input[type="button"],input[type="submit"],a[class*="button"],a[class*="btn"]) {
  --button-green: #0d5c63;
}
html[data-theme="dark"] :where(button,.button,.btn,.w3-button,input[type="button"],input[type="submit"],a[class*="button"],a[class*="btn"]):not(.theme-toggle) {
  background-color: #0d5c63 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.25) !important;
}
.theme-toggle {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: auto;
  top: max(14px, env(safe-area-inset-top));
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: #0d5c63 !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.theme-toggle:hover, .theme-toggle:focus-visible, .theme-toggle:active { background: #0d5c63 !important; transform: none; }
.theme-toggle:focus-visible { outline: 3px solid rgba(143,208,212,.75); outline-offset: 3px; }
html[data-theme="dark"] .theme-toggle { border-color: rgba(255,255,255,.45); }
@media (max-width: 700px) {
  .theme-toggle { width: 42px; height: 42px; left: 10px; right:auto; top: 10px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html, body, main, section, article, .w3-content, .content, .container { transition: none !important; }
}
@media print {
  .theme-toggle { display: none !important; }
  html, html[data-theme="dark"], body { color-scheme: light !important; background: #fff !important; color: #000 !important; }
}


/* var108 readability */
html[data-theme="dark"] .bgimg-1,
html[data-theme="dark"] .bgimg-2,
html[data-theme="dark"] .bgimg-3{
  background-image:none !important;
  background:transparent !important;
}
html[data-theme="dark"] #documents-entry,
html[data-theme="dark"] .w3-content,
html[data-theme="dark"] .w3-card,
html[data-theme="dark"] .w3-panel{
  background-color: var(--dm-surface) !important;
}
