/* SKY-TOGGLE-V1 — the day/night switch in the sidebar, ported from the
   React sky-toggle component (same markup, same art, same motion) to plain
   CSS for Pulse's Jinja templates. Differences from the original, all for
   fit and access:
   - sized to the bell capsule beside it (34px tall, --toggle-size 13.6px)
   - the checkbox is visually hidden, not display:none, so it keeps keyboard
     focus; a focus ring shows on the track
   - the outer shadow is tuned for the dark glass sidebar (the original's
     white under-glow was made for a light page)
   - reduced motion switches instantly */

.sb-quick { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; }
.sb-quick > .notif-bell-wrap { flex: 1 1 auto; min-width: 0; margin: 0 !important; }
html.t27 .sb-quick { margin: 0 2px 10px; gap: 8px; }
html.pulse-native .sky-toggle { display: none; }        /* the Pulse app has its own theme switch */

.sky-toggle.theme-switch {
  --toggle-size: 13.6px;
  --container-width: 5.625em;
  --container-height: 2.5em;
  --container-radius: 6.25em;
  --container-light-bg: #3D7EAE;
  --container-night-bg: #1D1F2C;
  --circle-container-diameter: 3.375em;
  --sun-moon-diameter: 2.125em;
  --sun-bg: #ECCA2F;
  --moon-bg: #C4C9D1;
  --spot-color: #959DB1;
  --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
  --stars-color: #fff;
  --clouds-color: #F3FDFF;
  --back-clouds-color: #AACADF;
  --transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
  --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);
  position: relative; display: block; flex: 0 0 auto; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sky-toggle.theme-switch, .sky-toggle.theme-switch *, .sky-toggle.theme-switch *::before, .sky-toggle.theme-switch *::after {
  box-sizing: border-box; margin: 0; padding: 0; font-size: var(--toggle-size);
}

.sky-toggle .theme-switch__container {
  width: var(--container-width);
  height: var(--container-height);
  background-color: var(--container-light-bg);
  border-radius: var(--container-radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 6px 14px -8px rgba(0, 0, 0, .65);
  transition: var(--transition);
  position: relative;
}
.sky-toggle .theme-switch__container::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  border-radius: var(--container-radius);
}

/* hidden but focusable */
.sky-toggle .theme-switch__checkbox {
  position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none;
}
.sky-toggle .theme-switch__checkbox:focus-visible + .theme-switch__container { outline: 2px solid rgba(199, 210, 254, .85); outline-offset: 2px; }

.sky-toggle .theme-switch__circle-container {
  width: var(--circle-container-diameter);
  height: var(--circle-container-diameter);
  background-color: rgba(255, 255, 255, 0.1);
  position: absolute;
  left: var(--circle-container-offset);
  top: var(--circle-container-offset);
  border-radius: var(--container-radius);
  box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  display: flex;
  transition: var(--circle-transition);
  pointer-events: none;
}
.sky-toggle .theme-switch__sun-moon-container {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  width: var(--sun-moon-diameter);
  height: var(--sun-moon-diameter);
  margin: auto;
  border-radius: var(--container-radius);
  background-color: var(--sun-bg);
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
  filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
  overflow: hidden;
  transition: var(--transition);
}
.sky-toggle .theme-switch__moon {
  transform: translateX(100%);
  width: 100%;
  height: 100%;
  background-color: var(--moon-bg);
  border-radius: inherit;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  transition: var(--transition);
  position: relative;
}
.sky-toggle .theme-switch__spot {
  position: absolute;
  top: 0.75em;
  left: 0.312em;
  width: 0.75em;
  height: 0.75em;
  border-radius: var(--container-radius);
  background-color: var(--spot-color);
  box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
}
.sky-toggle .theme-switch__spot:nth-of-type(2) { width: 0.375em; height: 0.375em; top: 0.937em; left: 1.375em; }
.sky-toggle .theme-switch__spot:nth-last-of-type(3) { width: 0.25em; height: 0.25em; top: 0.312em; left: 0.812em; }

.sky-toggle .theme-switch__clouds {
  width: 1.25em;
  height: 1.25em;
  background-color: var(--clouds-color);
  border-radius: var(--container-radius);
  position: absolute;
  bottom: -0.625em;
  left: 0.312em;
  box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
  transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
}
.sky-toggle .theme-switch__stars-container {
  position: absolute;
  color: var(--stars-color);
  top: -100%;
  left: 0.312em;
  width: 2.75em;
  height: auto;
  transition: var(--transition);
}
.sky-toggle .theme-switch__stars-container svg { display: block; width: 100%; height: auto; }

/* actions */
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container { background-color: var(--container-night-bg); }
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em);
}
.sky-toggle .theme-switch__circle-container:hover { left: calc(var(--circle-container-offset) + 0.187em); }
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon { transform: translate(0); }
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds { bottom: -4.062em; }
.sky-toggle .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container { top: 50%; transform: translateY(-50%); }

@media (prefers-reduced-motion: reduce) {
  .sky-toggle .theme-switch__container, .sky-toggle .theme-switch__circle-container, .sky-toggle .theme-switch__sun-moon-container,
  .sky-toggle .theme-switch__moon, .sky-toggle .theme-switch__clouds, .sky-toggle .theme-switch__stars-container { transition: none; }
}
