@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta monocromática */
    --pia-1: #111111; /* texto principal */
    --pia-2: #222222; /* acento oscuro */
    --pia-3: #f4f4f4; /* fondo claro */
    --pia-4: #e0e0e0; /* fondo medio */
    --pia-5: #ffffff; /* blanco puro */
    --pia-6: #666666; /* texto secundario */
}

html {
    height: 100%;
}

body {
    min-height: 100vh;
    font-family: Arial, sans-serif;
    font-size: clamp(12px, 1.05vw, 14px);
    line-height: 1.6;
    color: var(--pia-1);
    background-color: var(--pia-3);
    background-image: url('../images/educacion-concepto-de-los-ninos.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed; /* efecto hero que cubre toda la pantalla */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 14px;
    overflow-y: auto;
    overflow-x: hidden; /* evita scroll horizontal por 100vw */
}

.page-header {
    width: min(100%, 1100px);
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

.page-title {
    font-family: 'Poppins', Arial, sans-serif;
    font-size: clamp(2.2rem, 4vw, 2.8rem);
    letter-spacing: 0.08em;
    color: var(--pia-5);
    text-transform: uppercase;
    width: 100%;
    margin: 0;
}

.page-title-img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 18px;
}

.accordion-section {
    width: min(100%, 1100px);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.accordion-item {
    border: 1px solid var(--pia-3);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.accordion-item:last-child {
    margin-bottom: 0;
}

.accordion-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.accordion-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--pia-3) 0%, var(--pia-4) 100%);
    transition: all 0.3s ease;
    user-select: none;
}

.accordion-header:hover { background: linear-gradient(135deg, var(--pia-4) 0%, var(--pia-3) 100%); }

.accordion-icon {
    font-size: 1.2em;
    margin-right: 15px;
    color: var(--pia-1);
    transition: transform 0.3s ease;
    min-width: 20px;
}

.accordion-title {
    color: var(--pia-1);
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
    flex: 1;
}

.accordion-content {
    height: 0;
    overflow: hidden;
    padding: 0 18px;
    opacity: 0;
    transition: height 0.35s ease, opacity 0.25s ease;
    will-change: height;
    background-color: transparent;
}

.accordion-content.show {
    opacity: 1;
    padding: 16px 18px;
}

.accordion-content p {
    color: var(--pia-1);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    text-align: justify;
    text-wrap: pretty;
}

.resolutions-content p + p,
.resolutions-content ul + p {
    margin-top: 14px;
}

.resolutions-content p + ul {
    margin-top: 0;
}

.resolutions-content p + ul.sub-follow.open {
    margin-top: 8px;
}

.accordion-content ul.sub-follow {
    margin-top: 0;
    margin-bottom: 0;
}

.accordion-content ol,
.accordion-content ul {
    padding-left: 18px;
    margin: 10px 0 0 0;
}

.accordion-content li {
    margin-bottom: 4px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.video-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-frame {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(224, 224, 224, 0.88));
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pia-1);
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
}

.video-frame:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(230, 230, 230, 0.95));
    transform: scale(1.02);
}

.video-caption {
    text-align: left;
    color: var(--pia-6);
    font-size: 0.95em;
    line-height: 1.4;
    min-height: 2.2em; /* reserva espacio para futuras descripciones */
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.pdf-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.pdf-item:hover {
    background-color: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.pdf-icon {
    font-size: 2.5em;
    margin-right: 20px;
    color: #d93025;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.pdf-item:hover .pdf-icon {
    color: var(--pia-2);
    transform: scale(1.1);
}

.pdf-name {
    font-weight: bold;
    color: var(--pia-1);
}

/* Spacing when PDF grid appears inside accordion content */
.accordion-content .pdf-grid {
    margin-top: 8px;
}

/* Folders grid inside Material Didáctico */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.folder-item:hover {
    background-color: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* (Nivel Inicial) reverted: removed inline file list styles */

/* Sub-toggles inside Resoluciones paragraphs */
.sub-icon {
    display: inline-block;
    width: 1em;
    margin-right: 8px;
    color: var(--pia-6);
    font-weight: bold;
    user-select: none;
    cursor: pointer;
}

.sub-toggle { cursor: pointer; }

/* Smooth open/close for paragraph details */
.sub-content {
    display: block;           /* allow height animation */
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.sub-content.open {
    max-height: 1000px;       /* sufficiently large */
    opacity: 1;
    margin-top: 6px;
}

/* Any block that follows the paragraph (like UL or PDF grid) should animate too */
.sub-follow {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
}
.sub-follow.open {
    max-height: 2000px;
    opacity: 1;
    margin-top: 8px;
}

.sub-follow.open.pdf-spacing {
    margin-bottom: 18px;
}

.drive-icon-img {
    width: 28px;
    height: 28px;
    margin-right: 8px;
    vertical-align: middle;
}

.folder-name {
    font-weight: bold;
    color: var(--pia-1);
}

@media (max-width: 768px) {
    body {
        background-position: center top;
        padding: 14px 12px;
        gap: 10px;
        min-height: auto;
    }

    .page-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        z-index: 10;
    }

    .page-title {
        font-size: inherit;
        letter-spacing: normal;
        text-align: center;
    }

    .page-title-img {
        width: 100%;
        border-radius: 0;
    }

    .accordion-section {
        margin-top: 110px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .pdf-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

}

/* Desktop-specific tweaks */
@media (min-width: 769px) {
    .accordion-section {
        padding: 32px;
    }
}
