/* Páginas hechas con el editor de secciones */
.cms-section {
    --section-color: var(--brand-section, #185fbf);
    padding: clamp(2.25rem, 4vw, 3.25rem) 0;
    scroll-margin-top: 90px;
    overflow-wrap: anywhere;
}

.cms-section h1:not(.page-prose *),
.cms-section h2:not(.page-prose *) {
    font-weight: 700;
    color: var(--text-dark);
}

.cms-section.is-color {
    background: var(--section-color);
    color: #fff;
}

.cms-section.is-color h1:not(.page-prose *),
.cms-section.is-color h2:not(.page-prose *),
.cms-section.is-color :not(.has-box) > .page-prose,
.cms-section.is-color :not(.has-box) > .page-prose a {
    color: #fff;
}

.cms-section :not(.has-box) > .page-prose {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.cms-section-image {
    display: block;
    width: 100%;
    max-height: 520px;
    border-radius: var(--el-border-radius);
    object-fit: cover;
}

.cms-section-button {
    margin-top: 1.25rem;
}

.cms-hero {
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.cms-hero h1,
.cms-hero h2 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.25rem);
    letter-spacing: -0.02em;
}

.cms-hero p {
    margin: 1rem 0 0;
    font-size: 1.2rem;
}

.cms-hero .cms-section-image {
    margin-top: 2rem;
}

.cms-hero.has-image {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    max-width: none;
    text-align: left;
}

.cms-hero.has-image .cms-section-image {
    margin-top: 0;
}

.cms-text.is-narrow {
    max-width: 760px;
    margin: 0 auto;
}

.cms-text.is-narrow.has-box {
    max-width: 52rem;
}

.cms-section-hero:has(.page-head):has(+ .cms-section-text .is-narrow.has-box) .page-head {
    max-width: 52rem;
    margin-right: auto;
    margin-left: auto;
}

.cms-text > h2,
.cms-media-text-body > h2 {
    margin: 0 0 1rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.cms-media-text {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}

.cms-media-text.no-image {
    grid-template-columns: minmax(0, 1fr);
}

.cms-media-text.is-image-left .cms-section-image {
    order: -1;
}

@media (max-width: 767.98px) {
    .cms-hero.has-image,
    .cms-media-text {
        grid-template-columns: minmax(0, 1fr);
    }

    .cms-media-text.is-image-left .cms-section-image {
        order: 0;
    }
}

/* El menú superior es fijo: la primera sección empieza debajo. */
.page-sections .main-wrapper-home {
    padding-top: 74px;
    background: transparent;
}

.cms-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin-bottom: 1.25rem;
}

.cms-section-head h2 {
    margin: 0;
    font-size: clamp(1.5rem, 2.4vw, 1.9rem);
    letter-spacing: -0.03em;
}

.cms-section.is-color .home-link {
    color: #fff;
}

.cms-section-empty {
    margin: 0;
    color: var(--text-gray);
    font-style: italic;
    text-align: center;
}

.cms-grid {
    display: grid;
    gap: 1rem;
}

.cms-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cms-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cms-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cms-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--el-border-radius);
    background: #fff;
    color: var(--text-dark);
    text-decoration: none;
}

.cms-card.is-link:hover {
    border-color: var(--accent-blue);
    color: var(--text-dark);
}

.cms-card h3 {
    margin: 0.75rem 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.cms-card p {
    margin: 0;
    color: var(--text-gray);
}

.cms-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.cms-cta {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.cms-cta h2 {
    margin: 0;
    font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.cms-cta p {
    margin: 0.75rem 0 0;
    font-size: 1.1rem;
}

.cms-photo {
    margin: 0;
}

.cms-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--el-border-radius);
    object-fit: cover;
}

.cms-photo figcaption {
    margin-top: 0.4rem;
    font-size: 0.9rem;
}

.cms-faq {
    max-width: 820px;
    margin: 0 auto;
}

.cms-faq details {
    margin-bottom: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--el-border-radius);
    background: #fff;
    color: var(--text-dark);
}

.cms-faq summary {
    padding: 0.85rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.cms-faq details p {
    margin: 0;
    padding: 0 1rem 1rem;
    color: var(--text-gray);
}

.cms-contact-alone {
    max-width: 760px;
    margin: 0 auto;
}

.cms-list {
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--el-border-radius);
    background: #fff;
    list-style: none;
    overflow: hidden;
}

.cms-list li + li {
    border-top: 1px solid var(--border-color);
}

.cms-list a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
}

.cms-list a:hover {
    background: var(--bg-gray);
}

.cms-list img {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 3rem;
    border-radius: var(--el-border-radius-min);
    object-fit: cover;
}

.cms-list-title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
}

.cms-list time {
    flex: 0 0 auto;
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Vista previa dentro del editor: se marca lo que se puede pulsar. */
.is-section-preview .cms-section {
    outline: 2px solid transparent;
    outline-offset: -2px;
    cursor: pointer;
}

.is-section-preview .cms-section:hover {
    outline-color: rgba(var(--brand-rgb, 29, 111, 224), 0.45);
}

.is-section-preview .cms-section.is-selected {
    outline-color: var(--brand, #1d6fe0);
}

.is-section-preview .cms-section a,
.is-section-preview .cms-section input,
.is-section-preview .cms-section textarea,
.is-section-preview .cms-section button {
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .cms-grid-3,
    .cms-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .cms-grid-2,
    .cms-grid-3,
    .cms-grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .cms-list time {
        display: none;
    }
}

/* Mismo aspecto que las páginas fijas de la web */
.cms-section:has(> .home-hero) {
    padding: 0;
}

.cms-section .home-hero {
    padding: 40px 0 44px;
}

.cms-section .home-hero .home-hero-title {
    color: inherit;
}

.page-sections .breadcrumb-custom {
    padding-top: 18px;
}


.cms-section-hero:has(.page-head) {
    padding: 0.25rem 0 0;
}

.cms-section-news,
.cms-section-programs,
.cms-section-videos,
.cms-section-quick-links {
    padding: 2.25rem 0;
}

.cms-section-cards:has(.interest-card) {
    padding: 1.75rem 0 0.25rem;
}

.cms-section-news-archive,
.cms-section-programs-archive,
.cms-section-videos-archive {
    padding: 0 0 2.75rem;
}

.cms-section-contact:has(> .site-contact) {
    padding: 0 0 2.75rem;
}

.cms-section-hero:has(.page-head) + .cms-section-contact {
    padding-top: 0;
}

.cms-section-hero.is-first-head {
    padding-top: 22px;
}

.cms-section-hero:has(.page-head) + .cms-section-text:has(.has-box) {
    padding-top: 0;
}

.cms-section-text:has(.has-box) {
    padding-bottom: 2.75rem;
}

.cms-section-companies {
    padding: 0 0 2.75rem;
}

.cms-section-text:has(.has-box):has(+ .cms-section-companies) {
    padding-bottom: 1rem;
}

.is-section-preview .cms-section.is-hidden-section {
    opacity: 0.4;
}

.contact-legal > :last-child {
    margin-bottom: 0;
}

/* Hoja blanca detrás de la portada grande (Diseño de la web → Acabados). */
.home-sheet .cms-section:not(.is-color) {
    background: transparent;
}

.home-sheet .cms-section {
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(0.25rem, 1.5vw, 0.75rem);
}

.home-sheet .cms-section + .cms-section {
    border-top: 1px solid #eef0f4;
}

.home-sheet .cms-section.is-color {
    border-radius: var(--site-radius-sm, 12px);
}

.home-sheet .cms-section > .container {
    max-width: none;
}

/* Botón sobre fondo de color: blanco con el texto en el color principal. */
.home-btn-on-color {
    background: #fff;
    color: var(--brand, #1d6fe0);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.15);
}

.home-btn-on-color:hover {
    background: #f0f5ff;
    color: var(--brand-hover, #185fbf);
}

/* Portada de sección (Emergencias): destacadas, accesos y lo último. */
.section-hub {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-hub-pinned {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid #f3c4c9;
    border-radius: 16px;
    background: #fff7f8;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.section-hub-pinned:hover {
    border-color: #e32636;
    box-shadow: 0 8px 22px rgba(227, 38, 54, 0.12);
    color: inherit;
}

.section-hub-pinned-media {
    flex: 0 0 180px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 10px;
}

.section-hub-pinned-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.section-hub-pinned-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
}

.section-hub-pinned-body strong {
    font-size: 1.1rem;
    line-height: 1.3;
}

.section-hub-pinned-text {
    color: #667085;
    font-size: 0.9rem;
}

.section-hub-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.section-hub-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 1rem 0.75rem;
    border: 1px solid #e4e8ef;
    border-radius: 14px;
    background: #fff;
    color: inherit;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.section-hub-tile:hover {
    border-color: #e32636;
    transform: translateY(-2px);
    color: inherit;
}

.section-hub-tile i {
    color: #e32636;
    font-size: 1.6rem;
}

.section-hub-tile span {
    color: #667085;
    font-size: 0.82rem;
}

.section-hub-latest ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-hub-latest li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eef0f4;
}

.section-hub-latest li a {
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.section-hub-latest li a:hover {
    color: #e32636;
}

.section-hub-latest time {
    flex: 0 0 auto;
    color: #98a2b3;
    font-size: 0.8rem;
}

.section-hub-tag {
    flex: 0 0 auto;
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
}

.section-hub-tag.is-news {
    background: #eef0f4;
    color: #475467;
}

.section-hub-tag.is-event {
    background: #fdecee;
    color: #b42318;
}

.section-hub-tag.is-video {
    background: #e8f1fd;
    color: #1557b0;
}

@media (max-width: 767.98px) {
    .section-hub-pinned {
        flex-wrap: wrap;
    }

    .section-hub-pinned-media {
        flex-basis: 100%;
    }

    .section-hub-pinned-btn {
        display: none;
    }

    .section-hub-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-hub-latest li {
        flex-wrap: wrap;
        gap: 0.25rem 0.6rem;
    }

    .section-hub-latest li a {
        flex-basis: 100%;
        order: 3;
    }
}
