/* ============================================================
   SJFL shared styles: animations & interactive touches
   Loaded on every page after the Tailwind CDN.
   Respects prefers-reduced-motion throughout.
   ============================================================ */

body { font-family: 'Inter', sans-serif; }

/* ---------- Shared hero overlay (used by index / rules / safeguarding) ---------- */
.hero-overlay { background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.7)); }

/* ---------- Mobile menu dropdown ---------- */
#mobile-menu { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
#mobile-menu.open { max-height: 520px; }

/* ---------- Accordion (details/summary) polish ---------- */
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary ~ * { animation: sjfl-sweep 0.3s ease-in-out; }
@keyframes sjfl-sweep { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Rotate any chevron-down icon inside an open accordion header */
details > summary i.fa-chevron-down { transition: transform 0.25s ease; display: inline-block; }
details[open] > summary i.fa-chevron-down { transform: rotate(180deg); }

/* ---------- Reveal on scroll (driven by sjfl.js) ---------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: opacity, transform;
}
[data-reveal="left"] { transform: translateX(-34px); }
[data-reveal="right"] { transform: translateX(34px); }
[data-reveal].revealed { opacity: 1; transform: none; }

/* ---------- Ken Burns hero zoom ---------- */
@keyframes sjfl-kenburns {
    from { transform: scale(1.12) translateY(-1%); }
    to   { transform: scale(1.02) translateY(0); }
}
.sjfl-kenburns { animation: sjfl-kenburns 16s ease-out forwards; will-change: transform; }

/* ---------- Ticker marquee (duplicate the track content twice for a seamless loop) ---------- */
@keyframes sjfl-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.sjfl-ticker-track { display: flex; width: max-content; animation: sjfl-ticker 34s linear infinite; }
.sjfl-ticker:hover .sjfl-ticker-track,
.sjfl-ticker:focus-within .sjfl-ticker-track { animation-play-state: paused; }

/* ---------- Card hover lift ---------- */
.sjfl-lift { transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.3s ease; }
.sjfl-lift:hover { transform: translateY(-4px); }

/* ---------- Header scroll state (driven by sjfl.js) ---------- */
header.sjfl-header.scrolled { box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.35); }

/* ---------- Back to top button (injected by sjfl.js) ---------- */
#sjfl-back-to-top {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 60;
    width: 3rem; height: 3rem; border-radius: 9999px;
    background: #111827; color: #fff; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
    opacity: 0; transform: translateY(16px) scale(0.9); pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease, color 0.2s ease;
}
#sjfl-back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
#sjfl-back-to-top:hover { background: #E6B800; color: #111827; }

/* ---------- Confetti (pieces created by sjfl.js) ---------- */
@keyframes sjfl-confetti-fall {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(var(--sx, 0px), var(--sy, 45vh), 0) rotate(720deg); opacity: 0; }
}
.sjfl-confetti-piece { position: fixed; z-index: 9999; pointer-events: none; animation: sjfl-confetti-fall linear forwards; }

/* ---------- Lightbox fade-in ---------- */
@keyframes sjfl-fade-in { from { opacity: 0; } to { opacity: 1; } }
.sjfl-fade-in { animation: sjfl-fade-in 0.25s ease-out both; }

/* ---------- Gentle float (hero decorations) ---------- */
@keyframes sjfl-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.sjfl-float { animation: sjfl-float 3.2s ease-in-out infinite; }

/* ---------- Soft bounce (scroll cue) ---------- */
@keyframes sjfl-bounce-soft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.sjfl-scroll-cue { animation: sjfl-bounce-soft 2s ease-in-out infinite; }

/* ---------- Shake (quiz wrong answer) ---------- */
@keyframes sjfl-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.sjfl-shake { animation: sjfl-shake 0.35s ease-in-out; }

/* ---------- Reduced motion: everything stays visible & calm ---------- */
@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
    .sjfl-kenburns,
    .sjfl-ticker-track,
    .sjfl-float,
    .sjfl-scroll-cue,
    .sjfl-confetti-piece { animation: none !important; }
    .sjfl-lift, .sjfl-lift:hover { transform: none; transition: none; }
    details > summary i.fa-chevron-down { transition: none; }
}
