/* The day and night switch in every page's header (founder, 2026-10-23, board pick A): it shows the mode you are in,
   the sun by day and the moon at night. The sun's eight rays fold in, its disc grows, and a second circle slides over it
   to cut a true crescent. It starts on the device's own setting and remembers a pick in this browser (web/theme.js).
   Tokens only. */
.theme-toggle { flex: none; width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3), background-color 0.2s, border-color 0.2s; }
.theme-toggle:hover { background: var(--surface-sunk); border-color: var(--line-strong); }
.theme-toggle:active { transform: scale(0.88); }
.theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.theme-toggle svg { width: 22px; height: 22px; display: block; overflow: visible;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25); }
/* Sun: a saffron disc with a terracotta rim and eight even rays (the rim keeps it readable on the cream button). */
.theme-rays { fill: none; stroke: var(--terracotta); stroke-width: 2; stroke-linecap: round; transform-origin: 12px 12px;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) 0.14s, opacity 0.3s ease 0.14s; }
.theme-disc { fill: var(--saffron); stroke: var(--terracotta); stroke-width: 2.8; transform-origin: 12px 12px;
  transform: scale(0.54); transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25), stroke-opacity 0.25s; }
.theme-cut { transform: translate(9px, -9px); transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
/* Hover (mouse only, so a tap never leaves it turned): the sun's rays turn, the moon tilts. */
@media (hover: hover) { .theme-toggle:hover .theme-rays { transform: rotate(45deg); transition-delay: 0s; } }
/* Moon: the rays fold away, the disc grows to full size and the cut circle leaves a crescent. The same rules twice:
   under the device's dark setting (no pick) and under a dark pick. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-rays { opacity: 0; transform: rotate(-90deg) scale(0.3); transition-delay: 0s; }
  :root:not([data-theme="light"]) .theme-disc { transform: none; stroke-opacity: 0; transition-delay: 0.12s; }
  :root:not([data-theme="light"]) .theme-cut { transform: none; transition-delay: 0.12s; }
}
:root[data-theme="dark"] .theme-rays { opacity: 0; transform: rotate(-90deg) scale(0.3); transition-delay: 0s; }
:root[data-theme="dark"] .theme-disc { transform: none; stroke-opacity: 0; transition-delay: 0.12s; }
:root[data-theme="dark"] .theme-cut { transform: none; transition-delay: 0.12s; }
@media (hover: hover) {
  :root[data-theme="dark"] .theme-toggle:hover svg { transform: rotate(-16deg); }
}
@media (hover: hover) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle:hover svg { transform: rotate(-16deg); }
}
/* On the home and guide header the links hide on phones; the switch then leads the right side. */
@media (max-width: 820px) { .nav .theme-toggle { margin-left: auto; } .nav .theme-toggle + .btn--small { margin-left: 0; } }
/* The page fades into its new colors, app screenshots included, in one move (board pick P1). Browsers with view
   transitions fade a picture of the old page into the new one; the switch sits above both so its own move stays live. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.4s; animation-timing-function: ease; }
html.theme-vt .theme-toggle { view-transition-name: theme-toggle; }
::view-transition-old(theme-toggle) { display: none; }
::view-transition-new(theme-toggle) { animation: none; }
/* Older browsers ease every color instead; the switch and the hero's sun and moon keep their own transitions. Never
   at load. */
html.theme-fade, html.theme-fade *:not(.theme-toggle, .theme-toggle *, .sun), html.theme-fade *:not(.sun)::before,
html.theme-fade *::after {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, fill 0.4s ease,
    stroke 0.4s ease !important; }
/* Reduce Motion: nothing turns or slides; the switch changes with the page in a short plain fade. */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-toggle svg, .theme-toggle svg * { transition: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.2s; }
}
