/* ==========================================================================
   1. ESTILOS GENERALES Y VARIABLES (Desktop Original)
   ========================================================================== */
:root {
    --primary-color: #732231;
    --secondary-color: #ffffff;
    --crema: #f2ebdc;
    --azul: #0B758C;
    --rosa: #d97789;
    --rosafuerte: #f24b6a;
    --negro: #000000;
    --monse: 'Montserrat', sans-serif;
    --anton: 'Anton', sans-serif;
    --max: 3rem calc(50% - 600px);
    --prueba: 1px solid red;
    --bg-gradient: linear-gradient(135deg, #006877 0%, #4c5c68 50%, #d4526e 100%);
    --text-color: #ffffff;
    --title-main-color: #6b1d2f;
    --font-family: 'Montserrat', sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--monse);
    background-color: var(--secondary-color);
    
    /* 🛡️ ESCUDO ANTI-SCROLL HORIZONTAL */
    overflow-x: hidden;
    position: relative;
}

/* --- Centinela para el Menú Scroll --- */
.header-sentinel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    pointer-events: none;
}

/* ==========================================================================
   2. NAVBAR / HEADER (Estado Base Desktop)
   ========================================================================== */
header {
    max-width: 1200px;
    margin: 1rem calc(50% - 600px);
    background-color: var(--primary-color);
    padding: 1rem;
    font-family: var(--monse);
    font-size: 1.5rem;
    text-align: center;
    color: var(--secondary-color);
    border-radius: 50px;
    position: relative;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.navbar-list {
    list-style: none;
    padding: 0.5rem;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.navbar__link a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar__link a:hover {
    color: var(--rosa);
}

.header-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 2.2rem;
    cursor: pointer;
}

/* --- Estado Fixed (Inyectado con JS en Scroll) --- */
header.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%; /* ✅ Corregido de 100vw a 100% para evitar desborde */
    max-width: 100%;
    margin: 0;
    padding: 0.75rem 2rem;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    background-color: rgba(115, 34, 49, 0.95);
    backdrop-filter: blur(10px);
    animation: slideDown 0.4s ease forwards;
}

header.is-fixed .navbar {
    max-width: 1200px;
    margin: 0 auto;
    justify-content: space-between;
}

header.is-fixed .navbar-list {
    justify-content: flex-end;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ==========================================================================
   3. SECCIONES (Diseño Base Desktop)
   ========================================================================== */

/* --- Main / Hero --- */
.main {
    max-width: 1200px;
    margin: var(--max);
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.main-info {
    flex: 2;
    padding: 1rem;
}

.main-title {
    font-family: var(--monse);
    font-size: 7rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.main-subtitle {
    margin-top: 3rem;
    font-family: var(--monse);
    font-size: 1.5rem;
    color: var(--rosa);
    text-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.main-photo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0.5rem;
}

.main-photo--img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    position: relative;
    z-index: 1;
}

.main-photo::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 18px;
    right: 3px;
    bottom: 2px;
    background-color: var(--azul);
    border-radius: 20px;
    z-index: 0;
}

/* --- Conóceme (About) --- */
.about {
    max-width: 1200px;
    margin: var(--max);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 4rem;
    background: linear-gradient(200deg, rgba(242, 75, 106, 1) 0%, rgba(11, 117, 140, 1) 100%);
    border-radius: 50px;
    box-shadow: -8px 4px 55px -19px rgba(0, 0, 0, 0.75);
    color: var(--secondary-color);
}

.about-info {
    flex: 1.8;
    padding: 1rem;
}

.about-title {
    font-family: var(--monse);
    font-size: 5rem;
    margin-bottom: 1rem;
}

.about-description {
    font-family: var(--monse);
    font-size: 1.4rem;
    line-height: 1.5;
    color: var(--secondary-color);
}

.about-grid {
    flex: 1.2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    align-items: center;
    justify-items: center;
}

.about-grid__img {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.377);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.grid__img-logo {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
}

.about-grid__img:hover {
    transform: translateY(-5px) scale(1.05);
    background-color: rgba(255, 255, 255, 0.18);
}

/* --- Portafolio --- */
.portfolio {
    max-width: 1200px;
    margin: var(--max);
}

.portfolio-title {
    font-family: var(--monse);
    font-size: 4rem;
    margin-bottom: 1rem;
    text-align: left;
    color: var(--primary-color);
}

.portfolio-nav {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 1rem;
}

.portfolio-btn {
    flex: 1;
    padding: .5rem 3rem;
    background-color: var(--secondary-color);
    text-align: center;
    border-radius: 50px;
    color: var(--rosafuerte);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 2rem;
    border: 1px solid var(--rosafuerte);
}

.portfolio-btn:hover,
.portfolio-btn.active {
    background-color: var(--rosafuerte);
    color: var(--secondary-color);
    transform: translateY(-5px) scale(1.05);
}

.portfolio-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.portfolio-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.portfolio-card__img-container {
    position: relative;
    width: 100%;
    height: 350px;
    border-radius: 15px;
    overflow: hidden;
}

.portfolio-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s ease;
}

.portfolio-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(115, 34, 49, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 2;
}

.portfolio-card__overlay span {
    color: var(--secondary-color);
    font-family: var(--monse);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

/* - Hovers unificados de Tarjetas - */
.portfolio-item:hover .portfolio-card__img {
    transform: scale(1.08);
}

.portfolio-item:hover .portfolio-card__overlay {
    opacity: 1;
}

.portfolio-item:hover .portfolio-card__overlay span {
    transform: translateY(0);
}

.porfolio-card__title {
    font-family: var(--monse);
    text-align: center;
    font-size: 1.7rem;
    color: var(--rosa);
    margin-top: 0.75rem;
}

.portfolio-card__btn {
    width: 50%;
    margin: 1rem auto;
    border: 1px solid var(--primary-color);
    padding: 0.5rem 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    color: var(--primary-color);
    background-color: var(--crema);
    transition: all 0.3s ease;
    display: block;
}

.portfolio-card__btn:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: translateY(-5px) scale(1.05);
}

/* --- Ventana Flotante / Modal Lightbox --- */
.portfolio-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 6rem;
    left: 0;
    top: 0;
    width: 100%; /* ✅ Corregido de 100vw a 100% para evitar barra de scroll horizontal */
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    box-sizing: border-box;
}

.modal-content-img {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 65vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

.modal-content-title {
    margin: 1.5rem auto 0 auto;
    text-align: center;
    color: var(--secondary-color);
    font-family: var(--monse);
    font-size: 2rem;
    max-width: 85%;
}

.modal-close {
    position: absolute;
    top: 2rem;
    right: 3.5rem;
    color: #f1f1f1;
    font-size: 3.5rem;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--rosa);
    transform: scale(1.1);
}

@keyframes zoomIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Contacto --- */
.contacto {
    font-family: var(--font-family);
    max-width: 1100px;
    margin: 4rem auto;
}

.contacto-main-title {
    color: var(--title-main-color);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: left;
}

.contacto-card {
    background: var(--bg-gradient);
    border-radius: 12px;
    padding: 3rem 4rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

.contacto-info {
    flex: 1.2;
}

.contacto-title {
    color: var(--text-color);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.contacto-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
}

.contacto-redes {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

.contacto-redes__item a {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.contacto-redes__item a:hover {
    opacity: 0.85;
    transform: translateX(5px);
}

.contacto-icon {
    font-size: 1.8rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.contacto-redes__item strong {
    font-weight: 600;
    margin-right: 0.25rem;
}

/* --- Footer --- */
.footer {
    background-color: var(--negro);
    padding: 1rem 0;
    text-align: center;
    color: var(--secondary-color);
    font-family: var(--monse);
}

/* --- Botón Volver Arriba --- */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 2px solid var(--rosafuerte);
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1500; /* Por debajo del modal, pero por encima del contenido */
    
    /* Estado inicial oculto */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado visible (se activa con JS) */
.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: var(--rosafuerte);
    color: var(--secondary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(242, 75, 106, 0.4);
}

/* ==========================================================================
   4. RESPONSIVIDAD (Media Queries - Desktop-First con max-width)
   ========================================================================== */

/* --- Tablets / Pantallas Medianas (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .main, .about, .portfolio, .contacto {
        margin: 2rem 2rem;
    }

    header {
        margin: 1rem 2rem;
    }

    .main-title {
        font-size: 5rem;
    }

    .about-title {
        font-size: 4rem;
    }

    .portfolio-title {
        font-size: 3.2rem;
    }

    .portfolio-btn {
        padding: .5rem 1.5rem;
        font-size: 1.4rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Celulares Grandes / Medios (max-width: 768px) --- */
@media (max-width: 768px) {
    .main, .about, .portfolio, .contacto {
        margin: 2rem 1rem;
    }

    header {
        margin: 1rem;
        padding: 0.75rem 1.5rem;
        border-radius: 30px;
    }

    .navbar {
        justify-content: flex-end;
    }

    .header-toggle {
        display: block; 
    }

    /* Menú móvil tipo cortina */
    .navbar-menu {
        position: absolute;
        top: 110%;
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        border-radius: 20px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
        padding: 1.5rem 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.4s ease;
        z-index: 99;
    }

    .navbar-menu.is-active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .navbar-list {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        padding: 0;
    }

    .navbar__link {
        font-size: 1.3rem;
        width: 100%;
        text-align: center;
    }
    
    .navbar__link a {
        display: block;
        padding: 0.5rem 0;
    }

    /* Adaptación del menú móvil desplegable cuando el header está .is-fixed */
    header.is-fixed .navbar-menu {
        top: 100%;
        border-radius: 0 0 20px 20px;
        background-color: rgba(115, 34, 49, 0.98);
    }

    /* --- Adaptación Main --- */
    .main {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2rem;
    }
    .main-info {
        text-align: center;
    }
    .main-title {
        font-size: 3.2rem;
    }
    .main-subtitle {
        font-size: 1.2rem;
        margin-top: 1.5rem;
    }
    .main-photo {
        max-width: 280px;
    }

    /* --- Adaptación About --- */
    .about {
        flex-direction: column;
        padding: 2.5rem 1.5rem;
        border-radius: 30px;
        gap: 2rem;
    }
    .about-info {
        text-align: center;
    }
    .about-title {
        font-size: 3rem;
    }
    .about-description {
        font-size: 1.1rem;
    }
    .about-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    /* --- Adaptación Portafolio --- */
    .portfolio-title {
        font-size: 2.5rem;
    }
    .portfolio-nav {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
    }
    .portfolio-nav::-webkit-scrollbar {
        display: none;
    }
    .portfolio-btn {
        flex: 0 0 auto;
        font-size: 1.1rem;
        padding: 0.5rem 1.5rem;
        white-space: nowrap;
    }
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    .portfolio-card__img-container {
        height: 280px;
    }
    .portfolio-card__btn {
        width: 60%;
    }

    /* --- Adaptación Modal en Móvil --- */
    .portfolio-modal {
        padding-top: 4rem;
    }
    .modal-close {
        top: 1rem;
        right: 2rem;
        font-size: 3rem;
    }
    .modal-content-img {
        max-width: 95%;
    }
    .modal-content-title {
        font-size: 1.4rem;
    }

    /* --- Adaptación Contacto --- */
    .contacto-card {
        flex-direction: column;
        padding: 2rem;
        gap: 2rem;
        text-align: center;
    }
    .contacto-title {
        font-size: 1.8rem;
    }
    .contacto-redes__item a {
        justify-content: center;
    }

    .scroll-top-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.75rem;
    }
}