/*-- -------------------------- -->
<---      Core Dark Styles      -->
<--- -------------------------- -*/
/* Mobile */
@media only screen and (min-width: 0em) {
  :root {
    /* Dark mode palette — derived from the CCS Website Color Palette
       (see documentation/websitecolors.png).
       --dark:       page/nav background, image-frame borders (very dark #322f87)
       --medium:     card backgrounds, mobile nav menu, secondary buttons (#322f87)
       --accent:     toppers, callouts, primary CTAs, nav links, names (#ac2071)
       --primaryLight: light surfaces/text in dark mode (legacy token) */
    --dark: #0e0a26;
    --medium: #322f87;
    --accent: #ac2071;
    --primaryLight: #ffffff;
  }
  body.dark-mode {
    background-color: var(--dark);
  }
  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;
  }
  body.dark-mode .light {
    display: none;
  }
  body.dark-mode .dark {
    display: block !important;
  }
  .dark {
    display: none;
  }
}
/*-- -------------------------- -->
<---      CTA / Button Overrides      -->
<--- -------------------------- -*/
/* In light mode .cs-button-solid is the primary CTA (coral var(--accent) on
   hero, soft navy var(--primary) on contact/donate/shop) and .button-solid
   is the secondary button (soft navy var(--primary)). In dark mode the brand
   reverses the two: the primary CTA becomes the deep blue var(--medium) and
   the secondary button becomes the magenta var(--accent) — matching
   documentation/darkmode.png. The :before hover overlay is also re-themed
   (darker version of the new background). The #cs-contact button additionally
   needs color: #fff because its light-mode rule sets text to #1a1a1a. */
/* Mobile */
@media only screen and (min-width: 0em) {
  body.dark-mode #hero .cs-button-solid,
  body.dark-mode #cs-contact .cs-button-solid,
  body.dark-mode #donate .cs-button-solid,
  body.dark-mode #shop .cs-button-solid {
    background-color: var(--medium);
  }
  body.dark-mode #hero .cs-button-solid:before,
  body.dark-mode #cs-contact .cs-button-solid:before,
  body.dark-mode #donate .cs-button-solid:before,
  body.dark-mode #shop .cs-button-solid:before {
    background-color: #251f6b;
  }
  body.dark-mode #cs-contact .cs-button-solid {
    color: #fff;
  }
  body.dark-mode .button-solid {
    background-color: var(--accent);
  }
  body.dark-mode .button-solid:before {
    background-color: #8a1858;
  }
  body.dark-mode #donate .cs-button-solid:hover,
  body.dark-mode #shop .cs-button-solid:hover {
    background-color: #251f6b;
  }
}
/*-- -------------------------- -->
<---      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;
  }
  #dark-mode-toggle {
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 3.75rem;
    width: 3rem;
    height: 3rem;
    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 .3s, opacity .3s, fill .3s;
    fill: #000;
  }
  #dark-mode-toggle .sun {
    z-index: 1;
    transform: translate(-50%, 100%);
    opacity: 0;
    transition: transform .3s, opacity .3s;
  }
}
/* Desktop */
@media only screen and (min-width: 64em) {
  #dark-mode-toggle {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    margin-left: 1.875rem;
    margin-bottom: 0rem;
  }
  #dark-mode-toggle .moon {
    fill: #fff;
  }
}
/*-- -------------------------- -->
<---   Dark Mode Scrollbar      -->
<--- -------------------------- -*/
/* The light-mode scrollbar (white track, soft-navy thumb) is jarring on the
   --dark page background. In dark mode the track/bar use --medium (deep blue,
   matches the dark page) and the thumb uses --accent (magenta — the same
   dark-mode accent used for toppers, callouts, primary CTAs, and nav links).
   Magenta on deep blue is high contrast and on-theme; a pale tint like
   --cardBgWarm would look like a stray light-mode color. Scoped to desktop
   via the same min-width: 64em media query the light-mode scrollbar uses.

   NOTE on the selector: the document scrollbar's pseudo-elements are
   generated by <html>, not <body>, so `body.dark-mode ::-webkit-scrollbar-thumb`
   does NOT match them (the descendant combinator requires a DOM descendant).
   `html:has(body.dark-mode)` reaches <html> from the body.dark-mode class so
   the rule can target the scrollbar correctly. `:has()` is supported in
   Chrome 105+, Safari 15.4+, Firefox 121+ — same compatibility profile as
   `::-webkit-scrollbar-*` itself. */
@media only screen and (min-width: 64em) {
  html:has(body.dark-mode) ::-webkit-scrollbar-track {
    -webkit-box-shadow: none;
    background-color: var(--medium);
  }
  html:has(body.dark-mode) ::-webkit-scrollbar-track-piece {
    background-color: var(--medium);
  }
  html:has(body.dark-mode) ::-webkit-scrollbar {
    background-color: var(--medium);
  }
  html:has(body.dark-mode) ::-webkit-scrollbar-thumb {
    background: var(--accent);
  }
}
