/* ==========================================================================
   FancyOrb Events -- Animations, Transitions & Responsive Breakpoints
   Motion design for a premium gaming storefront.
   ========================================================================== */


/* ==========================================================================
   Keyframe Definitions
   ========================================================================== */

/* --- Page / Element Entrances --- */

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-down {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Modal Animations --- */

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modal-content-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Cart Sidebar --- */

@keyframes slide-in-right {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes slide-out-right {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

/* --- Notification Toast --- */

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(80px);
    }
}

/* --- Loading / Feedback --- */

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

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    }
    50% {
        box-shadow: 0 4px 24px rgba(34, 197, 94, 0.5);
    }
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Ambient / Decorative --- */

@keyframes ambient-drift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

@keyframes border-glow {
    0%, 100% {
        border-color: rgba(16, 178, 210, 0.2);
        box-shadow: 0 0 12px rgba(16, 178, 210, 0.08);
    }
    50% {
        border-color: rgba(16, 178, 210, 0.4);
        box-shadow: 0 0 24px rgba(16, 178, 210, 0.15);
    }
}

/* --- Card Shine Sweep --- */

@keyframes card-shine {
    0%   { left: -100%; }
    100% { left: 180%; }
}

/* --- Countdown Tick --- */

@keyframes countdown-tick {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}


/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */

/* Page entrance */
.anim-fade-in {
    animation: fade-in 0.4s ease-out forwards;
}

.anim-fade-up {
    animation: fade-up 0.5s var(--ease-out) forwards;
}

.anim-scale-in {
    animation: scale-in 0.35s var(--ease-out) forwards;
}

/* Staggered reveals for grids/lists */
.stagger-fade {
    opacity: 0;
    animation: fade-up 0.45s var(--ease-out) forwards;
}

.stagger-fade:nth-child(1)  { animation-delay: 0.05s; }
.stagger-fade:nth-child(2)  { animation-delay: 0.1s; }
.stagger-fade:nth-child(3)  { animation-delay: 0.15s; }
.stagger-fade:nth-child(4)  { animation-delay: 0.2s; }
.stagger-fade:nth-child(5)  { animation-delay: 0.25s; }
.stagger-fade:nth-child(6)  { animation-delay: 0.3s; }
.stagger-fade:nth-child(7)  { animation-delay: 0.35s; }
.stagger-fade:nth-child(8)  { animation-delay: 0.4s; }
.stagger-fade:nth-child(9)  { animation-delay: 0.45s; }
.stagger-fade:nth-child(10) { animation-delay: 0.5s; }

/* Scroll-triggered reveal (JS adds .visible) */
.scroll-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll reveal with stagger (use data-delay or nth-child) */
.scroll-reveal:nth-child(2) { transition-delay: 0.06s; }
.scroll-reveal:nth-child(3) { transition-delay: 0.12s; }
.scroll-reveal:nth-child(4) { transition-delay: 0.18s; }
.scroll-reveal:nth-child(5) { transition-delay: 0.24s; }
.scroll-reveal:nth-child(6) { transition-delay: 0.30s; }


/* ==========================================================================
   Interactive Hover Effects
   ========================================================================== */

/* Lift on hover */
.hover-lift {
    transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Subtle scale */
.hover-scale {
    transition: transform var(--duration-fast) ease;
}

.hover-scale:hover {
    transform: scale(1.03);
}

.hover-scale:active {
    transform: scale(0.98);
}

/* Border glow on hover */
.hover-glow {
    transition: border-color var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}

.hover-glow:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
}

/* Text color shift */
.hover-accent {
    transition: color var(--duration-fast) ease;
}

.hover-accent:hover {
    color: var(--accent);
}

/* Background highlight */
.hover-bg {
    transition: background var(--duration-fast) ease;
}

.hover-bg:hover {
    background: rgba(16, 178, 210, 0.08);
}

/* Button ripple overlay */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}


/* ==========================================================================
   Component Animation Bindings
   ========================================================================== */

/* Spinner */
.spinner {
    animation: spin 0.8s linear infinite;
}

/* Skeleton shimmer */
.skeleton {
    animation: skeleton-shimmer 1.8s ease infinite;
}

/* Buy Now button pulse when enabled */
.btn-buy-now:not(:disabled) {
    animation: pulse-glow 2.5s ease infinite;
}

/* Modal enter */
.modal.active .modal-content {
    animation: modal-content-in 0.3s var(--ease-out) forwards;
}

.modal.active .modal-overlay {
    animation: modal-backdrop-in 0.25s ease forwards;
}

/* Server selection modal slide */
#server-selection-modal .modal-container {
    animation: modal-slide-up 0.3s var(--ease-out) forwards;
}

/* Toast enter */
.toast.show {
    animation: toast-in 0.3s var(--ease-out) forwards;
}

.toast.hiding {
    animation: toast-out 0.25s ease-in forwards;
}

/* Countdown tick */
.countdown-value.tick {
    animation: countdown-tick 0.3s var(--ease-spring);
}

/* Ambient background gradient shift (applied to body::before via JS toggle) */
.ambient-bg {
    background-size: 200% 200%;
    animation: ambient-drift 20s ease infinite;
}

/* Card hover shine effect -- already handled in main.css via ::after,
   but here we add a keyframe alternative for JS-triggered shine */
.card-shine-trigger::after {
    animation: card-shine 0.6s var(--ease-out) forwards;
}

/* Section border glow (for featured sections) */
.border-glow-pulse {
    animation: border-glow 3s ease infinite;
}

/* Text gradient glow */
.text-gradient {
    animation: glow-pulse 4s ease infinite;
}


/* ==========================================================================
   Loading State Overlay
   ========================================================================== */

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ==========================================================================
   Focus States -- Accessibility
   ========================================================================== */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}


/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ---- 1280px: Large Desktop ---- */
@media (max-width: 1280px) {
    .container {
        max-width: 100%;
    }

    .bundle-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .bundle-pricing {
        align-items: flex-start;
        flex-direction: row;
        gap: var(--space-lg);
    }
}

/* ---- 1024px: Tablet Landscape ---- */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--space-md);
    }

    .grid-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .trust-bar {
        gap: var(--space-lg);
        flex-wrap: wrap;
    }

    .product-details {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .product-details-image {
        max-height: 300px;
    }

    .event-highlights {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-content--full {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- 768px: Tablet Portrait ---- */
@media (max-width: 768px) {
    /* Navigation swap */
    .desktop-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-nav {
        display: block;
    }

    /* Header */
    .header-content {
        padding: var(--space-xs) 0;
        min-height: 56px;
    }

    .logo {
        font-size: var(--text-lg);
    }

    .logo-icon {
        width: 30px;
        height: 30px;
    }

    /* Grid */
    .grid-cols-4,
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: var(--space-md);
    }

    /* Hero */
    .hero-section {
        padding: var(--space-2xl) 0;
    }

    .hero-section--banner {
        min-height: 320px;
    }

    .countdown-bar {
        gap: var(--space-sm);
        padding: var(--space-xs) var(--space-md);
    }

    .countdown-value {
        font-size: var(--text-xl);
    }

    /* Trust bar */
    .trust-bar {
        gap: var(--space-md);
        padding: var(--space-sm) var(--space-md);
    }

    .trust-item {
        font-size: var(--text-xs);
    }

    /* Bundle */
    .bundle-section {
        padding: var(--space-xl) var(--space-lg);
    }

    .bundle-price-current {
        font-size: var(--text-3xl);
    }

    /* Cards */
    .card {
        padding: var(--space-md);
    }

    .product-card {
        min-height: 380px;
    }

    /* Cart */
    .cart-sidebar-content {
        width: 360px;
    }

    /* Modal */
    .modal-content {
        width: calc(100% - var(--space-xl));
    }

    .modal-content-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .modal-left-column {
        order: 2;
    }

    .modal-right-column {
        order: 1;
    }

    /* Event */
    .event-highlights {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .site-footer .footer-content {
        font-size: 0.625rem;
    }

    .footer-left,
    .footer-right {
        display: none;
    }

    .footer-center {
        width: 100%;
    }

    .footer-content--full {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-section {
        text-align: center;
    }

    /* Typography */
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* ---- 480px: Mobile ---- */
@media (max-width: 480px) {
    :root {
        --space-xs: 0.375rem;
        --space-sm: 0.5rem;
        --space-md: 0.75rem;
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
    }

    .container {
        padding: 0 var(--space-sm);
    }

    body {
        font-size: 14px;
    }

    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }
    h3 { font-size: var(--text-lg); }
    h4 { font-size: var(--text-base); }

    /* Grid collapse */
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .grid {
        gap: var(--space-md);
    }

    /* Header */
    .logo {
        font-size: var(--text-base);
    }

    .logo-icon {
        width: 28px;
        height: 28px;
    }

    .user-name {
        display: none;
    }

    /* Buttons */
    .btn {
        padding: var(--space-xs) var(--space-md);
        font-size: var(--text-xs);
    }

    .btn-lg {
        padding: var(--space-sm) var(--space-lg);
        font-size: var(--text-sm);
    }

    /* Product cards */
    .product-card {
        min-height: 340px;
    }

    .product-image-wrapper {
        height: 150px;
    }

    /* Cart */
    .cart-sidebar-content {
        width: 100%;
    }

    .cart-header,
    .cart-items,
    .cart-footer {
        padding: var(--space-md);
    }

    /* Hero */
    .hero-section {
        padding: var(--space-xl) 0;
    }

    .hero-section--banner {
        min-height: 260px;
    }

    .countdown-bar {
        gap: var(--space-xs);
        padding: var(--space-2xs) var(--space-sm);
    }

    .countdown-segment {
        min-width: 40px;
    }

    .countdown-value {
        font-size: var(--text-lg);
    }

    .countdown-label {
        font-size: 0.5625rem;
    }

    /* Trust bar */
    .trust-bar {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-md);
    }

    /* Bundle */
    .bundle-section {
        padding: var(--space-lg);
        border-radius: var(--radius-xl);
    }

    .bundle-badges {
        flex-direction: column;
        align-items: flex-start;
    }

    .bundle-price-current {
        font-size: var(--text-2xl);
    }

    .bundle-pricing {
        flex-direction: column;
    }

    /* Toast */
    .toast-container {
        left: var(--space-sm);
        right: var(--space-sm);
        top: var(--space-sm);
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Modal */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-header,
    .modal-body {
        padding: var(--space-md);
    }

    .modal-footer {
        padding: var(--space-md);
        flex-direction: column;
    }

    /* Event info */
    .event-info {
        padding: var(--space-md);
    }

    /* Content */
    .content {
        padding: var(--space-xl) 0;
    }
}

/* ---- 360px: Small Mobile ---- */
@media (max-width: 360px) {
    h1 {
        font-size: var(--text-xl);
        word-break: break-word;
    }

    .logo-text {
        font-size: var(--text-sm);
    }

    .btn {
        font-size: 0.6875rem;
        letter-spacing: var(--tracking-wide);
    }

    .countdown-bar {
        flex-wrap: wrap;
        justify-content: center;
    }
}


/* ==========================================================================
   Touch Device Adjustments
   ========================================================================== */

@media (hover: none) {
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow-card);
    }

    .product-card:hover .product-image {
        transform: none;
    }

    .product-card::after {
        display: none;
    }

    .hover-lift:hover {
        transform: none;
        box-shadow: none;
    }

    .hover-scale:hover {
        transform: none;
    }

    .navlink-card:hover {
        transform: none;
    }

    .navlink-card:hover .navlink-icon {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .nav-link:hover::after {
        width: 0;
    }
}


/* ==========================================================================
   High Resolution Displays
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}


/* ==========================================================================
   Landscape with limited height
   ========================================================================== */

@media (orientation: landscape) and (max-height: 500px) {
    .site-header {
        position: relative;
    }

    .modal-content {
        max-height: 90vh;
    }

    .hero-section--banner {
        min-height: 220px;
    }

    .content {
        padding: var(--space-lg) 0;
    }
}


/* ==========================================================================
   Reduced Motion (Accessibility)
   ========================================================================== */

@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;
    }

    .scroll-reveal {
        opacity: 1;
        transform: none;
    }

    .product-card::after {
        display: none;
    }

    .skeleton {
        animation: none;
        background: var(--dark-elevated);
    }
}


/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .site-header,
    .site-footer,
    .mobile-nav,
    .cart-sidebar,
    .modal,
    .toast-container,
    .video-background,
    #snow-particles,
    .frost-overlay {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    body::before {
        display: none;
    }

    .container {
        max-width: 100%;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .product-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
