html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: #f4f6f9;
    color: #2c2c2c;
}

.page-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 10px auto 40px;
    padding: 0 20px;
    box-sizing: border-box;
    position: relative;
}

.back-link {
    position: absolute;
    left: 40px;
    top: 110px;
    color: #1E3A5F;
    font-size: 28px;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 10;
    text-decoration: none;
}

.back-link:hover {
    color: #2C7DA0;
    transform: scale(1.08);
}

.main-title {
    font-size: 3rem;
    color: #003b6f;
    text-align: center;
    margin: 50px 0 20px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    position: relative;
}

.main-title::after {
    content: '';
    display: block;
    width: 70px;
    height: 4px;
    background-color: #0077b6;
    margin: 12px auto 0;
    border-radius: 2px;
}

.contenedor {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    margin-top: 20px;
}

/* NAVEGACIÓN */
.monografia-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.nav-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    color: #1E3A5F;
    background: #ffffff;
    border: 1px solid #dbe4ec;
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.25s ease;
}

.nav-card:hover {
    background-color: #eaf3f9;
    transform: translateY(-2px);
    border-color: #2C7DA0;
}

.nav-numero {
    min-width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1E3A5F;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.nav-titulo {
    color: #1E3A5F;
    line-height: 1.45;
    font-weight: 700;
}

/* BLOQUES */
.bloques-monografia {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.bloque-monografia {
    background: #f8fafc;
    border: 1px solid #dbe4ec;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    scroll-margin-top: 20px;
}

.bloque-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid #dbe4ec;
    background: #f8fafc;
}

.bloque-header h2 {
    margin: 0 0 10px;
    font-size: 1.55rem;
    color: #1E3A5F;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}

.bloque-descripcion {
    margin: 0;
    color: #555;
    font-size: 1rem;
    line-height: 1.7;
}

.bloque-body {
    padding: 26px 28px;
}

/* IMAGEN */
.media-unica img {
    width: 100%;
    display: block;
    border-radius: 10px;
    background: #ffffff;
    max-height: 950px;
    object-fit: contain;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

/* ÍNDICE */
.indice-obra {
    background: #ffffff;
    border: 1px solid #dbe4ec;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.indice-linea {
    width: 100%;
    height: 1px;
    background: #333;
    margin-bottom: 18px;
}

.indice-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.indice-item {
    color: #111;
    line-height: 1.7;
    word-break: break-word;
}

.indice-item.nivel-1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: 1.08rem;
    margin-top: 4px;
}

.indice-item.nivel-2 {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 1.04rem;
    padding-left: 14px;
}

.indice-item.nivel-3 {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 1.02rem;
    padding-left: 34px;
}

.indice-item.nivel-4 {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 1rem;
    padding-left: 56px;
}

/* TEXTO GENERAL */
.texto-largo {
    margin: 0;
    color: #444;
}

.texto-largo p {
    margin-top: 0;
}

/* REFERENCIAS */
.texto-largo.referencias {
    font-size: 1rem;
    line-height: 1.65;
    text-align: left;
}

.texto-largo.referencias p:first-child {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
    margin: 0 0 22px;
    text-align: justify;
}

.texto-largo.referencias p:not(:first-child) {
    margin: 0 0 12px;
    padding-left: 1.6rem;
    text-indent: -1.6rem;
    color: #2f2f2f;
}

.texto-largo.referencias p:last-child {
    margin-bottom: 0;
}

/* BIOGRAFÍA */
.texto-largo.biografia {
    font-size: 1.06rem;
    line-height: 1.85;
    color: #444;
    text-align: justify;
}

.texto-largo.biografia p {
    margin: 0 0 16px;
}

.texto-largo.biografia p:last-child {
    margin-bottom: 0;
}

/* TEXTOS NORMALES */
.texto-largo.normal {
    font-size: 1.05rem;
    line-height: 1.8;
    text-align: justify;
}

.texto-largo.normal p {
    margin: 0 0 14px;
}

.texto-largo.normal p:last-child {
    margin-bottom: 0;
}

/* VIDEOS */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.video-card {
    background: #ffffff;
    border: 1px solid #dbe4ec;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.video-card h3 {
    margin: 0 0 14px;
    font-size: 1.05rem;
    color: #1E3A5F;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

.video-card video {
    width: 100%;
    display: block;
    border-radius: 8px;
    background: #000;
}

.video-card-single {
    max-width: 950px;
}

/* GALERÍA */
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.galeria-item {
    margin: 0;
    background: #ffffff;
    border: 1px solid #dbe4ec;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.galeria-item:hover {
    transform: translateY(-2px);
    border-color: #2C7DA0;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.galeria-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.galeria-item figcaption {
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #5a6472;
    text-align: center;
    font-weight: 600;
}

/* VOLVER ARRIBA */
.volver-wrapper {
    margin-top: 18px;
}

.volver-arriba {
    display: inline-block;
    text-decoration: none;
    color: #1E3A5F;
    font-weight: 700;
    transition: color 0.25s ease;
}

.volver-arriba:hover {
    color: #2C7DA0;
    text-decoration: underline;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .monografia-nav {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .bloque-header,
    .bloque-body {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.2rem;
    }

    .contenedor {
        padding: 20px;
    }

    .monografia-nav {
        grid-template-columns: 1fr;
    }

    .back-link {
        left: 20px;
        top: 105px;
    }

    .bloque-header,
    .bloque-body {
        padding: 18px;
    }

    .bloque-header h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .videos-grid,
    .galeria-grid {
        grid-template-columns: 1fr;
    }

    .indice-obra {
        padding: 16px;
    }

    .indice-item.nivel-1 {
        font-size: 1rem;
    }

    .indice-item.nivel-2,
    .indice-item.nivel-3,
    .indice-item.nivel-4 {
        font-size: 0.98rem;
    }

    .indice-item.nivel-2 {
        padding-left: 10px;
    }

    .indice-item.nivel-3 {
        padding-left: 20px;
    }

    .indice-item.nivel-4 {
        padding-left: 30px;
    }

    .texto-largo.referencias,
    .texto-largo.biografia,
    .texto-largo.normal {
        font-size: 1rem;
    }

    .texto-largo.referencias p:first-child,
    .texto-largo.biografia p,
    .texto-largo.normal p {
        text-align: left;
    }
}