/*
 * Componentes del home — Gobernación del Magdalena
 * Tokens: magdalena.min.css (--mg-*). Diseño: "web gobernacion.pdf", página 1.
 * Mobile first.
 */

.mgh-home {
    --mg-home-ink: #58595B;
    --mg-home-card-border: #E6E7E8;
    --mg-home-news-bg: #E1F3FD;
    --mg-home-max: 1200px;
    font-family: var(--mg-font-sans);
    box-sizing: border-box;
}

.mgh-home *,
.mgh-home *::before,
.mgh-home *::after {
    box-sizing: inherit;
}

.mgh-home :focus-visible {
    outline: 3px solid var(--mg-primary);
    outline-offset: 3px;
}

/* ---------------------------------------------------------------
   Diseño 2026: caja invisible centrada (1200px de contenido)
   Fondos de sección a todo el ancho; el contenido (GOV.CO, logo+menú,
   banner, secciones y pie) siempre dentro de la caja.
   --------------------------------------------------------------- */

body.mg-2026 {
    --mgh-box: 1200px;
    --mgh-gutter: 16px;
}

@media (min-width: 768px) {
    body.mg-2026 {
        --mgh-gutter: 24px;
    }
}

body.mg-2026 .gov-bar-inner,
body.mg-2026 #Top_bar > .container,
body.mg-2026 #Footer > .container,
body.mg-2026 #Footer .footer_copy > .container,
body.mg-2026 .the_content .section_wrapper {
    width: 100% !important;
    max-width: calc(var(--mgh-box) + 2 * var(--mgh-gutter)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: var(--mgh-gutter) !important;
    padding-right: var(--mgh-gutter) !important;
    box-sizing: border-box;
}

body.mg-2026 .the_content .the_content_wrapper {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* logo pegado al borde izquierdo de la caja (Be le da padding propio) */
body.mg-2026 #Top_bar .column.one,
body.mg-2026 #Top_bar .top_bar_left {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

body.mg-2026 #Top_bar .logo {
    margin-left: 0;
    padding-left: 0;
}

/* ---------------------------------------------------------------
   Título de sección: "Anuncios y destacados"
   --------------------------------------------------------------- */

.mgh-section-title {
    margin: 0 0 24px;
    text-align: center;
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 400;
    line-height: 1.25;
    color: var(--mg-home-ink);
    letter-spacing: 0;
}

.mgh-section-title strong {
    font-weight: 700;
}

/* ---------------------------------------------------------------
   Pestañas + tarjetas de acceso rápido
   --------------------------------------------------------------- */

.mgh-tabs {
    max-width: var(--mg-home-max);
    margin: 0 auto;
}

.mgh-tabs__list {
    display: flex;
    gap: 8px 28px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px 20px;
    padding: 4px 16px;
    scroll-snap-type: x proximity;
}

.mgh-tabs__list::-webkit-scrollbar {
    display: none;
}

.mgh-tabs__tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    appearance: none;
    background: none;
    border: 0;
    margin: 0;
    padding: 6px 0;
    font: 400 18px/1.2 var(--mg-font-sans);
    color: var(--mg-home-ink);
    cursor: pointer;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}

.mgh-tabs__tab:hover {
    color: var(--mg-purple);
}

.mgh-tabs__tab[aria-selected="true"] {
    font-weight: 700;
    color: var(--mg-purple);
}

.mgh-tabs__panel[hidden] {
    display: none;
}

.mgh-tabs__panel:not([hidden]) {
    animation: mgh-fade .25s ease-out;
}

@keyframes mgh-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.mgh-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mgh-cards > li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mgh-card {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 100%;
    min-height: 92px;
    padding: 14px 14px 12px;
    border: 3px solid var(--mg-home-card-border);
    border-radius: 18px;
    background: #fff;
    color: var(--mg-home-ink);
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}

.mgh-card:hover,
.mgh-card:focus-visible {
    border-color: var(--mg-primary-200);
    box-shadow: var(--mg-shadow-lg);
    transform: translateY(-2px);
    color: var(--mg-home-ink);
    text-decoration: none;
}

.mgh-card__ico {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    color: #C8CACC;
    transition: color .2s;
}

.mgh-card:hover .mgh-card__ico,
.mgh-card:focus-visible .mgh-card__ico {
    color: var(--mg-primary);
}

.mgh-card__text {
    display: flex;
    flex-direction: column;
    padding-right: 4px;
}

.mgh-card__small {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.mgh-card__big {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
}

@media (min-width: 600px) {
    .mgh-tabs__list {
        justify-content: center;
        margin: 0 0 32px;
        padding: 4px 0;
    }

    .mgh-tabs__tab {
        font-size: 22px;
    }

    .mgh-cards {
        gap: 16px;
    }

    .mgh-card {
        min-height: 104px;
        padding: 18px 20px 14px;
    }

    .mgh-card__ico {
        width: 36px;
        height: 36px;
        top: 12px;
        right: 16px;
    }

    .mgh-card__small {
        font-size: 14px;
    }

    .mgh-card__big {
        font-size: 20px;
    }
}

@media (min-width: 900px) {
    .mgh-cards {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px 24px;
    }

    .mgh-tabs__tab {
        font-size: 24px;
    }

    .mgh-card__big {
        font-size: 22px;
    }
}

/* ---------------------------------------------------------------
   Noticias
   --------------------------------------------------------------- */

.mgh-news {
    position: relative;
    max-width: var(--mg-home-max);
    margin: 0 auto;
    padding: 32px 0;
}

/* fondo a todo el ancho aunque esté dentro de un contenedor de Be Theme */
.mgh-news--bg {
    background: var(--mg-home-news-bg);
    box-shadow: 0 0 0 100vmax var(--mg-home-news-bg);
    clip-path: inset(0 -100vmax);
}

.mgh-news__grid {
    display: grid;
    gap: 16px;
}

.mgh-news__card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 18px;
    background: var(--mg-navy-800);
    color: #fff;
    text-decoration: none;
    isolation: isolate;
}

.mgh-news__card:hover,
.mgh-news__card:focus-visible {
    color: #fff;
    text-decoration: none;
}

.mgh-news__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.mgh-news__img--empty {
    background: var(--mg-gradient-primary);
}

.mgh-news__card:hover .mgh-news__img {
    transform: scale(1.04);
}

.mgh-news__card--big {
    aspect-ratio: 16 / 10;
}

.mgh-news__card--small {
    aspect-ratio: 16 / 10;
}

.mgh-news__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px;
    background: rgba(40, 40, 40, .72);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.mgh-news__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
}

.mgh-news__card--big .mgh-news__title {
    font-size: clamp(16px, 2.1vw, 26px);
    font-weight: 400;
    line-height: 1.3;
}

/* columna lateral: en móvil es una fila con scroll horizontal */
.mgh-news__side {
    position: relative;
    min-width: 0;
}

.mgh-news__viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 0 16px;
}

.mgh-news__viewport::-webkit-scrollbar {
    display: none;
}

.mgh-news__track {
    display: flex;
    gap: 12px;
}

.mgh-news__page {
    display: contents;
}

.mgh-news__page > .mgh-news__card {
    flex: 0 0 78%;
    scroll-snap-align: start;
}

.mgh-news__arrow {
    display: none;
}

@media (min-width: 600px) {
    .mgh-news__page > .mgh-news__card {
        flex-basis: 46%;
    }
}

@media (min-width: 900px) {
    .mgh-news {
        padding: 48px 0 40px;
    }

    .mgh-news__grid {
        grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
        gap: 40px;
        align-items: stretch;
    }

    .mgh-news__card--big {
        aspect-ratio: auto;
        min-height: 400px;
    }

    .mgh-news__card--big .mgh-news__caption {
        padding: 20px 24px;
    }

    .mgh-news__viewport {
        overflow: hidden;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .mgh-news__track {
        height: 100%;
        gap: 0;
        transition: transform .45s cubic-bezier(.22, .61, .36, 1);
    }

    .mgh-news__page {
        display: grid;
        grid-template-rows: 1fr 1fr;
        gap: 16px;
        flex: 0 0 100%;
    }

    .mgh-news__page > .mgh-news__card {
        aspect-ratio: auto;
        min-height: 0;
    }

    .mgh-news__arrow {
        position: absolute;
        top: 50%;
        z-index: 2;
        display: grid;
        place-items: center;
        width: 30px;
        height: 30px;
        margin: -15px 0 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #4D4D4D;
        color: #fff;
        cursor: pointer;
        transition: background .2s, opacity .2s;
    }

    .mgh-news__arrow svg {
        width: 18px;
        height: 18px;
    }

    .mgh-news__arrow:hover {
        background: var(--mg-primary);
    }

    .mgh-news__arrow[disabled] {
        opacity: .35;
        cursor: default;
        background: #4D4D4D;
    }

    .mgh-news__arrow--prev { left: -22px; }
    .mgh-news__arrow--next { right: -22px; }
}

/* Síguenos en */
.mgh-social {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.mgh-social__label {
    margin-right: 4px;
    font-size: 18px;
    font-weight: 500;
    color: var(--mg-home-ink);
}

.mgh-social__link {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--mg-primary);
    color: #fff;
    transition: background .2s, transform .2s;
}

.mgh-social__link svg {
    width: 16px;
    height: 16px;
}

.mgh-social__link:hover,
.mgh-social__link:focus-visible {
    background: var(--mg-purple);
    color: #fff;
    transform: translateY(-2px);
}

/* ---------------------------------------------------------------
   CTA (Boletines)
   --------------------------------------------------------------- */

.mgh-cta {
    display: grid;
    max-width: var(--mg-home-max);
    margin: 0 auto;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    background: var(--mg-primary);
}

.mgh-cta:hover,
.mgh-cta:focus-visible {
    color: #fff;
    text-decoration: none;
}

.mgh-cta__panel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 84px;
    padding: 14px 56px 14px 20px;
    background: var(--mg-primary);
}

.mgh-cta__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--mg-purple);
    color: var(--mg-yellow);
}

.mgh-cta__icon .mgh-ico {
    width: 26px;
    height: 26px;
}

.mgh-cta__title {
    font-size: clamp(26px, 3.4vw, 40px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.02em;
    color: var(--mg-yellow);
}

.mgh-cta__go {
    position: absolute;
    right: 16px;
    top: 50%;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    border-radius: 50%;
    background: #fff;
    color: var(--mg-primary);
    transition: transform .2s;
}

.mgh-cta__go svg {
    width: 18px;
    height: 18px;
}

.mgh-cta:hover .mgh-cta__go {
    transform: translateX(4px);
}

.mgh-cta__media {
    display: block;
    aspect-ratio: 16 / 5;
    background: var(--mg-primary-100);
}

.mgh-cta__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 700px) {
    .mgh-cta {
        grid-template-columns: 46% 54%;
    }

    .mgh-cta__panel {
        min-height: 92px;
        padding: 16px 64px 16px clamp(24px, 10%, 110px);
        gap: 18px;
    }

    .mgh-cta__icon {
        width: 58px;
        height: 58px;
    }

    .mgh-cta__icon .mgh-ico {
        width: 30px;
        height: 30px;
    }

    /* la flecha queda en la unión panel / imagen, como en el diseño */
    .mgh-cta__go {
        right: -15px;
        z-index: 1;
    }

    .mgh-cta__media {
        aspect-ratio: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mgh-home *,
    .mgh-home *::before,
    .mgh-home *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------------------------------------------------------------
   Ritmo vertical entre componentes (si van en secciones de BeBuilder
   con su propio padding, se puede quitar con la clase "mgh-flush")
   --------------------------------------------------------------- */

.mgh-tabs { margin-top: 32px; margin-bottom: 40px; }
.mgh-cta { margin-top: 48px; margin-bottom: 48px; }
.mgh-section-title { margin-top: 48px; }

.mgh-flush .mgh-home,
.mgh-home.mgh-flush { margin-top: 0; margin-bottom: 0; }

@media (min-width: 900px) {
    .mgh-tabs { margin-top: 48px; margin-bottom: 56px; }
    .mgh-cta { margin-top: 64px; margin-bottom: 64px; }
    .mgh-section-title { margin-top: 64px; }
}

/* Be Theme da margen/viñetas a los ul del contenido: anularlo en los componentes */
.mgh-home ul.mgh-cards,
.the_content_wrapper .mgh-home ul.mgh-cards {
    margin: 0;
    padding: 0;
    list-style: none;
}

.the_content_wrapper .mgh-home ul.mgh-cards > li {
    margin: 0;
    list-style: none;
}

/* móvil: el texto nunca pasa por debajo del icono y no se parten palabras */
@media (max-width: 599px) {
    .mgh-card {
        min-height: 110px;
        padding: 46px 12px 12px;
    }

    .mgh-card__big {
        font-size: clamp(14px, 4.1vw, 16px);
        overflow-wrap: normal;
        word-break: normal;
        -webkit-hyphens: auto;
        hyphens: auto;
    }

    .mgh-card__small {
        font-size: 11px;
    }
}
