/*-- -------------------------- -->
<---      Core Dark Styles      -->
<--- -------------------------- -*/
/* Mobile */
@media only screen and (min-width: 0em) {
  :root {
    --dark: #082032;
    --medium: #2c394b;
    --accent: #334756;
  }
  /* removed html[data-theme="dark"] duplicates — inline <style> handles flicker prevention */
  body.dark-mode {
    background-color: var(--dark);
    /* Flip the shared color tokens so every component that references them
       (CodeStitch .cs-title/.cs-h3 use var(--headerColor)) recolors in dark mode.
       The nav overrides its own colors explicitly, so this is safe site-wide. */
    --headerColor: #ffffff;
    --bodyTextColor: #e4e6eb;
  }
  body.dark-mode p,
  body.dark-mode li,
  body.dark-mode h1,
  body.dark-mode h2,
  body.dark-mode h3,
  body.dark-mode h4,
  body.dark-mode h5,
  body.dark-mode h6 {
    color: #fff;
  }
  /* CodeStitch section headings/text use classes with hardcoded colors that
     beat the element rules above on specificity — cover them explicitly. */
  body.dark-mode .cs-title,
  body.dark-mode .cs-h3,
  body.dark-mode .cs-text,
  body.dark-mode .cs-item-text,
  body.dark-mode .cs-item-p,
  body.dark-mode .cs-review,
  body.dark-mode .cs-name,
  body.dark-mode .cs-li {
    color: var(--bodyTextColorWhite);
  }
  body.dark-mode .cs-title,
  body.dark-mode .cs-h3 {
    color: #ffffff;
  }
  body.dark-mode .light {
    display: none;
  }
  body.dark-mode .dark {
    display: block !important;
  }
}
/*-- -------------------------- -->
<---      Dark Mode Toggle      -->
<--- -------------------------- -*/
/* Mobile */
@media only screen and (min-width: 0em) {
  body.dark-mode #dark-mode-toggle .sun {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
  body.dark-mode #dark-mode-toggle .moon {
    transform: translate(-50%, -150%);
    opacity: 0;
  }
  /* Positioning/sizing lives with the nav (root.css) — the toggle is a normal
     flex child of .cs-container at every width. Only the icon swap is here. */
  #dark-mode-toggle {
    display: block;
    background: transparent;
    border: none;
    overflow: hidden;
    padding: 0;
  }
  #dark-mode-toggle img,
  #dark-mode-toggle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.5625rem;
    height: 1.5625rem;
    pointer-events: none;
  }
  #dark-mode-toggle .moon {
    z-index: 2;
    transition:
      transform 0.3s,
      opacity 0.3s,
      fill 0.3s;
    fill: #000;
  }
  #dark-mode-toggle .sun {
    z-index: 1;
    transform: translate(-50%, 100%);
    opacity: 0;
    transition:
      transform 0.3s,
      opacity 0.3s;
  }
}
/* Desktop */
@media only screen and (min-width: 64em) {
  /* Nav is white in light mode, so the moon must be dark to be visible */
  #dark-mode-toggle .moon {
    fill: #1a1a1a;
  }
  /* In dark mode the sun shows; keep the (hidden) moon white for the transition */
  body.dark-mode #dark-mode-toggle .moon {
    fill: #fff;
  }
}
