/* =========================================
   1. PRELOAD & FONTS
========================================= */
/* Añade esto al principio de tu archivo CSS o en la sección de RESET */
* {
    -webkit-tap-highlight-color: transparent;
}

.preload,
.preload * {
    transition: none !important;
}

@font-face {
    font-family: 'bootstrap-icons';
    src: url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/fonts/bootstrap-icons.woff2?2820a38c237c5643a6d9627702e5c8e3') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter.woff2') format('woff2');
    font-display: swap;
    size-adjust: 100%;
    ascent-override: 90%;
    descent-override: 10%;
    line-gap-override: 0%;
}



/* =========================================
   2. HTML & BODY (LOAD PRIORITY)
========================================= */
html {
    min-height: 100vh;
    padding: 0;
    margin: 0;
    scroll-behavior: auto;
    scroll-padding-top: 100px;
    scrollbar-width: none;
    color: rgb(255, 255, 255);

}

html::-webkit-scrollbar {
    display: none;
}

html.light-theme-init {
    margin: 0;
    opacity: 1;
    background: linear-gradient(135deg, #ebebeb, #d6d6d6);
    background-attachment: fixed;
    background-size: cover;
    color: #000;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
    margin: 0 5%;
    background-color: transparent !important;
    font-family: 'Inter', Arial, sans-serif;
}

body.preload {
    opacity: 0;
    visibility: hidden;
}

/* =========================================
   3. LAYERS & Z-INDEX 
========================================= */

html {

    background-attachment: fixed;
    background-size: cover;
    overflow: inherit;

}




/* =========================================
   4. GENERAL STYLES
========================================= */

#home:target,
body:not(:has(:target)) #home {
    display: block;
}

b {
    font-weight: 900;
}

.light-theme b {
    color: #000000;
}

h2 {
    font-family: 'Lexend';
    font-size: 20px;
    font-weight: 200;
}

.light-theme h2 {
    color: #000000;
}

p {
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.6;
    word-spacing: 0.2em;
}

img {
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

a img {
    pointer-events: auto;
}

.c {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    z-index: 1;
    margin: 0;
    color: rgb(199, 199, 199);
    text-align: center;
}

.light-theme .c {
    color: rgb(0, 0, 0);

}

.cont {
    display: flex;
    gap: 1.3vw;
}


/* Watermark */
.watermark {
    position: fixed;
    z-index: 9999;
    bottom: 20%;
    right: 10px;
    padding: 10px 5px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.71);
    font: 200 12px 'Michroma', sans-serif;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

.light-theme .watermark {
    border: 0.8px solid rgba(20, 20, 20, 0.268);
    color: rgba(0, 0, 0, 0.418);
}

/* =========================================
   5. HEADER
========================================= */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 10px 0 30px;
    margin: 0 0 10px;
    border-top: none;
    border-radius: 0 0 10px 10px;
    font-family: "Michroma", sans-serif;
    user-select: none;
    will-change: transform;
    overflow: visible;
}




header a {
    padding-left: 10px;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 2;
}

header a h1 {
    font-family: "Michroma";
    font-size: 150%;
}

.light-theme header a h1 {
    color: #131313b8;
}

header a h1:hover {
    color: #ffffff;
    cursor: pointer;
}

.light-theme header a h1:hover {
    color: #000000;
    cursor: pointer;
}

header button,
header i {
    border: 0;
    background-color: transparent;
    color: #ffcb69;
    font-size: 15px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.menu-toggle {
    display: none;
    padding-right: 10px;
    margin: 0 5px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.menu-toggle i {
    font-size: 26px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: none !important;
}

.menu-toggle:hover i {
    color: #ffffff;
    opacity: 0.8;
    transform: none !important;

}

.light-theme .menu-toggle i {
    color: rgba(0, 0, 0, 0.7);

}

.light-theme .menu-toggle:hover i {
    color: #000000;
    transform: none !important;
}

nav {
    padding: 1dvw;
    position: relative;
    z-index: 2;
}

nav a {
    padding: 0 1dvw;
    color: rgba(187, 187, 187, 0.73);
    font: 500 16px 'Epilogue', sans-serif;
    text-align: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

.light-theme nav a {
    color: #4a4a4a;
}


nav a.active {
    color: rgb(255, 255, 255);
    font-weight: 800;
    text-shadow: none;

}

.light-theme nav a.active {
    color: rgba(0, 0, 0, 0.841);
}

/* =========================================
   6. MAIN / SECTIONS
========================================= */
.content {
    flex: 1;
    width: 80%;
    max-width: 1200px;
    padding: 0 2rem;
    margin: 0 auto;
}

section {
    display: none;
    position: relative;
    padding: 20px 30px;
    margin-top: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: visible;
}

section:target {
    display: block;
}

.subsection_grid {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
}


.subarticle {
    /* flex-basis en 45% obliga a que quepan 2. grow: 1 hace que se estiren */

    max-width: 500px;
    /* Un poco más ancho para que luzcan las 2 columnas */
    min-width: 280px;
    /* Umbral para el salto */
    padding: 20px;
}




@media (max-width: 768px) {
    .subsection_grid {
        flex-direction: column;
        align-items: center;
    }

    .subarticle {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        /* Desactiva el cálculo de flex de escritorio */
        margin: 10px 0;
    }
}


/* =========================================
   7. ARTICLES
========================================= */
article {
    display: block;
    position: relative;
    padding-top: 14px;
    padding-bottom: 14px;
    margin: 10px;
    margin-top: 14px;
    border-radius: 9px;
    background: rgb(61, 61, 61);
    color: inherit;
    font: 300 1rem 'Inter', sans-serif;
    text-align: start;
}


.light-theme article {
    background-color: rgba(214, 214, 214, 0.884);
}

article h3 {
    padding-left: 5%;
    font-family: 'Lexend';
    font-size: 18px;
    font-weight: 400;
    text-align: left;
}

/*flex: 1 1 calc(45% - 20px);*/
.subarticle {

    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Cambiado de center a stretch */
    box-sizing: border-box;
    width: 100%;
    max-width: 300px;
    min-height: auto;
    /* Dejamos que crezca según el contenido */
    padding-top: 10px;
    padding-bottom: 10px;
    margin-top: 0px;
    border-radius: 10px;
    background: rgb(56, 56, 56);
    font-family: 'Epilogue';
    box-shadow: inset -6px -6px 15px #2e2e2e73, inset -2px -2px 10px #00000093, inset 6px 6px 20px #555555, inset 5px 5px 8px #f0f0f03d;
}



.subarticle h4 {
    font-family: 'Lexend', sans-serif;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
    /* El título sí puede ir centrado */
}

.light-theme .subarticle {
    background: #e0e0e0;
    box-shadow: inset 5px 5px 4px #99999972, inset -5px -5px 10px #ececec, inset -5px -5px 10px #ffffff;
}


.subarticle h2 {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.2;
    text-align: center;
}

.subarticle p {
    flex-grow: 1;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    /* Cambiado de center a left para evitar huecos raros */
    hyphens: auto;
    padding: 0 5px;
    /* Reducido para ganar espacio lateral */
    margin: 15px 0 0;
    width: 100%;
    max-width: none;
    /* Eliminamos el límite de 250px que causaba el problema */
}

.subarticle h4 {
    width: 100%;
    text-align: center;
    /* El título queda bien centrado */
    margin-bottom: 15px;
}

.subarticle a {
    display: flex;
    justify-content: center;
    /* Mantiene la imagen centrada */
    width: 100%;
}

.subarticle img {
    max-width: 96%;
    max-height: 96%;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
    user-select: none;
    filter: grayscale(10%) brightness(1);
    transition: filter 0.2s ease;
}



/* =========================================
   8. FORM
========================================= */
form {
    display: flex;
    flex-direction: column;
    max-width: 600px;
    padding: 2rem;
    margin: 0 auto;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
}

.field label {
    margin-bottom: 0.5rem;
    padding-left: 5%;
    font-size: 17px;
    font-weight: bold;
    text-align: left;
}

.field input,
.field textarea {
    color: #cecece;
    border: none;
    padding: 0.75rem;
    border-radius: 4px;
    background: rgb(65, 65, 65);
    box-shadow: inset -5px -5px 9px #00000079, inset 2px 2px 10px #686868a6;
    font-family: 'lexend', sans-serif;
    font-size: 1rem;
    resize: none;
    outline: none;
    cursor: pointer;
}

.light-theme .field input,
.light-theme .field textarea {
    background: #e2e2e2;
    color: #272727;
    box-shadow: inset 3px 3px 5px #acacac, inset -3px -3px 5px #f3f3f3;
}


.contact button {
    margin: 0 30%;
    padding: 0.7rem;
    border: none;
    border-radius: 4px;
    background: rgba(22, 22, 22, 0);
    box-shadow: -5px -5px 15px #0c0c0c, 5px 5px 15px #5e5e5e;
    color: rgb(187, 187, 187);
    font: 700 16px 'Epilogue', sans-serif;
    cursor: pointer;
}

.contact button:hover {
    background: rgb(56, 56, 56);
    box-shadow: inset -5px -5px 5px #00000073, inset 5px 5px 20px #555555a6;
    backdrop-filter: none;
}

.light-theme .contact button {
    background: rgb(220, 220, 220);
    box-shadow: 5px 5px 5px #b4b4b4, -5px -5px 5px #ffffff;
    color: #000000;
}



.light-theme .contact button:hover {
    color: #000000;
    background-color: #d8d8d8;
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.1), inset 2px 2px 5px rgba(0, 0, 0, 0.3);

}

.fin p {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    font: 600 1.25rem 'Lexend', sans-serif;
    letter-spacing: 0.05rem;
    text-align: center;
    transition: all 0.3s ease;
}

.light-theme .fin p {
    color: #000000;
}

/* =========================================
   9. FOOTER
========================================= */
footer {
    display: block;
    position: relative;
    padding: 0 30px 15px 30px;
    margin: 15px 0 0 0;

    border-bottom: none;
    /* Sin borde abajo */
    border-radius: 10px 10px 0 0;

    font-weight: 300;
    user-select: none;
    overflow: visible;
    /* Asegura visibilidad del reflex */
}





/*==========================================
   General
========================================= */

html {
    background: linear-gradient(135deg, #1b1b1b, #383838);
    background-attachment: fixed;
    background-size: cover;
}

footer,
section,
header {
    background: rgb(36, 36, 36);

    box-shadow: -4px -4px 12px #000000cc, 5px 5px 10px #474747;


}

.light-theme footer,
.light-theme header,
.light-theme section {
    border: none;
    background: #e9e9e9;
    box-shadow: 5px 5px 10px rgba(81, 81, 81, 0.256), -5px -5px 10px #ffffff;
}




/* =========================================
   10. MEDIA QUERIES
========================================= */
@media (max-width: 768px) {
    body {
        margin: 0 15px !important;
    }

    header {
        padding: 10px 15px;
    }

    .content {
        width: 90%;
        padding: 0;
        margin: 0 auto;
    }

    section {
        padding: 20px 15px;
    }

    article {
        padding: 20px 15px;
        margin: 20px 0;
    }

    article h3,
    .field label {
        padding-left: 0;
    }

    form {
        padding: 0;
    }

    footer {
        padding: 2px 1px;
    }

    .subsection_grid {
        flex-direction: column;
        align-items: center;
    }

    .subarticle {
        max-width: 300px;
        min-height: auto !important;
        margin: 10px 0;
    }


    .watermark {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    nav {
        display: none;
        position: absolute;
        top: calc(100% + 5px);
        right: 10px;
        width: 150px;
        padding: 10px;
        border-radius: 12px;
        background: rgb(0, 0, 0);
        flex-direction: column;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

        border: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1001;

    }

    .light-theme nav {
        background: rgb(250, 250, 250);
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    nav.active {
        display: flex;
    }

    nav a {
        padding: 12px 20px !important;
        width: 100px;
        text-align: left;
        font-size: 17px;
    }

    nav a:last-child {
        border-bottom: none;
    }

    .cont {
        gap: 0;
    }



    /* =========================================
   11. DISABLE HOVER ON TOUCH DEVICES
   @media (hover: none) targets devices that
   have NO true hover capability (touch screens).
   This prevents "sticky" hover effects on mobile.
========================================= */
    @media (hover: none) {

        /* Navigation links - no glow on tap */
        nav a:hover {
            color: rgba(187, 187, 187, 0.73);
            text-shadow: none;
        }

        .light-theme nav a:hover {
            color: #4a4a4a;
        }

        /* Header logo - no glow on tap */
        header a h1:hover {
            color: inherit;
            text-shadow: none;
            cursor: default;
        }

        /* Header buttons (theme toggle, menu toggle) */
        header button:hover {
            color: #ffff69;
            text-shadow: none;
            cursor: default;
        }

        .light-theme header button i:hover {
            color: rgb(193, 106, 0);
            text-shadow: none;
            cursor: default;
        }

        .subarticle img {
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
        }
    }
}