/* TorBula · top bar icons, shared by every page with the top bar (the
   portfolio, both hubs, every tool). See CLAUDE.md, "one top bar everywhere".

   Theme button: sun ⇄ moon. Both glyphs sit stacked in .tbi-theme and the
   one that doesn't apply is turned a quarter away and scaled to nothing
   (transform only, never opacity: the button is glass). On a switch the old
   glyph turns away and shrinks, accelerating (.2s), and the new one turns in
   and grows a touch past full size before settling (.38s after .12s), like
   SF Symbols' replace: .5s in all, the timing of the Settings panel and of
   the language globe (nav-icons.js). One wheel: into dark everything turns
   clockwise, out of it back. The transition that runs is the one of the
   state an icon goes TO, so each rule carries its own.

   Markup (sizes/colours come from the page's own icon class):
     <button …><span class="tbi-theme" aria-hidden="true">
       <img src="…/main-svg/sol.svg" class="nav-ic-img tbi-sun" alt="">
       <img src="…/main-svg/luna.svg?v=2" class="nav-ic-img tbi-moon" alt="">
     </span></button>
   The page's inline pre-paint script puts .dark on <html> (hubs) or <body>
   (portfolio, tools); either works here. */
.tbi-theme { display: grid; place-items: center; }
.tbi-theme > * {
  grid-area: 1 / 1; display: block;
  transition: transform .38s .12s cubic-bezier(.34, 1.5, .64, 1);   /* arriving */
}
/* Ink: the pages colour these icons with filter: invert(1) in dark, which
   flips at once, while the glass behind may still be fading. Into dark the
   button stays light until the page behind darkens, so the leaving sun keeps
   its dark ink until it has shrunk away. Out of dark the portfolio's and the
   tools' buttons turn light at once (the moon takes the new ink straight
   away), but the hubs' capsules fade their background over .25s: they set
   --tbi-ink-wait (.12s, halfway) so the moon doesn't turn black on dark. */
.tbi-theme > .tbi-moon {   /* leaving */
  transition: transform .2s cubic-bezier(.4, 0, 1, 1), filter 0s var(--tbi-ink-wait, 0s);
}
.dark .tbi-theme > .tbi-sun { transition: transform .2s cubic-bezier(.4, 0, 1, 1), filter 0s .2s; }
.tbi-theme > .tbi-moon { transform: rotate(-90deg) scale(0); }
.dark .tbi-theme > .tbi-sun { transform: rotate(90deg) scale(0); }
.dark .tbi-theme > .tbi-moon {
  transform: none;
  transition: transform .38s .12s cubic-bezier(.34, 1.5, .64, 1);
}
@media (prefers-reduced-motion: reduce) {
  .tbi-theme > * { transition: none !important; }
}
