/*
 * Viña del Mar - Portal Municipal
 * Modernización responsiva
 * Autor: CMF_INF
 * Versión: 2.0.0
 * Sitio: historico.munivina.cl
 */

:root {
    --cmf-azul: #0056b3;
    --cmf-azul-oscuro: #173b67;
    --cmf-fondo: #f7f9fc;
    --cmf-blanco: #ffffff;
    --cmf-texto: #263445;
    --cmf-borde: #dce4ed;
    --cmf-radio: 12px;
}
/* CMF NOTICIAS RESPONSIVAS 2.0.0 */

.cmf-home {
    width: 100%;
    background: var(--cmf-fondo);
}

.cmf-news {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 20px;
    box-sizing: border-box;
}

.cmf-news-heading {
    margin-bottom: 22px;
}

.cmf-news-heading h2 {
    margin: 0;
    color: var(--cmf-azul-oscuro);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 700;
    line-height: 1.25;
}

.cmf-news-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.cmf-news-card {
    min-width: 0;
    overflow: hidden;
    background: var(--cmf-blanco);
    border: 1px solid var(--cmf-borde);
    border-radius: var(--cmf-radio);
    box-shadow: 0 4px 18px rgba(20, 45, 75, 0.08);
}

.cmf-news-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.cmf-news-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--cmf-texto);
    text-decoration: none;
}

.cmf-news-link:hover,
.cmf-news-link:focus-visible {
    color: var(--cmf-azul);
    text-decoration: none;
}

.cmf-news-link:focus-visible {
    outline: 3px solid var(--cmf-azul);
    outline-offset: -3px;
}

.cmf-news-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    overflow: hidden;
    background: #e8edf4;
}

.cmf-news-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.cmf-news-card:hover .cmf-news-image img {
    transform: scale(1.035);
}

.cmf-news-video {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 11px;
    border-radius: 6px;
    background: var(--cmf-azul-oscuro);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.cmf-news-body {
    padding: 16px;
}

.cmf-news-body time {
    display: block;
    margin-bottom: 8px;
    color: #56677b;
    font-size: 13px;
}

.cmf-news-body h3 {
    margin: 0 0 10px;
    color: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
}

.cmf-news-body p {
    margin: 0;
    color: #536173;
    font-size: 14px;
    line-height: 1.55;
}

.cmf-news-card:first-child .cmf-news-body h3 {
    font-size: clamp(20px, 2vw, 27px);
}

@media (max-width: 1024px) {
    .cmf-news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cmf-news-card:first-child {
        grid-column: span 2;
        grid-row: auto;
    }
}

@media (max-width: 600px) {
    .cmf-news {
        padding: 24px 14px;
    }

    .cmf-news-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .cmf-news-card:first-child {
        grid-column: auto;
    }

    .cmf-news-body {
        padding: 14px;
    }

    .cmf-news-body h3,
    .cmf-news-card:first-child .cmf-news-body h3 {
        font-size: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cmf-news-image img {
        transition: none;
    }

    .cmf-news-card:hover .cmf-news-image img {
        transform: none;
    }
}


/* CMF BANNERS OFICIALES FASE 1 */

/* Los tres widgets de banners mantienen su orden original. */
.cmf-home-widgets :is(#block-62, #block-82, #block-73) {
    display: block;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto 18px;
    padding: 0 20px;
    box-sizing: border-box;
    float: none;
    clear: both;
    list-style: none;
}

/* Columnas adaptables, sin modificar el contenido de WordPress. */
.cmf-home-widgets :is(#block-62, #block-82, #block-73) > .wp-block-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
    margin: 0;
}

/* Cada columna contiene una tarjeta oficial. */
.cmf-home-widgets :is(#block-62, #block-82, #block-73) > .wp-block-columns > .wp-block-column {
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Se sustituyen los tamaños fijos del tema antiguo. */
.cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios {
    display: flex;
    flex-direction: column;
    float: none;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dce5ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(15, 55, 90, 0.08);
    transition: box-shadow .2s ease, transform .2s ease;
}

.cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 55, 90, 0.13);
}

.cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios a {
    display: block;
    float: none;
    width: 100%;
    height: auto;
    margin: 0;
}

.cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Mantiene la barra de título reconocible del sitio municipal. */
.cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios hgroup {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .cmf-home-widgets :is(#block-62, #block-82, #block-73) > .wp-block-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .cmf-home-widgets :is(#block-62, #block-82, #block-73) {
        padding: 0 14px;
    }

    .cmf-home-widgets :is(#block-62, #block-82, #block-73) > .wp-block-columns {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios {
        transition: none;
    }

    .cmf-home-widgets :is(#block-62, #block-82, #block-73) .banner-sitios:hover {
        transform: none;
    }
}


/* CMF ANCHO COMPLETO ARMONICO FASE 1 */

.cmf-home,
.cmf-home-content,
.cmf-home-widgets,
.cmf-home-widgets > .home-widgets-wrapper {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.cmf-news {
    width: 100%;
    max-width: none;
    padding: 32px clamp(16px, 2.5vw, 48px);
    box-sizing: border-box;
}

.cmf-home-widgets :is(#block-62, #block-82, #block-73) {
    width: 100%;
    max-width: none;
    padding-left: clamp(16px, 2.5vw, 48px);
    padding-right: clamp(16px, 2.5vw, 48px);
    box-sizing: border-box;
}

.cmf-home-widgets :is(#block-62, #block-82, #block-73) > .wp-block-columns {
    gap: clamp(14px, 1.5vw, 24px);
}

@media (max-width: 600px) {
    .cmf-news {
        padding: 24px 16px;
    }

    .cmf-home-widgets :is(#block-62, #block-82, #block-73) {
        padding-left: 16px;
        padding-right: 16px;
    }
}


/* CMF CORRECCION ANCHO PRINCIPAL FASE 2 */

/* Elimina la restricción de 989px del tema original. */
#wrapper-home-vina.cmf-home {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    box-sizing: border-box;
}

#wrapper-home-vina #main-desktop.cmf-home-content {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Corrige el límite de 480px heredado en tablets y móviles. */
@media (max-width: 991px) {
    body #wrapper-home-vina.cmf-home {
        width: 100% !important;
        max-width: none !important;
        margin: 0 auto !important;
        float: none !important;
    }

    body #wrapper-home-vina #main-desktop.cmf-home-content {
        width: 100%;
        max-width: none;
        margin: 0 auto;
        float: none;
    }
}


/* CMF ANCHO EXTERIOR PORTADA FASE 3 */

/* Amplía únicamente el contenedor exterior de la portada. */
body.home #main:has(> #wrapper-home-vina.cmf-home) {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

/* Mantiene los contenedores interiores adaptables. */
body.home #main > #wrapper-home-vina.cmf-home,
body.home #main #main-desktop.cmf-home-content {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* CMF HEADER MODERNO FASE 1 */
@media (min-width: 992px) {
  body .cmf-pagina-municipal > header.header {
    height: auto;
    min-height: 0;
    background: #fff;
    position: relative;
    overflow: visible;
    box-shadow: 0 3px 16px rgba(15,45,75,.10);
    z-index: 1000;
  }

  body header.header #top {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 42px;
    padding: 6px 4%;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #f1f5f9;
  }

  body header.header #top .indicadores {
    float: none;
    width: auto;
    margin: 0;
    background: transparent !important;
    font-size: 12px;
  }

  body header.header #top .redes-sociales {
    float: none;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }
}

/* CMF HEADER MODERNO FASE 2 - LOGO */
@media (min-width: 992px) {
  body header.header #subhead {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 150px;
    padding: 20px 4% 0;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  body header.header #subhead .logo-area {
    width: 100%;
    min-height: 85px;
    display: flex;
    align-items: center;
  }

  body header.header #subhead .custom-logo {
    float: none;
    position: static;
    display: block;
    width: auto;
    height: auto;
    max-width: 390px;
    max-height: 95px;
    object-fit: contain;
  }
}

/* CMF HEADER MODERNO FASE 3 - NAVEGACION */
@media (min-width: 992px) {
  body header.header #menu {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
    min-height: 50px;
    margin: 0;
    padding: 0;
    background: transparent;
  }

  body header.header #menuhorizontal {
    display: flex !important;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    float: none;
    gap: 4px;
    background: transparent !important;
  }

  body header.header #menuhorizontal > li {
    display: block;
    float: none;
    border: 0 !important;
  }

  body header.header #menuhorizontal > li > a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    min-height: 46px;
    padding: 10px 14px;
    border: 0;
    border-radius: 6px 6px 0 0;
    box-sizing: border-box;
    background: transparent !important;
    background-image: none !important;
    color: #123f70 !important;
    text-shadow: none !important;
    text-indent: 0;
    font-size: 14px;
    font-weight: 600 !important;
    line-height: 1.3;
  }

  body header.header #menuhorizontal > li > a:hover,
  body header.header #menuhorizontal > li:hover > a,
  body header.header #menuhorizontal > li > a:focus-visible {
    background: #eaf3fb !important;
    color: #07569a !important;
  }

  body header.header #menuhorizontal > li.home > a,
  body header.header #menuhorizontal > li.search > a {
    width: auto;
    min-width: 54px;
    background-image: none !important;
    text-indent: 0;
  }
}

/* CMF HEADER FASE 4 - LOGO IZQUIERDA Y MENU CENTRADO */
@media (min-width: 992px) {
  body header.header #subhead {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 32px;
    min-height: 120px;
    padding: 15px 4%;
  }

  body header.header #subhead .logo-area {
    flex: 0 0 auto;
    width: auto;
    min-height: 0;
  }

  body header.header #subhead .custom-logo {
    max-width: 290px;
    max-height: 95px;
  }

  body header.header #menu {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body header.header #menuhorizontal {
    width: auto;
    justify-content: center;
    align-items: center;
    gap: 2px;
  }

  body header.header #menuhorizontal > li > a {
    padding: 12px 10px;
    font-size: 13px;
    border-radius: 6px;
  }
}

/* CMF HEADER FASE 5 - SUBMENUS MODERNOS */
@media (min-width: 992px) {
  body header.header #menuhorizontal > li {
    position: relative !important;
  }

  body header.header #menuhorizontal > li > ul.sub-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    width: 320px !important;
    max-width: calc(100vw - 40px);
    min-width: 0;
    padding: 10px !important;
    margin: 0 !important;
    box-sizing: border-box;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-top: 3px solid #0874bd !important;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 28px rgba(0,35,75,.16);
    z-index: 99999;
  }

  body header.header #menuhorizontal > li:nth-last-child(-n+3) > ul.sub-menu {
    left: auto !important;
    right: 0 !important;
  }

  body header.header #menuhorizontal > li > ul.sub-menu > li {
    display: block;
    float: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body header.header #menuhorizontal > li > ul.sub-menu > li > a {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    padding: 11px 12px !important;
    margin: 0 !important;
    box-sizing: border-box;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 5px;
    color: #123f70 !important;
    text-shadow: none !important;
    font-size: 13px;
    font-weight: 500 !important;
    line-height: 1.45;
    white-space: normal;
  }

  body header.header #menuhorizontal > li > ul.sub-menu > li > a:hover,
  body header.header #menuhorizontal > li > ul.sub-menu > li > a:focus-visible {
    background: #edf5fc !important;
    color: #07569a !important;
  }
}

/* CMF HEADER MOVIL FASE 1 */
@media screen and (max-width: 1199px) {
  body header.header {
    height: 64px !important;
    min-height: 64px !important;
    background: transparent !important;
  }

  body .header-mobile {
    height: 64px !important;
    padding: 0 14px !important;
    display: flex !important;
    align-items: center !important;
    background: #fff !important;
    background-image: none !important;
    border-bottom: 3px solid #0874bd;
    box-shadow: 0 3px 12px rgba(15,45,75,.12);
    box-sizing: border-box;
  }

  body .header-mobile #menu-trigger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px !important;
    height: 40px !important;
    margin: 0 10px 0 0 !important;
    color: #123f70 !important;
    font-size: 23px;
    border-radius: 8px;
  }

  body .header-mobile .mobile-icons {
    height: 64px !important;
    right: 12px !important;
    gap: 6px;
  }

  body .header-mobile .mobile-icons a.icon {
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    background: #edf5fc !important;
    color: #07569a !important;
    border-radius: 9px;
  }

  body {
    padding-top: 64px !important;
  }
}

/* CMF HEADER MOVIL FASE 2 - LOGO INSTITUCIONAL */
@media screen and (max-width: 1199px) {
  body .header-mobile .muni-brand {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 100px 0 0 !important;
  }

  body .header-mobile .muni-brand > a {
    display: flex !important;
    align-items: center !important;
    position: static !important;
    width: auto !important;
    height: 56px !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }

  body .header-mobile .cmf-logo-movil {
    display: block;
    width: auto;
    height: auto;
    max-width: min(245px, 100%);
    max-height: 49px;
    object-fit: contain;
    object-position: left center;
  }

  @media screen and (max-width: 420px) {
    body .header-mobile {
      padding: 0 8px !important;
    }

    body .header-mobile #menu-trigger {
      margin-right: 6px !important;
    }

    body .header-mobile .cmf-logo-movil {
      max-height: 42px;
    }
  }
}

/* CMF MOVIL FASE 3 - MENU SOBRE ENCABEZADO */
@media screen and (max-width: 1199px) {
  html.mm-opened body .header-mobile {
    z-index: 10 !important;
  }

  html.mm-opened #menu-mobile.mm-menu {
    z-index: 100000 !important;
  }

  html.mm-opened .mm-slideout {
    z-index: 20 !important;
  }
}

/* CMF MOVIL FASE 4 - MENU DEBAJO DEL ENCABEZADO */
@media screen and (max-width: 1199px) {
  body .header-mobile,
  html.mm-opened body .header-mobile {
    z-index: 100001 !important;
  }

  html.mm-opened #menu-mobile.mm-menu {
    top: 64px !important;
    height: calc(100% - 64px) !important;
    z-index: 100000 !important;
  }

  html.mm-opened #menu-mobile .mm-header {
    display: none !important;
  }
}

/* CMF MOVIL FASE 5 - RESTAURAR NAVEGACION MMENU */
@media screen and (max-width: 1199px) {
  html.mm-opened #menu-mobile .mm-header {
    display: block !important;
    visibility: visible !important;
  }
}

/* CMF MOVIL FASE 6 - EVITAR PANELES SUPERPUESTOS */
@media screen and (max-width: 1199px) {
  #menu-mobile.mm-menu > .mm-panel.mm-subopened {
    -webkit-transform: translateX(-100%) !important;
    transform: translateX(-100%) !important;
  }

  #menu-mobile.mm-menu > .mm-panel.mm-opened:not(.mm-subopened) {
    -webkit-transform: translateX(0) !important;
    transform: translateX(0) !important;
  }
}

/* CMF MOVIL FASE 7 - ESPACIO PARA FLECHA DE REGRESO */
@media screen and (max-width: 1199px) {
  #menu-mobile.mm-menu.mm-hasheader > .mm-panel {
    padding-top: 100px !important;
  }

  #menu-mobile.mm-menu.mm-hasheader > .mm-panel > .mm-list:first-child {
    margin-top: 0 !important;
  }

  #menu-mobile.mm-menu .mm-header {
    height: 40px;
    box-sizing: border-box;
  }
}

/* CMF MOVIL FASE 8 - AJUSTE FINO DEL ESPACIADO */
@media screen and (max-width: 1199px) {
  #menu-mobile.mm-menu.mm-hasheader > .mm-panel {
    padding-top: 55px !important;
  }
}

/* CMF MOVIL FASE 9 - ESTILO VISUAL DEL MENU */
@media screen and (max-width: 1199px) {
  #menu-mobile.mm-menu {
    background: #ffffff !important;
    color: #234766 !important;
  }

  #menu-mobile .mm-list {
    font-family: Arial, sans-serif;
    font-size: 15px;
  }

  #menu-mobile .mm-list > li > a:not(.mm-subopen),
  #menu-mobile .mm-list > li > span {
    line-height: 24px;
    padding-top: 12px;
    padding-bottom: 12px;
    color: #234766;
  }

  #menu-mobile .mm-list > li:after {
    border-color: #e5edf4;
  }

  #menu-mobile .mm-list > li.mm-selected > a:not(.mm-subopen) {
    background: #eaf4fc;
    color: #07569a;
    font-weight: 600;
  }

  #menu-mobile .mm-header {
    background: #f4f8fc;
    color: #07569a;
    border-bottom: 1px solid #dce8f2;
  }

  #menu-mobile .mm-header .mm-prev:before,
  #menu-mobile .mm-header .mm-next:after,
  #menu-mobile .mm-list a.mm-subopen:after {
    border-color: #07569a;
  }

  #menu-mobile.mm-menu em.mm-counter {
    color: #647b90;
  }
}


/* CMF HOME - ACCESOS DIRECTOS CONSOLIDADOS */
#AccesosDirectos {
  background: #ffffff;
  width: 96%;
  max-width: 1600px;
  height: auto;
  margin: 36px auto 48px;
  padding: 12px 0;
}

#AccesosDirectos .carr-item {
  background: none;
  box-sizing: border-box;
  height: 174px;
  margin: 0 20px 0 0 !important;
  padding: 6px 0;
}

#AccesosDirectos .carr-item > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  height: 162px;
  min-height: 162px;
  padding: 12px 6px;
  background: #ffffff;
  border: 1px solid #e0eaf2;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(17, 69, 111, 0.07);
  text-decoration: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

#AccesosDirectos .carr-item a img {
  width: 65px;
  height: 65px;
  flex-shrink: 0;
  object-fit: contain;
  border: 2px solid #c8ddec;
  border-radius: 50%;
  margin: 0 auto 10px;
}

#AccesosDirectos .carr-item a h3 {
  color: #234766;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  margin: 0;
  overflow-wrap: anywhere;
}

#AccesosDirectos .carr-item:hover > a,
#AccesosDirectos .carr-item > a:focus-visible {
  border-color: #3987bd;
  box-shadow: 0 5px 14px rgba(17, 69, 111, 0.14);
}

#AccesosDirectos .carr-item:hover a img {
  border-color: #3987bd;
}

#AccesosDirectos .carr-item:hover a h3 {
  color: #07569a;
}

@media screen and (max-width: 767px) {
  #AccesosDirectos {
    margin: 20px auto 32px;
    padding: 8px 0;
  }
}

/* CMF ACCESOS DIRECTOS - VISTA MOVIL DOS TARJETAS */
@media screen and (max-width: 767px) {
  #AccesosDirectos .flex-viewport {
    width: 300px !important;
    max-width: calc(100% - 70px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
