/**
 * Flavor Starter — Cyberpunk Animations & Enhancements
 *
 * Supplements style.css with performant animations, scroll-reveal effects,
 * and cyberpunk-themed UI enhancements.
 *
 * @package Flavor_Starter
 */

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fs-fade-in {
    animation: fadeInUp 0.45s ease-out forwards;
}

/* Pulse */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fs-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spin */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fs-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--fs-color-border-light);
    border-top-color: var(--fs-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Scale In */
@keyframes scaleIn {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.fs-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fs-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

/* Neon Pulse — subtle glow oscillation */
@keyframes neonPulse {
    0%, 100% {
        box-shadow: 0 0 8px var(--fs-color-primary-glow),
                    0 0 24px var(--fs-color-primary-glow);
    }
    50% {
        box-shadow: 0 0 14px var(--fs-color-primary-glow-strong),
                    0 0 40px var(--fs-color-primary-glow);
    }
}

/* Glitch — very subtle, performance-safe text glitch */
@keyframes glitchText {
    0%, 93%, 100% {
        transform: none;
        opacity: 1;
    }
    94% {
        transform: translate(-2px, 1px);
        opacity: 0.85;
    }
    95% {
        transform: translate(1px, -1px);
        opacity: 0.9;
    }
    96% {
        transform: none;
        opacity: 1;
    }
}

.fs-glitch {
    animation: glitchText 4s ease-in-out infinite;
}

/* Gradient sweep for borders */
@keyframes gradientSweep {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* ==========================================================================
   SCROLL REVEAL — Cards animate in on viewport entry
   ========================================================================== */

.fs-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fs-reveal.fs-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered reveal for grid children */
.fs-video-grid .fs-reveal:nth-child(1) { transition-delay: 0ms; }
.fs-video-grid .fs-reveal:nth-child(2) { transition-delay: 60ms; }
.fs-video-grid .fs-reveal:nth-child(3) { transition-delay: 120ms; }
.fs-video-grid .fs-reveal:nth-child(4) { transition-delay: 180ms; }
.fs-video-grid .fs-reveal:nth-child(5) { transition-delay: 240ms; }
.fs-video-grid .fs-reveal:nth-child(6) { transition-delay: 300ms; }
.fs-video-grid .fs-reveal:nth-child(7) { transition-delay: 360ms; }
.fs-video-grid .fs-reveal:nth-child(8) { transition-delay: 420ms; }

.fs-bento-grid .fs-reveal:nth-child(1) { transition-delay: 0ms; }
.fs-bento-grid .fs-reveal:nth-child(2) { transition-delay: 80ms; }
.fs-bento-grid .fs-reveal:nth-child(3) { transition-delay: 160ms; }
.fs-bento-grid .fs-reveal:nth-child(4) { transition-delay: 240ms; }
.fs-bento-grid .fs-reveal:nth-child(5) { transition-delay: 320ms; }

/* ==========================================================================
   VIDEO PLAYER ENHANCEMENTS
   ========================================================================== */

.fs-player__iframe-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.fs-player__iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.fs-player__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--fs-color-bg-medium) 0%, var(--fs-color-bg-dark) 100%);
    color: var(--fs-color-text-muted);
}

.fs-player__placeholder svg {
    width: 72px;
    height: 72px;
    opacity: 0.35;
    fill: var(--fs-color-primary);
}

.fs-player__poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.fs-loading {
    pointer-events: none;
    opacity: 0.7;
}

.fs-footer__load-more.fs-loading {
    opacity: 0.5;
}

.fs-skeleton {
    background: linear-gradient(90deg,
            var(--fs-color-bg-medium) 0%,
            var(--fs-color-bg-light) 40%,
            var(--fs-color-bg-medium) 80%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--fs-card-border-radius);
}

/* ==========================================================================
   SUCCESS STATES
   ========================================================================== */

.fs-success {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border-color: #10b981 !important;
    color: white !important;
}

/* ==========================================================================
   FOCUS STATES (Accessibility)
   ========================================================================== */

.fs-keyboard-user *:focus {
    outline: 2px solid var(--fs-color-primary);
    outline-offset: 2px;
}

.fs-keyboard-user *:focus:not(:focus-visible) {
    outline: none;
}

.fs-video-card--focus {
    outline: 2px solid var(--fs-color-primary);
    outline-offset: 3px;
}

/* ==========================================================================
   MOBILE NAV ENHANCEMENTS
   ========================================================================== */

@media (max-width: 991px) {
    .fs-nav__list--open {
        display: flex !important;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: var(--fs-color-bg-medium);
        border-bottom: 1px solid var(--fs-color-border);
        padding: var(--fs-space-4);
        animation: slideUp 0.25s ease-out;
        z-index: var(--fs-z-dropdown);
        backdrop-filter: blur(12px);
    }

    .fs-header__mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        color: var(--fs-color-text-secondary);
        border: 1px solid var(--fs-color-border);
        border-radius: var(--fs-card-border-radius-sm);
        transition: all var(--fs-transition-fast);
    }

    .fs-header__mobile-toggle:hover,
    .fs-header__mobile-toggle.fs-active {
        color: var(--fs-color-primary);
        border-color: var(--fs-color-primary);
    }
}

/* ==========================================================================
   ENHANCED HOVER EFFECTS
   ========================================================================== */

.fs-video-card--hover .fs-video-card__thumbnail::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(0, 240, 255, 0.05) 100%
    );
    opacity: 0;
    transition: opacity var(--fs-transition-base);
    z-index: 1;
}

.fs-video-card:hover .fs-video-card__thumbnail::before {
    opacity: 1;
}

/* ==========================================================================
   TAG / PILL HOVERS
   ========================================================================== */

.fs-tag--settings {
    background-color: var(--fs-color-bg-medium);
    color: var(--fs-color-text-muted);
}

.fs-tag--settings:hover {
    background-color: var(--fs-color-bg-hover);
    color: var(--fs-color-primary);
}

.fs-tag--settings svg {
    transition: transform var(--fs-transition-base);
}

.fs-tag--settings:hover svg {
    transform: rotate(45deg);
}

/* ==========================================================================
   PAGINATION DOTS
   ========================================================================== */

.fs-pagination__dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    color: var(--fs-color-text-muted);
    font-family: var(--fs-font-family-mono);
}

/* ==========================================================================
   SCROLLBAR — CYBERPUNK
   ========================================================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--fs-color-border-light) var(--fs-color-bg-dark);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--fs-color-bg-dark);
}

::-webkit-scrollbar-thumb {
    background-color: var(--fs-color-border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--fs-color-primary-dark);
}

/* ==========================================================================
   SELECTION
   ========================================================================== */

::selection {
    background-color: var(--fs-color-primary);
    color: var(--fs-color-bg-dark);
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
    .fs-header,
    .fs-nav,
    .fs-footer,
    .fs-sidebar,
    .fs-video-card__play,
    .fs-search,
    .fs-tags,
    .fs-pagination {
        display: none !important;
    }

    body::before {
        display: none !important;
    }

    .fs-main {
        padding: 0;
    }

    .fs-video-grid {
        display: block;
    }

    .fs-video-card {
        break-inside: avoid;
        margin-bottom: 1rem;
        border: 1px solid #ccc;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .fs-video-card__title {
        color: black !important;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .fs-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ==========================================================================
   HIGH CONTRAST
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --fs-color-border: #555577;
        --fs-color-text-secondary: #c0c8e0;
        --fs-color-text-muted: #8899bb;
    }

    .fs-video-card {
        border-width: 2px;
    }

    .fs-tag {
        border-width: 2px;
    }
}