/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* =====================================================================
   Makerique Boutique — custom cursor effects (optional, off by default)
   Follower dot / ring / image that trails the mouse, rendered by
   template/common/footer.twig (see docs/cursor_footer_block.twig.txt) when
   mr_cursor.enabled is true.

   DESKTOP ONLY: the follower markup is only inserted / activated on
   fine-pointer, non-touch devices and is fully disabled under
   prefers-reduced-motion. As belt-and-braces, this stylesheet also hides the
   elements on touch (@media (hover: none)) and under reduced motion, so even a
   stray element never shows on the wrong device.

   Colour: the footer block sets an inline --mr-cursor-color custom property
   when the admin provides one; otherwise it falls back to var(--mr-primary).
   Size comes from --mr-cursor-size (px). Everything else keys off --mr-* tokens.
   ===================================================================== */

.mr-cursor {
  --mr-cursor-color: var(--mr-primary, #e26d8a);
  --mr-cursor-size: 24px;

  position: fixed;
  top: 0;
  left: 0;
  width: var(--mr-cursor-size);
  height: var(--mr-cursor-size);
  /* Centre the element on the pointer; JS updates --mr-cursor-x/-y. */
  transform: translate3d(var(--mr-cursor-x, -100px), var(--mr-cursor-y, -100px), 0) translate(-50%, -50%);
  pointer-events: none;
  z-index: 2147483000;
  will-change: transform;
  /* Smooth the scale/opacity changes on hover-grow; position is rAF-driven. */
  transition: width var(--mr-transition, .2s ease),
              height var(--mr-transition, .2s ease),
              opacity var(--mr-transition, .2s ease),
              background-color var(--mr-transition, .2s ease),
              border-color var(--mr-transition, .2s ease);
}

/* The ring lags slightly behind the dot — its own translate vars are eased in
   JS — so it reads as a soft trail. */
.mr-cursor-ring {
  border: 2px solid var(--mr-cursor-color);
  border-radius: 50%;
  background: transparent;
}

.mr-cursor-dot {
  width: calc(var(--mr-cursor-size) * 0.28);
  height: calc(var(--mr-cursor-size) * 0.28);
  background: var(--mr-cursor-color);
  border-radius: 50%;
}

/* Image variant — the src is applied inline via background-image on the element
   the JS creates; keep it contained and centred. */
.mr-cursor-image {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Hover-grow: JS toggles .mr-cursor--active on the shared elements while over
   interactive targets. Emphasise without moving the centre. */
.mr-cursor--active.mr-cursor-ring {
  width: calc(var(--mr-cursor-size) * 1.6);
  height: calc(var(--mr-cursor-size) * 1.6);
  border-color: var(--mr-cursor-color);
  background: color-mix(in srgb, var(--mr-cursor-color) 15%, transparent);
}

.mr-cursor--active.mr-cursor-dot {
  width: calc(var(--mr-cursor-size) * 0.45);
  height: calc(var(--mr-cursor-size) * 0.45);
}

.mr-cursor--active.mr-cursor-image {
  width: calc(var(--mr-cursor-size) * 1.35);
  height: calc(var(--mr-cursor-size) * 1.35);
}

/* When the native cursor is hidden, the JS adds this to <html>. */
.mr-cursor-hide-native,
.mr-cursor-hide-native * {
  cursor: none !important;
}

/* =====================================================================
   Safety net — never show the follower on touch devices or under
   reduced motion, regardless of what the JS did.
   ===================================================================== */
@media (hover: none), (pointer: coarse) {
  .mr-cursor { display: none !important; }
  .mr-cursor-hide-native,
  .mr-cursor-hide-native * { cursor: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
  .mr-cursor {
    display: none !important;
    transition: none;
  }
  .mr-cursor-hide-native,
  .mr-cursor-hide-native * { cursor: auto !important; }
}
