/* Theme switch: sun/moon button inside the island, left of the contact CTA */
.island-wrap { position: relative; display: flex; justify-content: center; }

.island__theme {
  position: relative;
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  transition: background .3s, rotate .6s var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.island__theme:hover { background: rgba(237, 23, 111, .1); }
.island__theme:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }
.island__theme svg { width: 22px; height: 22px; overflow: visible; }

/* Sun (light theme): disc + rays. Moon (dark theme): the disc grows and a circle cuts a crescent out of it */
.island__theme-disc { fill: currentColor; transform-box: view-box; transform-origin: center; transition: r .5s var(--ease-out); }
.island__theme-cut { transition: cx .5s var(--ease-out), cy .5s var(--ease-out); }
.island__theme-rays {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  transform-box: view-box; transform-origin: center;
  transition: opacity .35s, scale .5s var(--ease-out), rotate .5s var(--ease-out);
}
.island__theme:hover .island__theme-rays { rotate: 45deg; }

[data-theme="dark"] .island__theme { color: #ffe08a; }
[data-theme="dark"] .island__theme:hover { background: rgba(237, 23, 111, .18); }
[data-theme="dark"] .island__theme-disc { r: 8px; }
[data-theme="dark"] .island__theme-cut { cx: 17px; cy: 7px; }
[data-theme="dark"] .island__theme-rays { opacity: 0; scale: .4; rotate: -90deg; }
[data-theme="dark"] .island__theme:hover { rotate: -15deg; }

@media (prefers-reduced-motion: reduce) {
  .island__theme, .island__theme-disc, .island__theme-cut, .island__theme-rays { transition: opacity .2s; }
}

/* Light wave from the button on theme change (composited: transform + opacity) */
.theme-wave {
  position: fixed; z-index: 99;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}
.theme-wave--dark {
  background: radial-gradient(circle, transparent 52%, rgba(255, 214, 90, .28) 62%, rgba(237, 23, 111, .22) 68%, transparent 74%);
}
.theme-wave--light {
  background: radial-gradient(circle, transparent 52%, rgba(255, 244, 214, .7) 62%, rgba(249, 207, 224, .45) 68%, transparent 74%);
}

@media (max-width: 640px) {
  .island-wrap { width: 100%; }
  .island__theme { width: 44px; height: 44px; }
}
