:root {
    --cUnit: calc(0.75 * (1vw + 1svh));

    --cFontSize: clamp(15px, calc(1.5 * var(--cUnit)), 24px);
    --cBorderSize: calc(4.0 * 0.0625 * var(--cUnit));
    --cRadius: calc(0.25 * var(--cUnit));

    --cWhite: #FFFFFF;
    --cDark: #262626;
    --cSky: #58b4c3;

    --cYellow: #fbcd22;
    --cGold: #c8960e;
    --cLightGold: #efc300;

    --cShieldBlue: #57c0d1;

    --cSunLarge: #eee53c;
    --cMoonLarge: #c3e1df;
    --cSunSmall: #fac900;
    --cMoonSmall: #2eafb2;
}

* {
    box-sizing: border-box;
    font-family: sans-serif;
}

html {
    font-size: var(--cFontSize);
}

body {
    margin: 0;
    background-color: var(--cBackground);
    color: var(--cText);
    font-size: var(--cFontSize);
}

h1 {
    text-align: center;
    font-size: calc(2 * var(--cFontSize));
}

h2 {
    text-align: center;
    font-size: calc(1.75 * var(--cFontSize));
}

h3 {
    text-align: center;
    font-size: calc(1.5 * var(--cFontSize));
}

/* CABECERA */

header {
    width: 87.5%;
    margin: 1.5625% auto;
    display: flex;
    align-items: center;
    gap: 3.125%;
}

/* LOGO */

.logo {
    flex: 0 0 12.5%;
    display: block;
}

.logo img {
    display: block;
    width: 100%;
    height: auto;
}

/* NAVEGACIÓN */

header nav {
    flex: 1;
    min-width: 0;
    padding: calc(0.5 * var(--cUnit));
    background-color: var(--cMenu);
    border-radius: var(--cRadius);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav > ul {
    display: flex;
    flex-flow: row wrap;
    align-items: stretch;
    gap: calc(0.5 * var(--cUnit));
}

nav li {
    position: relative;
}

nav a {
    display: block;
    padding: calc(1.5 * var(--cUnit)) calc(2 * var(--cUnit));
    color: var(--cMenuText);
    text-decoration: none;
    font-size: var(--cFontSize);
    border-radius: var(--cRadius);
    white-space: normal;
    transition: background-color 0.2s;
}

/* CATEGORÍAS PRINCIPALES */

nav > ul > li > a {
    font-weight: bold;
}

/* SUBMENÚS */

nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    min-width: 100%;
    width: max-content;
    padding: calc(0.5 * var(--cUnit));
    flex-direction: column;
    background-color: var(--cSubmenu);
    border-radius: var(--cRadius);
}

nav ul ul a {
    font-size: calc(0.875 * var(--cFontSize));
    font-weight: normal;
    padding: calc(1.25 * var(--cUnit)) calc(1.5 * var(--cUnit));
}

/* APERTURA Y ÉNFASIS */

nav li.is-open > ul {
    display: flex;
}

nav > ul > li > a:hover,
nav > ul > li > a:focus-visible {
    background-color: var(--cMainHover);
}

nav ul ul a:hover,
nav ul ul a:focus-visible {
    background-color: var(--cSubHover);
}

/* HOVER EN DISPOSITIVOS QUE LO ADMITEN */

@media (hover: hover) {
    nav li:hover > ul {
        display: flex;
    }
}

/* TEMAS */

@media (prefers-color-scheme: light) {
    :root {
        --cBackground: var(--cWhite);
        --cText: var(--cDark);

        --cMenu: var(--cSky);
        --cMenuText: var(--cDark);
        --cMainHover: rgb(38 38 38 / 25%);
        --cSubmenu: rgb(87 192 209 / 93.75%);
        --cSubHover: rgb(38 38 38 / 25%);

        --cFooter: var(--cWhite);
        --cFooterText: var(--cDark);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --cBackground: var(--cDark);
        --cText: var(--cWhite);

        --cMenu: var(--cDark);
        --cMenuText: var(--cWhite);
        --cMainHover: rgb(200 150 14 / 75%);
        --cSubmenu: rgb(88 180 195 / 93.75%);
        --cSubHover: rgb(200 150 14 / 75%);
        --cFooter: var(--cDark);
        --cFooterText: var(--cWhite);
    }
}

/* BLOQUES DE CONTENIDO */

.container {
    width: 93.75%;
    margin: 1.5625% auto;
    padding: 1.5625%;
    justify-content: center;
    align-items: center;
    border-radius: var(--cRadius);
}

.container img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin-inline: auto;
}

/* garantizar contraste en modo claro y oscuro */
.container {
    color: var(--cDark);
}

.container a {
    color: #0b4f6c;
    font-weight: 600;
}


/* FOOTER */

footer {
    width: 87.5%;
    max-width: 100%;
    margin: 1.5625% auto 0;
    padding: 3.125%;
    background-color: var(--cFooter);
    color: var(--cFooterText);
    border-top: var(--cBorderSize) solid var(--cGold);
    border-radius: var(--cRadius) var(--cRadius) 0 0;
    overflow-wrap: anywhere;
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 3.125%;
    min-width: 0;
}

.footer-info > div {
    flex: 1 1 25%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: calc(0.5 * var(--cUnit));
}

.footer-info a {
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.footer-info a:hover {
    text-decoration: underline;
}

.footer-school strong {
    font-size: calc(1.125 * var(--cFontSize));
}

/* REDES SOCIALES */

.footer-social {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3.125%;
    margin-top: 3.125%;
}

.footer-social a {
    display: block;
    flex: 0 0 calc(2 * var(--cUnit));
    aspect-ratio: 1;
    transition: transform 0.2s, filter 0.2s;
}

.footer-social img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (hover: hover) {
    .footer-social a:hover {
        transform: scale(1.125);
        filter: brightness(1.2);
    }
}

.footer-social a:focus-visible {
    outline: var(--cBorderSize) solid var(--cGold);
    outline-offset: var(--cUnit);
}

/* DISPOSITIVOS EN PORTRAIT */

@media (orientation: portrait) {
    .footer-info {
        flex-direction: column;
        gap: calc(2 * var(--cUnit));
    }

    .footer-info > div {
        width: 100%;
    }

    .footer-social {
        gap: 6.25%;
    }
}




/* CONTENEDORES ADAPTABLES */

.adaptCont {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 1.5625%;
    width: 100%;
    min-width: 0;
}

.adaptItem {
    min-width: 0;
}

/* DISPOSICIÓN VERTICAL */

@media (orientation: portrait) {
    .adaptCont {
        grid-auto-flow: row;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        justify-content: center;
    }

    .adaptItem {
        grid-column: span 3;
    }

    .adaptItem:last-child:nth-child(odd) {
        grid-column: 2 / span 4;
    }
}




/* ANIMACIÓN DE NAVEGACIÓN */

.container {
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

.container.is-active {
    opacity: 1;
    transform: translateY(0);
}

.container:not(.is-active) {
    opacity: 0.85;
    transform: translateY(calc(0.25 * var(--cUnit)));
}

@media (prefers-reduced-motion: reduce) {
    .container {
        transition: none;
        transform: none;
    }
}


/* Videos */
.video {
  width: 100%;
  max-width: 900px; /* opcional: evita que se haga enorme en pantallas grandes */
  aspect-ratio: 16 / 9;
  margin-inline: auto;
}

.video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}


/* UTILIDADES DE PALETA INSTITUCIONAL */
.bg-white      { background-color: var(--cWhite); }
.bg-sky        { background-color: var(--cSky); }
.bg-yellow     { background-color: var(--cYellow); }
.bg-gold       { background-color: var(--cGold); }
.bg-light-gold { background-color: var(--cLightGold); }
.bg-shield     { background-color: var(--cShieldBlue); }
.bg-sun-large  { background-color: var(--cSunLarge); }
.bg-moon-large { background-color: var(--cMoonLarge); }
.bg-sun-small  { background-color: var(--cSunSmall); }
.bg-moon-small { background-color: var(--cMoonSmall); }

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

/* TARJETAS DE DOCUMENTOS */
.doc-card a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: calc(1 * var(--cUnit));
}

.doc-icon {
    width: 25%;
    height: auto;
}

/* PUBLICACIONES Y REDES */
.publicacion {
    background-color: rgb(255 255 255 / 45%);
    padding: calc(2 * var(--cUnit));
    border-radius: var(--cRadius);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: calc(1 * var(--cUnit));
    text-align: center;
}

.instagram-embed {
    width: 100%;
    overflow-x: auto;
}

.youtube-logo {
    font-size: calc(2 * var(--cFontSize));
    color: #c4302b;
    line-height: 1;
}

.img-destacada {
    width: 75%;
    margin-top: calc(1.5 * var(--cUnit));
    border-radius: var(--cRadius);
}

.btn-link {
    display: inline-block;
    margin-top: calc(0.5 * var(--cUnit));
    padding: calc(0.75 * var(--cUnit)) calc(1.5 * var(--cUnit));
    background-color: var(--cDark);
    color: var(--cWhite) !important;
    text-decoration: none;
    border-radius: var(--cRadius);
}

.instagram-embed iframe,
.instagram-media {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}
