/* Ashta Project — Fun Kit Styles (fun.css)
   Precision instrument + friendly lab aesthetic.
   Tokens: --bg, --panel, --gold, --gold-light, --gold-deep, --cream, --hair */

/* ── 1. Hero Ring & Parallax ── */
.fun-ring-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + var(--fun-ring-x, 0px)), calc(-50% + var(--fun-ring-y, 0px)));
  width: 280px;
  height: 280px;
  pointer-events: none;
  z-index: 0;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.fun-ring-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fun-ring-rotator {
  transform-origin: 150px 150px;
  animation: fun-ring-spin 120s linear infinite;
  animation-delay: 1.5s;
}

@keyframes fun-ring-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.fun-ring-line {
  stroke-dasharray: 792;
  stroke-dashoffset: 792;
  animation: fun-line-draw 0.85s cubic-bezier(0.4, 0, 0.2, 1) 0.62s forwards;
}

@keyframes fun-line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.fun-dot {
  opacity: 0;
  transform: scale(0);
  animation: fun-dot-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fun-dot-pop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  70% {
    opacity: 1;
    transform: scale(1.25);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

section.hero::before {
  transform: translate(calc(-50% + var(--fun-mandala-x, 0px)), calc(-50% + var(--fun-mandala-y, 0px))) !important;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (max-width: 768px) {
  .fun-ring-wrap {
    width: 200px;
    height: 200px;
  }
}

/* ── 2. Gold Glint on .btn-primary ── */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 45%,
    rgba(230, 197, 140, 0.6) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg) translateX(-250%);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.btn-primary:hover::after,
.btn-primary:focus-visible::after {
  animation: fun-glint-sweep 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fun-glint-sweep {
  0% {
    transform: rotate(25deg) translateX(-250%);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: rotate(25deg) translateX(450%);
    opacity: 0;
  }
}

.hero .btn-primary::after {
  animation: fun-glint-idle 6s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.hero .btn-primary:hover::after,
.hero .btn-primary:focus-visible::after {
  animation: fun-glint-sweep 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fun-glint-idle {
  0% {
    transform: rotate(25deg) translateX(-250%);
    opacity: 0;
  }
  2% {
    opacity: 1;
  }
  12% {
    transform: rotate(25deg) translateX(450%);
    opacity: 0;
  }
  100% {
    transform: rotate(25deg) translateX(450%);
    opacity: 0;
  }
}

/* ── 3. Magnetic Buttons ── */
html.fun-on .btn {
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1),
              box-shadow 0.2s cubic-bezier(0.23, 1, 0.32, 1),
              background-color 0.2s ease,
              color 0.2s ease;
  will-change: transform;
}

/* ── 4. Card Spotlight & Tilt ── */
.card {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    380px circle at var(--fun-mx, var(--mx, -999px)) var(--fun-my, var(--my, -999px)),
    rgba(199, 137, 62, 0.12),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.card:hover::before {
  opacity: 1;
}

.card > * {
  position: relative;
  z-index: 2;
}

/* ── 5. Section Headings (Underline & Word Rise) ── */
section h2 {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
}

html.fun-on section h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--gold, #C7893E);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}

html.fun-on section.is-visible h2::after,
html.fun-on section h2.fun-visible::after {
  transform: scaleX(1);
}

html.fun-on section h2 .fun-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  transition-delay: calc(var(--fun-w-i, 0) * 40ms);
  will-change: transform, opacity;
}

html.fun-on section.is-visible h2 .fun-word,
html.fun-on section h2.fun-visible .fun-word {
  opacity: 1;
  transform: translateY(0);
}

/* ── 6. Scroll Progress Bar ── */
.fun-scroll-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gold, #C7893E);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 1000;
  pointer-events: none;
  will-change: transform;
}

/* ── Touch / Coarse Pointer: Disable Tilt, Magnet & Parallax ── */
@media (pointer: coarse) {
  .fun-ring-wrap {
    transform: translate(-50%, -50%) !important;
  }
  section.hero::before {
    transform: translate(-50%, -50%) !important;
  }
  html.fun-on .btn {
    transform: none !important;
  }
  .card {
    transform: none !important;
  }
  .card::before {
    display: none !important;
  }
}

/* ── Reduced Motion: Inert State (Progress Bar Allowed) ── */
@media (prefers-reduced-motion: reduce) {
  .fun-ring-wrap {
    transform: translate(-50%, -50%) !important;
    transition: none !important;
  }
  .fun-ring-rotator {
    animation: none !important;
    transform: none !important;
  }
  .fun-ring-line {
    animation: none !important;
    stroke-dashoffset: 0 !important;
  }
  .fun-dot {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  section.hero::before {
    transform: translate(-50%, -50%) !important;
    transition: none !important;
  }
  .btn-primary::after,
  .hero .btn-primary::after {
    animation: none !important;
    display: none !important;
  }
  html.fun-on .btn {
    transform: none !important;
    transition: none !important;
  }
  .card {
    transform: none !important;
    transition: none !important;
  }
  .card::before {
    display: none !important;
  }
  html.fun-on section h2::after {
    transform: scaleX(1) !important;
    transition: none !important;
  }
  html.fun-on section h2 .fun-word {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
