/* Light / dark switch. Component from Uiverse.io by mamyapro123 (Uiverse components are MIT licensed), kept as
   published; the Prepora adjustments (size per place, keyboard focus, touch and reduced motion) are at the end. */
.theme-switch {
  --toggle-size: 32px;
  --container-width: 5.625em;
  --container-height: 2.5em;
  --container-radius: 0.38em;
  --container-light-bg: #5caad4;
  --container-night-bg: #1b1e36;
  --circle-container-diameter: 3.375em;
  --sun-moon-diameter: 2.125em;
  --sun-bg: #f5c518;
  --moon-bg: #d8d4c0;
  --spot-color: #9b9787;
  --circle-container-offset: calc(
    (var(--circle-container-diameter) - var(--container-height)) / 2 * -1
  );
  --stars-color: #fff8e1;
  --clouds-color: #f4f4f4;
  --back-clouds-color: #bacfe0;
  --transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
  --circle-transition: 0.3s cubic-bezier(0, -0.02, 0.35, 1.17);
  display: inline-block;
}

.theme-switch,
.theme-switch *,
.theme-switch *::before,
.theme-switch *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: var(--toggle-size);
}

.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;
  position: relative;
  background-image: linear-gradient(
    to bottom,
    var(--container-light-bg) 0%,
    #4a92bd 100%
  );
  transition: all var(--transition);
  box-shadow:
    0 0 0 2.5px #1a1a1a,
    3px 4px 0 2.5px rgba(26, 26, 26, 0.22);
  transform: rotate(-0.7deg);
  filter: url(#sketchy);
}

.theme-switch__container::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background-image: repeating-linear-gradient(
    -50deg,
    transparent,
    transparent 7px,
    rgba(255, 255, 255, 0.04) 7px,
    rgba(255, 255, 255, 0.04) 8px
  );
  border-radius: inherit;
  pointer-events: none;
}

.theme-switch__checkbox {
  display: none;
}

.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;
}

.theme-switch__circle-container::before {
  content: "";
  position: absolute;
  width: calc(var(--circle-container-diameter) + 1.5em);
  height: calc(var(--circle-container-diameter) + 1.5em);
  left: -0.75em;
  top: -0.75em;
  border-radius: 50%;
  background: conic-gradient(
    transparent 0deg,
    transparent 8deg,
    rgba(245, 197, 24, 0.52) 8deg,
    rgba(245, 197, 24, 0.52) 22deg,
    transparent 22deg,
    transparent 53deg,
    rgba(245, 197, 24, 0.52) 53deg,
    rgba(245, 197, 24, 0.52) 67deg,
    transparent 67deg,
    transparent 98deg,
    rgba(245, 197, 24, 0.52) 98deg,
    rgba(245, 197, 24, 0.52) 112deg,
    transparent 112deg,
    transparent 143deg,
    rgba(245, 197, 24, 0.52) 143deg,
    rgba(245, 197, 24, 0.52) 157deg,
    transparent 157deg,
    transparent 188deg,
    rgba(245, 197, 24, 0.52) 188deg,
    rgba(245, 197, 24, 0.52) 202deg,
    transparent 202deg,
    transparent 233deg,
    rgba(245, 197, 24, 0.52) 233deg,
    rgba(245, 197, 24, 0.52) 247deg,
    transparent 247deg,
    transparent 278deg,
    rgba(245, 197, 24, 0.52) 278deg,
    rgba(245, 197, 24, 0.52) 292deg,
    transparent 292deg,
    transparent 323deg,
    rgba(245, 197, 24, 0.52) 323deg,
    rgba(245, 197, 24, 0.52) 337deg,
    transparent 337deg,
    transparent 360deg
  );
  animation: rotateSunRays 14s linear infinite;
  opacity: 1;
  transition: opacity var(--transition);
  pointer-events: none;
  filter: url(#sketchy-sm);
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__circle-container::before {
  opacity: 0;
}

@keyframes rotateSunRays {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.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,
    0.1em 0.13em 0 0.04em #1a1a1a;
  filter: url(#sketchy-sm)
    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);
  transform: scale(1);
}

.theme-switch__sun-moon-container:hover {
  transform: scale(1.1) rotate(5deg);
}

.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:
    all var(--transition),
    transform 0.3s ease;
  position: relative;
}

.theme-switch__moon:hover {
  transform: rotate(15deg);
}

.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;
  transition: background-color 0.3s ease;
  filter: url(#sketchy-sm);
}

.theme-switch__spot:nth-of-type(2) {
  width: 0.375em;
  height: 0.375em;
  top: 0.937em;
  left: 1.375em;
}
.theme-switch__spot:nth-last-of-type(3) {
  width: 0.25em;
  height: 0.25em;
  top: 0.312em;
  left: 0.812em;
}
.theme-switch__moon:hover .theme-switch__spot {
  background-color: #7a7f8c;
}

.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);
  filter: url(#sketchy-sm);
}

.theme-switch__stars-container {
  position: absolute;
  color: var(--stars-color);
  top: -100%;
  left: 0.312em;
  width: 2.75em;
  height: auto;
  transition: var(--transition);
}

.theme-switch__checkbox:checked + .theme-switch__container {
  background-color: var(--container-night-bg);
  background-image: linear-gradient(
    to bottom,
    var(--container-night-bg) 0%,
    #252a4a 100%
  );
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__circle-container {
  left: calc(
    100% - var(--circle-container-offset) - var(--circle-container-diameter)
  );
}

.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
  );
}

.theme-switch__circle-container:hover {
  left: calc(var(--circle-container-offset) + 0.187em);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon {
  transform: translate(0);
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__clouds {
  bottom: -4.062em;
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__stars-container {
  top: 50%;
  transform: translateY(-50%);
}

.theme-switch__container:hover .theme-switch__clouds {
  transform: translateX(15px) scale(1.02);
}

.theme-switch__sun-moon-container::after {
  content: "";
  position: absolute;
  inset: -5px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-switch__sun-moon-container:hover::after {
  opacity: 1;
}

.theme-switch__shooting-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  top: 20%;
  left: -10%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-switch__shooting-star-2 {
  position: absolute;
  width: 1px;
  height: 1px;
  background: white;
  top: 35%;
  left: -10%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-switch__meteor {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #ffd700;
  border-radius: 50%;
  top: -10%;
  left: 50%;
  opacity: 0;
  filter: blur(1px);
  transition: opacity 0.3s ease;
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__shooting-star {
  animation: shootingStar 2s linear infinite;
  opacity: 1;
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__shooting-star-2 {
  animation: shootingStar 3s linear infinite 1s;
  opacity: 1;
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__meteor {
  animation: meteor 4s linear infinite 2s;
  opacity: 1;
}

@keyframes shootingStar {
  0% {
    transform: translateX(0) translateY(0) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: translateX(150px) translateY(150px) rotate(45deg);
    opacity: 0;
  }
}

@keyframes meteor {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(150px) scale(0.3);
    opacity: 0;
  }
}

.theme-switch__stars-cluster {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-switch__stars-cluster .star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 4px 1px white;
}

.theme-switch__stars-cluster .star:nth-child(1) {
  top: 20%;
  left: 20%;
  animation: twinkle 1s infinite ease-in-out;
}
.theme-switch__stars-cluster .star:nth-child(2) {
  top: 30%;
  left: 55%;
  animation: twinkle 1s infinite ease-in-out 0.3s;
}
.theme-switch__stars-cluster .star:nth-child(3) {
  top: 40%;
  left: 80%;
  animation: twinkle 1s infinite ease-in-out 0.6s;
}
.theme-switch__stars-cluster .star:nth-child(4) {
  top: 60%;
  left: 30%;
  animation: twinkle 1s infinite ease-in-out 0.9s;
}
.theme-switch__stars-cluster .star:nth-child(5) {
  top: 70%;
  left: 65%;
  animation: twinkle 1s infinite ease-in-out 1.2s;
}

.theme-switch__aurora {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(
    90deg,
    rgba(0, 255, 255, 0) 0%,
    rgba(0, 255, 255, 0.2) 25%,
    rgba(128, 0, 255, 0.2) 50%,
    rgba(0, 255, 255, 0.2) 75%,
    rgba(0, 255, 255, 0) 100%
  );
  opacity: 0;
  filter: blur(4px);
  transform: translateY(-100%);
  transition: opacity 0.3s ease;
}

.theme-switch__comets {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-switch__comets .comet {
  position: absolute;
  width: 2px;
  height: 2px;
  background: linear-gradient(90deg, white 0%, transparent 90%);
  border-radius: 50%;
  filter: blur(1px);
}

.theme-switch__comets .comet:nth-child(1) {
  top: 30%;
  left: -10%;
  animation: cometMove 4s linear infinite;
}
.theme-switch__comets .comet:nth-child(2) {
  top: 50%;
  left: -10%;
  animation: cometMove 6s linear infinite 2s;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes cometMove {
  0% {
    transform: translateX(0) translateY(0) rotate(-45deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateX(200px) translateY(200px) rotate(-45deg) scale(0.2);
    opacity: 0;
  }
}

.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__stars-cluster {
  opacity: 1;
}
.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__aurora {
  opacity: 1;
  animation: auroraWave 8s linear infinite;
}
.theme-switch__checkbox:checked
  + .theme-switch__container
  .theme-switch__comets {
  opacity: 1;
}

@keyframes auroraWave {
  0% {
    transform: translateY(-100%) translateX(-50%);
  }
  100% {
    transform: translateY(-100%) translateX(50%);
  }
}

/* ------------------------------------------------------------------ Prepora adjustments */
/* size: the component is drawn in em of --toggle-size; 32px makes it 180px wide, so each place sets its own */
.theme-switch.pp-ts { --toggle-size: 12px; vertical-align: middle; line-height: 0; flex: 0 0 auto; }
.theme-switch.pp-ts.sm { --toggle-size: 11px; }
/* the shadow ring is in px: scaled with the switch so it does not look heavy at this size */
.theme-switch.pp-ts .theme-switch__container { box-shadow: 0 0 0 1.6px #1a1a1a, 2px 2.5px 0 1.6px rgba(26, 26, 26, 0.22); }
:root[data-theme="dark"] .theme-switch.pp-ts .theme-switch__container { box-shadow: 0 0 0 1.6px rgba(255, 255, 255, 0.55), 2px 2.5px 0 1.6px rgba(0, 0, 0, 0.35); }
/* keyboard: the checkbox stays in the tab order (display:none would remove it), hidden but focusable */
.theme-switch.pp-ts .theme-switch__checkbox { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.theme-switch.pp-ts { position: relative; }
.theme-switch.pp-ts .theme-switch__checkbox:focus-visible + .theme-switch__container { outline: 2px solid #7FC3C6; outline-offset: 3px; }
.theme-switch.pp-ts .theme-switch__stars-container svg { width: 100%; height: auto; display: block; }
/* touch screens: hover poses would stick after a tap */
@media (hover: none) {
  .theme-switch .theme-switch__sun-moon-container:hover, .theme-switch .theme-switch__moon:hover { transform: none; }
  .theme-switch .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon:hover { transform: translate(0); }
  .theme-switch .theme-switch__circle-container:hover { left: var(--circle-container-offset); }
  .theme-switch .theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover { left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter)); }
  .theme-switch .theme-switch__container:hover .theme-switch__clouds { transform: none; }
}
/* reduced motion: the switch still slides, the endless sky animations stop */
@media (prefers-reduced-motion: reduce) {
  .theme-switch *, .theme-switch *::before, .theme-switch *::after { animation: none !important; }
  .theme-switch { --transition: 0.2s ease; --circle-transition: 0.2s ease; }
}
/* placement: the switch replaces the old pill controls, so their frames go */
.hero-theme.hero-theme-sw, :root[data-theme="dark"] .hero-theme.hero-theme-sw, .dbh-hero .hero-theme.hero-theme-sw { padding: 4px; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.mode-toggle.mode-sw, .lx-mode .mode-toggle.mode-sw { padding: 2px 4px; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.nld-mode-sw { display: inline-flex; align-items: center; padding: 0 2px; }
/* account menu on the photo dashboards (the profile page is hidden; this keeps Sign out one tap away) */
.pp-avm { position: relative; }
.pp-avm > summary { list-style: none; cursor: pointer; }
.pp-avm > summary::-webkit-details-marker { display: none; }
.pp-avm-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 150px; padding: 6px; border-radius: 12px; background: var(--sf, var(--surface, #fff)); border: 1px solid var(--ln, var(--line, rgba(0,0,0,.1))); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.pp-avm-menu a, .pp-avm-menu button { display: block; box-sizing: border-box; text-decoration: none; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink, inherit); font: 600 .9rem/1.2 inherit; cursor: pointer; }
.pp-avm-menu a:hover, .pp-avm-menu a:focus-visible, .pp-avm-menu button:hover, .pp-avm-menu button:focus-visible { background: rgba(127,127,127,.12); }
.side-profile { flex-wrap: wrap; }
.side-profile .side-out { flex-basis: 100%; margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 600 .78rem/1 inherit; font-family: inherit; cursor: pointer; transition: color .16s ease, border-color .16s ease; }
.side-profile .side-out:hover { color: var(--ink); border-color: var(--ink-3); }
.side-profile .side-out:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.side-profile .side-out svg { width: 14px; height: 14px; display: inline-block; }
.side-profile .side-out span { display: inline; font-size: inherit; color: inherit; }
