/* Pill and round buttons get, on hover and on keyboard focus, a rolling label (0.5 s), a blue glow and halo (0.4 s)
   and slow drifting colour clouds; at all times a 1 px gradient ring whose bright end turns toward the pointer
   (button-glow.js writes --fb-ring-angle). Buttons: the menu button (every page), the round arrow on blog covers, the
   /contact send button.

   Layers per button: its own background image is the glow, a soft ellipse centred on the bottom edge that grows up
   from nothing (background-size, painted only during the 0.4 s change); ::before holds the clouds (twice the button's
   size, clipped by it), faded in with opacity and drifted with `translate`, both on the compositor, the drift paused
   unless the button is hovered or focused; ::after is the ring; box-shadow is the outer halo.

   Every rule starts with html:root (one class and one element of specificity) so it outranks the buttons' own rules,
   such as the background shorthand on #menu-btn:hover, which would otherwise reset the glow. */
html:root :is(#menu-btn, .cover-arrow, .cp-send) {
  --fb-roll: .5s cubic-bezier(.16, 1, .3, 1);
  --fb-glow: .4s ease;
  --fb-halo: #3652de;
  --fb-halo-on: 70%;
  --fb-ring: #283044 0%, #3652de 4%, #3652de00 31%, #3652de00 60%, #f1c631 85%, #3652de 100%;
  --fb-ring-angle: 90deg;
  isolation: isolate;
  overflow: hidden;
  box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) 0%, transparent);
  background-image: radial-gradient(55% 75% at 50% 100%, var(--fb-glow-in), color-mix(in srgb, var(--fb-glow-in) 50%, transparent) 50%, transparent);
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 100% 0%;
}
/* the menu button's glow and halo at about half strength (owner, 2026-10-14); its ring and clouds are unchanged */
html:root #menu-btn {
  --fb-glow-in: color-mix(in srgb, #3652de 45%, transparent);
  --fb-halo-on: 35%;
  --fb-clouds: radial-gradient(closest-side, #3652de3d, #3652de00) 0 0 / 70% 60%, radial-gradient(closest-side, #f1c63147, #f1c63100) 60% 30% / 60% 70%, radial-gradient(closest-side, #28304424, #28304400) 40% 80% / 55% 55%;
  position: relative;
  transition: color .4s, background-color .4s, box-shadow var(--fb-glow), background-size var(--fb-glow);
}
/* On portfolio pages the header row clips its buttons (they slide up into it from 4em below on arrival), which would
   cut the halo off at the row's edges. While the menu button is hovered or focused the clip grows by 2em; it shrinks
   back after the halo has faded. */
html:root #site-header-row:has(#talk-btn-ghost) { overflow: clip; overflow-clip-margin: 0px; transition: overflow-clip-margin 0s .4s; }
html:root #site-header-row:has(#talk-btn-ghost):has(#menu-btn:is(:hover, :focus-visible)) { overflow-clip-margin: 2em; transition-delay: 0s; }
html:root .cover-arrow {
  --fb-glow-in: #3652de;
  --fb-clouds: radial-gradient(closest-side, #3652de8c, #3652de00) 30% 20% / 60% 60%, radial-gradient(closest-side, #f1c63140, #f1c63100) 70% 40% / 55% 55%, radial-gradient(closest-side, #7f93ff66, #7f93ff00) 40% 75% / 60% 60%;
  color: transparent;
  text-shadow: 0 0 #fff, -1.2em 1.2em #fff;
  transition: text-shadow var(--fb-roll), box-shadow var(--fb-glow), background-size var(--fb-glow);
}
html:root .cp-send {
  --fb-glow-in: #1c1f86;
  --fb-ring: #283044 0%, #f1c631 4%, #ffffff00 31%, #ffffff00 60%, #f1c631 85%, #283044 100%;
  --fb-clouds: radial-gradient(closest-side, #8f9dff73, #8f9dff00) 20% 30% / 45% 70%, radial-gradient(closest-side, #28304466, #28304400) 65% 70% / 40% 80%, radial-gradient(closest-side, #b8c1ff59, #b8c1ff00) 85% 25% / 35% 60%;
  position: relative;
  transition: background-color .2s, box-shadow var(--fb-glow), background-size var(--fb-glow);
}

/* clouds: fade in and drift */
html:root :is(#menu-btn, .cover-arrow, .cp-send)::before {
  content: ''; position: absolute; inset: -50%; z-index: -1; pointer-events: none;
  background: var(--fb-clouds); background-repeat: no-repeat;
  opacity: 0;
  transition: opacity var(--fb-glow);
  animation: fb-clouds 14s ease-in-out infinite alternate paused;
}
/* ring: 1 px, the gradient masked to the border box minus the content box */
html:root :is(#menu-btn, .cover-arrow, .cp-send)::after {
  content: ''; position: absolute; inset: 0; z-index: 1; padding: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(var(--fb-ring-angle), var(--fb-ring));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* the label copies: the menu label's copy is its text shadow one line below, the cover arrow's a text shadow down and
   to the left (its own glyph is drawn by the first shadow), the send label's a drop shadow */
html:root #menu-btn:not(.--opened) #menu-btn-label { text-shadow: 0 1.2em currentColor; }
html:root #menu-btn-label,
html:root #menu-btn-label-close { transition: transform var(--fb-roll); }
html:root #menu-btn.--opened #menu-btn-label { transform: translate3d(0, -2.4em, 0); }
html:root .cp-send-label { filter: drop-shadow(0 1.7em 0 currentColor); transition: transform var(--fb-roll); }

/* hover (pointer devices) and keyboard focus: roll, glow, halo, clouds */
@media (hover: hover) {
  html:root :is(#menu-btn:hover, .cover-link:hover .cover-arrow, .cp-send:hover) { box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) var(--fb-halo-on), transparent); background-size: 100% 100%; }
  html:root :is(#menu-btn:hover, .cover-link:hover .cover-arrow, .cp-send:hover)::before { opacity: 1; animation-play-state: running; }
  html:root #menu-btn:hover:not(.--opened) #menu-btn-label { transform: translate3d(0, -1.2em, 0); }
  html:root .cover-link:hover .cover-arrow { text-shadow: 1.2em -1.2em #fff, 0 0 #fff; }
  html:root .cp-send:hover .cp-send-label { transform: translateY(-1.7em); }
}
html:root :is(#menu-btn:focus-visible, .cover-link:focus-visible .cover-arrow, .cp-send:focus-visible) { box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) var(--fb-halo-on), transparent); background-size: 100% 100%; }
html:root :is(#menu-btn:focus-visible, .cover-link:focus-visible .cover-arrow, .cp-send:focus-visible)::before { opacity: 1; animation-play-state: running; }
html:root #menu-btn:focus-visible:not(.--opened) #menu-btn-label { transform: translate3d(0, -1.2em, 0); }
html:root .cover-link:focus-visible .cover-arrow { text-shadow: 1.2em -1.2em #fff, 0 0 #fff; }
html:root .cp-send:focus-visible .cp-send-label { transform: translateY(-1.7em); }

/* The menu panel's close button on the desktop plan gets the menu button's treatment: ring, glow and halo at the menu
   button's strength, clouds, and the label rolling to its copy one line below (the label's inner span; the outer one
   clips it). Its own border gives way to the ring. The phone sheet keeps its round icon button, whose ::after is its
   touch target (menu-plan.css). Selectors carry #site-header #menu-panel to outrank menu-plan.css, including the
   background shorthand on its hover. */
@media (min-width: 813px) {
  html:root #site-header #menu-panel .fbm-close {
    --fb-glow-in: color-mix(in srgb, #3652de 45%, transparent);
    --fb-halo: #3652de;
    --fb-ring: #283044 0%, #3652de 4%, #3652de00 31%, #3652de00 60%, #f1c631 85%, #3652de 100%;
    --fb-ring-angle: 90deg;
    --fb-clouds: radial-gradient(closest-side, #3652de3d, #3652de00) 0 0 / 70% 60%, radial-gradient(closest-side, #f1c63147, #f1c63100) 60% 30% / 60% 70%, radial-gradient(closest-side, #28304424, #28304400) 40% 80% / 55% 55%;
    isolation: isolate;
    overflow: hidden;
    border-color: transparent;
    box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) 0%, transparent);
    background-image: radial-gradient(55% 75% at 50% 100%, var(--fb-glow-in), color-mix(in srgb, var(--fb-glow-in) 50%, transparent) 50%, transparent);
    background-repeat: no-repeat;
    background-position: 50% 100%;
    background-size: 100% 0%;
    transition: box-shadow .4s ease, background-size .4s ease;
  }
  html:root #site-header #menu-panel .fbm-close::before {
    content: ''; position: absolute; inset: -50%; z-index: -1; pointer-events: none;
    background: var(--fb-clouds); background-repeat: no-repeat;
    opacity: 0;
    transition: opacity .4s ease;
    animation: fb-clouds 14s ease-in-out infinite alternate paused;
  }
  html:root #site-header #menu-panel .fbm-close::after {
    content: ''; position: absolute; inset: 0; z-index: 1; padding: 1px; border-radius: inherit; pointer-events: none;
    background: linear-gradient(var(--fb-ring-angle), var(--fb-ring));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
  }
  html:root #site-header #menu-panel .fbm-close-text { display: block; overflow: hidden; line-height: 1.2; }
  html:root #site-header #menu-panel .fbm-close-text > span { display: block; text-shadow: 0 1.2em currentColor; transition: transform .5s cubic-bezier(.16, 1, .3, 1); }
  html:root #site-header #menu-panel .fbm-close:focus-visible { box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) 35%, transparent); background-size: 100% 100%; }
  html:root #site-header #menu-panel .fbm-close:focus-visible::before { opacity: 1; animation-play-state: running; }
  html:root #site-header #menu-panel .fbm-close:focus-visible .fbm-close-text > span { transform: translate3d(0, -1.2em, 0); }
}
@media (min-width: 813px) and (hover: hover) {
  html:root #site-header #menu-panel .fbm-close:hover { background-color: #fdfdfe; border-color: transparent; box-shadow: 0 .35em 1.6em -.2em color-mix(in srgb, var(--fb-halo) 35%, transparent); background-size: 100% 100%; }
  html:root #site-header #menu-panel .fbm-close:hover::before { opacity: 1; animation-play-state: running; }
  html:root #site-header #menu-panel .fbm-close:hover .fbm-close-text > span { transform: translate3d(0, -1.2em, 0); }
}
@media (min-width: 813px) and (prefers-reduced-motion: reduce) {
  html:root #site-header #menu-panel .fbm-close::before { animation: none; }
  html:root #site-header #menu-panel .fbm-close-text > span { transition: none; }
}

/* a slow figure across a quarter of the layer each way; the layer overhangs the button by half its size, so it never
   uncovers an edge */
@keyframes fb-clouds {
  0% { translate: -18% -12%; }
  33% { translate: 14% 6%; }
  66% { translate: -6% 16%; }
  100% { translate: 18% -14%; }
}

@media (prefers-reduced-motion: reduce) {
  html:root :is(#menu-btn, .cover-arrow, .cp-send)::before { animation: none; }
  html:root :is(#menu-btn-label, #menu-btn-label-close, .cp-send-label) { transition: none; }
  html:root .cover-arrow { transition: box-shadow var(--fb-glow), background-size var(--fb-glow); }
}
