/* ── Day / night switch ──
   The site is designed dark. Light mode flips the whole page's tones with one filter
   on <html>, then flips photos, screenshots and project artwork back so they keep
   their real colours. assets/theme.js adds the switch to the navbar and remembers
   the choice. */

/* The switch (sits in the navbar, after the email pill) */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  margin-left: 2px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); }
.theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
}
/* Dark mode shows the sun ("switch to day"); light mode shows the moon */
.theme-toggle .t-moon { transform: translateY(120%) rotate(-40deg); opacity: 0; }
html[data-theme="light"] .theme-toggle .t-sun { transform: translateY(-120%) rotate(40deg); opacity: 0; }
html[data-theme="light"] .theme-toggle .t-moon { transform: none; opacity: 1; }

/* Light mode: flip everything... */
html { transition: filter 0.45s ease; }
html[data-theme="light"] {
  background: #0a0a0a;          /* gets flipped to a soft off-white with the rest */
  filter: invert(1) hue-rotate(180deg);
}
/* With its own background on <html>, the body would paint its (identical) background
   over the cursor grid that sits behind the page at z-index -1. Let <html> carry it. */
html[data-theme="light"] body { background: transparent; }

/* ...then flip real imagery back so photos and screens keep their own colours */
html[data-theme="light"] :is(img, video, picture, .media, .hero-shot, .pb-art--game, .art-planner, .art-games, .demo-eyes-wrap) {
  filter: invert(1) hue-rotate(180deg);
}
/* the homepage device mockups already carry a drop shadow; keep it, lighter */
html[data-theme="light"] .acc-media .acc-device,
html[data-theme="light"] .acc-device {
  filter: invert(1) hue-rotate(180deg) drop-shadow(0 18px 28px rgba(0,0,0,0.18));
}
/* cursor effects: flip the fluid splash and the glowing grid back so they keep their
   real colours instead of turning dark. In day mode the splash drops its inline
   contrast/brightness sheen (hence !important) and draws soft pastels (splashCursor.js). */
html[data-theme="light"] #fluid {
  filter: invert(1) hue-rotate(180deg) !important;
}
/* Prompt Book: the fluid demo card draws its own light pastel version in day mode
   (prompt-demos.js), so flip that card back to its real colours */
html[data-theme="light"] .demo-fluid-wrap { filter: invert(1) hue-rotate(180deg); }
/* the cursor grid draws its own day colour (cursorGrid.js lightColor), so show it as-is */
html[data-theme="light"] .cursor-grid__canvas { filter: invert(1) hue-rotate(180deg); }
/* the hero portrait O: show the real photo */
html[data-theme="light"] .hero-invert .hero-o { filter: invert(1) hue-rotate(180deg); }

/* the googly eyes (hero + footer): flip back to white eyeballs, then give them a
   bold outline and a glint on the pupil (colours here are the real, unflipped ones) */
html[data-theme="light"] .eye {
  filter: invert(1) hue-rotate(180deg);
  background: #f7f7f7;
  border: 6px solid #111;
}
html[data-theme="light"] .pupil { background: #111; }
html[data-theme="light"] .pupil::after {
  content: '';
  position: absolute;
  top: 16%;
  right: 18%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: #d9d9d9;
}

@media (prefers-reduced-motion: reduce) { html { transition: none; } }

/* Small phones: keep the navbar on one line */
@media (max-width: 440px) {
  .theme-toggle { width: 32px; height: 32px; }
  .theme-toggle svg { width: 16px; height: 16px; }
}
