/* ================================
   UX Enhancements Styles
   Micro-interactions and animations
   ================================ */

/* ===== Loading State ===== */
body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.loaded {
    opacity: 1;
}

/* ===== Skip to Content Link ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: var(--accent);
    color: var(--bg-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: var(--space-sm);
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ===== Scroll Indicator ===== */
.scroll-indicator {
    position: absolute;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    opacity: 1;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 10;
}

.scroll-indicator__icon {
    font-size: 1.5rem;
    color: var(--accent);
    animation: bounce 2s infinite;
}

.scroll-indicator__text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ===== Fade-in Animations ===== */
.fade-in-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.cards-grid .fade-in-element {
    transition-delay: calc(var(--index, 0) * 0.1s);
}

.cards-grid .card:nth-child(1) { --index: 0; }
.cards-grid .card:nth-child(2) { --index: 1; }
.cards-grid .card:nth-child(3) { --index: 2; }
.cards-grid .card:nth-child(4) { --index: 3; }
.cards-grid .card:nth-child(5) { --index: 4; }
.cards-grid .card:nth-child(6) { --index: 5; }

/* ===== Enhanced Card Hover ===== */
.card, .video-card {
    position: relative;
    overflow: hidden;
}

.card::before, .video-card::before {
    content: '';
    position: absolute;
    top: var(--mouse-y, 50%);
    left: var(--mouse-x, 50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(10, 132, 255, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 0;
}

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

.card > *, .video-card > * {
    position: relative;
    z-index: 1;
}

/* ===== Planet Glow Effect ===== */
/* Moved to orbital-mechanics.css for three-body system */

/* ===== Quantum Pulse Animation ===== */
@keyframes quantum-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ===== Button Press Effect ===== */
.btn {
    position: relative;
    will-change: transform;
    transition: transform 0.1s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.btn:active {
    transform: scale(0.95);
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: 8px;
    border: 1px solid var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 500;
    min-width: 250px;
    text-align: center;
}

.toast--visible {
    bottom: var(--space-lg);
}

/* ===== Enhanced Focus States ===== */
a:focus-visible,
button:focus-visible,
.planet:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

/* ===== Smooth Transitions ===== */
.card,
.timeline-item,
.planet,
.btn,
a {
    will-change: transform;
}

/* ===== Parallax Container ===== */
.stars {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* ===== Video Loading Skeleton ===== */
.video-embed {
    background: linear-gradient(
        90deg,
        var(--bg-surface) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--bg-surface) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.video-embed iframe {
    z-index: 1;
}

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

/* ===== Animated Counters ===== */
[data-count] {
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

[data-count].counted {
    color: var(--accent);
}

/* ===== Link Hover Underline ===== */
a {
    position: relative;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* Override for buttons and planets */
.btn::after,
.planet::after {
    display: none;
}

/* Reset planet after pseudo-element for glow effect */
.planet::after {
    display: block;
    content: '';
    bottom: auto;
    left: auto;
    width: auto;
    height: auto;
}

/* ===== Mobile Optimizations ===== */
@media (max-width: 768px) {
    .scroll-indicator {
        bottom: var(--space-lg);
    }
    
    .scroll-indicator__text {
        font-size: 0.75rem;
    }
    
    /* Disable parallax on mobile for performance */
    .stars {
        transform: none !important;
    }
    
    /* Simpler card hover on mobile */
    .card::before,
    .video-card::before {
        display: none;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .fade-in-element,
    .scroll-indicator__icon,
    .video-embed,
    * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-indicator__icon {
        animation: none;
    }
}

/* ===== High Contrast Mode ===== */
@media (prefers-contrast: high) {
    .card,
    .timeline-item,
    .planet {
        border-width: 2px;
    }
    
    .btn {
        border-width: 3px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .scroll-indicator,
    .toast,
    .skip-link,
    .stars {
        display: none !important;
    }
    
    .fade-in-element {
        opacity: 1 !important;
        transform: none !important;
    }
}

