:root {
    --color-edificio: #1a1e26;
    --color-logo-rojo: #b21f2d;
    --color-logo-verde: #008751;
    --texto-claro: #ffffff;
    --texto-gris: #555555;
    --bg-gris-claro: #f4f4f4;
    --fuente-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--fuente-principal);
    color: var(--color-edificio);
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background-color: var(--color-edificio);
    color: var(--texto-claro);
    padding: 1.5rem 5%;
    text-align: center;
    border-bottom: 4px solid var(--color-logo-verde);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.escudo-placeholder {
    width: 70px;
    height: 80px;
    overflow: hidden;
    border-radius: 16px;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.escudo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

header h1 {
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

header p {
    font-size: 1rem;
    letter-spacing: 3px;
    opacity: 0.8;
}

/* --- NAVEGACIÓN --- */
nav {
    position: relative;
    background-color: #fff;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
}

.nav-item {
    position: relative;
}

.dropbtn {
    background: none;
    border: none;
    color: var(--color-edificio);
    font: inherit;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    min-width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 16px 30px rgba(0,0,0,0.12);
    padding: 0.75rem 0;
    z-index: 20;
    flex-direction: column;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.2rem;
    color: var(--color-edificio);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: none;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
    background: rgba(26, 30, 38, 0.05);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    display: flex;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 28px;
    height: 2px;
    background: var(--color-edificio);
    margin: 6px auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

nav a {
    text-decoration: none;
    color: var(--color-edificio);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--color-logo-rojo);
}

nav a.active {
    border-bottom: 2px solid var(--color-logo-rojo);
}

/* --- HERO --- */
.hero {
    position: relative;
    height: 450px;
    background: linear-gradient(rgba(26, 30, 38, 0.7), rgba(26, 30, 38, 0.7)), 
                url('https://images.unsplash.com/photo-1523050854058-8df90110c9f1?auto=format&fit=crop&q=80&w=1920');
    background-size: cover;
    background-position: center;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 0 10%;
    color: white;
}

.hero-text h2 {
    font-size: 3rem;
    max-width: 600px;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-text span {
    display: block;
    font-weight: 300;
}

.hero-text p {
    font-size: 1rem;
    max-width: 520px;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero-image img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(0,0,0,0.3);
}

.btn-explora {
    background-color: var(--color-logo-rojo);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    transition: transform 0.3s, background 0.3s;
    display: inline-block;
}

.btn-explora:hover {
    background-color: #8e1825;
    transform: scale(1.05);
}

/* --- SECCIONES PRINCIPALES --- */
.section-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-edificio);
    border-bottom: 4px solid var(--color-logo-verde);
    display: inline-block;
}

.section-content {
    padding: 4rem 10%;
}

.section-content:nth-child(even) {
    background-color: var(--bg-gris-claro);
}

.section-content p {
    max-width: 740px;
    color: var(--texto-gris);
    margin-bottom: 1.5rem;
}

.text-image {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 3rem;
}

.text-image img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(0,0,0,0.12);
    object-fit: cover;
    min-height: 320px;
}

.text-image .cards {
    margin-top: 3rem;
}

/* --- CARDS --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 28px;
    width: min(100%, 1280px);
    margin: 2rem auto 0;
    justify-content: center;
}

.card {
    background: white;
    border-radius: 14px;
    padding: 1.8rem;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 4px solid transparent;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(0,0,0,0.12);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--color-edificio);
}

.card p {
    color: var(--texto-gris);
    line-height: 1.75;
}

.card-red  { border-top-color: #F05454; }
.card-red h3  { color: #F05454; }

.card-green { border-top-color: #008C1A; }
.card-green h3 { color: #008C1A; }

.card-gray  { border-top-color: #706B6B; }
.card-gray h3  { color: #706B6B; }

.card-black { border-top-color: #000000; }
.card-black h3 { color: #000000; }

.card-stack {
    display: grid;
    gap: 30px;
}

/* --- NOSOTROS --- */
.nosotros-text-full {
    max-width: 100%;
    margin-bottom: 2.5rem;
}

.nosotros-text-full p {
    max-width: 100%;
    margin-bottom: 1.5rem;
}

.nosotros-text p {
    max-width: none;
}

.nosotros-layout {
    display: block;
    width: 100%;
    max-width: 1280px;
    gap: 0;
    margin: 3rem auto 0;
}

.nosotros-layout .cards-grid {
    display: grid;
    width: 100%;
    margin: 0 auto;
    gap: 30px;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
}

.nosotros-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 30px;
    align-items: stretch;
    margin-bottom: 3rem;
}

.nosotros-card-grid .card {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.card-history {
    justify-content: space-between;
}

/* --- INSTITUCIONAL --- */
.institucional-layout {
    display: block;
    width: 100%;
    max-width: 1280px;
    margin: 2rem auto 0;
}

.institucional-left {
    min-width: 0;
}

.autoridades-card {
    padding: 1.6rem;
}

.autoridades-card ul {
    margin-top: 0.75rem;
    list-style: none;
    padding-left: 0;
    color: var(--texto-gris);
    line-height: 1.6;
}

.autoridades-card li + li {
    margin-top: 0.5rem;
}

.autoridades-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 50vw;
    gap: 24px;
    width: 100%;
    max-width: 1280px;
    margin: 1.5rem auto 0;
    align-items: center;
}

.autoridades-video video {
    width: 100%;
    height: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: 12px;
}

/* --- ACADEMICO / PROPUESTAS PEDAGOGICAS --- */
.academico-media {
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 1px;
}

.academico-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

/* --- VIDEO --- */
.video-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 1.5rem;
}

.video-container video {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(0,0,0,0.12);
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: white;
    border-radius: 18px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.25);
    position: relative;
    padding: 2rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--color-edificio);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal h3 {
    margin-bottom: 1rem;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 5rem);
    line-height: 1.75;
    color: var(--texto-gris);
}

.modal-body p {
    margin-bottom: 1rem;
}

.history-open-button {
    margin-top: auto;
    background: transparent;
    border: 1px solid rgba(26, 30, 38, 0.2);
    color: var(--color-edificio);
    padding: 0.8rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
    font-weight: 600;
}

.history-open-button:hover {
    background: rgba(178, 31, 45, 0.08);
    transform: translateY(-1px);
}

/* --- ADMISIONES --- */
.admisiones-intro {
    max-width: 740px;
    color: var(--texto-gris);
    margin-bottom: 2rem;
}

.admisiones-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
}

.admisiones-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-documento {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-family: var(--fuente-principal);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background-color: var(--color-edificio);
    color: #fff;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

.btn-documento .btn-ico {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    transition: background-color 0.22s ease;
}

.btn-documento:nth-child(odd)  { border-left: 4px solid var(--color-logo-rojo); }
.btn-documento:nth-child(even) { border-left: 4px solid var(--color-logo-verde); }

.btn-documento:nth-child(odd)  .btn-ico { background-color: var(--color-logo-rojo); }
.btn-documento:nth-child(even) .btn-ico { background-color: var(--color-logo-verde); }

.btn-documento:nth-child(odd):hover {
    background-color: var(--color-logo-rojo);
    box-shadow: 0 10px 24px rgba(178,31,45,0.30);
    transform: translateY(-3px);
}
.btn-documento:nth-child(even):hover {
    background-color: var(--color-logo-verde);
    box-shadow: 0 10px 24px rgba(0,135,81,0.30);
    transform: translateY(-3px);
}

.btn-documento:nth-child(odd):hover  .btn-ico,
.btn-documento:nth-child(even):hover .btn-ico {
    background-color: rgba(255,255,255,0.18);
}

.admisiones-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 16px 35px rgba(0,0,0,0.12);
    max-height: 320px;
}

/* --- NOTICIAS --- */
.card-news {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 1.5rem;
}

.news-item {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.news-item:hover {
    transform: translateY(-4px);
}

.news-item img {
    width: 100%;
    display: block;
    height: 180px;
    object-fit: cover;
}

.news-item-content {
    padding: 1.3rem;
}

.news-item-content h4 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.news-item-content p {
    color: var(--texto-gris);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --- CONTACTO --- */
.contact-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 30px;
    margin-top: 2rem;
}

.contact-card {
    background: white;
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.contact-card h4 {
    margin-bottom: 1rem;
    color: var(--color-edificio);
}

.contact-card p,
.contact-card a {
    color: var(--texto-gris);
    display: block;
    margin-bottom: 0.75rem;
    text-decoration: none;
}

.map-placeholder {
    width: 100%;
    height: 320px;
    border-radius: 14px;
    background-image: url('img/portada.jpg');
    background-size: cover;
    background-position: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}
footer {
    background-color: var(--color-edificio);
    color: white;
    padding: 3rem 10% 1rem;
    margin-top: 2rem;
}
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 2rem;
}

.footer-info h4 {
    color: var(--color-logo-verde);
    margin-bottom: 1rem;
}

.footer-info p {
    margin-bottom: 0.65rem;
    color: #ddd;
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 0.8rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 0.95rem;
    transition: background 0.3s, transform 0.3s;
}

.social-link:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}

.copyright {
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    opacity: 0.6;
}

/* --- RESPONSIVE 1025px+ --- */
@media (min-width: 1025px) {
    .nosotros-layout {
        grid-template-columns: 1.5fr 1fr;
    }

    .cards-grid {
        grid-template-columns: repeat(3, minmax(240px, 1fr));
        gap: 32px;
        width: min(100%, 1280px);
        margin: 2rem auto 0;
        justify-content: center;
    }

    .video-container {
        align-self: center;
        padding-top: 1.5rem;
    }
}

/* --- RESPONSIVE 1024px --- */
@media (max-width: 1024px) {
    .text-image,
    .card-news,
    .cards {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .nosotros-card-grid {
        grid-template-columns: 1fr;
    }

    .autoridades-row {
        grid-template-columns: 1fr;
    }

    .autoridades-video video {
        max-width: 100%;
        max-height: 320px;
    }

    .nosotros-layout {
        grid-template-columns: 1fr;
        margin: 2rem auto 0;
        padding: 0;
    }

    .nosotros-layout .cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        max-width: 860px;
        margin: 2rem auto 0;
        padding: 0;
        justify-items: center;
    }

    .nosotros-layout .cards-grid .card {
        width: 100%;
        max-width: 760px;
    }

    .academico-media {
        width: 100%;
    }

    .academico-media img {
        min-height: 320px;
    }

    .admisiones-layout {
        grid-template-columns: 1fr;
    }

    .admisiones-imagen {
        order: -1;
    }

    .admisiones-imagen img {
        max-height: 260px;
    }
}

/* --- RESPONSIVE 768px --- */
@media (max-width: 768px) {
    nav {
        justify-content: space-between;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
        margin-top: 10px;
        gap: 0;
        background: #fff;
        padding: 1rem 0;
        border-top: 1px solid rgba(0,0,0,0.06);
    }

    nav.open .nav-links {
        display: flex;
    }

    nav.open .nav-toggle span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    nav.open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    nav.open .nav-toggle span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-links a {
        width: 100%;
        padding: 12px 16px;
        text-align: center;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        justify-content: center;
    }

    .nav-item {
        width: 100%;
        text-align: center;
    }

    .dropbtn {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
    }

    .dropdown-menu {
        position: relative;
        top: 0;
        left: 0;
        box-shadow: none;
        padding: 0;
        background: transparent;
        align-items: center;
        text-align: center;
    }

    .dropdown-menu a {
        padding: 0.8rem 0;
        width: 100%;
        text-align: center;
    }

    .hero {
        padding-left: 5%;
        padding-right: 5%;
        height: auto;
        min-height: 420px;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .text-image {
        grid-template-columns: 1fr;
    }

    .section-content {
        padding: 2.5rem 6%;
    }

    .cards,
    .card-news {
        gap: 18px;
    }

    .modal {
        padding: 1.5rem;
        max-height: 90vh;
    }

    .modal-body {
        max-height: calc(90vh - 5rem);
    }

    .admisiones-buttons {
        grid-template-columns: 1fr;
    }

    /* --- PROPUESTAS PEDAGOGICAS RESPONSIVE --- */
    #academico .nosotros-layout {
        margin: 1rem auto 0;
        width: 100%;
        padding: 0;
    }

    #academico .cards-grid {
        grid-template-columns: 1fr;
        width: 100%;
        margin: 1rem auto 0;
        padding: 0;
        justify-items: center;
    }

    #academico .card {
        width: 90%;
        max-width: 420px;
    }
}

