/*
 * Encabezado y pie. Réplica del sitio React (versión 0dacf88): Header.tsx y Footer.tsx.
 * Los dos son patrones sincronizados (Patrones > "Encabezado" y "Pie de página") que el tema
 * inserta con los ganchos generate_header y generate_footer de GeneratePress.
 */

/* ---------- Encabezado ---------- */
.ec-header {
	position: relative;
	z-index: 40;
	width: 100%;
	background-color: rgba(243, 239, 231, 0.95);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--linea);
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.ec-header__inner {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	width: 100%;
	max-width: 80rem;
	height: 68px;
	margin: 0 auto;
	padding: 0 1rem;
}

@media (min-width: 901px) {
	.ec-header__inner {
		height: 80px;
		padding: 0 1.5rem;
	}
}

@media (min-width: 960px) {
	.ec-header__inner {
		padding: 0 2rem;
	}
}

@media (min-width: 1024px) {
	.ec-header__inner {
		padding: 0 3rem;
	}
}

/* Marca: el logo es el enlace al inicio. Compacto a color por debajo de 1024 px y horizontal desde 1024 px. */
.ec-brand {
	position: relative;
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	min-width: 0;
	margin: 0 0 0 -0.25rem;
	padding: 0.25rem;
	border-radius: 0.5rem;
}

.ec-logo {
	display: flex;
	align-items: center;
	line-height: 0;
	border-radius: 0.5rem;
	text-decoration: none;
}

.ec-logo:focus-visible {
	outline: 2px solid var(--arcilla-700);
	outline-offset: 2px;
}

.ec-logo__img {
	display: block;
	width: 132px;
	max-width: none;
	height: auto;
	aspect-ratio: 1032 / 250;
}

@media (min-width: 640px) {
	.ec-logo__img {
		width: 160px;
	}
}

/* Horizontal (kit v3, 3,30:1): 240 px de ancho; el mínimo de la marca es 230 px, porque debajo "DIGITAL" deja de leerse.
   Desde 1100 px (con la cápsula del menú, antes no entra sin tocar los demás elementos del encabezado). */
@media (min-width: 1100px) {
	.ec-logo__img {
		width: 240px;
		aspect-ratio: 1163 / 352;
	}
}

/*
 * Menú de escritorio (desde 901 px).
 * Se usa nav.ec-nav.wp-block-navigation para ganarle a las reglas del bloque Navegación de WordPress.
 * Con el ítem "Guías" (siete enlaces en vez de seis) el espacio entre enlaces se reduce:
 * 1 rem desde 901 px, 1,5 rem desde 1100 px y 2 rem desde 1280 px. Así la marca y el botón de WhatsApp
 * no se cortan en el tramo de 901 a 1040 px.
 */
nav.ec-nav.wp-block-navigation {
	display: none;
}

@media (min-width: 901px) {
	nav.ec-nav.wp-block-navigation {
		display: flex;
	}
}

.ec-nav .wp-block-navigation__container {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 1rem;
	margin: 0;
	padding: 0;
	font-size: 0.875rem;
	line-height: 1.25rem;
	list-style: none;
}

@media (min-width: 1100px) {
	.ec-nav .wp-block-navigation__container {
		gap: 1.5rem;
	}
}

@media (min-width: 1280px) {
	.ec-nav .wp-block-navigation__container {
		gap: 2rem;
	}
}

.ec-nav.wp-block-navigation .wp-block-navigation-item__content {
	display: inline-block;
	padding: 0.25rem 0;
	border-bottom: 2px solid transparent;
	border-radius: 0.25rem;
	color: var(--pizarra);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s;
}

.ec-nav.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--grafito);
}

.ec-nav.wp-block-navigation .wp-block-navigation-item__content:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--arcilla-700);
}

.ec-nav.wp-block-navigation .wp-block-navigation-item__content.is-active {
	border-bottom-color: var(--fiordo);
	color: var(--grafito);
	font-weight: 700;
}

/* Acciones: WhatsApp y botón del menú móvil */
.ec-header__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 0.625rem;
}

@media (min-width: 640px) {
	.ec-header__actions {
		gap: 0.75rem;
	}
}

.ec-wa {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0;
	border: 1px solid var(--linea);
	border-radius: 9999px;
	background-color: var(--nieve);
	color: var(--fiordo);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(22, 24, 28, 0.04);
	transition: all 0.15s;
}

/* Botón secundario (CRO-1, R1): en la primera pantalla el único botón relleno es "Pedir una revisión gratis". */
.ec-wa:hover {
	border-color: var(--fiordo);
	background-color: var(--nieve);
	color: var(--fiordo);
}

.ec-wa:active {
	transform: scale(0.95);
}

.ec-wa:focus-visible {
	outline: 2px solid var(--arcilla-700);
	outline-offset: 2px;
}

.ec-wa svg {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
}

.ec-wa__label {
	display: none;
}

@media (min-width: 600px) {
	.ec-wa {
		width: auto;
		gap: 0.5rem;
		padding: 0 1rem;
	}

	.ec-wa__label {
		display: inline;
	}
}

@media (min-width: 640px) {
	.ec-wa__label {
		font-size: 0.875rem;
	}
}

@media (min-width: 901px) {
	.ec-wa {
		height: 40px;
		min-height: 40px;
		padding: 0.5rem 1rem;
		font-size: 0.875rem;
	}

	.ec-wa svg {
		width: 16px;
		height: 16px;
	}
}

/* Entre 901 y 1023 px el botón de WhatsApp es un círculo (solo ícono) para que quepa el ítem "Guías" */
@media (min-width: 901px) and (max-width: 1023.98px) {
	.ec-wa {
		width: 40px;
		min-width: 40px;
		padding: 0;
	}

	.ec-wa__label {
		display: none;
	}
}

.ec-burger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0;
	border: 1px solid var(--linea);
	border-radius: 12px;
	background-color: var(--nieve);
	color: var(--fiordo);
	cursor: pointer;
	transition: all 0.15s;
}

.ec-burger:hover {
	background-color: var(--arena);
	color: var(--fiordo);
}

.ec-burger:active {
	transform: scale(0.95);
}

.ec-burger:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--arcilla-700);
}

.ec-burger svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
}

.ec-burger__close {
	display: none;
}

.ec-header.is-menu-open .ec-burger__open {
	display: none;
}

.ec-header.is-menu-open .ec-burger__close {
	display: block;
}

@media (min-width: 901px) {
	.ec-burger {
		display: none;
	}
}

/* Panel del menú móvil (hasta 900 px) */
.ec-mobile-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 50;
	display: none;
	width: 100%;
	border-bottom: 1px solid var(--linea);
	background-color: var(--bruma);
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.ec-header.is-menu-open .ec-mobile-menu {
	display: block;
	animation: ec-menu-down 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (min-width: 901px) {
	.ec-header .ec-mobile-menu {
		display: none !important;
	}
}

@keyframes ec-menu-down {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ec-header.is-menu-open .ec-mobile-menu {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

.ec-mobile-menu .wp-block-navigation,
.ec-mobile-menu .wp-block-navigation__container {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ec-mobile-menu .wp-block-navigation-item {
	display: block;
	width: 100%;
	margin: 0;
}

.ec-mobile-menu .wp-block-navigation .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	width: 100%;
	height: 48px;
	padding: 0 1.5rem;
	border-bottom: 1px solid var(--linea);
	color: var(--grafito);
	font-size: 1rem;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.15s;
}

.ec-mobile-menu .wp-block-navigation .wp-block-navigation-item__content:hover {
	background-color: var(--arena);
}

.ec-mobile-menu .wp-block-navigation .wp-block-navigation-item__content:focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--arcilla-700);
}

.ec-mobile-menu .wp-block-navigation .wp-block-navigation-item__content.is-active {
	background-color: rgba(243, 239, 231, 0.8);
	font-weight: 700;
}

.ec-mobile-menu__wa {
	margin: 0;
	padding: 1rem;
}

@media (min-width: 640px) {
	.ec-mobile-menu__wa {
		padding: 1.25rem;
	}
}

.ec-wa-full {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.625rem;
	width: 100%;
	min-height: 48px;
	padding: 0.875rem 1.5rem;
	border-radius: 9999px;
	background-color: var(--arcilla);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	transition: all 0.15s;
}

@media (min-width: 640px) {
	.ec-wa-full {
		font-size: 1rem;
	}
}

.ec-wa-full:hover {
	background-color: var(--arcilla-700);
	color: #fff;
}

.ec-wa-full:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--arcilla-700);
}

.ec-wa-full svg {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
}

/* ---------- Pie ---------- */
.ec-footer {
	width: 100%;
	padding: 3rem 0;
	border-top: 1px solid rgba(217, 211, 198, 0.2);
	background-color: var(--fiordo-900);
	color: #d9d5cc;
}

.ec-footer__inner {
	width: 100%;
	max-width: 80rem;
	margin: 0 auto;
	padding: 0 1.25rem;
}

@media (min-width: 640px) {
	.ec-footer__inner {
		padding: 0 2rem;
	}
}

@media (min-width: 1024px) {
	.ec-footer__inner {
		padding: 0 3rem;
	}
}

.ec-footer__top {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding-bottom: 2rem;
	border-bottom: 1px solid rgba(217, 211, 198, 0.2);
}

@media (min-width: 768px) {
	.ec-footer__top {
		flex-direction: row;
	}
}

.ec-footer__brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
}

@media (min-width: 768px) {
	.ec-footer__brand {
		align-items: flex-start;
	}
}

.ec-footer__logo {
	display: block;
	width: 140px;
	max-width: none;
	height: auto;
	aspect-ratio: 1032 / 250;
}

.ec-footer__brand-text {
	display: block;
	margin: 0;
	text-align: center;
}

@media (min-width: 768px) {
	.ec-footer__brand-text {
		text-align: left;
	}
}

.ec-footer__brand-text .wp-block-site-tagline {
	margin: 0;
	color: rgba(217, 213, 204, 0.8);
	font-size: 0.75rem;
	line-height: 1rem;
}

/* Redes: solo las que tienen dirección en Datos comerciales (sin ninguna, no se escribe nada). Ícono monocromo en marfil. */
.ec-social {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin: 0.25rem 0 0;
	padding: 0;
	list-style: none;
}

.ec-social li {
	margin: 0;
}

.ec-social__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 0.5rem;
	color: #f3efe7;
	transition: opacity 0.15s;
}

.ec-social__link:hover {
	opacity: 0.75;
}

.ec-social__link:focus-visible {
	outline: 2px solid #f3efe7;
	outline-offset: 2px;
}

.ec-social__link svg {
	display: block;
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Menú del pie: Contacto | Políticas */
.ec-footer__links {
	display: flex;
	justify-content: center;
	width: 100%;
	font-size: 0.875rem;
}

@media (min-width: 768px) {
	.ec-footer__links {
		width: auto;
	}
}

.ec-footer__links .wp-block-navigation__container {
	line-height: 1.25rem;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	white-space: nowrap;
}

.ec-footer__links .wp-block-navigation-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.ec-footer__links .wp-block-navigation-item + .wp-block-navigation-item::before {
	content: '|';
	color: rgba(217, 213, 204, 0.4);
	font-size: 0.75rem;
	-webkit-user-select: none;
	user-select: none;
}

.ec-footer__links.wp-block-navigation .wp-block-navigation-item__content {
	color: #d9d5cc;
	text-decoration: none;
	transition: color 0.15s;
}

.ec-footer__links.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: #fff;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.ec-footer__links.wp-block-navigation .wp-block-navigation-item__content:focus-visible {
	outline: 2px solid var(--arcilla);
	outline-offset: 2px;
}

/* Ubicación y WhatsApp */
.ec-footer__contact {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	margin: 0;
	font-size: 0.75rem;
	line-height: 1rem;
	color: #d9d5cc;
}

@media (min-width: 640px) {
	.ec-footer__contact {
		flex-direction: row;
	}
}

.ec-footer__contact-item {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	color: #d9d5cc;
	text-decoration: none;
}

a.ec-footer__contact-item:hover {
	color: var(--bruma);
}

.ec-footer__contact-item svg {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	fill: none;
	stroke: var(--arcilla);
}

.ec-footer__legal {
	margin: 0;
	padding-top: 1.5rem;
	color: rgba(217, 213, 204, 0.75);
	font-size: 0.75rem;
	line-height: 1.625;
	text-align: center;
}

/* CRO-1, R6: enlaces tocables de 44 px o más por debajo de 640 px */
@media (max-width: 639px) {
	.ec-logo {
		min-height: 44px;
	}

	.ec-footer__links a,
	.ec-footer__contact-item {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

/* TD-45d: entre 1024 y 1099 px el botón de WhatsApp se pasaba del ancho de la ventana (el submenú de "Servicios" sumó la flecha al menú). Se juntan un poco
   los ítems y el botón solo en ese tramo; desde 1100 px el encabezado queda como estaba. */
@media (min-width: 1024px) and (max-width: 1099.98px) {
	body.ec-tema-dorado nav.ec-nav .wp-block-navigation__container {
		gap: 0.75rem;
	}

	body.ec-tema-dorado .ec-header .ec-header__actions {
		margin-left: 12px;
	}
}
