/* ===== Dark mode (works on top of the compiled React build) =====
   Soft invert of the whole page + hue-rotate so colours keep their hue.
   Images / videos / background-image elements are inverted back. */
html.dark-mode {
  filter: invert(92%) hue-rotate(180deg);
  background: #fff; /* becomes ~#141414 after the filter */
}
html.dark-mode img,
html.dark-mode video,
html.dark-mode picture,
html.dark-mode iframe,
html.dark-mode [style*="background-image"],
html.dark-mode .no-dark {
  filter: invert(100%) hue-rotate(180deg);
}

html.dark-mode img.dm-icon { filter: none; }

/* ===== Toggle button ===== */
#dark-mode-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483647;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#dark-mode-toggle:hover { transform: scale(1.08); }
#dark-mode-toggle:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; }
#dark-mode-toggle svg { width: 22px; height: 22px; fill: currentColor; }
#dark-mode-toggle .icon-sun { display: none; }
html.dark-mode #dark-mode-toggle { filter: invert(100%) hue-rotate(180deg); }
html.dark-mode #dark-mode-toggle .icon-moon { display: none; }
html.dark-mode #dark-mode-toggle .icon-sun { display: block; }

@media print {
  #dark-mode-toggle { display: none; }
  html.dark-mode { filter: none; }
}
