/* Variables CSS para una gestión de colores y fuentes más sencilla */
:root {
    --primary-color: #2c3e50; /* Azul oscuro, profesional */
    --secondary-color: #34495e; /* Gris pizarra, para fondos o elementos secundarios */
    --accent-color: #e67e22; /* Naranja quemado, para toques de énfasis */
    --text-color: #333333; /* Texto principal oscuro */
    --light-text-color: #ffffff; /* Texto claro para fondos oscuros */
    --background-light: #f4f7f6; /* Fondo general claro */
    --background-card: #ffffff; /* Fondo para tarjetas y secciones claras */
    --border-color: #dddddd; /* Color de borde sutil */
    --shadow-color: rgba(0, 0, 0, 0.08); /* Sombra suave */
    --font-family-sans: 'Open Sans', sans-serif;
    --font-family-serif: 'Merriweather', serif;
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #4a6a8a;
        --secondary-color: #1e2a38;
        --background-light: #121212;
        --background-card: #1e1e1e;
        --text-color: #e0e0e0;
        --light-text-color: #ffffff;
        --border-color: #444444;
        --shadow-color: rgba(0, 0, 0, 0.3);
    }

    body {
        background-color: var(--background-light);
        color: var(--text-color);
    }

    .card, .contacto-info, .contacto-form, .comments-box {
        background-color: var(--background-card);
        border-color: var(--border-color);
    }
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-sans);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-light);
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

/* Encabezados */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-serif);
    margin-bottom: 1rem;
    color: var(--primary-color);
    line-height: 1.2;
}

h1 { font-size: 2.8rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.8rem; }

/* Contenedor principal para centrar contenido */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header y Navegación */
header {
    background-color: var(--primary-color);
    padding: 1rem 0;
    box-shadow: 0 3px 6px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo img {
    max-width: 60px;
    height: auto;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin-right: -2rem;
}

.nav-links li {
    margin-right: 2rem;
}

.nav-links li a {
    color: var(--light-text-color);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.5rem 0;
    position: relative;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    width: 100%;
}

/* Hamburguer menu para móviles */
.burger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.burger div {
    width: 25px;
    height: 3px;
    background-color: var(--light-text-color);
    margin: 4px 0;
    transition: all 0.3s ease;
}

/* Animación de la hamburguesa */
.burger.toggle .line1 {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.burger.toggle .line2 {
    opacity: 0;
}

.burger.toggle .line3 {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Main Content */
main {
    flex-grow: 1;
    padding: 3rem 0;
}

section {
    padding: 3rem 0;
    margin-bottom: 2rem;
}

section:last-of-type {
    margin-bottom: 0;
}

.bg-light {
    background-color: var(--background-light);
}

.card {
    background-color: var(--background-card);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Section Titles */
.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    position: relative;
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
}

/* Hero Section */
.hero {
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--light-text-color);
    padding: 6rem 0;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: rotate(45deg);
    pointer-events: none;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--light-text-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.4rem;
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin: 0 0.5rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--light-text-color);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    background-color: #d16e1e;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--light-text-color);
}

.btn-secondary:hover {
    background-color: #2c3a4a;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 4px;
}

/* About Section */
.about-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3rem;
}

.about-image {
    flex: 1;
    min-width: 250px;
    text-align: center;
}

.about-image img {
    max-width: 200px;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.about-text {
    flex: 2;
    min-width: 300px;
}

.about-text p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: #555;
}

.contact-info-list {
    list-style: none;
    margin-top: 1.5rem;
}

.contact-info-list li {
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.contact-info-list li i {
    color: var(--accent-color);
    margin-right: 0.8rem;
    width: 20px;
    text-align: center;
}

/* Timeline for Experience and Education */
.timeline {
    position: relative;
    padding: 2rem 0;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--primary-color);
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item:nth-child(even) {
    justify-content: flex-start;
}

.timeline-dot {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    border: 3px solid var(--light-text-color);
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-content {
    width: calc(50% - 40px);
    padding: 1.5rem;
    position: relative;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-right: 40px;
    text-align: right;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 40px;
    text-align: left;
}

.timeline-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.timeline-content h4 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.timeline-content ul {
    list-style: none;
    padding-left: 0;
}

.timeline-content ul li {
    margin-bottom: 0.5rem;
    color: #555;
    position: relative;
}

.timeline-content ul li::before {
    content: '\2022';
    color: var(--accent-color);
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.timeline-content ul li::before {
    margin-right: 0.5em;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.skill-card {
    text-align: center;
    padding: 2.5rem;
}

.skill-card i {
    font-size: 3.5rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    display: block;
}

.skill-card h3 {
    margin-bottom: 0.8rem;
}

.skill-card p {
    color: #555;
}

/* Portfolio Section */
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.galeria-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.galeria-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.galeria-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 220px;
    background-color: rgba(44, 62, 80, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    color: var(--light-text-color);
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    pointer-events: none;
}

.galeria-item:hover img {
    transform: scale(1.08);
}

.galeria-item:hover .galeria-overlay {
    opacity: 1;
}

.galeria-details {
    padding: 1.5rem;
    flex-grow: 1;
    background-color: var(--background-card);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
}

.galeria-details h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.galeria-details p {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
}

.galeria-details .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.galeria-details .btn-sm i {
    margin-left: 0.5rem;
}

/* Contact Section */
.contacto-container {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.contacto-info,
.contacto-form {
    flex: 1;
    min-width: 300px;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
    background-color: var(--background-card);
}

.contact-details-list {
    list-style: none;
    margin-top: 1.5rem;
}

.contact-details-list li {
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.contact-details-list li i {
    color: var(--accent-color);
    margin-right: 1rem;
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

.social-media-contact {
    margin-top: 2rem;
    text-align: center;
}

.social-media-contact a {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin: 0 0.8rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-media-contact a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

.contacto-form form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.contacto-form input,
.contacto-form textarea,
#comment-form input,
#comment-form textarea {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: var(--font-family-sans);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contacto-form input:focus,
.contacto-form textarea:focus,
#comment-form input:focus,
#comment-form textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.contacto-form textarea,
#comment-form textarea {
    height: 160px;
    resize: vertical;
}

.message {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message.show {
    opacity: 1;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mapa {
    margin-top: 2.5rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.mapa iframe {
    width: 100%;
    height: 450px;
    border: none;
    display: block;
}

/* Comments Section */
.comments-box {
    margin-top: 2rem;
    background-color: var(--background-card);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.comments-box h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    padding-bottom: 2rem;
}

.comment-card {
    background-color: var(--background-card); /* Usa el fondo de la tarjeta para consistencia */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.8rem;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 700px;
    width: 100%;
    text-align: left; /* Cambiar a izquierda para mejor legibilidad */
}

.comment-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.comment-card p {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: var(--text-color); /* Asegura contraste */
}

.comment-card h4 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-top: 0.5rem;
    font-weight: 600;
    display: block; /* Eliminar fecha */
}

.comment-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.comment-actions button {
    background-color: var(--primary-color);
    color: var(--light-text-color);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.comment-actions button:hover {
    background-color: var(--accent-color);
    transform: translateY(-1px);
}

/* Estilos para las respuestas (anidadas) */
.reply-card {
    border-left: 4px solid var(--accent-color);
    margin-top: 1.5rem;
    padding-left: 1.5rem;
    background-color: var(--background-card); /* Consistencia con modo claro/oscuro */
    border-radius: 0 8px 8px 0;
    box-shadow: inset 3px 0 5px rgba(0, 0, 0, 0.03);
    margin-left: auto;
    width: calc(100% - 2rem);
    max-width: 600px;
    text-align: left;
}

.reply-card .comment-card {
    margin-bottom: 0;
    box-shadow: none;
    border: none;
    background-color: transparent;
    padding: 1rem 0;
    text-align: left;
}

.reply-card .comment-card h4,
.reply-card .comment-card p {
    text-align: left;
}

/* Ajustes para el formulario de respuesta */
.reply-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.reply-form form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.reply-form input,
.reply-form textarea {
    width: 90%;
    max-width: 500px;
}

.reply-form .btn-primary {
    width: fit-content;
    align-self: flex-end;
    margin-right: 0;
}

.no-comments {
    text-align: center;
    color: #777;
    font-style: italic;
    margin-top: 2rem;
}

/* Paginación */
.pagination {
    text-align: center;
    margin-top: 2rem;
}

.pagination a {
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--primary-color);
}

.pagination a.active, .pagination a:hover {
    background-color: var(--accent-color);
    color: var(--light-text-color);
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: var(--light-text-color);
    padding: 3rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    color: var(--light-text-color);
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
}

.footer-section p, .footer-section ul li {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.social-media {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.social-media a {
    color: var(--light-text-color);
    font-size: 1.8rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-media a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Animaciones */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes navLinkFade {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.5rem; }

    .container {
        padding: 0 1rem;
    }

    nav {
        flex-wrap: wrap;
        padding: 0 1rem;
    }

    .logo {
        flex-grow: 1;
        text-align: left;
    }

    .burger {
        display: flex;
        order: 2;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        background-color: var(--primary-color);
        position: absolute;
        top: 100%;
        left: 0;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
        padding: 1rem 0;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        gap: 0;
    }

    .nav-links.nav-active {
        transform: translateY(0%);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links li {
        margin: 0;
        text-align: center;
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links li a {
        font-size: 1.1rem;
        width: 100%;
        display: block;
    }

    .nav-links li a::after {
        display: none;
    }

    .hero {
        padding: 4rem 1.5rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .btn {
        margin: 0.5rem 0;
        display: block;
    }

    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .about-text {
        min-width: unset;
    }

    .contact-info-list li {
        justify-content: center;
    }

    .timeline::before {
        left: 10px;
        width: 2px;
    }

    .timeline-item {
        justify-content: flex-start;
        margin-bottom: 2rem;
    }

    .timeline-item:nth-child(even) {
        justify-content: flex-start;
    }

    .timeline-dot {
        left: 5px;
        width: 12px;
        height: 12px;
        border-width: 2px;
    }

    .timeline-content {
        margin-left: 25px;
        width: calc(100% - 25px);
        text-align: left;
    }

    .timeline-item:nth-child(odd) .timeline-content {
        margin-right: 0;
        margin-left: 25px;
        text-align: left;
    }

    .contacto-container {
        flex-direction: column;
    }

    .mapa iframe {
        height: 300px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-section {
        min-width: unset;
        margin-bottom: 1.5rem;
    }

    .footer-section ul {
        padding-left: 0;
    }

    .social-media {
        justify-content: center;
    }

    .comment-card {
        max-width: 100%;
        padding: 1.2rem;
    }

    .reply-card {
        width: calc(100% - 1.5rem);
        margin-left: 1.5rem;
        max-width: unset;
    }

    .reply-card .comment-card {
        padding: 0.8rem 0;
    }
}

@media screen and (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .btn {
        padding: 0.8rem 1.8rem;
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .skill-card {
        padding: 1.5rem;
    }

    .galeria-item img {
        height: 180px;
    }

    .galeria-overlay {
        height: 180px;
    }

    .galeria-details {
        padding: 1rem;
    }

    .galeria-details h3 {
        font-size: 1.1rem;
    }

    .galeria-details p {
        font-size: 0.85rem;
    }
}

/* Foto de perfil y logo */
.profile-img {
    max-width: 200px;
    height: auto;
    border-radius: 10px;
    display: block;
    margin: 0 auto 20px;
}