/* =========================================================
   KUSO - animations.css
   ---------------------------------------------------------
   All premium animation utilities live in this one file.
   Load AFTER main.css so overrides win.
   Every utility is a single class that can be added to any
   element - no wiring needed unless noted.
   ---------------------------------------------------------
   Contents:
     1.  Motion tokens (durations / easings)
     2.  Motion-reduce guard (respect user preference)
     3.  Rich preloader (logo + progress bar)
     4.  Page-in animation
     5.  Extra scroll-reveal variants (blur, slide, rotate)
     6.  Image reveal (clip-path curtain)
     7.  Ken-burns slow zoom on hero background
     8.  Split-word entrance for headings
     9.  Navigation polish (hide on scroll down, mobile slide)
     10. Magnetic + ripple buttons
     11. Card cursor spotlight
     12. Section fade-in cascade
     13. Back-to-top progress ring
     14. Lightbox zoom transition
     15. Gallery entrance stagger
   ========================================================= */

/* ---------- 1. Motion tokens ---------- */
:root {
  --motion-fast: .28s;
  --motion:      .5s;
  --motion-slow: .9s;
  --ease-smooth: cubic-bezier(.22,.61,.36,1);
  --ease-swift:  cubic-bezier(.16,1,.3,1);
  --ease-back:   cubic-bezier(.34,1.56,.64,1);
}

/* ---------- 2. Respect prefers-reduced-motion ----------
   If the visitor has "reduce motion" turned on in their OS,
   we quietly disable all fancy timing and just show content. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-left, .reveal-right, .reveal-zoom,
  .reveal-blur, .reveal-slide, .reveal-rotate, .img-reveal img {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    filter: none !important;
  }
}

/* ---------- 3. Rich preloader ---------- */
/* Replace the plain spinner with logo + progress bar. */
#preloader {
  flex-direction: column;
  gap: 22px;
  background:
    radial-gradient(circle at 30% 30%, #eafcf6, #ffffff 60%);
}
#preloader .loader { display: none; }
#preloader::before {
  content: "";
  width: 88px; height: 88px;
  border-radius: 22px;
  background:
    url("../img/kuso_logo.png") center/70% no-repeat,
    linear-gradient(135deg, #ffffff, #eafcf6);
  box-shadow:
    0 20px 40px rgba(27,172,145,.25),
    inset 0 0 0 1px rgba(27,172,145,.15);
  animation: pl-pop .7s var(--ease-back) both, pl-float 2.5s ease-in-out 1s infinite;
}
#preloader::after {
  content: "";
  width: 180px; height: 4px;
  border-radius: 999px;
  background: rgba(27,172,145,.15);
  overflow: hidden;
  position: relative;
}
#preloader .pl-fill {
  position: absolute;
  left: calc(50% - 90px);
  bottom: calc(50% - 43px);
  width: 180px; height: 4px;
  border-radius: 999px;
  pointer-events: none;
}
#preloader .pl-fill::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--brand), var(--brand-3), transparent);
  transform: translateX(-100%);
  animation: pl-slide 1.4s linear infinite;
}
@keyframes pl-pop   { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pl-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pl-slide { to { transform: translateX(100%); } }

/* ---------- 4. Page-in ---------- */
/* Body content fades and slides up once preloader is gone. */
body { opacity: 0; transform: translateY(6px); transition: opacity .6s var(--ease-smooth), transform .6s var(--ease-smooth); }
body.page-in { opacity: 1; transform: none; }

/* ---------- 5. Extra scroll-reveal variants ---------- */
.reveal-blur   { opacity: 0; filter: blur(14px); transform: translateY(20px); transition: all var(--motion-slow) var(--ease-smooth); }
.reveal-slide  { opacity: 0; transform: translateY(50px); transition: all .8s var(--ease-swift); }
.reveal-rotate { opacity: 0; transform: rotate(-4deg) translateY(30px); transition: all .8s var(--ease-back); }
.reveal-blur.in, .reveal-slide.in, .reveal-rotate.in {
  opacity: 1; filter: none; transform: none;
}

/* ---------- 6. Image reveal (curtain wipe) ---------- */
/* Wrap any <img> in <span class="img-reveal">...</span>.
   The image fades + un-clips from left to right when in view. */
.img-reveal {
  display: block;
  overflow: hidden;
  border-radius: inherit;
  position: relative;
}
.img-reveal img {
  clip-path: inset(0 100% 0 0);
  transform: scale(1.1);
  transition: clip-path 1.1s var(--ease-swift), transform 1.4s var(--ease-swift);
}
.img-reveal.in img {
  clip-path: inset(0 0 0 0);
  transform: scale(1);
}
/* Overlay wipe */
.img-reveal::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--brand-3) 50%, transparent 100%);
  transform: translateX(-101%);
  transition: transform 1s var(--ease-swift);
  pointer-events: none;
}
.img-reveal.in::after { transform: translateX(101%); }

/* ---------- 7. Ken-burns hero background ---------- */
.hero::before, .hero::after { animation-duration: 22s; }
.hero-content .hand-img,
.hero .hand-img              { animation: floaty 3.5s ease-in-out infinite; }
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  50%     { transform: translateY(-12px) rotate(2deg); }
}
/* Mobile motto: relax letter-spacing so it doesn't clip */
@media (max-width: 576px) {
  .hero .motto {
    letter-spacing: 3px;
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  .hero h1 { padding: 0 4px; }
  .hero .meta-row { gap: 14px; }
}

/* ---------- 8. Split-word heading entrance ---------- */
/* Wrap words in <span class="word">Word</span> and add
   .split-in to the parent. JS is not required - CSS handles it. */
.split-in .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px) rotate(2deg);
  animation: word-in .7s var(--ease-back) forwards;
}
.split-in .word:nth-child(1) { animation-delay: .10s; }
.split-in .word:nth-child(2) { animation-delay: .18s; }
.split-in .word:nth-child(3) { animation-delay: .26s; }
.split-in .word:nth-child(4) { animation-delay: .34s; }
.split-in .word:nth-child(5) { animation-delay: .42s; }
.split-in .word:nth-child(6) { animation-delay: .50s; }
.split-in .word:nth-child(n+7) { animation-delay: .58s; }
@keyframes word-in { to { opacity: 1; transform: none; } }

/* ---------- 9. Navigation polish ---------- */
/* Header slides up when scrolling down, drops back on scroll up. */
.site-header { transition: transform .35s var(--ease-swift), background var(--tr), box-shadow var(--tr), height var(--tr); }
.site-header.hide { transform: translateY(-110%); }

/* Underline sweep for nav (extend existing look) */
.nav-menu a::before { transition: transform var(--motion-fast) var(--ease-swift); }

/* Mobile menu: slide from right + staggered link entrance */
@media (max-width: 991px) {
  .nav-menu {
    right: 0; left: auto;
    top: var(--header-h);
    width: min(320px, 92vw);
    max-height: none; height: auto;
    transform: translateX(105%);
    transition: transform .4s var(--ease-swift);
    border-radius: 18px 0 0 18px;
  }
  .nav-menu.open { transform: translateX(0); max-height: none; }
  .nav-menu li {
    opacity: 0; transform: translateX(20px);
    transition: opacity .4s var(--ease-swift), transform .4s var(--ease-swift);
  }
  .nav-menu.open li { opacity: 1; transform: none; }
  .nav-menu.open li:nth-child(1) { transition-delay: .05s; }
  .nav-menu.open li:nth-child(2) { transition-delay: .10s; }
  .nav-menu.open li:nth-child(3) { transition-delay: .15s; }
  .nav-menu.open li:nth-child(4) { transition-delay: .20s; }
  .nav-menu.open li:nth-child(5) { transition-delay: .25s; }
  .nav-menu.open li:nth-child(6) { transition-delay: .30s; }
  .nav-menu.open li:nth-child(7) { transition-delay: .35s; }
  .nav-menu.open li:nth-child(8) { transition-delay: .40s; }

  /* Backdrop */
  .nav-backdrop {
    position: fixed; inset: 0;
    background: rgba(11,63,79,.4);
    backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden;
    transition: opacity .3s var(--ease-smooth), visibility .3s;
    z-index: 999;
  }
  .nav-backdrop.show { opacity: 1; visibility: visible; }
  .nav-toggle.open i,
  .nav-toggle.open   { transform: rotate(90deg); transition: transform var(--motion) var(--ease-back); }
}

/* ---------- 10. Button ripple (click effect only) ---------- */
/* No cursor-follow / magnetic anywhere. */
.btn { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  transform: scale(0);
  animation: ripple .7s var(--ease-smooth) forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ---------- 11. Simple text pop on hover ----------
   The single rule the entire site uses for "hover feedback":
   the text (or icon) lifts up by 3 px and gains a hint of color.
   No cursor-follow. No spotlight. No magnetic drag. */
.nav-menu a,
.footer-links a,
.hero .meta,
.contact-card a,
.team-card .info h4,
.event-card h4,
.faq-question,
.tabs-nav button,
.filter-bar button,
.btn,
.brand-text strong {
  transition: transform var(--motion-fast) var(--ease-swift),
              color      var(--motion-fast) var(--ease-swift);
  display: inline-block;
}
/* .person b stays as its own block (name above role) but still animates. */
.person b {
  transition: transform var(--motion-fast) var(--ease-swift),
              color      var(--motion-fast) var(--ease-swift);
}
.nav-menu a:hover,
.footer-links a:hover,
.hero .meta:hover,
.contact-card a:hover,
.team-card:hover .info h4,
.event-card:hover h4,
.person:hover b,
.faq-question:hover,
.tabs-nav button:hover,
.filter-bar button:hover,
.btn:hover,
.brand:hover .brand-text strong {
  transform: translateY(-3px);
}


/* ---------- 12. Section fade-in cascade ---------- */
/* Add `data-cascade` to a section — its first-level children fade in one after another */
[data-cascade] > * { opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease-smooth), transform .8s var(--ease-smooth); }
[data-cascade].in > * { opacity: 1; transform: none; }
[data-cascade].in > *:nth-child(1) { transition-delay: 0s; }
[data-cascade].in > *:nth-child(2) { transition-delay: .08s; }
[data-cascade].in > *:nth-child(3) { transition-delay: .16s; }
[data-cascade].in > *:nth-child(4) { transition-delay: .24s; }
[data-cascade].in > *:nth-child(5) { transition-delay: .32s; }

/* ---------- 13. Back-to-top progress ring ---------- */
/* Replace the flat pill with a circular button + SVG progress ring
   that JS updates via --p (0 to 1). */
.back-to-top {
  background: #ffffff;
  color: var(--brand-2);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.back-to-top:hover { color: #fff; background: var(--brand); }
.back-to-top svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.back-to-top svg circle { fill: none; stroke-width: 3; }
.back-to-top svg .track { stroke: rgba(27,172,145,.15); }
.back-to-top svg .fill  {
  stroke: var(--brand);
  stroke-linecap: round;
  stroke-dasharray: 141.37;                       /* 2 * PI * r (r=22.5) */
  stroke-dashoffset: calc(141.37 * (1 - var(--p, 0)));
  transition: stroke-dashoffset .15s linear;
}
.back-to-top span { position: relative; z-index: 1; }

/* ---------- 14. Lightbox zoom-in ---------- */
.lightbox img { transform: scale(.85); transition: transform .35s var(--ease-back); }
.lightbox.open img { transform: scale(1); }

/* ---------- Public notification banner ----------
   Sits at the very top of the page (above the sticky header).
   Slides down on load, and slides up (removed) when dismissed.
   Non-intrusive: normal document flow, does not overlay content. */
#kuso-notifs {
  position: relative;
  z-index: 1001;
  overflow: hidden;
}
.kuso-notif {
  position: relative;
  background: linear-gradient(90deg, #0e8f76 0%, #128a72 55%, #0b3f4f 100%);
  color: #ffffff;
  padding: 12px 56px 12px 22px;
  font-size: .95rem;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(11,63,79,.18);
  border-bottom: 1px solid rgba(255,255,255,.15);
  transform: translateY(-100%);
  animation: kn-in .55s cubic-bezier(.22,.61,.36,1) .1s forwards;
  transition: max-height .35s cubic-bezier(.4,0,.2,1),
              opacity   .25s ease,
              padding-top .3s ease,
              padding-bottom .3s ease;
}
.kuso-notif::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--brand-3);
}
.kuso-notif .inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}
.kuso-notif .ic {
  width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
  animation: kn-pulse 2.2s ease-in-out infinite;
}
.kuso-notif b { color: #ffffff; margin-right: 6px; }
.kuso-notif a { color: #eafcf6; text-decoration: underline; }
.kuso-notif .close {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  width: 30px; height: 30px;
  background: rgba(255,255,255,.15);
  border: 0; border-radius: 50%;
  color: #ffffff; cursor: pointer;
  font-size: 1.1rem; line-height: 1;
  transition: background .25s ease, transform .25s ease;
}
.kuso-notif .close:hover { background: rgba(255,255,255,.3); transform: translateY(-50%) rotate(90deg); }
.kuso-notif.leaving {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0; padding-bottom: 0;
  border-bottom: 0;
}
@keyframes kn-in { to { transform: translateY(0); } }
@keyframes kn-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,216,182,.5); }
  50%     { box-shadow: 0 0 0 8px rgba(34,216,182,0); }
}

/* Push the fixed header down when a notification is showing */
body.has-notif { padding-top: 0; }  /* the banner sits above header in flow */

/* ---------- 15. Gallery entrance stagger ---------- */
.gallery a {
  opacity: 0; transform: translateY(30px) scale(.98);
  transition: opacity .7s var(--ease-swift), transform .7s var(--ease-swift);
}
.gallery.in a { opacity: 1; transform: none; }
.gallery.in a:nth-child(1)  { transition-delay: .03s; }
.gallery.in a:nth-child(2)  { transition-delay: .06s; }
.gallery.in a:nth-child(3)  { transition-delay: .09s; }
.gallery.in a:nth-child(4)  { transition-delay: .12s; }
.gallery.in a:nth-child(5)  { transition-delay: .15s; }
.gallery.in a:nth-child(6)  { transition-delay: .18s; }
.gallery.in a:nth-child(7)  { transition-delay: .21s; }
.gallery.in a:nth-child(8)  { transition-delay: .24s; }
.gallery.in a:nth-child(9)  { transition-delay: .27s; }
.gallery.in a:nth-child(10) { transition-delay: .30s; }
.gallery.in a:nth-child(11) { transition-delay: .33s; }
.gallery.in a:nth-child(12) { transition-delay: .36s; }
.gallery.in a:nth-child(13) { transition-delay: .39s; }
.gallery.in a:nth-child(14) { transition-delay: .42s; }
.gallery.in a:nth-child(15) { transition-delay: .45s; }
.gallery.in a:nth-child(16) { transition-delay: .48s; }
