/**
 * Ierahkwa Enhanced CSS v1.0
 * Animaciones, print, responsive avanzado, prefers-color-scheme
 * Complementa ierahkwa.css — carga después
 */

/* ═══════════════════════════════════════════════
   CUSTOM PROPERTIES — ANIMACIONES & SOMBRAS
   ═══════════════════════════════════════════════ */
:root {
    /* Easing */
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Durations */
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(0,230,118,0.3);
}

/* ═══════════════════════════════════════════════
   KEYFRAMES — LIBRERÍA DE ANIMACIONES
   ═══════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0,230,118,0.2); }
    50% { box-shadow: 0 0 20px rgba(0,230,118,0.6); }
}

/* Clases de animación */
.animate-fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }
.animate-fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-out); }
.animate-fade-in-down { animation: fadeInDown var(--duration-slow) var(--ease-out); }
.animate-slide-left { animation: slideInLeft var(--duration-slow) var(--ease-out); }
.animate-slide-right { animation: slideInRight var(--duration-slow) var(--ease-out); }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-bounce); }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s var(--ease-in-out) infinite; }
.animate-bounce { animation: bounce 1s var(--ease-in-out) infinite; }
.animate-glow { animation: glow 2s var(--ease-in-out) infinite; }

/* Skeleton loader / Shimmer */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
.skeleton-text { height: 1em; margin: 0.5em 0; }
.skeleton-card { height: 200px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }

/* ═══════════════════════════════════════════════
   PREFERS-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;
    }
    .skeleton { animation: none; background: rgba(255,255,255,0.08); }
    video[autoplay] { display: none; }
}

/* ═══════════════════════════════════════════════
   PREFERS-COLOR-SCHEME — LIGHT MODE
   ═══════════════════════════════════════════════ */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg-primary: #f5f5f5;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --text-primary: #1a1a2e;
        --text-secondary: #444;
        --text-muted: #777;
        --border-color: #e0e0e0;
        --accent: #00c853;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
        --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
        --shadow-lg: 0 10px 15px rgba(0,0,0,0.12);
    }
    :root:not([data-theme="dark"]) body {
        background: var(--bg-primary);
        color: var(--text-primary);
    }
    :root:not([data-theme="dark"]) .card,
    :root:not([data-theme="dark"]) .nx-card,
    :root:not([data-theme="dark"]) .px-card {
        background: var(--bg-card);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE AVANZADO
   ═══════════════════════════════════════════════ */

/* Clamp typography */
h1 { font-size: clamp(1.5rem, 4vw, 3rem); }
h2 { font-size: clamp(1.25rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1rem, 2.5vw, 1.75rem); }

/* Small phones (iPhone SE, 5) */
@media (max-width: 320px) {
    .hero h1 { font-size: 1.3rem; }
    .grid, .nx-grid, .px-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .stats-grid { flex-direction: column; }
    .badge { font-size: 0.65rem; padding: 2px 6px; }
}

/* Large desktop */
@media (min-width: 1440px) {
    .container { max-width: 1400px; }
    .nx-grid { grid-template-columns: repeat(5, 1fr); }
    .px-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Ultra-wide */
@media (min-width: 2560px) {
    .container { max-width: 2000px; }
    .nx-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Hover only on devices that support it */
@media (hover: hover) {
    .card:hover, .nx-card:hover, .px-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        transition: all var(--duration-normal) var(--ease-out);
    }
}

/* Touch devices — larger tap targets */
@media (pointer: coarse) {
    .card, .nx-card, .px-card, button, a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ═══════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════ */
@media print {
    * { color: #000 !important; background: #fff !important; box-shadow: none !important; text-shadow: none !important; }
    body { font-size: 12pt; line-height: 1.5; }
    nav, footer, .hero-video, .particles-canvas, button, .badge, .ai-panel,
    .back-btn, #intro-overlay, .install-prompt, .offline-indicator { display: none !important; }
    a { text-decoration: underline; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
    a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }
    h1, h2, h3 { page-break-after: avoid; }
    .card, .nx-card, .px-card { break-inside: avoid; border: 1px solid #ccc; margin: 8px 0; padding: 12px; }
    .grid, .nx-grid, .px-grid { display: block; }
    img { max-width: 100% !important; }
    @page { margin: 2cm; }
    @page :first { margin-top: 3cm; }
}

/* ═══════════════════════════════════════════════
   ACCESSIBILITY EXTRAS
   ═══════════════════════════════════════════════ */

/* Skip to content */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent, #00e676);
    color: #000;
    padding: 8px 16px;
    z-index: 10000;
    font-weight: bold;
    transition: top var(--duration-fast);
}
.skip-to-content:focus { top: 0; }

/* Focus visible */
:focus-visible {
    outline: 3px solid var(--accent, #00e676);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* High contrast mode */
@media (forced-colors: active) {
    .card, .nx-card, .px-card { border: 2px solid CanvasText; }
    .badge { border: 1px solid CanvasText; }
}
