/* RESET Y VARIABLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0a;
    --bg-card: rgba(20, 20, 20, 0.5);
    --border-card: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-secondary: #cccccc;
    --primary: #7a5cff;
    --primary-dark: #5d45d9;
    --accent: #4fd1ff;
    --font-family: 'Arial', 'Helvetica', sans-serif;
    --glow-primary: 0 0 20px rgba(122, 92, 255, 0.5);
    --glow-accent: 0 0 20px rgba(79, 209, 255, 0.4);
    --toast-success: #4caf50;
    --toast-error: #f44336;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    background: #0a0a0a;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(122, 92, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(79, 209, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(122, 92, 255, 0.06) 0%, transparent 50%);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

/* ========== PRELOADER ========== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}
.preloader-logo {
    width: 120px;
    animation: pulse 1.5s infinite alternate;
    margin-bottom: 20px;
}
@keyframes pulse {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.05); opacity: 1; }
}
.preloader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(122,92,255,0.3);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== HEADER ========== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10%;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: padding 0.3s;
}

.logo-img {
    height: 50px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 10px rgba(122, 92, 255, 0.5));
    transition: filter 0.3s;
}
.logo-img:hover {
    filter: drop-shadow(0 0 16px rgba(122, 92, 255, 0.9));
}

/* Menú hamburguesa */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    width: 30px;
    height: 24px;
    justify-content: space-between;
}
.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 3px;
}
.menu-toggle.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

nav {
    display: flex;
    gap: 30px;
    align-items: center;
}
nav a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 1rem;
    transition: color 0.3s;
    font-weight: 500;
    position: relative;
}
nav a:hover,
nav a:focus-visible {
    color: var(--primary);
    outline: none;
}

/* Selector de idioma */
.lang-switch {
    display: flex;
    gap: 5px;
    margin-left: 20px;
}
.lang-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #aaa;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
}
.lang-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.lang-btn:hover {
    border-color: var(--primary);
}

/* ========== SLIDER ========== */
.hero-slider {
    width: 100%;
    max-width: 90%;
    margin: 0 auto;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(122, 92, 255, 0.25), 0 0 60px rgba(79, 209, 255, 0.1);
    border: 1px solid rgba(122, 92, 255, 0.2);
}
.slider-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1584 / 672;
    touch-action: pan-y;
    background: #0a0a0a; /* Fondo oscuro para cuando usemos contain */
}
.slider-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    pointer-events: none;
}
.slider-img.active {
    opacity: 1;
}
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, box-shadow 0.3s;
    z-index: 10;
}
.slider-btn:hover,
.slider-btn:focus-visible {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(122, 92, 255, 0.6);
    outline: none;
}
.slider-btn.prev { left: 15px; }
.slider-btn.next { right: 15px; }

.slider-dots {
    text-align: center;
    margin-top: 12px;
}
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #444;
    margin: 0 6px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}
.dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    transform: scale(1.3);
}

/* ========== HERO ========== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    padding-top: 80px;
}
.hero h1 {
    display: none;
}
.hero p {
    font-size: clamp(1rem, 4vw, 1.3rem);
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}
.typewriter-text {
    display: inline-block;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    overflow: hidden;
    animation: blinkCursor 0.8s infinite;
    color: var(--text-secondary);
    font-size: inherit;
}
@keyframes blinkCursor {
    0%, 100% { border-color: var(--primary); }
    50% { border-color: transparent; }
}

/* ========== BOTONES ========== */
.btn {
    display: inline-block;
    margin-top: 2rem;
    padding: 14px 35px;
    background: linear-gradient(135deg, var(--primary), #8b6fff);
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(122, 92, 255, 0.3);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.btn:hover::after,
.btn:focus-visible::after {
    width: 300px;
    height: 300px;
}
.btn:hover,
.btn:focus-visible {
    box-shadow: 0 8px 35px rgba(122, 92, 255, 0.5);
    transform: translateY(-2px);
    outline: none;
}
.btn-small {
    margin-top: 15px;
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* ========== SECCIONES ========== */
.section {
    padding: 90px 10%;
}
.section h2 {
    text-align: center;
    margin-bottom: 50px;
    font-size: 2.4rem;
    letter-spacing: 2px;
    position: relative;
    display: inline-block;
    width: 100%;
}
.section h2::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.6s ease;
}
.section h2.visible-line::after {
    width: 80px;
}

/* ========== PROYECTOS ========== */
.proyectos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.card {
    background: rgba(20, 20, 20, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 25px;
    transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(30px);
    position: relative;
    overflow: hidden;
}
.card.visible {
    opacity: 1;
    transform: translateY(0);
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(122, 92, 255, 0.08), transparent);
    transition: left 0.8s;
    pointer-events: none;
}
.card:hover::before {
    left: 100%;
}
.card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px rgba(122, 92, 255, 0.2);
}
.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 18px;
    background: #1a1a1a;
}
.card h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
}
.card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ========== SERVICIOS ========== */
.servicios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin-top: 20px;
}
.servicio-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 35px 25px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(122, 92, 255, 0.15);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.servicio-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(122, 92, 255, 0.25);
}
.servicio-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    transition: transform 0.3s, filter 0.3s;
    filter: drop-shadow(0 0 6px rgba(122, 92, 255, 0.4));
}
.servicio-card:hover .servicio-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 14px rgba(122, 92, 255, 0.8));
}

/* ========== PROCESO ========== */
.proceso-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin-top: 20px;
}
.proceso-paso {
    background: rgba(20,20,20,0.4);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    border: 1px solid rgba(122,92,255,0.1);
    transition: transform 0.3s, border-color 0.3s;
    position: relative;
}
.proceso-paso:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}
.paso-numero {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 auto 15px;
    color: white;
}

/* ========== TECNOLOGÍAS ========== */
.tech-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}
.tech-icons span {
    background: rgba(26, 26, 26, 0.7);
    padding: 10px 22px;
    border-radius: 40px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    letter-spacing: 1px;
}
.tech-icons span:hover {
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(122, 92, 255, 0.4);
    background: rgba(122, 92, 255, 0.15);
}

/* ========== ESTADÍSTICAS ========== */
.stats {
    background: linear-gradient(135deg, #0a0a0a, #111);
    border-radius: 30px;
    margin: 0 10%;
    width: auto;
    padding: 50px 20px;
}
.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 40px;
}
.stat-item {
    text-align: center;
}
.stat-number {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(45deg, #7a5cff, #4fd1ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-item p {
    margin-top: 10px;
    color: #aaa;
}

/* ========== TESTIMONIOS ========== */
.testimonios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}
.testimonio {
    background: rgba(17, 17, 17, 0.6);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    position: relative;
}
.testimonio::before {
    content: '"';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 5rem;
    color: rgba(122, 92, 255, 0.15);
    font-family: Georgia, serif;
    line-height: 1;
}
.testimonio:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 12px 35px rgba(122, 92, 255, 0.15);
}
.testimonio p {
    font-style: italic;
    color: #ddd;
    line-height: 1.5;
}
.testimonio h4 {
    margin-top: 15px;
    color: var(--primary);
}

/* ========== SOBRE MÍ ========== */
.sobre {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ========== CONTACTO ========== */
.contacto {
    text-align: center;
}
.contacto p {
    font-size: 1.2rem;
}
.contacto-form {
    margin-top: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.contacto-form input,
.contacto-form textarea {
    width: 100%;
    margin: 10px 0;
    padding: 12px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    transition: border 0.3s;
}
.contacto-form input:focus,
.contacto-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(122,92,255,0.2);
}
.contacto-form button {
    width: 100%;
}
.contacto-form small {
    display: block;
    margin-top: 10px;
    color: #777;
}

/* ========== FOOTER ========== */
footer {
    padding: 30px 10%;
    text-align: center;
    border-top: 1px solid var(--border-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.social-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}
.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}
.social-links a:hover {
    color: var(--primary);
}

/* ========== BOTÓN VOLVER ARRIBA ========== */
#btn-up {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 28px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
#btn-up:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ========== TOASTS ========== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #222;
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3s forwards;
    max-width: 300px;
}
.toast.success {
    border-left: 4px solid var(--toast-success);
}
.toast.error {
    border-left: 4px solid var(--toast-error);
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ========== PARTÍCULAS ========== */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}
.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    animation: floatUp 12s infinite;
}
@keyframes floatUp {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    15% { opacity: 0.6; }
    85% { opacity: 0.1; }
    100% { transform: translateY(-10vh) scale(1.2); opacity: 0; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    header {
        padding: 12px 5%;
    }
    .menu-toggle {
        display: flex;
    }
    nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 80%;
        height: calc(100vh - 70px);
        background: rgba(10,10,10,0.98);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 40px;
        transition: left 0.3s ease;
        backdrop-filter: blur(12px);
        z-index: 999;
    }
    nav.active {
        left: 0;
    }
    nav a {
        font-size: 1.4rem;
    }
    .section {
        padding: 60px 5%;
    }
    .proyectos {
        grid-template-columns: 1fr;
    }
    .stats {
        margin: 0 5%;
        padding: 40px 15px;
    }
    .stat-number {
        font-size: 2rem;
    }
    .servicios-grid,
    .testimonios-grid,
    .proceso-grid {
        grid-template-columns: 1fr;
    }
    #btn-up {
        width: 45px;
        height: 45px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }

    /* ===== SLIDER MÓVIL CORREGIDO ===== */
    .hero-slider {
        max-width: 96%;
        border-radius: 14px;
    }
    .slider-container {
        aspect-ratio: 1584 / 672;   /* proporción real de los banners */
        min-height: unset;           /* sin altura mínima forzada */
        background: #0a0a0a;
    }
    .slider-img {
        object-fit: contain;        /* muestra la imagen completa sin recortes */
        object-position: center;
    }
    .slider-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    .slider-btn.prev { left: 8px; }
    .slider-btn.next { right: 8px; }
    .lang-switch {
        margin-left: 10px;
    }
}

@media (max-width: 400px) {
    .slider-container {
        aspect-ratio: 1584 / 672;
        min-height: unset;
    }
}