/* ---------- Tokens / Tema ---------- */
:root {
  /* Brand */
  --brand: #395542;
  --brand-hover: #999;
  --link: var(--brand);

  /* Superficies */
  --header-bg: #F5D9B3;
  --footer-bg: var(--brand);
  --footer-text: #fff;

  /* Radios */
  --r-lg: 10px;

  /* Tintas del brand */
  --brand-a14: rgba(57, 85, 66, .14);
  --brand-a20: rgba(57, 85, 66, .20);
  --brand-a32: rgba(57, 85, 66, .32);

  /* Menú principal (navbar) */
  --nav-border: rgba(15, 23, 42, .06);
  --nav-shadow: 0 18px 50px rgba(2, 6, 23, .12);
  --nav-focus: rgba(57, 85, 66, .55);
  --nav-text: rgba(15, 23, 42, .78);
  --nav-text-strong: rgba(15, 23, 42, .92);
  --nav-text-active: rgba(15, 23, 42, .95);

  /* Icono X (mask y fallback) */
  --icon-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.9 3H21l-6.6 7.5L22 21h-6.2l-4.9-6.3L5.4 21H3l7.1-8.1L2 3h6.3l4.4 5.6L18.9 3Zm-2.2 16h1.7L7.2 4.9H5.4L16.7 19Z'/%3E%3C/svg%3E");
  --icon-x-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M18.9 3H21l-6.6 7.5L22 21h-6.2l-4.9-6.3L5.4 21H3l7.1-8.1L2 3h6.3l4.4 5.6L18.9 3Zm-2.2 16h1.7L7.2 4.9H5.4L16.7 19Z'/%3E%3C/svg%3E");
}

/* ---------- Base ---------- */
:where(body, button, input, select, textarea) {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
}

a {
  color: var(--link);
}

/* =========================================================
   Bootstrap overrides (globales)
   ========================================================= */

/* ---------- Botones ---------- */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:is(:hover, :focus, .focus, :active, .active) {
  color: #fff;
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

/* legacy (bs3): dropdown toggle dentro de .open */
.open>.dropdown-toggle.btn-primary {
  color: #fff;
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-primary:is(.disabled, :disabled) {
  background: var(--brand);
  border-color: var(--brand);
  opacity: .7;
}

/* ---------- Navbar / navegación (global) ---------- */
.navbar.bg-light {
  background: #fff !important;
}

.navbar-light .navbar-nav :is(.show>.nav-link,
  .active>.nav-link,
  .nav-link.show,
  .nav-link.active) {
  background: var(--brand);
  color: #fff;
}

.dropdown-item:is(:hover, :focus),
.nav-pills :is(.nav-link.active, .show>.nav-link),
.sidebar-list li a.currentStep {
  background: var(--brand);
}

/* =========================================================
   Componentes
   ========================================================= */

/* ---------- Header ---------- */
header,
header .container {
  min-height: 110px;
  background: var(--header-bg);
}

header .logo {
  position: absolute;
  top: 30px;
  left: 5px;
  height: 50px;
  width: auto;
}

/* ---------- Varios ---------- */
.nav-idioma-login ul li ul li a:hover {
  color: #fff;
}

.validation-summary-errors {
  border-left: 5px solid var(--brand);
}

/* Carrusel (fallback global) */
.carousel-control-prev,
.carousel-control-next {
  top: 150px !important;
  max-height: 285px;
}

.carousel-item {
  min-height: 570px;
  background-size: cover;
  background-position: 50% 50%;
  background-repeat: no-repeat;
}

/* Jumbotron inicio */
.jumbotron.inicio {
  padding: 0 !important;
  min-height: 500px;
}

.jumbotron.inicio .container {
  visibility: hidden;
}

/* ---------- Action bar (RRSS + idioma/login) ---------- */
.action-bar {
  background: var(--brand);
  color: #fff;
}

.action-bar,
.action-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.action-bar a {
  color: inherit;
  text-decoration: none;
}

.action-bar a:is(:hover, :focus) {
  opacity: 1;
  text-decoration: none;
}

.action-bar .clearfix {
  display: none !important;
}

/* neutraliza floats solo en los UL principales */
.action-bar :is(.nav-social, .nav-idioma-login)>ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 10px;
  float: none !important;
}

.action-bar :is(.nav-social, .nav-idioma-login)>ul>li {
  float: none !important;
  display: flex;
  align-items: center;
}

.action-bar :is(.nav-social, .nav-idioma-login)>ul>li>a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  line-height: 1;
}

/* empuja login a la derecha aunque cambie el DOM */
#ActionBar_panelLogin {
  margin-left: auto;
}

/* dropdown login */
#ActionBar_panelLogin .dropdown {
  position: relative;
}

#ActionBar_panelLogin .dropdown-toggle {
  color: #fff !important;
  opacity: .95;
}

#ActionBar_panelLogin .dropdown-toggle:is(:hover, :focus) {
  opacity: 1;
}

#ActionBar_panelLogin .dropdown-menu {
  background: #2f4a3a;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  border-radius: var(--r-lg);
  padding: 6px;
  min-width: 220px;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
}

#ActionBar_panelLogin .dropdown-menu .dropdown-item {
  color: rgba(255, 255, 255, .92);
  border-radius: 8px;
}

#ActionBar_panelLogin .dropdown-menu .dropdown-item:is(:hover, :focus) {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

#ActionBar_panelLogin .dropdown-menu .dropdown-item:is(.active, :active) {
  background: #f3d6a6;
  color: #2b3f34;
}

/* ---------- Footer ---------- */
footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  width: 100%;
  padding: 95px 0 55px;
  border: 0 !important;

  /* tokens tipográficos */
  --footer-fs: 20px;
  --footer-fs-legal: 18px;
}

footer a {
  color: inherit;
}

footer .container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 70px;
  box-sizing: border-box;
}

/* reset panel heredado */
footer .panel-inicio {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* calendario (día actual) */
footer .calendar .cal-today {
  color: #51453A;
}

/* fila superior: 4 columnas (flex) */
footer .container>.row:not(.footer-bottom) {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  column-gap: clamp(18px, 3vw, 55px);
  row-gap: 25px;
}

footer .container>.row:not(.footer-bottom)>[class*="col-"] {
  float: none;
  width: auto;
  max-width: none;
  flex: 1 1 240px;
  min-width: 0;
}

footer img {
  max-width: 100%;
  height: auto;
}

/* col 1 */
footer .logo-pie {
  width: 85%;
  max-width: 280px;
  display: block;
}

/* col 2 (contacto) */
.footer-contact .footer-address {
  margin: 0 0 14px;
  line-height: 1.65;
  font-weight: 300;
  opacity: .92;
  font-size: var(--footer-fs);
}

.footer-contact .footer-email {
  margin: 0 0 18px;
}

.footer-contact .footer-email a {
  display: inline-block;
  padding-bottom: 2px;
  border-bottom: 2px solid rgba(255, 255, 255, .55);
  font-size: var(--footer-fs);
  word-break: break-word;
}

.footer-contact .footer-phone {
  margin: 10px 0 0;
}

.footer-contact .footer-phone a {
  font-size: var(--footer-fs);
  font-weight: 600;
  letter-spacing: .2px;
}

/* cuando el JS reordena */
footer.footer--reordered .footer-mid-grid {
  display: block !important;
}

/* col 3 (links) */
.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin: 0 0 10px;
}

.footer-links a {
  font-size: var(--footer-fs);
  font-weight: 300;
  text-decoration: none;
}

.footer-links a:hover {
  opacity: .85;
}

/* col 4 (comarca + RRSS) */
.logo-comarca {
  width: 60%;
  max-height: 100px;
  display: block;
  margin-bottom: 16px;
}

footer .footer-social {
  display: flex;
  gap: 12px;
}

footer .footer-social a.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;

  /* ajustes por icono (FA) */
  --fa-size: 16px;
  --fa-ty: -0.35px;
}

/* en el HTML los iconos van en <em> */
footer .footer-social a.social-btn :is(i, em) {
  color: #fff;
  opacity: .92;
  font-size: var(--fa-size);
  line-height: 1;
  display: block;
  font-style: normal;
  transform: translateY(var(--fa-ty));
}

/* tweaks por icono */
footer .footer-social a.social-btn[aria-label="Facebook"] {
  --fa-size: 17px;
  --fa-ty: -0.6px;
}

footer .footer-social a.social-btn[aria-label="LinkedIn"] {
  --fa-ty: -0.45px;
}

footer .footer-social a.social-btn[aria-label="Instagram"] {
  --fa-ty: -0.25px;
}

/* Botón X (Twitter) como máscara SVG */
footer .footer-social a.social-btn.social-x {
  --icon: none;
  --s: 20px;
  --nx: 0px;
  --ny: 0px;
}

footer .footer-social a.social-btn.social-x span {
  display: none;
}

footer .footer-social a.social-btn.social-x::before {
  content: "";
  display: block;
  width: var(--s);
  height: var(--s);
  background: #fff;
  opacity: .92;
  -webkit-mask: var(--icon) no-repeat 50% 50%/contain;
  mask: var(--icon) no-repeat 50% 50%/contain;
  transform: translate(var(--nx), var(--ny));
}

footer .footer-social a.social-btn.social-x[href*="x.com"],
footer .footer-social a.social-btn.social-x[href*="twitter.com"] {
  --icon: var(--icon-x);
  --s: 18px;
  --nx: 0px;
  --ny: -0.3px;
}

/* hover RRSS */
footer .footer-social a.social-btn:hover {
  border-color: rgba(255, 255, 255, .35);
}

footer .footer-social a.social-btn:hover :is(i, em) {
  opacity: 1;
}

footer .footer-social a.social-btn.social-x:hover::before {
  opacity: 1;
}

/* fila inferior (legales) */
.footer-bottom {
  margin-top: 55px;
}

.footer-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .35);
  width: 72%;
  margin: 0 auto 18px;
}

.footer-legal {
  margin: 0;
  font-size: var(--footer-fs-legal);
  font-weight: 300;
  opacity: .92;
}

.footer-legal a:hover {
  opacity: .85;
}

/* sin subrayado en hover */
footer.footer--reordered a:is(:hover, :focus) {
  text-decoration: none;
}

/* =========================================================
   Action-bar · Sustituir icono Twitter por X
   ========================================================= */

.action-bar .nav-social a[href*="x.com"],
.action-bar .nav-social a[href*="twitter.com"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  position: relative;
}

/* Oculta el icono antiguo de Twitter SOLO en ese enlace */
.action-bar .nav-social a[href*="x.com"] i.fab.fa-twitter,
.action-bar .nav-social a[href*="twitter.com"] i.fab.fa-twitter {
  display: none !important;
}

/* Pinta el icono X (mask SVG) */
@supports ((-webkit-mask: url("")) or (mask: url(""))) {

  .action-bar .nav-social a[href*="x.com"]::before,
  .action-bar .nav-social a[href*="twitter.com"]::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor; /* hereda el blanco del action-bar */
    opacity: .92;

    -webkit-mask: var(--icon-x) no-repeat 50% 50%/contain;
    mask: var(--icon-x) no-repeat 50% 50%/contain;
  }

  .action-bar .nav-social a[href*="x.com"]:hover::before,
  .action-bar .nav-social a[href*="twitter.com"]:hover::before {
    opacity: 1;
  }
}

/* Fallback si algún navegador no soporta mask */
@supports not ((-webkit-mask: url("")) or (mask: url(""))) {

  .action-bar .nav-social a[href*="x.com"]::before,
  .action-bar .nav-social a[href*="twitter.com"]::before {
    content: "";
    width: 18px;
    height: 18px;
    opacity: .92;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: contain;
    background-image: var(--icon-x-white);
  }
}

/* =========================================================
   MENÚ PRINCIPAL · navbar principal (dentro o fuera de <header>)
   - Se ancla por #navbarSupportedContent para que aplique aunque
     el .navbar no esté dentro del <header>.
   ========================================================= */

:where(header .navbar.navbar-light.bg-light,
  header + .navbar.navbar-light.bg-light,
  .navbar.navbar-light.bg-light.fixed-top,
  .navbar.navbar-light.bg-light.navbar-fixed-top) {
  background: #fff !important;
  border-bottom: 1px solid var(--nav-border);
  padding-top: 6px;
  padding-bottom: 10px;
}

/* Links */
#navbarSupportedContent .navbar-nav .nav-link {
  color: var(--nav-text);
  font-weight: 600;
  font-size: 14.5px;
  padding: 10px 12px;
  border-radius: 12px;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
  text-decoration: none;
}

#navbarSupportedContent .navbar-nav .nav-link:is(:hover, :focus) {
  background: var(--brand-a14);
  color: var(--nav-text-strong);
  text-decoration: none;
}

/* Dropdown abierto (BS4): .nav-link.show */
#navbarSupportedContent .navbar-nav .nav-link.show {
  background: var(--brand);
  color: #fff;
}

/* Activo (BS4) + dropdown abierto (BS4/BS3): corrige el selector */
#navbarSupportedContent .navbar-nav :is(.active > .nav-link, .nav-link.active, .show > .nav-link) {
  background: var(--brand-a20);
  color: var(--nav-text-active);
  box-shadow: inset 0 -2px 0 var(--brand);
}

/* Dropdown menu (solo el del menú principal) */
#navbarSupportedContent .dropdown-menu {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  box-shadow: var(--nav-shadow);
  padding: 10px;
  margin-top: 8px;
}

#navbarSupportedContent .dropdown-item {
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  color: rgba(15, 23, 42, .85);
  text-decoration: none;
}

#navbarSupportedContent .dropdown-item:is(:hover, :focus) {
  background: var(--brand-a20);
  color: rgba(15, 23, 42, .95);
  text-decoration: none;
}

/* Foco accesible (teclado) SOLO dentro del menú principal */
#navbarSupportedContent :focus-visible {
  outline: 2px solid var(--nav-focus);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Botón hamburguesa: scoped al navbar principal */
:where(header .navbar.navbar-light.bg-light,
  header + .navbar.navbar-light.bg-light,
  .navbar.navbar-light.bg-light.fixed-top,
  .navbar.navbar-light.bg-light.navbar-fixed-top) .navbar-toggler {
  border-color: rgba(15, 23, 42, .12);
  border-radius: 12px;
  padding: .45rem .6rem;
}

:where(header .navbar.navbar-light.bg-light,
  header + .navbar.navbar-light.bg-light,
  .navbar.navbar-light.bg-light.fixed-top,
  .navbar.navbar-light.bg-light.navbar-fixed-top) .navbar-toggler:focus {
  box-shadow: 0 0 0 3px var(--brand-a14);
}

/* Home icon: evita que quede “descentrado” respecto a texto */
#navbarSupportedContent .nav-link i {
  vertical-align: -1px;
}

/* =========================================================
   HOME slider · Alturas por ratio (horizontal 1660×500)
   ========================================================= */

#cphTitulo_Slider_panelSlider.slider {
  position: relative; /* ancla controles si quedan fuera del #carouselIndicators */
}

#cphTitulo_Slider_panelSlider #carouselIndicators .carousel-item {
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: cover;
  min-height: 0; /* neutraliza el legacy min-height:570px */
}

/* Controles: que ocupen todo el alto del slider */
#cphTitulo_Slider_panelSlider .carousel-control-prev,
#cphTitulo_Slider_panelSlider .carousel-control-next {
  top: 0 !important;
  bottom: 0;
  max-height: none !important;
}

/* Desktop: ratio real del banner horizontal (600/1660 = 36.14vw) */
@media (min-width:992px) {
  #cphTitulo_Slider_panelSlider #carouselIndicators .carousel-item {
    height: clamp(360px, 36.14vw, 600px);
  }
}

/* Tablet / móvil: más alto para que el vertical no quede “enano” */
@media (max-width:991.98px) {
  #cphTitulo_Slider_panelSlider #carouselIndicators .carousel-item {
    height: clamp(300px, 45vw, 460px);
  }

  /* Vertical: llena el banner y ajusta el foco */
  #cphTitulo_Slider_panelSlider #carouselIndicators .carousel-item[style*="tipo=slide-vertical"] {
    background-size: cover !important;
    background-position: 50% 25%;
  }
}

/* Móvil estrecho: un poco más alto para legibilidad */
@media (max-width:575.98px) {
  #cphTitulo_Slider_panelSlider #carouselIndicators .carousel-item {
    height: clamp(340px, 70vh, 560px);
  }
}

/* =========================================================
   Responsive
   ========================================================= */

/* cabecera: oculta decorativa */
@media (max-width:1007px) {
  header .container {
    background-image: none;
  }
}

/* footer: padding */
@media (max-width:991px) {
  footer {
    padding: 55px 0 35px;
  }

  footer .container {
    padding: 0 20px;
  }
}

/* footer: 2x2 + centrado (768–1199.98) */
@media (min-width:768px) and (max-width:1199.98px) {
  footer.footer--reordered .container>.row:not(.footer-bottom)>.col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  footer.footer--reordered .logo-pie {
    margin-left: auto;
    margin-right: auto;
  }

  /* Bloque centrado pero texto de enlaces alineado a la izq (más legible) */
  footer.footer--reordered .footer-links ul {
    display: inline-block;
    text-align: left;
  }

  footer.footer--reordered .footer-social {
    justify-content: center;
  }

  footer.footer--reordered #repPie_panelPie_3 .logo-comarca {
    width: 100%;
    max-width: 260px;
    height: auto;
    display: block;
  }

  footer.footer--reordered #repPie_panelPie_3 .footer-comarca {
    text-align: center !important;
  }
}


/* footer: centrado "intermedio" SOLO si NO está reorder (992–1199.98) */
@media (min-width:992px) and (max-width:1199.98px) {
  footer:not(.footer--reordered) .container>.row:not(.footer-bottom)>[class*="col-"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  footer:not(.footer--reordered) .logo-pie {
    margin-left: auto;
    margin-right: auto;
  }

  footer:not(.footer--reordered) .footer-links ul {
    display: inline-block;
    text-align: left;
  }

  footer:not(.footer--reordered) .footer-social {
    justify-content: center;
  }
}

/* Tablet: centra legales también (768–991.98) */
@media (min-width:768px) and (max-width:991.98px) {
  footer.footer--reordered .footer-legal {
    text-align: center;
  }
}

/* móvil (<=767px) */
@media (max-width:767px) {

  header,
  header .container {
    min-height: 80px;
  }

  header .logo {
    height: 35px;
    max-width: 80vw;
    top: 20px;
    left: 10px;
  }

  .action-bar a {
    padding: 6px 8px;
    font-size: 12px;
  }

  .action-bar :is(.nav-social, .nav-idioma-login)>ul {
    gap: 8px;
  }

  #ActionBar_panelLogin .dropdown-menu {
    min-width: 200px;
  }

  footer.footer--reordered .container>.row:not(.footer-bottom) {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    row-gap: 22px;
  }

  footer.footer--reordered .container>.row:not(.footer-bottom)>[class*="col-"] {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }

  footer.footer--reordered .logo-pie {
    margin: 0 auto;
  }

  footer.footer--reordered .footer-right {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  footer.footer--reordered .footer-social {
    justify-content: center;
  }

  footer.footer--reordered .footer-links ul {
    margin: 0 auto;
    padding-left: 0;
  }

  footer.footer--reordered .footer-divider {
    width: 92%;
  }
}

/* refinado móvil (<=575.98px) */
@media (max-width:575.98px) {
  footer.footer--reordered {
    padding-top: 28px;
    padding-bottom: 18px;
    --footer-fs-legal: 12px;
  }

  footer.footer--reordered .panel-inicio {
    margin-bottom: 16px;
  }

  footer.footer--reordered img.logo-pie {
    max-width: 180px;
    width: 100%;
    display: inline-block;
  }

  footer.footer--reordered #repPie_panelPie_3 .logo-comarca {
    max-width: 210px;
    width: 100%;
    height: auto;
    display: inline-block;
    margin: 6px auto 0;
  }

  footer.footer--reordered .footer-contact p {
    margin: 6px 0;
    line-height: 1.35;
  }

  footer.footer--reordered nav.footer-links ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding-left: 0;
    margin: 12px 0 0;
    list-style: none;
  }

  footer.footer--reordered nav.footer-links li {
    margin: 0;
  }

  footer.footer--reordered nav.footer-links a {
    display: block;
    padding: 6px 0;
  }

  footer.footer--reordered .footer-social {
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
  }

  footer.footer--reordered .social-btn {
    width: 34px;
    height: 34px;
    line-height: 34px;
    border-radius: 999px;
  }

  footer.footer--reordered .footer-legal {
    line-height: 1.4;
    text-align: center;
  }
}