/* --- VARIABLES --- */
:root {
    --text-color: #3E2B26;
    --accent-color: #E86A46;
    --card-bg: #FBEFBC;
    --white-trans: rgba(253, 251, 247, 0.95);
    --white: #ffffff;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Poppins', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { color: var(--text-color); font-family: var(--font-sans); line-height: 1.6; overflow-x: hidden; }

/* --- FONDO --- */
.background-pattern {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-image: url('fondo-flores.svg'); background-repeat: repeat; background-size: 400px;
    animation: moveBackground 60s linear infinite; opacity: 0.6;
}
@keyframes moveBackground { 0% { background-position: 0 0; } 100% { background-position: 100% 100%; } }

/* --- HEADER --- */
header {
    background-color: var(--white-trans); backdrop-filter: blur(5px); padding: 1rem 5%;
    display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid rgba(62, 43, 38, 0.1);
}

.logo img {
    height: 70px; 
    width: auto; 
    display: block;
}

.logo a { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 700; color: var(--text-color); text-decoration: none;}
.logo span { color: var(--accent-color); font-size: 2.5rem; line-height: 0;}
.navbar ul { display: flex; list-style: none; gap: 1rem; }
.nav-btn { display: inline-block; background-color: var(--accent-color); color: var(--white); padding: 10px 25px; border-radius: 50px; text-decoration: none; font-weight: 500; font-size: 0.9rem; transition: 0.3s; }
.nav-btn:hover { background-color: #d15634; transform: translateY(-2px); }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-color); }

/* --- HERO --- */
.hero { padding: 3rem 5% 5rem; background: radial-gradient(circle, rgba(253,251,247,0.8) 0%, rgba(253,251,247,0) 80%); min-height: 90vh; display: flex; align-items: center; }
.hero-container { display: flex; align-items: center; justify-content: space-between; gap: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.hero-content { flex: 1; text-align: left; max-width: 600px; }
.hero h1 { font-family: var(--font-serif); font-size: 3.5rem; line-height: 1.1; margin-bottom: 1rem; color: var(--text-color); }
.subtitle { font-size: 1.2rem; margin-bottom: 2rem; color: #554; }
.btn-primary { display: inline-block; background-color: var(--accent-color); color: var(--white); padding: 12px 35px; border-radius: 50px; font-weight: 600; text-decoration: none; transition: 0.3s; box-shadow: 0 4px 15px rgba(232, 106, 70, 0.3); }
.btn-primary:hover { background-color: #d15634; transform: translateY(-3px); }
.hero-card-wrapper { flex: 1; display: flex; justify-content: center; padding-top: 20px; }

/* --- TARJETA CORREGIDA --- */
.card {
  width: 300px; height: 300px; background: var(--white); border-radius: 32px; padding: 3px;
  position: relative; box-shadow: rgba(62, 43, 38, 0.2) 0px 20px 30px -10px;
  transition: all 0.5s ease-in-out;
}

.card .mail {
  position: absolute; right: 2rem; top: 1.4rem; font-size: 1.5rem; color: var(--accent-color); border: none; background: none; z-index: 10;
}

.card .profile-pic {
  position: absolute; width: calc(100% - 6px); height: calc(100% - 6px); top: 3px; left: 3px;
  border-radius: 29px; z-index: 1; border: 0px solid var(--accent-color); overflow: hidden;
  transition: all 0.5s ease-in-out 0.2s, z-index 0.5s ease-in-out 0.2s;
}
.card .profile-pic img { object-fit: cover; width: 100%; height: 100%; object-position: top center; transition: all 0.5s ease-in-out 0s; }

/* CAJA NARANJA (FONDO) */
.card .bottom {
  position: absolute; 
  bottom: 3px; left: 3px; right: 3px;
  background: var(--accent-color);
  border-radius: 29px; z-index: 2;
  box-shadow: rgba(96, 75, 74, 0.2) 0px 5px 5px 0px inset;
  overflow: hidden;
  /* CLAVE: Altura inicial pequeña, solo para el botón */
  height: 80px; 
  transition: height 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
  
  display: flex; flex-direction: column; justify-content: flex-end; /* Alinea todo abajo */
  padding-bottom: 20px; /* Espacio para el botón */
}

/* TEXTO (Nombre y descripción) */
.card .bottom .content {
  position: absolute; top: 20px; left: 1.5rem; right: 1.5rem;
  opacity: 0; /* Oculto al inicio */
  transform: translateY(20px); /* Ligeramente abajo */
  transition: all 0.4s ease-in-out;
}
.card .bottom .content .name { display: block; font-size: 1.4rem; color: var(--white); font-family: var(--font-serif); font-weight: 700; margin-bottom: 0.5rem; }
.card .bottom .content .about-me { display: block; font-size: 0.85rem; color: rgba(255, 255, 255, 0.9); line-height: 1.4; }

/* BOTÓN DE CONTACTO */
.card .bottom .bottom-btn-container {
  width: 100%; display: flex; justify-content: center; /* Centrado horizontal */
  margin-top: auto; /* Empuja hacia abajo si es necesario */
  z-index: 5;
}
.card .bottom .button {
  background: var(--white); color: var(--accent-color); border: none; border-radius: 25px;
  font-size: 0.9rem; padding: 0.8rem 1.8rem; text-decoration: none; font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: all 0.3s;
}
.card .bottom .button:hover { background: var(--card-bg); color: var(--text-color); transform: scale(1.05); }

/* --- ESTADOS HOVER (ANIMACIÓN) --- */

.card:hover { border-top-left-radius: 55px; }

/* Al hacer hover, la caja naranja CRECE hacia arriba */
.card:hover .bottom {
  height: 200px; /* Crece lo suficiente para mostrar el texto */
  border-radius: 80px 29px 29px 29px;
}

/* El texto aparece */
.card:hover .bottom .content {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s; /* Espera un poquito a que suba el fondo */
}

.card:hover .profile-pic {
  width: 100px; height: 100px; aspect-ratio: 1; top: 10px; left: 10px;
  border-radius: 50%; z-index: 3;
  border: 5px solid var(--accent-color);
  box-shadow: rgba(96, 75, 74, 0.2) 0px 5px 5px 0px;
  transition: all 0.5s ease-in-out, z-index 0.5s ease-in-out 0.1s;
}
.card:hover .profile-pic:hover { transform: scale(1.1); }
.card:hover .profile-pic img { transform: scale(1); object-position: center; }

/* --- RESTO --- */
.portfolio, .about, .contact { padding: 4rem 5%; }
.portfolio { background-color: var(--white-trans); border-radius: 40px 40px 0 0; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: 2.5rem; font-family: var(--font-serif); }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2.5rem; max-width: 1000px; margin: 0 auto; }
.project-item { background-color: var(--card-bg); border-radius: 25px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; transition: 0.3s; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.project-item:hover { transform: translateY(-8px); }
.img-container { height: 220px; overflow: hidden; }
.project-item img { width: 100%; height: 100%; object-fit: cover; }
.card-text { padding: 1.5rem; text-align: center; }
.card-text h3 { margin-bottom: 0.5rem; font-family: var(--font-serif); }
.card-text p { color: var(--accent-color); font-weight: 600; font-size: 0.9rem; }
.about-card { background-color: var(--white); border: 2px dashed var(--accent-color); padding: 3rem; border-radius: 30px; max-width: 800px; margin: 0 auto; text-align: center; }
.about-card h2 { font-family: var(--font-serif); font-size: 2.2rem; margin-bottom: 1rem; }
.skills-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1.5rem;}
.skill-tag { background: var(--card-bg); color: var(--text-color); padding: 8px 18px; border-radius: 20px; font-size: 0.9rem; font-weight: 600; }
.contact { background-color: var(--white-trans); border-radius: 40px 40px 0 0; text-align: center; }
.contact-container { max-width: 600px; margin: 0 auto; }
.contact h2 { font-family: var(--font-serif); font-size: 2.5rem; margin-bottom: 1rem; }
form { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }
input, textarea { padding: 15px 20px; border-radius: 15px; border: 2px solid #EEE; font-family: var(--font-sans); font-size: 1rem; transition: 0.3s; }
input:focus, textarea:focus { outline: none; border-color: var(--accent-color); }
textarea { height: 150px; resize: none; }
footer { background-color: var(--text-color); color: #FDFBF7; padding: 3rem 5%; text-align: center; }
.social-icons a { color: #FDFBF7; font-size: 1.5rem; margin: 0 12px; transition: 0.3s; text-decoration: none;}
.social-icons a:hover { color: var(--accent-color); }
footer p { margin-top: 1rem; opacity: 0.7; font-size: 0.9rem; }


/* --- ANIMACIONES DE TEXTO --- */

/* 1. Definimos los Keyframes (El movimiento) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px); /* Empieza 30px más abajo */
    }
    to {
        opacity: 1;
        transform: translateY(0); /* Termina en su posición original */
    }
}


.fade-in-up {
    opacity: 0; /* Comienza invisible */
    animation: fadeInUp 1s ease-out forwards; /* Ejecuta la animación */
}

.delay-1 { animation-delay: 0.5s; } /* Retraso para el subtítulo */
.delay-2 { animation-delay: 1s; }   /* Retraso para el botón */


/* --- EFECTO TYPEWRITER (Máquina de Escribir) --- */

/* Contenedor del título para alinear todo */
.title-container {
    display: flex;
    flex-direction: column;
    width: fit-content; /* El contenedor se ajusta al ancho del texto */
    margin-bottom: 1rem;
}

/* Estilos base para las líneas de texto */
.typewriter-line-1, .typewriter-line-2 {
    display: block;
    overflow: hidden; /* Oculta el texto que aún no se "escribió" */
    white-space: nowrap; /* Evita que el texto baje de línea */
    margin: 0; /* Quita márgenes automáticos */
    border-right: 3px solid transparent; /* El cursor (inicialmente invisible) */
    width: 0; /* Empieza sin verse nada */
    
    font-family: var(--font-serif);
    font-size: 3.5rem; /* Mismo tamaño que tenías */
    line-height: 1.2;
    color: var(--text-color);
}

/* --- ANIMACIÓN LÍNEA 1 --- */
.typewriter-line-1 {
    /* Nombre | Duración | Pasos (letra x letra) | Mantener estado final */
    animation: 
        typing 2s steps(30, end) forwards, 
        blink-caret .75s step-end infinite;
    
    border-right-color: var(--accent-color); /* Color del cursor */
}

/* --- ANIMACIÓN LÍNEA 2 --- */
.typewriter-line-2 {
    /* Empieza después de 2s (cuando termina la línea 1) */
    animation: 
        typing 2s steps(30, end) 2s forwards, 
        blink-caret .75s step-end infinite 2s;
        
    /* El cursor de la línea 2 solo aparece cuando empieza su animación */
    border-right-color: transparent; 
}

/* --- KEYFRAMES (La lógica del movimiento) --- */

/* El efecto de escribir: aumenta el ancho de 0 a 100% */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* El efecto del cursor parpadeando */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--accent-color); }
}

/* AJUSTE PARA MÓVIL (Importante porque el typewriter puede romper el diseño en pantallas chicas) */
@media (max-width: 768px) {
    .typewriter-line-1, .typewriter-line-2 {
        white-space: normal; /* En celular permitimos que baje de línea normal */
        width: 100%; /* Ocupa todo el ancho */
        border: none; /* Quitamos el cursor en celular para evitar errores */
        animation: fadeInUp 1s ease-out forwards; /* Usamos la animación suave simple en celular */
        opacity: 0; /* Empieza invisible para el fade in */
    }
    
    .typewriter-line-2 {
        animation-delay: 0.3s;
    }
}

/* --- RESPONSIVE (MENÚ PANTALLA COMPLETA ESTILO APP) --- */
@media (max-width: 1024px) {
    
    /* 1. FONDO ESTÁTICO (Sin lag) */
    .background-pattern { animation: none; }

    /* 2. MENÚ FULL SCREEN (Fondo Oscuro) */
    .navbar {
        display: none;
        position: fixed; /* Fijo sobre toda la pantalla */
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; /* Ocupa toda la altura */
        background-color: var(--card-bg); /* AMARILLITO */
        flex-direction: column;
        justify-content: center; /* Centrado vertical */
        align-items: center; /* Centrado horizontal */
        z-index: 999; /* Encima de todo */
        opacity: 0; /* Efecto de aparición */
        transition: opacity 0.3s ease; /* Suavidad */
    }
    
    .navbar.active { 
        display: flex; 
        opacity: 1; /* Aparece suavemente */
    }
    
    .navbar ul {
        flex-direction: column;
        gap: 15px; /* Espacio entre items */
        width: 100%;
        text-align: center;
        padding: 0;
    }

    /* ESTILO DE LOS ENLACES (Letras Grandes y Blancas) */
    .nav-btn { 
        display: block; 
        width: 100%; 
        background-color: transparent; 
        color: var(--accent-color);
        font-family: var(--font-serif); /* Fuente elegante */
        font-weight: 600;
        font-size: 1.5rem; /* ¡LETRAS GRANDES! */
        padding: 15px 0;               
        box-shadow: none;
        border-radius: 0;
        border: none;
        transition: all 0.3s ease;
    }
    
    /* Efecto Hover (Franja Terracota como en tu referencia) */
    .nav-btn:hover, .nav-btn:active { 
        background-color: var(--accent-color); /* Fondo Naranja al tocar */
        color: var(--white);
        transform: none;
    }

    /* BOTÓN HAMBURGUESA (Ajuste de posición) */
    .menu-toggle { 
        display: block; 
        z-index: 1000; 
        font-size: 2rem;
        color: var(--text-color);
    }

    /* 3. OCULTAR TARJETA EN MÓVIL */
    .hero-card-wrapper { display: none; }

    /* 4. AJUSTES GENERALES */
    .hero {
        padding-top: 4rem; 
        min-height: 60vh;  
        align-items: center;
        display: flex;
    }
    
    .hero-container { 
        flex-direction: column; 
        text-align: center; 
        width: 100%;
    }
    
    .hero-content { 
        text-align: center; 
        width: 100%;
        padding: 0 15px; 
    }
    
    /* Título Principal */
    .typewriter-line-1 {
        font-size: 2rem; 
        line-height: 1.3;
        white-space: normal; 
        width: 100%; 
        border: none; 
        animation: fadeInUp 1s ease-out forwards; 
        opacity: 0;
        text-align: center;
        display: block;
    }

    /* Títulos unificados */
    .section-header h2, 
    .about-card h2, 
    .contact h2 {
        font-size: 2rem; 
        line-height: 1.3;
    }

    .subtitle { font-size: 1rem; margin-top: 1rem; }
    .title-container { margin: 0 auto; align-items: center; } 
    .hero-buttons { margin-top: 2rem; display: flex; justify-content: center; }
    
    /* Ajustes Proyectos */
    .project-title { font-size: 2.2rem; }
    .project-header, .project-description, .pdf-section { padding: 30px 20px; }
    .task-list { grid-template-columns: 1fr; }
    .process-gallery { grid-template-columns: 1fr; }
}


