/* ============================================================
   Turicantabria Restyle
   PARTE 1 — Menú móvil + Responsive
   (La paleta verde global llega en la Parte 2)
   ============================================================ */

:root {
	--tc-green: #2e9e5b;
	--tc-green-dark: #1f7a44;
	--tc-green-darker: #155c32;
	--tc-green-light: #e8f6ee;
	--tc-ink: #1d2b22;
	--tc-white: #ffffff;
}

/* ---------- Menú móvil propio (independiente de Astra/LiteSpeed) ---------- */

#tc-mnav,
#tc-mnav-backdrop {
	display: none;
}

@media (max-width: 921px) {

	/* Ocultamos el drawer roto original de Astra para no duplicar */
	.ast-mobile-popup-drawer {
		display: none !important;
	}

	#tc-mnav-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.5);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.25s ease;
		z-index: 99998;
	}

	#tc-mnav {
		display: block;
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		width: 86%;
		max-width: 360px;
		background: var(--tc-white);
		box-shadow: -6px 0 24px rgba(0, 0, 0, 0.18);
		transform: translateX(100%);
		transition: transform 0.28s ease;
		z-index: 99999;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	body.tc-open #tc-mnav {
		transform: translateX(0);
	}

	body.tc-open #tc-mnav-backdrop {
		opacity: 1;
		visibility: visible;
	}

	body.tc-open {
		overflow: hidden;
	}

	/* Cabecera del panel */
	#tc-mnav .tc-mnav-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 16px 18px;
		background: var(--tc-green);
		color: #fff;
		font-weight: 700;
		font-size: 16px;
		letter-spacing: 0.3px;
	}

	#tc-mnav .tc-mnav-close {
		background: transparent;
		border: 0;
		color: #fff;
		font-size: 26px;
		line-height: 1;
		cursor: pointer;
		padding: 0 4px;
	}

	/* Lista */
	#tc-mnav ul {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	#tc-mnav li {
		border-bottom: 1px solid #eef1ee;
		position: relative;
	}

	#tc-mnav a {
		display: block;
		padding: 14px 18px;
		color: var(--tc-ink);
		text-decoration: none;
		font-size: 15px;
		line-height: 1.3;
	}

	#tc-mnav a:hover,
	#tc-mnav a:focus {
		background: var(--tc-green-light);
		color: var(--tc-green-darker);
	}

	/* Submenús: ocultos hasta expandir */
	#tc-mnav .sub-menu {
		display: none;
		background: #f7faf8;
	}

	#tc-mnav li.tc-exp > .sub-menu {
		display: block;
	}

	#tc-mnav .sub-menu a {
		padding-left: 34px;
		font-size: 14px;
		color: #3a4a40;
	}

	#tc-mnav .sub-menu .sub-menu a {
		padding-left: 50px;
	}

	/* Flecha expandible en items con hijos */
	#tc-mnav .menu-item-has-children > a::after {
		content: "\25BC";
		float: right;
		font-size: 10px;
		opacity: 0.55;
		transition: transform 0.2s ease;
	}

	#tc-mnav .menu-item-has-children.tc-exp > a::after {
		transform: rotate(180deg);
	}

	/* Aseguramos que el botón hamburguesa sea visible y usable */
	.ast-mobile-menu-buttons,
	.main-header-menu-toggle,
	.menu-toggle {
		display: inline-flex !important;
		visibility: visible !important;
		opacity: 1 !important;
	}

	/* ---------- Seguridad responsive general ---------- */
	img,
	iframe,
	video,
	table {
		max-width: 100%;
	}

	img {
		height: auto;
	}

	/* Tablas grandes con scroll horizontal en vez de romper el layout */
	.entry-content table,
	.ast-single-post .entry-content table {
		display: block;
		overflow-x: auto;
		width: 100%;
	}
}

/* Evita scroll horizontal accidental en cualquier viewport */
html,
body {
	overflow-x: hidden;
}

/* ============================================================
   PARTE 2 — Paleta verde unificada (#2e9e5b)
   Unifica los 3 verdes dispares del sitio y el color de cabecera
   por página, sin tocar el contenido de las entradas.
   ============================================================ */

/* 1) Variables globales de Astra -> verde de marca */
:root {
	--ast-global-color-0: #2e9e5b !important; /* acento/marca principal */
	--ast-global-color-1: #1f7a44 !important; /* acento hover/secundario */
}

/* 2) Cabecera unificada en TODAS las páginas (fin del "cada página un color") */
.main-header-bar,
.ast-primary-header-bar,
.ast-primary-header-bar .ast-primary-header,
header.site-header .ast-primary-header-bar,
.ast-mobile-header-wrap .ast-primary-header-bar {
	background-color: #ffffff !important;
}

/* Línea de acento verde bajo la cabecera */
.ast-primary-header-bar,
.main-header-bar {
	border-bottom: 3px solid #2e9e5b !important;
}

/* 3) Menú principal en verde legible (buen contraste sobre blanco) */
.main-header-menu .menu-link,
.main-header-menu > .menu-item > .menu-link {
	color: #1f7a44 !important;
	font-weight: 600;
}

.main-header-menu .menu-item:hover > .menu-link,
.main-header-menu .menu-link:hover,
.main-header-menu .menu-link:focus,
.main-header-menu .current-menu-item > .menu-link,
.main-header-menu .current-menu-ancestor > .menu-link {
	color: #2e9e5b !important;
}

/* Desplegables del menú */
.main-header-menu .sub-menu {
	border-top: 3px solid #2e9e5b !important;
}

.main-header-menu .sub-menu .menu-link:hover,
.main-header-menu .sub-menu .menu-link:focus {
	background-color: #e8f6ee !important;
	color: #155c32 !important;
}

/* 4) Botones unificados en verde */
.wp-block-button__link,
.ast-button,
.button,
.ast-custom-button-link .ast-custom-button,
input[type="submit"],
button[type="submit"],
.menu-toggle.main-header-menu-toggle {
	background-color: #2e9e5b !important;
	border-color: #2e9e5b !important;
	color: #ffffff !important;
}

.wp-block-button__link:hover,
.ast-button:hover,
.button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
	background-color: #1f7a44 !important;
	border-color: #1f7a44 !important;
	color: #ffffff !important;
}

/* 5) Enlaces dentro del contenido (sin perder legibilidad) */
.entry-content a:not(.wp-block-button__link):not(.ast-button),
.ast-single-post .entry-content a:not(.wp-block-button__link),
.widget a {
	color: #1f7a44;
}

.entry-content a:not(.wp-block-button__link):hover,
.widget a:hover {
	color: #2e9e5b;
}

/* 6) Títulos con un verde-tinta sobrio y coherente */
.entry-title,
.ast-archive-title,
.widget-title,
.ast-single-post .entry-title {
	color: #173d28;
}

/* 7) Pie de página en verde oscuro (presencia de marca) */
footer.site-footer,
.site-footer,
.ast-footer-overlay,
.site-primary-footer-wrap,
.site-below-footer-wrap {
	background-color: #155c32 !important;
}

.site-footer,
.site-footer p,
.site-footer li,
.site-footer span,
.site-footer .widget-title,
.site-footer a {
	color: #eaf5ee !important;
}

.site-footer a:hover,
.site-footer a:focus {
	color: #ffffff !important;
}

/* 8) Detalles de acento verde */
.entry-content blockquote,
blockquote {
	border-left-color: #2e9e5b !important;
}

::selection {
	background: #2e9e5b;
	color: #fff;
}

/* Iconos/burbuja del menú hamburguesa coherentes */
.menu-toggle.main-header-menu-toggle .ast-mobile-svg {
	fill: #ffffff !important;
}

/* ============================================================
   PARTE 3 — Logo nuevo (rojo/blanco, montaña + ola)
   ============================================================ */
.custom-logo.tc-custom-logo {
	max-height: 62px !important;
	width: auto !important;
	height: auto !important;
	max-width: 320px;
}

.ast-mobile-header-logo .custom-logo.tc-custom-logo,
.ast-mobile-header-wrap .custom-logo.tc-custom-logo {
	max-height: 46px !important;
}

/* Pequeño aire alrededor del logo en la cabecera */
.site-branding .custom-logo-link {
	display: inline-flex;
	align-items: center;
}

/* ============================================================
   PARTE 4 — Quitar anuncios de Google + arreglar menú duplicado
   ============================================================ */

/* --- Anuncios de Google AdSense / GPT (NO afecta a Civitatis ni a tu contenido) --- */
.google-auto-placed,
ins.adsbygoogle,
.adsbygoogle,
iframe[src*="googlesyndication"],
iframe[src*="doubleclick"],
iframe[src*="adservice.google"],
iframe[id^="aswift_"],
iframe[id^="google_ads_iframe"],
[id^="google_ads_"],
[id^="div-gpt-ad"],
div[data-ad-client],
div[data-ad-slot],
ins[data-ad-client] {
	display: none !important;
	height: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
}

/* --- Menú móvil unificado: usar SOLO nuestro panel limpio (6 apartados) --- */
@media (max-width: 921px) {

	/* Ocultar el menú móvil DIFERENTE de Astra (25 items) y su drawer,
	   que provocaban el "se cambia por otro" y el solape de clics */
	#ast-hf-mobile-menu,
	.ast-mobile-popup-drawer,
	.ast-mobile-header-wrap .main-header-menu {
		display: none !important;
	}

	/* El disparador hamburguesa siempre visible y por encima */
	.ast-mobile-menu-buttons,
	.main-header-menu-toggle,
	.menu-toggle {
		display: inline-flex !important;
		position: relative;
		z-index: 100000;
	}
}

/* ============================================================
   PARTE 5 — Menú de ESCRITORIO fiable (clic + sin hueco + scroll)
   ============================================================ */
@media (min-width: 922px) {

	/* Puente invisible para que el submenú no se cierre al bajar el ratón */
	.main-header-menu > .menu-item-has-children > .menu-link {
		position: relative;
	}
	.main-header-menu > .menu-item-has-children > .menu-link::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: -18px;
		height: 20px;
	}

	/* Mostrar el submenú al hacer clic (clase añadida por nuestro JS) */
	.main-header-menu .menu-item.tc-desk-open > .sub-menu {
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
		display: block !important;
	}

	/* Submenús muy largos (p. ej. Comarcas, 100+ municipios) con scroll */
	.main-header-menu .sub-menu {
		max-height: 80vh;
		overflow-y: auto;
		overflow-x: hidden;
	}
}
