/* The light/dark switch (`ModeSwitch`): the sky by day or by night */
.mode-switch {
  --t: 700ms;
  --ease: cubic-bezier(0.45, 0, 0.2, 1);
  position: relative;
  width: 80px;
  height: 36px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.35), 0 0 0 1px color-mix(in oklab, var(--color-base-content) 15%, transparent);
}
.mode-switch:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.mode-switch__sky,
.mode-switch__hills {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mode-switch__hills {
  z-index: 2;
}

/* The sky turning: night over day, the stars coming out, the clouds off */
.mode-switch__night {
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.mode-switch__stars {
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.mode-switch__stars circle {
  animation: mode-twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes mode-twinkle {
  from { opacity: 1; }
  to { opacity: 0.35; }
}
.mode-switch__clouds {
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}
.mode-switch[data-mode='dark'] .mode-switch__night,
.mode-switch[data-mode='dark'] .mode-switch__stars {
  opacity: 1;
}
.mode-switch[data-mode='dark'] .mode-switch__clouds {
  transform: translateX(30px);
  opacity: 0;
}

/* The hills, green by day, dark by night */
.mode-switch__hill-back,
.mode-switch__hill-front {
  transition: fill var(--t) var(--ease);
}
.mode-switch__hill-back { fill: #7cc46a; }
.mode-switch__hill-front { fill: #4f9e45; }
.mode-switch[data-mode='dark'] .mode-switch__hill-back { fill: #1f3b3a; }
.mode-switch[data-mode='dark'] .mode-switch__hill-front { fill: #132a29; }

/* The knob: the sun up on the left, or the moon up on the right */
.mode-switch__knob {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  transition: transform var(--t) var(--ease);
}
.mode-switch[data-mode='dark'] .mode-switch__knob {
  transform: translateX(46px);
}
.mode-switch__sun,
.mode-switch__moon {
  position: absolute;
  inset: 0;
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}
/* (the one sunk below the hills, rising as it slides over; the sun turning
   as it goes) */
.mode-switch__moon {
  transform: translateY(34px);
  filter: drop-shadow(0 0 4px rgb(255 248 220 / 0.6));
}
.mode-switch__sun {
  filter: drop-shadow(0 0 4px rgb(255 200 60 / 0.7));
}
.mode-switch[data-mode='dark'] .mode-switch__sun {
  transform: translateY(34px) rotate(90deg);
}
.mode-switch[data-mode='dark'] .mode-switch__moon {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .mode-switch,
  .mode-switch * {
    transition: none !important;
    animation: none !important;
  }
}

/* The hold-to-buy button (`HoldToBuy`): its fill, empty; held, sweeping full
   over the hold's length; let go, easing back */
.hold-to-buy__fill {
  transform: scaleX(0);
  transition: transform 0.25s ease-out;
}
.hold-to-buy[data-holding] .hold-to-buy__fill {
  transform: scaleX(1);
  transition: transform var(--hold) linear;
}

