/* Licensed to account 52c7da1aea3f, 2026-10-20. Moving parts. */
/* =========================================================
   Button 02, portable build: fill, from the Button set.
   Moving parts.
   Built from components/button-motion/button-motion.css.

   Three parts. First the base every button of the set shares: the presence
   marker, the box and the label. Then the part of fill: the place and the
   paint of the layers the engine builds inside the button, and the two
   colours the effect owns, the fill and the ink over it, as custom
   properties whose fallbacks equal what the engine resolves by default.
   None of it sets a font, a size, a padding, a border or a background on
   the button.

   Then, at the end of the file, the look of the preview's button, on
   classes of their own. It is optional: the engine never reads those
   classes, and a button without them keeps the page's own look.
   ========================================================= */

/* ---------- base ---------- */

/* Presence marker for the engine.
   The engine reads it to know this sheet is on the page, and says so in the
   console when it is not. Every button of the set ships this part: two
   buttons on one page bring it twice, the same rules, which changes
   nothing. */
[data-button-motion] {
  --button-motion-css: 1;
}

/* A box that can move, and the origin of its layers.
   Zero specificity: a class of the page that sets position or display wins.
   An inline element cannot be transformed, hence inline-block, which is what
   a button already is. */
:where([data-button-motion]) {
  position: relative;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
}

/* The label, the button's own content moved into one box by the engine. */
.button-motion-label {
  display: inline-block;
  position: relative;
}

/* ---------- fill ---------- */

/* Flood growth, 0 to 1, registered so it interpolates as a number.
   It inherits on purpose: the pseudo-element and the ink copy of the label
   read it from the button. */
@property --button-motion-flood {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

/* The flood: a circle of the fill colour painted under the label.
   Its centre and its reach are written by the engine for the length of the
   hover; at rest the flood is 0 and the layer paints nothing. Clipped by the
   button's own corners through border-radius: inherit, so the button needs
   no overflow rule. The 1px soft edge grows with the flood: a fixed one left
   a dot of the colour at the centre of every button at rest. The layer is
   laid over the border box: the engine writes the four border widths at
   enter and the layer moves out by them, so the colour covers the border
   too and border-radius: inherit is the outer radius. With no border, or at
   rest, the widths are 0 and nothing moves. */
:where([data-button-motion="fill"])::before {
  content: "";
  position: absolute;
  inset:
    calc(-1 * var(--button-motion-bt, 0px))
    calc(-1 * var(--button-motion-br, 0px))
    calc(-1 * var(--button-motion-bb, 0px))
    calc(-1 * var(--button-motion-bl, 0px));
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--button-motion-fx, 50%) var(--button-motion-fy, 50%),
    var(--button-motion-color, #ff4a00) 0,
    var(--button-motion-color, #ff4a00) calc(var(--button-motion-flood, 0) * var(--button-motion-reach, 0px)),
    transparent calc(var(--button-motion-flood, 0) * var(--button-motion-reach, 0px) + min(1px, var(--button-motion-flood, 0) * 100px))
  );
}

/* The ink copy of the label, clipped by the same circle.
   Same box as the label, same words, in the ink colour: the letters change
   colour exactly where the flood passes under them. The circle's centre is
   the flood's, moved into the label's own box by the offsets the engine
   measured. */
.button-motion-label-fill {
  position: absolute;
  inset: 0;
  color: var(--button-motion-ink, #160903);
  pointer-events: none;
  clip-path: circle(
    calc(var(--button-motion-flood, 0) * var(--button-motion-reach, 0px))
    at calc(var(--button-motion-fx, 50%) - var(--button-motion-lx, 0px))
       calc(var(--button-motion-fy, 50%) - var(--button-motion-ly, 0px))
  );
}

/* ---------- keyboard ring of the look ---------- */

/* Focus ring of the preview's buttons, for the keyboard only.
   A Webflow paste carries no state (AB-41), so this ring stays above the
   look and travels in the Embed with the mechanics. :where() keeps it under
   any focus rule of the page. It finds the button by data-button-set-button,
   never by its class: Webflow renames a class pasted twice on one site, an
   attribute comes through as it is (AB-116). */
:where([data-button-set-button]:focus-visible) {
  outline: 2px solid #15100c;
  outline-offset: 4px;
}

/* ---------- look, left out of the Webflow Embed ---------- */

/* Clinix Studio: the look of the preview (the button-set-* classes of the
   cream page with one bordered button, set in Instrument Sans and Geist
   Mono) is left out of this copy on purpose. The effect runs on the site's
   own .btn--primary (src/styles/global.css), which keeps its pill, its
   Pale Sky ground and its type; the flood colour and the ink come from the
   tokens through window.ButtonMotionSettings in src/layouts/BaseLayout.astro.
   The mechanics above are the file as shipped. */
