/* ================================================================
   MAGICUI — vanilla port (no build step)
   Faithful ports of components from github.com/magicuidesign/magicui
   (border-beam, shimmer-button, animated-shiny-text, magic-card,
   meteors, marquee, ripple, dot-pattern), re-toned to the Keturah
   gold / bronze / jasmine / ink palette. Original library is
   React + Tailwind + Motion; this file reproduces the same visual
   behaviour with plain CSS custom properties + keyframes.
   ================================================================ */

:root {
  --mgc-accent:      #c79546;   /* v1 gold  */
  --mgc-accent-soft: rgba(199, 149, 70, 0.16);
  --mgc-hi:          #f8f3e7;   /* jasmine highlight */
  --mgc-ink:         #15110b;
}
body.ks-body {
  --mgc-accent:      #c19258;   /* v2 bronze */
  --mgc-accent-soft: rgba(193, 146, 88, 0.16);
  --mgc-hi:          #f6efdd;
  --mgc-ink:         #0a0805;
}

/* ----------------------------------------------------------------
   1 · BORDER BEAM — a light particle orbiting an element's border.
   Usage: add data-beam to a positioned, rounded container.
   magicui.js injects <span class="mgc-beam-layer"><span class="mgc-beam">.
   ---------------------------------------------------------------- */
@supports (offset-path: rect(0 auto auto 0)) {
  .mgc-beam-layer {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 50;
    /* keep only the 1.5px border ring visible */
    padding: 1.5px;
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    mask-composite: exclude;
  }
  .mgc-beam {
    position: absolute;
    aspect-ratio: 1;
    width: var(--mgc-beam-size, 70px);
    background: linear-gradient(to left, var(--mgc-accent), var(--mgc-hi), transparent);
    offset-path: rect(0 auto auto 0 round var(--mgc-beam-size, 70px));
    offset-distance: 0%;
    animation: mgc-beam-travel var(--mgc-beam-duration, 8s) linear infinite;
  }
  @keyframes mgc-beam-travel {
    to { offset-distance: 100%; }
  }
}

/* ----------------------------------------------------------------
   2 · SHIMMER BUTTON — conic spark rotating behind the button rim.
   Usage: add .mgc-shimmer-btn + set --mgc-btn-bg / --mgc-btn-bg-hover.
   ---------------------------------------------------------------- */
.mgc-shimmer-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: transparent !important;
  transform: translateZ(0);
}
.mgc-shimmer-btn::before {
  content: '';
  position: absolute;
  inset: -100%;
  z-index: -2;
  background: conic-gradient(
    from calc(270deg - 45deg),
    transparent 0deg,
    var(--mgc-hi) 90deg,
    transparent 90deg
  );
  animation: mgc-spin var(--mgc-shimmer-speed, 3s) linear infinite;
  filter: blur(2px);
}
.mgc-shimmer-btn::after {
  content: '';
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: inherit;
  background: var(--mgc-btn-bg, var(--mgc-accent));
  transition: background .25s ease;
  box-shadow: inset 0 -8px 10px rgba(255, 255, 255, 0.12);
}
.mgc-shimmer-btn:hover::after {
  background: var(--mgc-btn-bg-hover, var(--mgc-hi));
  box-shadow: inset 0 -6px 10px rgba(255, 255, 255, 0.25);
}
@keyframes mgc-spin {
  to { transform: rotate(1turn); }
}

/* ----------------------------------------------------------------
   3 · ANIMATED SHINY TEXT — a bright band sweeping through text.
   ---------------------------------------------------------------- */
.mgc-shiny {
  background: linear-gradient(
    120deg,
    var(--mgc-shiny-base, var(--mgc-accent)) 42%,
    var(--mgc-shiny-hi, var(--mgc-hi)) 50%,
    var(--mgc-shiny-base, var(--mgc-accent)) 58%
  );
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  animation: mgc-shine 4.5s cubic-bezier(0.6, 0.6, 0, 1) infinite;
}
@keyframes mgc-shine {
  0%   { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

/* ----------------------------------------------------------------
   4 · MAGIC CARD — pointer-following radial glow over cards.
   magicui.js updates --mx / --my on pointermove.
   ---------------------------------------------------------------- */
.mgc-card { position: relative; }
.mgc-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    var(--mgc-accent-soft),
    transparent 68%
  );
}
.mgc-card:hover::after { opacity: 1; }

/* ----------------------------------------------------------------
   5 · METEORS — diagonal light streaks (for dark heroes).
   Usage: data-meteors="18" on an overflowing positioned stage.
   ---------------------------------------------------------------- */
.mgc-meteor {
  position: absolute;
  top: -5%;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: var(--mgc-hi);
  box-shadow: 0 0 0 1px rgba(246, 239, 221, 0.08);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: mgc-meteor var(--mgc-meteor-duration, 6s) linear infinite;
  animation-delay: var(--mgc-meteor-delay, 0s);
}
.mgc-meteor::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, rgba(246, 239, 221, 0.65), transparent);
}
@keyframes mgc-meteor {
  0%   { transform: rotate(var(--mgc-meteor-angle, -215deg)) translateX(0);      opacity: 0; }
  6%   { opacity: 0.9; }
  70%  { opacity: 0.9; }
  100% { transform: rotate(var(--mgc-meteor-angle, -215deg)) translateX(-560px); opacity: 0; }
}

/* ----------------------------------------------------------------
   6 · MARQUEE — infinite gliding strip, pauses on hover.
   Usage: .mgc-marquee[data-marquee] > .mgc-marquee-track > items.
   magicui.js duplicates the track content once for the loop.
   ---------------------------------------------------------------- */
.mgc-marquee {
  overflow: hidden;
  display: flex;
  --gap: 14px;
  --duration: 42s;
}
.mgc-marquee-track {
  display: flex;
  align-items: center;
  gap: var(--gap);
  width: max-content;
  padding: 18px 0;
  animation: mgc-marquee var(--duration) linear infinite;
  will-change: transform;
}
.mgc-marquee:hover .mgc-marquee-track { animation-play-state: paused; }
.mgc-marquee-track img {
  height: 170px;
  width: auto;
  border-radius: 8px;
  display: block;
  box-shadow: 0 16px 32px -18px rgba(0, 0, 0, 0.45);
  transition: transform .35s cubic-bezier(.6, .05, .3, 1), filter .3s ease;
  filter: saturate(0.96);
}
.mgc-marquee-track img:hover {
  transform: translateY(-4px) scale(1.02);
  filter: saturate(1.05);
}
@keyframes mgc-marquee {
  to { transform: translateX(calc(-50% - var(--gap) / 2)); }
}
@media (max-width: 720px) {
  .mgc-marquee-track img { height: 120px; }
}

/* ----------------------------------------------------------------
   7 · RIPPLE — concentric pulse rings (e.g. behind the v2 tower node).
   magicui.js injects .mgc-ripple with three rings into [data-ripple].
   ---------------------------------------------------------------- */
.mgc-ripple {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: -1;
}
.mgc-ripple i {
  position: absolute;
  top: 0;
  left: 0;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%) scale(0.5);
  border: 1px solid var(--mgc-accent);
  border-radius: 50%;
  opacity: 0;
  animation: mgc-ripple 3.2s cubic-bezier(0.2, 0.5, 0.4, 1) infinite;
}
.mgc-ripple i:nth-child(2) { animation-delay: 1.05s; }
.mgc-ripple i:nth-child(3) { animation-delay: 2.1s; }
@keyframes mgc-ripple {
  0%   { transform: translate(-50%, -50%) scale(0.45); opacity: 0.85; }
  100% { transform: translate(-50%, -50%) scale(2.1);  opacity: 0; }
}

/* ----------------------------------------------------------------
   8 · DOT PATTERN — quiet dotted paper texture for section grounds.
   ---------------------------------------------------------------- */
.mgc-dots {
  background-image: radial-gradient(var(--mgc-dots-color, rgba(199, 149, 70, 0.16)) 1px, transparent 1px);
  background-size: 22px 22px;
}
.section.dark.mgc-dots,
.ks-section.mgc-dots {
  --mgc-dots-color: rgba(193, 146, 88, 0.10);
}

/* ----------------------------------------------------------------
   Reduced motion — every MagicUI animation stands down.
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .mgc-beam,
  .mgc-shimmer-btn::before,
  .mgc-shiny,
  .mgc-meteor,
  .mgc-marquee-track,
  .mgc-ripple i {
    animation: none !important;
  }
  .mgc-shiny {
    background: none;
    color: inherit !important;
    -webkit-background-clip: border-box;
    background-clip: border-box;
  }
  .mgc-meteor { display: none; }
}
