/* Archivo: styles.css (Refactored - Con Sección Lab Creativo) */

/* --- 1. Global Variables & Base --- */
:root {
    /* === Tema Claro (Default) === */
    --primary-color: #4A90E2;
    --primary-color-rgb: 74, 144, 226; /* RGB para opacidad en animaciones */
    --primary-hover-color: #357ABD;
    --text-dark: #333;
    --text-light: #f8f9fa;
    --text-muted: #6c757d;
    --background-light: #f8f9fa;
    --background-medium: #f0f2f5;
    --background-medium-end: #e6e9ed;
    --background-dark: #343a40;
    --background-darker: #212529;
    --card-background: #ffffff;
    --border-color: #dee2e6;
    --modal-overlay-color: rgba(0, 0, 0, 0.8);
    --shadow-color-light: rgba(0,0,0,0.1);
    --shadow-color-dark: rgba(0,0,0,0.2);
    --whatsapp-color: #25D366;
    --mobile-nav-height: 65px;
    --modal-close-button-color: #E74C3C;
    --modal-close-icon-color: #ffffff;
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: var(--mobile-nav-height);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.modal-open {
    overflow: hidden;
}

/* --- 2. Layout & Utilities --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.hidden {
    display: none !important;
}

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

/* --- 3. Preloader --- */
#preloader {
    position: fixed;
    inset: 0;
    background-color: var(--background-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- 4. Header & Navigation (Desktop) --- */
header {
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    z-index: 1000;
    top: 0;
    left: 0;
    display: none;
    transition: background-color 0.3s ease;
}

nav.container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    flex-wrap: nowrap;
}

.nav-brand {
    display: inline-block;
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    line-height: 0;
    flex-shrink: 0;
}

.nav-brand:hover {
    color: var(--primary-color);
}

.nav-menu-items {
    display: none;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.nav-link {
    color: #555;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 0.5rem 0;
    white-space: nowrap;
    display: inline-block;
}

.nav-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* --- 5. Language Switcher --- */
.language-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.2s ease;
    display: none;
}

.lang-button.visible {
    display: block;
}

.lang-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

.lang-button img {
    width: 24px;
    height: auto;
    display: block;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.nav-menu-items .language-switcher {
    margin-left: 1rem;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
}

/* --- 6. Mobile Footer Navigation --- */
.mobile-footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background-color: var(--card-background);
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.25rem;
    z-index: 1000;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.mobile-footer-nav a,
.mobile-footer-nav .lang-switcher-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.6rem;
    gap: 0.1rem;
    text-align: center;
    flex: 1;
    height: 100%;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
}

.mobile-footer-nav a i {
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
    transition: transform 0.2s ease;
}

.mobile-footer-nav a:hover,
.mobile-footer-nav .lang-switcher-container .lang-button:hover {
    color: var(--text-dark);
}

.mobile-footer-nav a.active {
    color: var(--primary-color);
    font-weight: 600;
}

.mobile-footer-nav .lang-switcher-container { padding: 0; }
.mobile-footer-nav .lang-button { display: none; }
.mobile-footer-nav .lang-button.visible { display: flex; }
.mobile-footer-nav .lang-button img { width: 20px; margin-bottom: 0.1rem; }

/* --- 7. Hero Section (#inicio) --- */
#inicio {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: var(--primary-color); /* CAMBIO: De texto claro a oscuro */
  padding-top: 0;
}

#video-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -100;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-color: rgba(0, 0, 0, 0.6); -- Desactivado como se solicitó */
    z-index: -50;
}

#inicio > .container {
    position: relative;
    z-index: 10;
}

#inicio h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.2;
    min-height: 3.6em;
}

#inicio p {
    font-size: 1.125rem;
    color: var(--text-muted); /* CAMBIO: A un color oscuro y apagado para consistencia */
    margin-bottom: 2rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  0% { transform: rotate(25deg) translateX(-100%); }
  100% { transform: rotate(25deg) translateX(100%); }
}

@keyframes border-pulse {
  0% { border-color: var(--primary-color); }
  50% { border-color: rgba(var(--primary-color-rgb), 0.6); }
  100% { border-color: var(--primary-color); }
}

.hero-button {
  position: relative;
  overflow: hidden;
  background-color: var(--primary-color);
  color: var(--text-light);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  border: 1px solid var(--primary-color);
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  animation: pulse 2s ease-in-out infinite, border-pulse 2s infinite;
}

.hero-button::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.1) 100%);
  transform: rotate(25deg);
  pointer-events: none;
  animation: shimmer 3s infinite;
}

.hero-button:hover {
  background-color: var(--primary-hover-color);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.typewriter-cursor::after {
    content: '|';
    display: inline-block;
    margin-left: 0.1em;
    opacity: 1;
    animation: blink 0.7s infinite;
}

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

/* --- 8. General Section Styling --- */
section {
    padding-top: 3rem;
    padding-bottom: 3rem;
    transition: background-color 0.3s ease;
}

section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 1rem; /* Reduced margin */
    line-height: 1.3;
    transition: color 0.3s ease;
}

section .section-description {
    text-align: center;
    color: #7C7C7C;
    margin-bottom: 2.5rem; /* Increased margin */
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.bg-gray-50 {
    background-color: var(--background-medium);
    background-image: linear-gradient(to bottom, var(--background-medium) 0%, var(--background-medium-end) 100%);
}

.bg-white {
    background-color: var(--card-background);
}


/* --- 9. Portfolio & Demo Reel --- */
.demo-reel-container {
    max-width: 90%;
    margin: 0 auto;
    background-color: #000;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.aspect-w-16 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portfolio-item, a.portfolio-item {
    cursor: pointer;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    background-color: var(--card-background);
    border-radius: 0.5rem;
    box-shadow: 0 2px 5px var(--shadow-color-light);
    overflow: hidden;
    display: inline-block; /* Essential for masonry */
    width: 100%;
}
a.portfolio-item, a.portfolio-item:hover {
    text-decoration: none;
    color: inherit;
}

.portfolio-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease-out;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}

.portfolio-item:hover {
    transform: translateY(-5px) scale(1.015);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.portfolio-item .p-4 { padding: 0.75rem; }
.portfolio-item h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--text-dark); }
.portfolio-item p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0; }
.hidden-portfolio-item { display: none; }


/* --- 10. Masonry & Grid Layouts --- */
.masonry-grid {
    column-count: 1;
    column-gap: 1rem;
}

#websites-grid.portfolio-grid { /* Specificity for website grid */
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1rem;
}

/* --- 11. Specific Portfolio Types --- */
.video-thumbnail { position: relative; }
.video-thumbnail .play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8); font-size: 3.5rem; color: rgba(255, 255, 255, 0.8); opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; z-index: 1; }
.video-thumbnail:hover .play-icon { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }

.website-card .website-content-wrapper { position: relative; overflow: hidden; border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; }
.website-card img { height: 16rem; object-fit: cover; object-position: top; transition: transform 0.4s ease-out; }
.website-card:hover img { transform: scale(1.03); }

.website-card .overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.1)); opacity: 0; transition: opacity 0.4s ease-in-out; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center; padding: 1rem; color: var(--text-light); display: none; pointer-events: auto; z-index: 1; }
.website-card .overlay > * { pointer-events: auto; }
.website-card:hover .overlay { opacity: 1; }
.website-card .overlay h3 { color: var(--text-light); transform: translateY(10px); transition: transform 0.4s ease-out; }
.website-card .overlay p { color: rgba(255, 255, 255, 0.8); transform: translateY(10px); transition: transform 0.4s ease-out 0.1s; }
.website-card .overlay span.website-link { font-size: 0.75rem; color: var(--text-light); border: 1px solid var(--text-light); padding: 0.3rem 0.6rem; border-radius: 9999px; text-decoration: none; display: inline-block; transform: translateY(10px); transition: transform 0.4s ease-out 0.2s, background-color 0.3s ease, color 0.3s ease; }
.website-card .overlay span.website-link:hover { background-color: var(--text-light); color: var(--text-dark); }
.website-card:hover .overlay h3, .website-card:hover .overlay p, .website-card:hover .overlay span.website-link { transform: translateY(0); }

.website-text-mobile { display: block; padding: 1rem; }

/* --- 12. Load More Button --- */
.load-more-button { display: block; margin: 2rem auto 0; padding: 0.75rem 1.5rem; max-width: 250px; border-radius: 9999px; border: 1px solid var(--primary-color); background-color: var(--primary-color); color: var(--text-light); font-weight: 700; cursor: pointer; transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease; position: relative; overflow: hidden; animation: pulse 2s ease-in-out infinite, border-pulse 2s infinite; }
.load-more-button::after { content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(120deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.1) 100%); transform: rotate(25deg); pointer-events: none; animation: shimmer 3s infinite; }
.load-more-button:hover { background-color: var(--primary-hover-color); transform: translateY(-4px) scale(1.02); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); }
.load-more-button.hidden { display: none; }

/* --- 13. Testimonials & Clients --- */
.testimonials-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-top: 3rem; }
.testimonial-card { background-color: var(--card-background); padding: 2rem; border-radius: 0.5rem; box-shadow: 0 4px 15px var(--shadow-color-light); text-align: center; position: relative; }
.quote-icon { font-size: 3rem; color: var(--primary-color); opacity: 0.3; position: absolute; top: 0.5rem; left: 1rem; line-height: 1; }
.stars { color: #fdd835; font-size: 1.2rem; margin-bottom: 1rem; }
.testimonial-text { font-style: italic; color: var(--text-muted); margin-bottom: 1.5rem; position: relative; }
.testimonial-author { font-weight: 600; color: var(--text-dark); display: block; font-style: normal; }

#clientes { padding: 3rem 0; background-color: var(--card-background); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.client-logos-carousel-container { overflow: hidden; position: relative; }
.client-logos-carousel { display: flex; gap: 3rem; padding: 1rem 0; animation: scroll-infinite linear infinite; will-change: transform; }
.client-logo { flex: 0 0 auto; width: 130px; height: auto; filter: grayscale(50%); opacity: 0.8; object-fit: contain; }
@keyframes scroll-infinite { from { transform: translateX(0); } to { transform: translateX(var(--scroll-distance, -100%)); } }

/* --- 14. Contact Section --- */
#contacto { background-color: #1F2937; color: var(--text-light); }
#contacto h2 { color: var(--primary-color); }
#contacto .grid { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
#contacto label { display: block; margin-bottom: 0.25rem; font-size: 0.875rem; font-weight: 500; color: rgba(255, 255, 255, 0.7); }
#contacto .contact-input { display: block; width: 100%; padding: 0.75rem 1rem; background-color: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 0.375rem; color: var(--text-light); transition: border-color 0.3s ease, background-color 0.3s ease; }
#contacto .contact-input::placeholder { color: rgba(255, 255, 255, 0.5); }
#contacto .contact-input:focus { outline: none; border-color: var(--primary-color); background-color: rgba(255, 255, 255, 0.15); }
.submit-button { background-color: var(--primary-color); color: var(--text-light); font-weight: 700; padding: 0.75rem 1.5rem; border-radius: 0.375rem; border: none; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease; width: 100%; }
.submit-button:hover { background-color: var(--primary-hover-color); transform: translateY(-2px); }
.contact-info p { margin: 0.5rem 0; display: flex; align-items: center; }
.contact-info .contact-icon { margin-right: 0.75rem; color: var(--primary-color); width: 1em; text-align: center; }
.social-links div { display: flex; gap: 1rem; }
.social-links a { color: rgba(255, 255, 255, 0.6); font-size: 1.5rem; transition: color 0.3s ease, transform 0.2s ease; }
.social-links a:hover { color: var(--text-light); transform: scale(1.1); }
.form-status-message { padding: 0.75rem 1rem; border-radius: 0.375rem; font-size: 0.9rem; text-align: center; margin-top: 1rem; display: none; opacity: 0; transition: opacity 0.3s ease-in-out; }
.form-status-message.success { background-color: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; display: block; opacity: 1; }
.form-status-message.error { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; display: block; opacity: 1; }
.submit-button:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- 15. Footer --- */
footer { background-color: var(--background-darker); color: rgba(255, 255, 255, 0.5); padding: 1.5rem 0; text-align: center; font-size: 0.8rem; }
footer p { margin: 0.25rem 0; }
footer .text-sm { font-size: 0.75rem; }

/* --- 16. Modal & WhatsApp --- */
.modal-overlay { position: fixed; inset: 0; background-color: var(--modal-overlay-color); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; cursor: pointer; }
.modal-overlay.visible { display: flex; }
.modal-close-button { position: absolute; top: 1.5rem; right: 1.5rem; width: 35px; height: 35px; background-color: var(--modal-close-button-color); color: var(--modal-close-icon-color); border: none; border-radius: 50%; font-size: 1.25rem; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; z-index: 2001; transition: background-color 0.2s ease, transform 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.modal-close-button:hover { background-color: #C0392B; transform: rotate(90deg); }
.modal-content { background-color: transparent; padding: 0; max-width: 95%; max-height: 95vh; overflow-y: auto; position: relative; box-shadow: none; cursor: default; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#modal-media-container { margin-bottom: 0; border-radius: 0.25rem; overflow: hidden; position: relative; width: 100%; }
#modal-media-container > * { display: block; max-width: 100%; max-height: 90vh; height: auto; margin: 0 auto; object-fit: contain; }
#modal-media-container > video { width: 100%; max-height: 90vh; }
.modal-content h3, .modal-content p, #modal-link { display: none; }

#whatsapp-button { position: fixed; bottom: calc(var(--mobile-nav-height) + 15px); right: 15px; width: 50px; height: 50px; background-color: var(--whatsapp-color); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 2px 2px 8px rgba(0,0,0,0.3); z-index: 1001; text-decoration: none; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; }
#whatsapp-button:hover { transform: scale(1.1); box-shadow: 3px 3px 12px rgba(0,0,0,0.4); }

/* --- 17. Animations --- */
.fade-in-element { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in-element.is-visible { opacity: 1; transform: translateY(0); }

/* --- 18. Media Queries --- */
@media (max-width: 767px) {
    .website-card .overlay { display: none; }
    .website-text-mobile { display: block; }
}

@media (min-width: 480px) {
    .container { padding-left: 1.5rem; padding-right: 1.5rem; }
    .masonry-grid, #videos-grid { column-count: 2; column-gap: 1.5rem; }
    #websites-grid.portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}

@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .mobile-footer-nav, .website-text-mobile { display: none; }
    header, .nav-menu-items, .website-card .overlay { display: flex; }
    #inicio h1 { font-size: 3.75rem; } #inicio p { font-size: 1.5rem; }
    section h2 { font-size: 2.25rem; } section .section-description { font-size: 1rem; }
    .demo-reel-container { max-width: 85%; }
    .masonry-grid, #videos-grid { column-count: 2; column-gap: 2rem; }
    #websites-grid.portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 2.5rem; }
    .testimonials-grid { grid-template-columns: repeat(2, 1fr); }
    #contacto .grid { grid-template-columns: repeat(2, 1fr); gap: 2.5rem; }
    .website-card img { height: 24rem; }
    #paginas-web .website-card img {
    aspect-ratio: 16 / 9;
    height: auto; /* Se ajusta automáticamente por el aspect-ratio */
}
    #whatsapp-button { bottom: 30px; right: 30px; }
}

@media (min-width: 1024px) {
    #inicio h1 { font-size: 4.5rem; }
    .masonry-grid, { column-count: 3; }
    #websites-grid.portfolio-grid, .testimonials-grid { grid-template-columns: repeat(3, 1fr); }
    .demo-reel-container { max-width: 75%; }
}
/* --- Efecto Hover MEJORADO exclusivo para la sección Lab Creativo --- */
#proyectos-especiales .portfolio-item:hover, 
#proyectos-especiales a.portfolio-item:hover {
    transform: translateY(-5px) scale(1.015); /* Mantiene el levantamiento y escalado */
    
    /* Mantiene la sombra y AÑADE un resplandor azul */
    box-shadow: 0 10px 20px rgba(0,0,0,0.1), 
                0 0 15px rgba(var(--primary-color-rgb), 0.5); 
}