/* Estilos base y fondo general */
body {
    position: relative;
    background-color: #d1d3ca;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,<svg id='patternId' width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><defs><pattern id='a' patternUnits='userSpaceOnUse' width='20' height='20' patternTransform='scale(3) rotate(0)'><rect x='0' y='0' width='100%' height='100%' fill='%23ffffff00'/><path d='M10-6V6M10 14v12M26 10H14M6 10H-6'  stroke-linecap='square' stroke-width='0.5' stroke='%2337553cff' fill='none'/></pattern></defs><rect width='800%' height='800%' transform='translate(0,0)' fill='url(%23a)'/></svg>");
    background-repeat: repeat;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

body>* {
    position: relative;
    z-index: 1;
}

/* Tipografía y encabezados */
h1.text-center {
    font-family: 'Croissant One', serif;
    opacity: 0;
    transform: translateY(-20px);
    animation: slideInDown 0.8s ease-out forwards;
    animation-delay: 0.2s;
}

/* Footer - Título de sección redes  */
.footer-estilizado .redes h5 {
    margin-bottom: 0.75rem;
}

/* Sección Info adicional (wrapper)  */
.info-wrapper h2 {
    font-size: 2rem;
}

/* Colores personalizados  */
.bg-personalizado {
    background-color: #37553c;
}

/* Footer - Estilizado general  */
.footer-estilizado {
    background-color: #37553c;
    border-radius: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    margin-top: 4rem;
    border-top: 3px solid #e4e4e4;
    padding: 2rem;
}

/* Íconos interactivos  */
.icono {
    width: 40px;
    height: 40px;
    filter: grayscale(100%);
    transition: all 0.3s ease;
    transform: translateY(0);
}

/* Íconos interactivos (hover) */
.icono:hover {
    filter: grayscale(0%);
    transform: translateY(-6px);
}

/* Enlaces del sidebar */
.link-sidebar {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 0.75rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.link-sidebar:hover {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ícono del botón hamburguesa */
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23ffffff' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Layout sección Acerca + Formulario */
#acerca-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Texto justificado */
.text-justificado {
    text-align: justify;
}

/* Footer - Distribución vertical de redes */
.footer-estilizado .redes {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Formulario de contacto */
.formulario-contacto {
    background: rgba(110, 156, 124, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s ease;
}

/* Sección sobre mí moderna */
.sobre-mi-section-modern {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease both;
}

.sobre-mi-section-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Imagen perfil sobre mí */
.img-sobre-mi {
    width: 150px;
    height: 150px;
    transition: transform 0.3s ease;
}

.img-sobre-mi:hover {
    transform: rotate(1deg) scale(1.03);
}

/* Galería Bento */
.galeria-bento {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.7rem;
    grid-auto-flow: dense;
}

/* Imágenes dentro de Bento */
.bento-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
    filter: grayscale(100%);
    transition: filter 0.4s ease, transform 0.3s ease;
    padding: 0.2rem;
    box-sizing: border-box;
    will-change: transform, filter;
}

.bento-img:hover {
    filter: grayscale(0%);
    transform: scale(1.03);
    z-index: 2;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

/* Posiciones específicas de las imágenes */
.img1,
.img2,
.img12,
.img13 {
    grid-column: span 3;
    grid-row: span 2;
}

.img3,
.img4,
.img5,
.img9,
.img10,
.img14,
.img15 {
    grid-column: span 2;
    grid-row: span 1;
}

.img6,
.img7 {
    grid-column: span 3;
    grid-row: span 1;
}

.img8 {
    grid-column: span 2;
    grid-row: span 2;
}

.img11 {
    grid-column: span 6;
    grid-row: span 1;
}

/* Menú colapsado (cerrado) */
.sidebar-collapse {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
}

/* Menú colapsado (abierto) */
.sidebar-collapse.open {
    opacity: 1;
}

/* 1) Fade-in escalonado de las imágenes de la galería */
.bento-img {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

/* 2) Animación de entrada para las imágenes */
.bento-img:nth-child(1) {
    animation-delay: 0.1s;
}

.bento-img:nth-child(2) {
    animation-delay: 0.2s;
}

.bento-img:nth-child(3) {
    animation-delay: 0.3s;
}

.bento-img:nth-child(4) {
    animation-delay: 0.4s;
}

.bento-img:nth-child(5) {
    animation-delay: 0.5s;
}

.bento-img:nth-child(6) {
    animation-delay: 0.6s;
}

.bento-img:nth-child(7) {
    animation-delay: 0.7s;
}

.bento-img:nth-child(8) {
    animation-delay: 0.8s;
}

.bento-img:nth-child(9) {
    animation-delay: 0.9s;
}

.bento-img:nth-child(10) {
    animation-delay: 1.0s;
}

.bento-img:nth-child(11) {
    animation-delay: 1.1s;
}

.bento-img:nth-child(12) {
    animation-delay: 1.2s;
}

.bento-img:nth-child(13) {
    animation-delay: 1.3s;
}

.bento-img:nth-child(14) {
    animation-delay: 1.4s;
}

.bento-img:nth-child(15) {
    animation-delay: 1.5s;
}

/* Animaciones*/
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media Queries - Menú móvil y ajustes generales */
@media (max-width: 767.98px) {
    .sidebar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1rem 2rem !important;
    }

    .sidebar ul {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
        padding-left: 0;
    }

    .sidebar ul li {
        width: 100%;
        overflow: visible;
    }

    .sidebar ul li a {
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.75rem 1.5rem;
        font-weight: 600;
        color: #fff;
        text-decoration: none;
        border-radius: 0.75rem;
        transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    }

    .sidebar ul li a:hover {
        background-color: rgba(255, 255, 255, 0.15);
        transform: scale(1.015);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .img-sobre-mi {
        margin-bottom: 1rem;
    }

    .galeria-bento {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .bento-img {
        width: 100%;
        aspect-ratio: 3 / 2;
        object-fit: cover;
        border-radius: 1rem;
        padding: 0.2rem;
        box-sizing: border-box;
        transition: filter 0.4s ease, transform 0.3s ease;
        filter: grayscale(0%) !important;

    }

    .sobre-mi-section-modern {
        flex-direction: column;
        text-align: center;
    }

    .info-wrapper {
        text-align: center;
    }

    .sidebar-collapse ul {
        overflow: visible !important;
    }

    #mainNavbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        transition: top 0.4s ease, opacity 0.4s ease;
    }

    #mainNavbar.navbar-hidden {
        top: -100px;
        pointer-events: none;
        opacity: 0;
    }

    .sidebar-collapse:not(.open) ul {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-collapse.open ul {
        opacity: 1;
        transition: opacity 0.4s ease 0.3s;
    }

    .sidebar-collapse:not(.open) {
        pointer-events: none;
    }
}

/* Media Queries - Layout de escritorio */
@media (min-width: 768px) {
    .sidebar {
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: center;
        width: 260px;
        min-width: 240px;
        max-width: 280px;
        flex-shrink: 0;
    }

    .sidebar-inner {
        position: sticky;
        top: 1rem;
        z-index: 10;
        will-change: top;
        backface-visibility: hidden;
    }

    .sidebar ul {
        align-items: center !important;
        text-align: center;
        width: 100%;
    }

    .sidebar ul li {
        width: 100%;
    }

    .sidebar ul li a {
        display: block;
        width: 100%;
        font-size: 1.5rem;
        padding: 0.75rem 1.25rem;
    }

    .sidebar a img {
        display: block;
        margin: 0 auto;
    }

    .footer-estilizado .contacto p,
    .footer-estilizado .contacto h5,
    .footer-estilizado .redes h5 {
        text-align: center !important;
    }

    #acerca-form-wrapper {
        flex-direction: row;
    }

    #acerca,
    #formulario {
        width: 50%;
    }

    .sidebar-collapse {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
    }
}

/* Media Queries - Ajustes en pantallas intermedias */
@media (max-width: 1150px) {
    #acerca-form-wrapper {
        flex-direction: column !important;
    }

    #acerca,
    #formulario {
        width: 100% !important;
    }
}

/* Media Queries - Ajustes para pantallas muy pequeñas */
@media (max-width: 576px) {

    .footer-estilizado .contacto p,
    .footer-estilizado .contacto h5,
    .footer-estilizado .redes h5 {
        text-align: center !important;
    }

    .footer-estilizado .redes {
        width: 100%;
    }

    .footer-estilizado .contacto {
        width: 100%;
    }
}