/**
 * Westmark v6.0.4 — Vengeance UI effects, ported to plain CSS/JS.
 *
 * Two effects, adapted from Vengeance UI (MIT License, Copyright (c)
 * Ashutosh — https://github.com/Ashutoshx7/VengeanceUI):
 *   1. Liquid Button  (components/ui/liquid-button.tsx)
 *   2. Glow Border Card (components/ui/glow-border-card.tsx)
 *
 * The originals are React + Tailwind. This file is the plain-CSS half of
 * the port; the animation loop lives in assets/js/vengeance-effects.js.
 * No React, no Tailwind, no build step, no extra libraries.
 *
 * Colours are Westmark's own: yellow #ffd400 on black. Two variants:
 *   .wm-liquid            — dark surfaces (black hero / dark sections)
 *   .wm-liquid--on-light  — light surfaces (white cards / light sections)
 *
 * Accessibility: both effects stop moving under
 * prefers-reduced-motion, and the glow card is static on touch devices
 * (pointer: coarse) so it never costs battery or distracts from taps.
 */

/* ================================================================
   1. LIQUID BUTTON
   Faithful port of Vengeance UI's Liquid Button. Resting state: a
   transparent pill with a coloured border and coloured label. On
   hover/focus a wobbly liquid blob (SVG turbulence + displacement,
   driven by assets/js/vengeance-effects.js) grows from the pointer
   and fills the button; the label inside the blob is shown in the
   inverted colour through a clipped copy layer. On click a shockwave
   ring fires from the press point.
   ================================================================ */

.wm-liquid {
  --liquid-fill: #ffd400;
  --liquid-text: #ffd400;
  --liquid-active-text: #111111;
  --liquid-border: #ffd400;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease-out, box-shadow .15s ease-out, border-color .15s ease-out;
}

/* Light-surface variant: black blob, black label, yellow label inside
   the blob — readable on white cards and light sections. */
.wm-liquid--on-light {
  --liquid-fill: #111111;
  --liquid-text: #111111;
  --liquid-active-text: #ffd400;
  --liquid-border: #111111;
}

/* Override the theme's solid .btn-yellow fill — the liquid blob IS the
   fill now. Specificity beats .btn-yellow / .btn-yellow:hover. */
.btn.wm-liquid {
  background: transparent;
  color: var(--liquid-text);
  border: 1.5px solid var(--liquid-border);
}
.btn-yellow.wm-liquid:hover,
.btn.wm-liquid:hover {
  background: transparent;
  text-decoration: none;
}

.wm-liquid:focus-visible {
  outline: 2px solid var(--liquid-fill);
  outline-offset: 4px;
}

.wm-liquid:disabled {
  pointer-events: none;
  opacity: .5;
}

/* Pressed state (JS adds .wm-pressed): Vengeance shrinks to 0.96 and
   drops the hover lift while pressed. */
.wm-liquid.wm-pressed {
  transform: translateY(0) scale(.96);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .25);
}
.wm-liquid-content.wm-pressed {
  transform: scale(.98);
}

/* SVG layer: one SVG unit = one CSS pixel of the button (no viewBox),
   exactly as in the original, so the blob and the clip path share the
   button's own pixel space. */
.wm-liquid-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.wm-liquid-blob {
  fill: var(--liquid-fill);
}
.wm-liquid-ring {
  fill: none;
  stroke: var(--liquid-active-text);
}

/* The real label. pointer-events:none so hover/press land on the button. */
.wm-liquid-content {
  position: relative;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  transition: transform .1s ease;
}

/* The inverted copy layer: same label, clipped by the SVG clip path so
   only the part inside the liquid blob shows, in the inverted colour.
   Text nodes are wrapped in [data-liquid-text] spans by the JS and
   rendered with ::before, so the label exists in the DOM only once. */
.wm-liquid-inverted {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: inherit;
  pointer-events: none;
  color: var(--liquid-active-text);
  transition: transform .1s ease;
}
.wm-liquid-inverted [data-liquid-text]::before {
  content: attr(data-liquid-text);
}

/* ================================================================
   2. GLOW BORDER CARD
   Faithful port of Vengeance UI's Glow Border Card. The original is a
   CSS-only rotating conic gradient: 10 colours as --glow-color-1..10,
   an angle registered with @property, and a linear animation spinning
   it. The original renders the gradient on a blurred div behind a
   glass card; the port keeps that halo and adds the same gradient as
   a crisp 2px rim (padding-box mask trick), because Westmark's cards
   are solid white, not glass — a blurred halo alone would be lost
   against them. Same mechanism, same 4s rotation, Westmark palette.
   ================================================================ */

/* Registered angle: the only reason the gradient can rotate. */
@property --wm-glow-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}

.wm-glow-card {
  /* position:relative is REQUIRED: it makes the card the containing
     block for the absolute .wm-glow halo and ::after rim. Without it
     (neither .service-card nor .price-card is positioned in the theme)
     the halo escapes to the page and paints a full-viewport yellow
     wash — caught by the headless preview render, 1 Dec 2026. */
  position: relative;
  isolation: isolate;
  --wm-glow-duration: 4s;
  animation: wm-glow-spin var(--wm-glow-duration) linear infinite;
}

@keyframes wm-glow-spin {
  to { --wm-glow-angle: 360deg; }
}

/* Soft halo behind the card: the rotating gradient, blurred.
   RING ONLY — the mask cuts the middle out, so the halo shows as an
   8px band strictly OUTSIDE the card and never washes the white card
   face (the first version had no mask: inside an isolated stacking
   context the z-index:-1 halo paints ABOVE the card background and
   turned the whole face yellow — caught by the preview render).
   Mask applies after the blur, so the band keeps the soft gradient;
   its outer edge is a defined line 8px out from the card. */
.wm-glow {
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: conic-gradient(from var(--wm-glow-angle, 0deg),
    #ffd400, #ffe14d, #ffb800, #fff3b0, #ffd400,
    #f5c400, #ffea70, #ffd400, #e6bf00, #ffd400);
  filter: blur(12px);
  opacity: .55;
  padding: 8px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* Crisp rotating rim: the same gradient as a 2px border, cut out with
   the padding-box mask trick. */
.wm-glow-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  background: conic-gradient(from var(--wm-glow-angle, 0deg),
    #ffd400, #ffe14d, #ffb800, #fff3b0, #ffd400,
    #f5c400, #ffea70, #ffd400, #e6bf00, #ffd400);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* ================================================================
   Reduced motion + touch
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .wm-liquid {
    transition: none;
  }
  /* The JS also skips its animation loop and fills instantly. */
  .wm-glow-card {
    animation: none;
  }
  /* Static gradient border + halo remain — the card still reads as
     a highlighted card, it just does not move. */
}

@media (pointer: coarse) {
  /* Touch devices: the glow is static, never animated — no battery
     cost, no distraction from taps. The liquid button keeps its tap
     shockwave (JS), which is a press response, not ambient motion. */
  .wm-glow-card {
    animation: none;
  }
}
