/* ============================================ */
/* ESPACIO FIRST - ESTILOS OPTIMIZADOS */
/* ============================================ */

/* ==================== FUENTES MIGRA ==================== */
@font-face {
    font-family: 'Migra';
    src: url('./fonts/Migra-Regular.woff2') format('woff2'),
         url('./fonts/Migra-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Migra';
    src: url('./fonts/Migra-Extrabold.woff2') format('woff2'),
         url('./fonts/Migra-Extrabold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

.font-display {
    font-family: 'Migra', serif !important;
    font-weight: 700 !important;
}

.font-body {
    font-family: 'Migra', sans-serif !important;
    font-weight: 400 !important;
}

/* ==================== VARIABLES CSS ==================== */
:root {
    --color-primary: #E75A7C;
    --color-secondary: #F98126;
    --gradient-primary: linear-gradient(135deg, #D7266D, #F98126);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== GRADIENTES ==================== */
.gradient-text {
    background: linear-gradient(90deg, #D7266D, #F98126);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 3s ease infinite;
    background-size: 200% auto;
}

/* ==================== KEYFRAMES / ANIMACIONES ==================== */
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes floatHero {
    0%, 100% { transform: translateY(0px) rotate(var(--rotation)) scale(1); }
    50% { transform: translateY(-15px) rotate(var(--rotation)) scale(1.02); }
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.8) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(var(--rotation));
    }
}

@keyframes subtleShadowPulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(215, 38, 109, 0.35); }
    50% { box-shadow: 0 20px 50px rgba(215, 38, 109, 0.45); }
}

@keyframes subtleShadowPulseOrange {
    0%, 100% { box-shadow: 0 10px 30px rgba(249, 129, 38, 0.35); }
    50% { box-shadow: 0 20px 50px rgba(249, 129, 38, 0.45); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== TRANSICIONES GLOBALES ==================== */
html {
    transition: background-color 0.5s, color 0.5s;
}

/* ==================== HERO SECTION ==================== */
.hero-image {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInScale 1s ease-out forwards;
    opacity: 0;
    border-radius: 1rem;
    display: block;
    width: 100%;
    height: auto;
    isolation: isolate;
    background-color: #fff;
}

#hero-images .grid > img:nth-child(1) {
    animation: fadeInScale 1s ease-out forwards 0.1s,
               floatHero 8s ease-in-out infinite 1.1s,
               subtleShadowPulse 5s ease-in-out infinite 1.1s;
}

#hero-images .grid > img:nth-child(2) {
    animation: fadeInScale 1s ease-out forwards 0.3s,
               floatHero 8s ease-in-out infinite 1.3s,
               subtleShadowPulseOrange 5s ease-in-out infinite 1.3s;
}

#hero-images .grid > img:nth-child(3) {
    animation: fadeInScale 1s ease-out forwards 0.5s,
               floatHero 8s ease-in-out infinite 1.5s,
               subtleShadowPulseOrange 5s ease-in-out infinite 1.5s;
}

#hero-images .grid > img:nth-child(4) {
    animation: fadeInScale 1s ease-out forwards 0.7s,
               floatHero 8s ease-in-out infinite 1.7s,
               subtleShadowPulse 5s ease-in-out infinite 1.7s;
}

#hero {
    position: relative;
    overflow: hidden;
}

section[id="hero"], #hero-images {
    position: relative;
}

#hero-images::before {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at 30% 40%, rgba(231, 90, 124, 0.1), transparent 60%);
    z-index: 0;
}

#hero-images img {
    position: relative;
    z-index: 1;
}

/* ==================== NAVEGACIÓN ==================== */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #D7266D, #F98126);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-link:hover::after {
    width: 100%;
}

/* ==================== INSTAGRAM ICONS ==================== */
.instagram-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.instagram-link svg {
    filter: drop-shadow(0 4px 12px rgba(236, 72, 153, 0.5));
    transition: all 0.3s ease;
}

.instagram-link:hover svg {
    filter: drop-shadow(0 6px 20px rgba(236, 72, 153, 0.8))
            drop-shadow(0 0 30px rgba(124, 58, 237, 0.6));
    transform: scale(1.15) rotate(-5deg);
}

.instagram-link::after {
    content: '@espaciofirst';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.8);
    background: linear-gradient(135deg, #7C3AED, #EC4899, #FB923C);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.instagram-link:hover::after {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

@keyframes instagram-pulse {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(236, 72, 153, 0.4)); }
    50% { filter: drop-shadow(0 6px 16px rgba(236, 72, 153, 0.6)); }
}

.instagram-link svg {
    animation: instagram-pulse 3s ease-in-out infinite;
}

/* Instagram en footer */
.instagram-link-footer {
    position: relative;
    display: inline-block;
}

.instagram-link-footer svg {
    filter: drop-shadow(0 4px 12px rgba(236, 72, 153, 0.4));
    transition: all 0.4s ease;
}

.instagram-link-footer:hover svg {
    filter: drop-shadow(0 6px 20px rgba(236, 72, 153, 0.7))
            drop-shadow(0 0 30px rgba(124, 58, 237, 0.5));
    transform: scale(1.25) rotate(-8deg);
}

.instagram-link-footer::after {
    content: 'Síguenos';
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.8);
    background: linear-gradient(135deg, #7C3AED, #EC4899, #FB923C);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.instagram-link-footer:hover::after {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

/* ==================== SERVICIOS ==================== */
.service-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(215, 38, 109, 0.4);
}

.service-card:hover .service-icon {
    transform: scale(1.2) rotate(10deg);
}

.service-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== PORTFOLIO RENOVADO ==================== */

/* Vista de Categorías (Inicial) */
.portfolio-categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .portfolio-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .portfolio-categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.portfolio-category-card {
    position: relative;
    border-radius: 2rem;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/5;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: scaleIn 0.6s ease-out backwards;
}

.dark .portfolio-category-card {
    background: linear-gradient(135deg, #374151, #1f2937);
}

.portfolio-category-card:nth-child(1) { animation-delay: 0.1s; }
.portfolio-category-card:nth-child(2) { animation-delay: 0.2s; }
.portfolio-category-card:nth-child(3) { animation-delay: 0.3s; }

.portfolio-category-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 30px 60px rgba(231, 90, 124, 0.4);
}

.portfolio-category-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.portfolio-category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease;
}

.portfolio-category-card:hover .portfolio-category-image {
    transform: scale(1.15);
}

.portfolio-category-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(215, 38, 109, 0.92),
        rgba(249, 129, 38, 0.92)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.portfolio-category-card:hover .portfolio-category-overlay {
    opacity: 1;
}

.portfolio-category-content {
    text-align: center;
    color: white;
    padding: 2rem;
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-category-card:hover .portfolio-category-content {
    transform: translateY(0);
}

.portfolio-category-content .material-icons {
    animation: pulse-icon 2s ease-in-out infinite;
}

/* Vista de Galería */
.portfolio-gallery-container {
    animation: fadeInUp 0.6s ease-out;
}

.back-button {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 2rem;
    background: white;
    color: #E75A7C;
    border: 2px solid #E75A7C;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dark .back-button {
    background: #374151;
    color: #F98126;
    border-color: #F98126;
}

.back-button:hover {
    background: linear-gradient(135deg, #E75A7C, #F98126);
    color: white;
    border-color: transparent;
    transform: translateX(-5px);
    box-shadow: 0 10px 25px rgba(231, 90, 124, 0.3);
}

.portfolio-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    grid-auto-rows: 350px;
}

@media (min-width: 768px) {
    .portfolio-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 380px;
    }
}

@media (min-width: 1024px) {
    .portfolio-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gallery-item {
    position: relative;
    border-radius: 1.5rem;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out backwards;
    height: 100%;
}

.dark .gallery-item {
    background: linear-gradient(135deg, #374151, #1f2937);
}

.gallery-item:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 25px 50px rgba(231, 90, 124, 0.35);
}

.gallery-item-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease;
    display: block;
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.12);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(231, 90, 124, 0.9),
        rgba(249, 129, 38, 0.9)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-overlay .material-icons {
    color: white;
    font-size: 4rem;
    animation: pulse-icon 2s ease-in-out infinite;
}

/* Animaciones staggered para galería */
.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }

/* Lightbox Modal Mejorado */
.lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease-out;
}

.lightbox-modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-media-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media-container img,
.lightbox-media-container video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 1.5rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
    position: absolute;
    top: -70px;
    right: 0;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(231, 90, 124, 0.8);
    border-color: rgba(231, 90, 124, 1);
    transform: rotate(90deg) scale(1.1);
}

.lightbox-nav {
    position: relative;
}

.lightbox-nav button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev { 
    left: -90px; 
}

.lightbox-next { 
    right: -90px; 
}

.lightbox-nav button:hover {
    background: rgba(231, 90, 124, 0.8);
    border-color: rgba(231, 90, 124, 1);
    transform: translateY(-50%) scale(1.15);
}

.lightbox-nav button:active {
    transform: translateY(-50%) scale(0.95);
}

/* Responsive Lightbox */
@media (max-width: 768px) {
    .lightbox-close {
        top: 20px;
        right: 20px;
    }
    
    .lightbox-nav button {
        display: none;
    }
    
    .lightbox-media-container img,
    .lightbox-media-container video {
        max-height: 70vh;
        border-radius: 1rem;
    }
    
    /* Portfolio responsive */
    .portfolio-categories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .portfolio-gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        grid-auto-rows: 380px; /* Más altura para mostrar imágenes completas */
    }
    
    /* Mostrar imágenes completas en móviles */
    .gallery-item img,
    .gallery-item video {
        object-fit: contain;
        background: linear-gradient(135deg, #1f2937, #374151);
    }
    
    /* Fondo para modo oscuro */
    .dark .gallery-item img,
    .dark .gallery-item video {
        background: linear-gradient(135deg, #111827, #1f2937);
    }
    
    .gallery-item:hover {
        transform: translateY(-6px) scale(1.01);
    }
}

@media (max-width: 640px) {
    .portfolio-gallery-grid {
        grid-auto-rows: 400px; /* Más altura para mostrar imágenes completas */
    }
    
    .back-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
}

/* ==================== ABOUT SECTION ==================== */
#about {
    position: relative;
    overflow: hidden;
}

.about-image-container {
    opacity: 0;
    position: relative;
    transform: translateY(40px) scale(0.95);
}

.about-image-container.animate-in {
    animation: slideInScale 1s ease-out forwards 0.2s;
}

.about-main-image {
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.about-image-container.animate-in .about-main-image {
    animation: floatSlow 6s ease-in-out infinite 1.2s;
}

.about-image-container:hover .about-main-image {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 30px 80px rgba(215, 38, 109, 0.4);
}

.about-content {
    opacity: 0;
    transform: translateX(50px);
}

.about-content.animate-in {
    animation: fadeInRight 1s ease-out forwards 0.4s;
}

.about-text-block {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

.about-text-block.animate-in:nth-child(1) {
    animation: slideInScale 0.8s ease-out forwards 0.6s;
}

.about-text-block.animate-in:nth-child(2) {
    animation: slideInScale 0.8s ease-out forwards 0.8s;
}

.about-text-block.animate-in:nth-child(3) {
    animation: slideInScale 0.8s ease-out forwards 1s;
}

.about-text-block:last-child {
    position: relative;
    overflow: hidden;
}

.about-text-block:last-child::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D7266D, #F98126, transparent);
    animation: shimmer 3s ease-in-out infinite;
}

#about::before {
    content: '';
    position: absolute;
    top: 10%;
    right: 5%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(231, 90, 124, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-slow 6s ease-in-out infinite;
    pointer-events: none;
}

#about::after {
    content: '';
    position: absolute;
    bottom: 15%;
    left: 5%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(249, 129, 38, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-slow 6s ease-in-out infinite;
    animation-delay: 3s;
    pointer-events: none;
}

/* ==================== PROCESS SECTION ==================== */
.process-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    position: relative;
    overflow: hidden;
}

.process-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.process-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(215, 38, 109, 0.2),
                0 0 20px rgba(249, 129, 38, 0.1);
    border-color: rgba(215, 38, 109, 0.3);
}

.process-number-badge {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.process-card:hover .process-number-badge {
    transform: scale(1.15) rotate(10deg);
    background: linear-gradient(135deg, #D7266D, #F98126);
    color: white;
    box-shadow: 0 8px 20px rgba(215, 38, 109, 0.4);
}

.process-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(215, 38, 109, 0.05) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.8s ease;
    z-index: 0;
}

.process-card:hover::before {
    transform: rotate(45deg) translateX(100%);
}

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

.process-card:nth-child(1).visible { animation: fadeInUp 0.6s ease-out forwards 0.1s; }
.process-card:nth-child(2).visible { animation: fadeInUp 0.6s ease-out forwards 0.2s; }
.process-card:nth-child(3).visible { animation: fadeInUp 0.6s ease-out forwards 0.3s; }
.process-card:nth-child(4).visible { animation: fadeInUp 0.6s ease-out forwards 0.4s; }
.process-card:nth-child(5).visible { animation: fadeInUp 0.6s ease-out forwards 0.5s; }
.process-card:nth-child(6).visible { animation: fadeInUp 0.6s ease-out forwards 0.6s; }

/* ==================== BOTONES ==================== */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(215, 38, 109, 0.4);
}

/* ==================== THEME TOGGLE ==================== */
.theme-toggle-btn {
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: rotate(180deg);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero-image {
        animation-duration: 6s;
    }
    
    .service-card:hover {
        transform: translateY(-8px) scale(1.01);
    }
    
    .about-image-container,
    .about-content {
        animation-duration: 0.8s;
    }
    
    #about::before,
    #about::after {
        width: 150px;
        height: 150px;
    }
    
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        grid-auto-rows: 280px; /* Altura controlada en móvil */
    }
    
    .portfolio-item.wide,
    .portfolio-item.tall {
        grid-column: auto;
        grid-row: auto;
    }
    
    .lightbox-nav button {
        display: none;
    }
    
    .process-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
}

@media (max-width: 640px) {
    .portfolio-grid {
        grid-auto-rows: 250px;
    }
    
    .portfolio-item:hover {
        transform: translateY(-4px) scale(1.01);
    }
}

/* ==================== VIDEO PREVIEW SYSTEM ==================== */
.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0.75rem;
}

.video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.video-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    z-index: 2;
    border-radius: 0.75rem;
}

.video-preview-overlay .material-icons {
    font-size: 3rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

/* Hover states para videos */
.gallery-item:hover .video-preview-overlay {
    opacity: 0;
}

.gallery-item:hover .video-preview-overlay .material-icons {
    transform: scale(1.1);
}

/* Responsive para videos */
@media (max-width: 768px) {
    .video-preview-overlay .material-icons {
        font-size: 2.5rem;
    }
}

/* ==================== VIDEO PLACEHOLDER & LOADING ==================== */
.video-placeholder {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .video-placeholder {
    background: linear-gradient(135deg, #374151, #1f2937);
}

/* Spinner de carga */
.video-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #E75A7C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Preview overlay mejorado */
.video-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    z-index: 5;
}

.video-preview-overlay .material-icons {
    font-size: 3.5rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: pulse-icon 2s ease-in-out infinite;
}

.video-tap-hint {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    background: rgba(231, 90, 124, 0.8);
    border-radius: 2rem;
    opacity: 0;
    animation: fadeInHint 0.5s ease-out 0.5s forwards;
}

@keyframes fadeInHint {
    to { opacity: 1; }
}

.video-error-msg {
    color: white;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Video container optimizado */
.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.dark .video-container {
    background: linear-gradient(135deg, #374151, #1f2937);
}

.video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    background: #000;
}

/* Estados de hover mejorados para desktop */
@media (min-width: 769px) {
    .gallery-item:hover .video-preview-overlay {
        opacity: 0;
    }
    
    .gallery-item:hover .video-tap-hint {
        opacity: 0;
    }
}

/* Optimizaciones para móviles */
@media (max-width: 768px) {
    .video-loading-spinner {
        background: rgba(0, 0, 0, 0.7);
        padding: 2rem;
        border-radius: 1rem;
    }
    
    .spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .video-preview-overlay .material-icons {
        font-size: 3rem;
    }
    
    .video-tap-hint {
        font-size: 0.75rem;
        padding: 0.4rem 0.875rem;
    }
    
    /* Hacer más fácil tocar los videos */
    .gallery-item {
        min-height: 280px;
    }
    
    /* Video en lightbox optimizado para móvil */
    #lightbox-video {
        max-height: 70vh;
        width: 100%;
        object-fit: contain;
    }
}

/* Mejoras para iOS específicamente */
@supports (-webkit-touch-callout: none) {
    .video-element {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .video-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Estado de carga en el lightbox */
.lightbox-modal .video-loading {
    position: relative;
}

.lightbox-modal .video-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #E75A7C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 100;
}

/* Optimización de rendimiento */
.gallery-item.loading {
    pointer-events: none;
}

/* Transiciones suaves para cambios de estado */
.video-preview-overlay,
.video-loading-spinner,
.video-tap-hint {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Efecto de feedback al tocar (móvil) */
@media (max-width: 768px) {
    .gallery-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Prevenir selección de texto en videos */
.video-container,
.video-placeholder {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* ==================== VIDEO CON THUMBNAILS ==================== */

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #000;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.video-element.hidden {
    display: none;
}

.video-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    z-index: 3;
    pointer-events: none;
}

.video-preview-overlay .material-icons {
    font-size: 3.5rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: pulse-icon 2s ease-in-out infinite;
}

.video-error-msg {
    color: white;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Hover en desktop: muestra video, oculta thumbnail */
@media (min-width: 769px) {
    .gallery-item:hover .video-preview-overlay {
        opacity: 0;
    }
}

/* Optimizaciones móvil */
@media (max-width: 768px) {
    .video-preview-overlay .material-icons {
        font-size: 3rem;
    }
    
    .gallery-item {
        min-height: 280px;
    }
    
    #lightbox-video {
        max-height: 70vh;
        width: 100%;
        object-fit: contain;
    }
}

/* iOS/Safari */
@supports (-webkit-touch-callout: none) {
    .video-element,
    .video-thumbnail {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Prevenir selección */
.video-container,
.video-thumbnail,
.video-preview-overlay {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}