/* Shared animation helpers used across the site. Section-specific motion lives in each section template. */

/* ---- Reveal on scroll ----
   A section with [data-reveal] gets .js-anim from animations.js, then .is-visible once it is on screen.
   Mark children with .rv (optionally .rv-left / .rv-right / .rv-zoom) and set --i for a stagger. */
@media (prefers-reduced-motion: no-preference) {
  .js-anim .rv {
    opacity: 0;
    transform: translate3d(var(--rv-x, 0), var(--rv-y, 28px), 0) scale(var(--rv-s, 1));
    transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
    transition-delay: calc(var(--rv-delay, 0s) + var(--i, 0) * var(--rv-step, .12s));
  }
  .js-anim .rv-left  { --rv-x: -48px; --rv-y: 0px; }
  .js-anim .rv-right { --rv-x: 48px;  --rv-y: 0px; }
  .js-anim .rv-zoom  { --rv-y: 16px;  --rv-s: .92; }
  .is-visible .rv { opacity: 1; transform: none; }
}

/* ---- Spotlight: a soft glow that follows the pointer inside a card ---- */
.spotlight { position: relative; isolation: isolate; }
.spotlight::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), rgba(30, 136, 229, .12), transparent 70%);
  opacity: 0; transition: opacity .35s ease;
}
.spotlight:hover::after { opacity: 1; }

/* ---- Button shine sweep on hover ---- */
.btn-shine { position: relative; overflow: hidden; isolation: isolate; }
.btn-shine::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg); pointer-events: none;
  transition: left .75s ease;
}
.btn-shine:hover::after { left: 130%; }

/* ---- Scroll progress bar ---- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 3px;
  background: linear-gradient(90deg, #1565c0, #1e88e5, #29b6f6);
  transform: scaleX(var(--progress, 0)); transform-origin: left;
  pointer-events: none;
}

/* ---- Back to top button with a progress ring ---- */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  width: 48px; height: 48px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(135deg, #1e88e5, #0d2c6e);
  box-shadow: 0 12px 26px -10px rgba(21, 101, 192, .75);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, box-shadow .3s ease;
}
.to-top.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.to-top.is-shown:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -10px rgba(21, 101, 192, .9); }
.to-top:focus-visible { outline: 2px solid #29b6f6; outline-offset: 3px; }
.to-top i { transition: transform .3s ease; }
.to-top:hover i { transform: translateY(-2px); }
.to-top-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top-ring circle { fill: none; stroke-width: 2.5; }
.to-top-ring .ring-track { stroke: rgba(255, 255, 255, .18); }
.to-top-ring .ring-fill {
  stroke: #fff; stroke-linecap: round;
  stroke-dasharray: 141.37;
  stroke-dashoffset: calc(141.37 * (1 - var(--progress, 0)));
}

/* ---- Footer ---- */
.footer-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, #1e88e5, #29b6f6, #1e88e5, transparent);
  background-size: 200% 100%;
}
.footer-link { display: inline-flex; align-items: center; transition: color .25s ease; }
.footer-link::before {
  content: ''; display: inline-block; width: 0; height: 1px; margin-right: 0;
  background: #29b6f6; transition: width .25s ease, margin-right .25s ease;
}
.footer-link:hover { color: #fff; }
.footer-link:hover::before { width: 10px; margin-right: 6px; }
.social-btn { transition: transform .25s ease, box-shadow .25s ease, filter .25s ease; }
.social-btn:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 18px -6px rgba(0, 0, 0, .55); filter: brightness(1.1); }

@media (prefers-reduced-motion: no-preference) {
  .footer-line { animation: footer-line 6s linear infinite; }
}
@keyframes footer-line { from { background-position: 200% 0; } to { background-position: 0 0; } }
