/* ==========================================================================
   RESET & VARIABLES CORPORATIVAS (DARK MODE)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --bg-main: #0B0C10; /* Negro asfalto */
    --bg-secondary: #1F2833; /* Azul grisáceo oscuro */
    --accent: #66FCF1; /* Cian tecnológico brillante */
    --accent-hover: #45A29E; /* Cian apagado */
    --text-light: #C5C6C7; /* Gris claro */
    --white: #FFFFFF;
}

/* ==========================================================================
   COMPORTAMIENTOS GENERALES (APP-LIKE EXPERIENCE)
   ========================================================================== */
html, body {
    overflow-x: hidden; /* CORTA cualquier elemento que intente salir por los costados */
    max-width: 100vw;   /* Asegura que el ancho máximo sea la pantalla visible */
}

html {
    scroll-behavior: smooth;
    touch-action: pan-x pan-y; /* Bloquea el zoom gestual en pantallas táctiles */
    overscroll-behavior-y: none; /* Evita el "rebote" elástico en topes de página */
}

body {
    background-color: var(--bg-main);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-user-select: none;
    user-select: none; /* Evita selección de texto accidental al dejar el dedo apoyado */
    -webkit-tap-highlight-color: transparent; /* Elimina destello celeste al tocar botones */
}

/* ==========================================================================
   NAVBAR & LOGO (ANIMACIÓN STROKE)
   ========================================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background-color: rgba(11, 12, 16, 0.95);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(102, 252, 241, 0.1);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 15px; 
}

.logo-img {
    height: 40px; 
    width: auto;
    border-radius: 5px; 
}

.stroke-logo-text {
    width: 250px; 
    height: 40px;
    display: block;
    animation: loopFadeOut 8s infinite;
}

.logo-stroke, .logo-fill {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo-stroke {
    fill: none;
    stroke: var(--white);
    stroke-width: 1.5px;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawNavStroke 8s ease-in-out infinite;
}

.logo-fill {
    fill: var(--accent);
    opacity: 0;
    animation: fillNavText 8s ease-in-out infinite;
}

@keyframes drawNavStroke {
    0%, 5% { stroke-dashoffset: 400; }
    35%, 100% { stroke-dashoffset: 0; }
}

@keyframes fillNavText {
    0%, 35% { opacity: 0; filter: drop-shadow(0 0 0px transparent); }
    45%, 85% { opacity: 1; filter: drop-shadow(0 0 8px rgba(102, 252, 241, 0.5)); }
}

@keyframes loopFadeOut {
    0%, 85% { opacity: 1; }
    92% { opacity: 0; }
    100% { opacity: 0; }
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    margin-left: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent);
}

/* ==========================================================================
   HERO SECTION & DECRYPTED TEXT
   ========================================================================== */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 5%;
    background: radial-gradient(circle at top right, #1F2833 0%, #0B0C10 60%);
}

.hero-content {
    max-width: 800px;
    margin-top: 50px;
}

.main-title {
    font-size: 4rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 20px;
    line-height: 1.1;
    min-height: 140px; 
    width: 100%;
    max-width: 100vw; 
    box-sizing: border-box;
}

.typewriter-static {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--accent);
    animation: typing-static 2s steps(30, end) forwards, blink-static 0.75s step-end infinite;
}

@keyframes typing-static {
    from { width: 0; }
    to { width: 100%; border-color: transparent; }
}

@keyframes blink-static {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent); }
}

.decrypted-loop {
    color: var(--accent);
    display: inline-block;
    white-space: pre-wrap;
    word-break: break-word; /* Forza salto de línea si la palabra es muy larga */
    overflow-wrap: anywhere; 
    max-width: 100%; 
    opacity: 1;
    transition: opacity 0.5s ease;
}

.decrypted-loop.fade-out {
    opacity: 0;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 90%;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg-main);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background-color: rgba(102, 252, 241, 0.1);
}

/* ==========================================================================
   SECCIONES GENERALES (SERVICIOS, PORTAFOLIO, SOBRE MÍ)
   ========================================================================== */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--white);
    margin-bottom: 60px;
}

.services-section {
    padding: 100px 5%;
    background-color: var(--bg-secondary);
}

.services-grid, .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    background-color: var(--bg-main);
    padding: 40px 30px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s, border-color 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: rgba(102, 252, 241, 0.3);
}

.featured-service {
    border: 1px solid var(--accent);
    position: relative;
}

.service-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 20px;
}

.service-card h3 {
    color: var(--white);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.btn-service {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: rgba(102, 252, 241, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-service:hover {
    background-color: var(--accent);
    color: var(--bg-main);
}

.portfolio-section {
    padding: 100px 5%;
    background-color: var(--bg-main);
}

.portfolio-item {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    padding: 30px;
    border-left: 4px solid var(--accent);
}

.tech-stack {
    display: inline-block;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.portfolio-item h3 {
    color: var(--white);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.about-section {
    padding: 80px 5%;
    background-color: var(--bg-secondary);
    text-align: center;
}

.about-container {
    max-width: 800px;
    margin: 0 auto;
}

.about-text {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
    background-color: var(--bg-main);
    padding: 80px 5% 40px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer h3 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 30px;
}

.footer-links {
    margin: 40px 0;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.1rem;
}

.copyright {
    color: #666;
    font-size: 0.9rem;
}

/* ==========================================================================
   ANIMACIONES JS (INTERSECTION OBSERVER)
   ========================================================================== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE CELULARES)
   ========================================================================== */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 5%;
    }
    
    .nav-links {
        display: none; 
    }

    .main-title {
        font-size: 2.5rem;
        min-height: 100px;
    }

    .hero-content p {
        font-size: 1rem;
        max-width: 100%;
    }

    .hero-buttons { 
        flex-direction: column; 
        align-items: flex-start; /* Evita que los botones se alarguen al 100% de la pantalla */
    }

    .services-grid, .portfolio-grid {
        grid-template-columns: 1fr; 
        gap: 20px;
    }
}