/* ==========================================================================
   Ring CTA: the HMOOD signature call to action, shared by HMOOD 2.0 and HMOOD Reviews.
   HMOOD 2.0 imports this file (footer.css); hmoodreviews.no gets the same file served as
   /reviews-marketing/ring-cta.css (routes/reviews-marketing.js). Behaviour: src/js/ring-cta.js.

   <a|button class="ring-cta" data-ring-cta>
     .ring-cta__ring   text ring, built from the label by ring-cta.js (aria-hidden)
     .ring-cta__core   the solid core (data-magnetic-circle: the magnetic pull moves it)
     .ring-cta__content > .ring-cta__label (visually hidden source text) + .ring-cta__arrow

   - idle: the ring turns slowly (one turn in 32s); the core and arrow stay still
   - hover / keyboard focus: the ring eases faster (ring-cta.js), opens up a touch and reads
     brighter; the core swells slightly and the arrow slides out and back in
   - press: core and ring give in quickly
   - reduced motion: no turning, no scaling; colours and the focus ring still respond
   Palette per context through custom properties: --ring-cta-core, --ring-cta-core-press,
   --ring-cta-arrow, --ring-cta-ink (ring text, dots and focus ring; defaults to currentColor).
   ========================================================================== */
.ring-cta {
  --ring-cta-core: var(--c-red, #e63b3b);
  --ring-cta-core-press: var(--c-red-deep, #c92a2a);
  --ring-cta-arrow: #fff;
  --ring-cta-ink: currentColor;
  --ring-cta-ease: var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(13rem, 8rem + 11vw, 20rem);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------- text ring ---------- */
.ring-cta__ring {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: var(--ring-cta-ink);
  opacity: 0.78;
  pointer-events: none;
  transition:
    scale 0.9s var(--ring-cta-ease),
    opacity 0.5s var(--ring-cta-ease);
}
.ring-cta__ring svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: ring-cta-turn 32s linear infinite;
}
/* right to left: the ring turns with the reading direction */
[dir='rtl'] .ring-cta__ring svg {
  animation-direction: reverse;
}
.ring-cta.is-offscreen .ring-cta__ring svg {
  animation-play-state: paused;
}
.ring-cta__text {
  font-family: var(--f-display, 'Manrope', system-ui, sans-serif);
  font-weight: 650;
  letter-spacing: 0; /* tracking is applied by ring-cta.js, the same in every engine */
  fill: currentColor;
}
.ring-cta__dot {
  fill: currentColor;
}
/* a hairline between ring and core: barely there at rest, it firms up on hover */
.ring-cta__track {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.6;
  opacity: 0.22;
  transition: opacity 0.5s var(--ring-cta-ease);
}
@keyframes ring-cta-turn {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- core ---------- */
.ring-cta__core {
  position: absolute;
  inset: 23%;
  z-index: 1;
  border-radius: 50%;
  translate: var(--mx, 0px) var(--my, 0px); /* HMOOD Reviews writes its magnetic pull here */
}
.ring-cta__core::before,
.ring-cta__core::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.ring-cta__core::before {
  inset: 0;
  background: var(--ring-cta-core);
  box-shadow: 0 1.4rem 2.6rem -1.6rem rgba(0, 0, 0, 0.45);
  transition:
    scale 0.8s var(--ring-cta-ease),
    background-color 0.4s ease,
    box-shadow 0.8s var(--ring-cta-ease);
}
/* keyboard focus ring, drawn around the core */
.ring-cta__core::after {
  inset: -0.5rem;
  border: 2px solid var(--ring-cta-ink);
  opacity: 0;
  scale: 0.94;
  transition:
    opacity 0.3s ease,
    scale 0.5s var(--ring-cta-ease);
}

/* ---------- arrow ---------- */
.ring-cta__content {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--ring-cta-arrow);
  translate: var(--cx, 0px) var(--cy, 0px);
}
.ring-cta__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.ring-cta__arrow {
  position: relative;
  display: block;
  width: clamp(2.4rem, 1.9rem + 1.3vw, 3.25rem);
  aspect-ratio: 1;
  overflow: hidden;
}
.ring-cta__arrow > span {
  position: absolute;
  inset: 0;
  transition: transform 0.6s var(--ring-cta-ease);
}
.ring-cta__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ring-cta__arrow-b {
  transform: translate(-110%, 110%);
}
/* a forward arrow (→, send buttons) slides along its own axis */
.ring-cta--forward .ring-cta__arrow-b {
  transform: translateX(-110%);
}

/* ---------- hover (mouse) and keyboard focus ---------- */
@media (hover: hover) and (pointer: fine) {
  .ring-cta:hover .ring-cta__ring {
    opacity: 1;
  }
  .ring-cta:hover .ring-cta__track {
    opacity: 0.4;
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ring-cta:hover .ring-cta__ring {
    scale: 1.035;
  }
  .ring-cta:hover .ring-cta__core::before {
    scale: 1.07;
    box-shadow: 0 1.8rem 3rem -1.6rem rgba(0, 0, 0, 0.5);
  }
  .ring-cta:hover .ring-cta__arrow-a {
    transform: translate(110%, -110%);
  }
  .ring-cta--forward:hover .ring-cta__arrow-a {
    transform: translateX(110%);
  }
  .ring-cta:hover .ring-cta__arrow-b {
    transform: none;
  }
}
.ring-cta[data-ring-cta]:focus-visible {
  outline: none;
}
.ring-cta:focus-visible .ring-cta__ring {
  opacity: 1;
}
.ring-cta:focus-visible .ring-cta__core::after {
  opacity: 1;
  scale: 1;
}

/* ---------- press ---------- */
.ring-cta:active .ring-cta__core::before {
  background: var(--ring-cta-core-press);
  transition-duration: 0.18s;
}
@media (prefers-reduced-motion: no-preference) {
  .ring-cta:active .ring-cta__core::before {
    scale: 0.94;
  }
  .ring-cta:active .ring-cta__ring {
    scale: 0.985;
    transition-duration: 0.25s;
  }
}
.ring-cta:disabled {
  cursor: default;
}

/* ---------- reduced motion: a still ring; states change in place ---------- */
@media (prefers-reduced-motion: reduce) {
  .ring-cta__ring svg {
    animation: none;
  }
  .ring-cta__ring,
  .ring-cta__track,
  .ring-cta__core::before,
  .ring-cta__core::after {
    transition: none;
  }
  .ring-cta__core::after {
    scale: none;
  }
  .ring-cta__arrow-b {
    display: none;
  }
}

/* forced colours (Windows high contrast): keep the core and the ring visible */
@media (forced-colors: active) {
  .ring-cta__core::before {
    background: ButtonText;
  }
  .ring-cta__content {
    color: ButtonFace;
  }
  .ring-cta__ring {
    color: ButtonText;
  }
}
