/**
 * HBMCS animation runtime — base CSS.
 *
 * Bundled into runtime.css alongside runtime.js. Imported by the React
 * app shells too (so admin/client editor previews look the same).
 *
 * All custom properties are documented inline so theme authors know
 * what they can override.
 */

:root {
  /* Cursor */
  --hbmcs-cursor-color: #fff;
  --hbmcs-cursor-size: 8px;
  --hbmcs-cursor-ring-size: 36px;
  --hbmcs-cursor-ring-border: 1.5px;

  /* Preloader */
  --hbmcs-preloader-bg: #0a0a0a;
  --hbmcs-preloader-fg: #ffffff;
  --hbmcs-preloader-font: var(--font-heading, 'Inter'), sans-serif;
  --hbmcs-preloader-letter-spacing: 0.4em;
}

/* ─── Cursor ─────────────────────────────────────────────────────────── */

html.hbmcs-has-cursor,
html.hbmcs-has-cursor * {
  cursor: none !important;
}

.hbmcs-cursor-dot,
.hbmcs-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: difference;
  will-change: transform;
}

.hbmcs-cursor-dot {
  width: var(--hbmcs-cursor-size);
  height: var(--hbmcs-cursor-size);
  border-radius: 50%;
  background: var(--hbmcs-cursor-color);
  margin-left: calc(var(--hbmcs-cursor-size) / -2);
  margin-top: calc(var(--hbmcs-cursor-size) / -2);
}

.hbmcs-cursor-ring {
  width: var(--hbmcs-cursor-ring-size);
  height: var(--hbmcs-cursor-ring-size);
  border-radius: 50%;
  border: var(--hbmcs-cursor-ring-border) solid var(--hbmcs-cursor-color);
  margin-left: calc(var(--hbmcs-cursor-ring-size) / -2);
  margin-top: calc(var(--hbmcs-cursor-ring-size) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.2s ease, height 0.2s ease, background 0.2s ease;
}

.hbmcs-cursor-ring.has-text {
  width: calc(var(--hbmcs-cursor-ring-size) * 2);
  height: calc(var(--hbmcs-cursor-ring-size) * 2);
  margin-left: calc(var(--hbmcs-cursor-ring-size) * -1);
  margin-top: calc(var(--hbmcs-cursor-ring-size) * -1);
  background: var(--hbmcs-cursor-color);
}

.hbmcs-cursor-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #000;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hbmcs-cursor-ring.has-text .hbmcs-cursor-text {
  opacity: 1;
}

/* ─── Preloader ──────────────────────────────────────────────────────── */

.hbmcs-preloader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hbmcs-preloader-bg);
  color: var(--hbmcs-preloader-fg);
  font-family: var(--hbmcs-preloader-font);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  letter-spacing: var(--hbmcs-preloader-letter-spacing);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hbmcs-preloader.is-visible {
  opacity: 1;
}

.hbmcs-preloader.is-leaving {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.hbmcs-preloader__text {
  display: inline-block;
}

/* ─── Lenis smooth scroll — required CSS (lenis 1.3 ships a stylesheet ──
 * we don't import; mirrored here so the runtime is self-contained).
 * Without these rules Lenis's JS runs but the browser keeps doing native
 * instant-snap scroll, so the page reads as "no smooth scrolling at all". */

html.lenis,
html.lenis body {
  height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
  overscroll-behavior: contain;
}

/* DELIBERATE DIVERGENCE FROM UPSTREAM LENIS. Upstream sets
   `pointer-events: none` here so the wheel is never captured by an embed.
   On a published customer site that silently makes every embedded video,
   map and player unclickable — embed, map, podcast_embed, video and
   video_hero all render an <iframe>.

   This rule has never actually been live: the BUILT runtime.css was frozen
   at 3594 bytes by a `if [ ! -f ]` guard in build-anim-runtime.sh and
   contained no Lenis block at all. Restoring the stylesheet (which we now
   do) would have shipped this for the first time. These are content sites,
   not scroll-jacked one-pagers, so an embed keeping its pointer events is
   correct; worst case the wheel over an embed scrolls the embed, which is
   ordinary browser behaviour. */
.lenis.lenis-smooth iframe {
  pointer-events: auto;
}

.lenis.lenis-autoToggle {
  transition-property: overflow;
  transition-duration: 1ms;
  transition-behavior: allow-discrete;
}

/* ─── Split-text — Splitting.js produces these classes ───────────────── */

.splitting .char,
.splitting .word,
.splitting .line {
  display: inline-block;
}

/* Reduced motion safety net — even if a preset slips through */

@media (prefers-reduced-motion: reduce) {
  .hbmcs-cursor-dot,
  .hbmcs-cursor-ring,
  .hbmcs-preloader {
    display: none !important;
  }
}
