/* ==========================================================================
   1. VARIABLES Y BASE
   ========================================================================== */
:root {
    --primary-color: #38bdf8;
    --secondary-color: #0284c7;
    --dark-color: #075985;
    --text-color: #ffffff;
    --transition: all 0.3s ease;
    --glass-bg: rgba(13, 96, 185, 0.35);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-hover: rgba(13, 96, 185, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
    position: relative;
    background-color: var(--dark-color); /* Color de respaldo para SEO/Carga */
    overflow-x: hidden;
}

/* Capa de legibilidad sobre el fondo */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* ==========================================================================
   2. FONDO ANIMADO (CORREGIDO A AVIF)
   ========================================================================== */
.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.bg-overlay {
    width: 100%;
    height: 100%;
    /* Prioridad AVIF para mejor rendimiento SEO */
    background-image: url('images/bg-pattern.avif');
    background-size: cover;
    background-position: center;
    animation: backgroundMove 35s ease-in-out infinite alternate;
}

@keyframes backgroundMove {
    0% { transform: scale(1.1) translate(0, 0); }
    50% { transform: scale(1.2) translate(-10px, -10px); }
    100% { transform: scale(1.1) translate(0, 0); }
}

/* ==========================================================================
   3. LOGO Y ANIMACIÓN DE ONDAS
   ========================================================================== */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 10;
}

.logo-section {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    z-index: 10;
    animation: float 3s ease-in-out infinite;
}

.logo-animation {
    position: absolute;
    width: 120px;
    height: 120px;
}

.wave {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: rippleOut 3s linear infinite;
}

.wave:nth-child(2) { animation-delay: 1s; }
.wave:nth-child(3) { animation-delay: 2s; }

/* ==========================================================================
   4. TIPOGRAFÍA Y BIENVENIDA
   ========================================================================== */
h1 {
    font-size: 2.2rem;
    line-height: 1.2;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}

.h1-subtitle {
    display: block;
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.9;
}

.welcome-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    margin: 2rem 0;
    min-height: 180px;
    display: flex;
    align-items: center;
    text-align: center;
}

.welcome-text {
    width: 100%;
    position: relative;
    height: 100px;
}

.typing-text {
    position: absolute;
    top: 50%; left: 0; right: 0;
    transform: translateY(-50%);
    opacity: 0;
    font-size: 1.1rem;
    animation: fadeCycle 15s infinite;
}

.typing-text:nth-child(1) { animation-delay: 0s; }
.typing-text:nth-child(2) { animation-delay: 5s; }
.typing-text:nth-child(3) { 
    animation-delay: 10s;
    font-weight: 700;
    color: var(--primary-color);
}

@keyframes fadeCycle {
    0%, 33% { opacity: 0; }
    5%, 28% { opacity: 1; }
    33.3%, 100% { opacity: 0; }
}

/* ==========================================================================
   5. SERVICIOS Y BOTONES SOCIALES
   ========================================================================== */
.services-section {
    margin-bottom: 2rem;
}

.services {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 2rem;
}

.service-tag {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-button {
    background: var(--secondary-color);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 600;
    transition: var(--transition);
}

.social-button:hover {
    background: var(--dark-color);
    transform: translateY(-3px);
}

.social-button i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.address {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.8;
}

/* ==========================================================================
   6. FORMULARIO DE CONTACTO
   ========================================================================== */
.contact-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    margin-top: 3rem;
}

.contact-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-form input, 
.contact-form textarea {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
}

/* CORRECCIÓN: Placeholders más visibles */
.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.75);
    opacity: 1;
}

.contact-form input::-webkit-input-placeholder,
.contact-form textarea::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.contact-form input::-moz-placeholder,
.contact-form textarea::-moz-placeholder {
    color: rgba(255, 255, 255, 0.75);
    opacity: 1;
}

.contact-form input:-ms-input-placeholder,
.contact-form textarea:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.contact-form input:focus, 
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
}

.contact-form button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.contact-form button:hover {
    background: var(--dark-color);
}

.contact-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   7. RESPUESTA DEL FORMULARIO
   ========================================================================== */
#form-response {
    padding: 1.5rem;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    border-radius: 8px;
    text-align: center;
    margin-top: 1rem;
}

#spinner {
    margin-right: 10px;
}

/* ==========================================================================
   8. FOOTER
   ========================================================================== */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.developer-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 15px;
    display: inline-block;
}

.developer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.developer-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   9. ANIMACIONES EXTRA Y RESPONSIVE
   ========================================================================== */
@keyframes rippleOut {
    0% { transform: scale(1); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Clase para elementos visibles con IntersectionObserver */
.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .logo-container { width: 140px; height: 140px; }
    .logo-img { width: 90px; height: 90px; }
    .welcome-container { padding: 1.5rem 1rem; }
    .typing-text { font-size: 1rem; }
}