/* ==========================================================================
   Encabezado principal — Turísticos Ejecutivos Sánchez
   CSS nativo. El comportamiento del menú está en js/header.js

   Estructura:
     1. Barra
     2. Marca (mascota + logo)
     3. Menú de escritorio
     4. Botón hamburguesa (y su versión flotante)
     5. Fondo oscuro (scrim)
     6. Foco visible y utilidades
     7. Móvil / tablet: panel deslizante
     8. Movimiento reducido
   ========================================================================== */

:root {
	--tes-logo-alto: 104px;      /* alto del logo en escritorio */
	--tes-mascota-alto: 92px;    /* alto de la mascota en escritorio */
	--tes-acento: #c05600;       /* naranja de marca, con contraste suficiente sobre blanco */
	--tes-foco: #8a5a00;         /* anillo de foco */
	--tes-borde: #ececec;
	--tes-gris-icono: #b9b9b9;
}

/* --------------------------------------------------------------------------
   1. Barra
   -------------------------------------------------------------------------- */

/* Sin z-index a propósito: si el encabezado creara contexto de apilado, el
   panel deslizante (que vive dentro) quedaría por debajo del fondo oscuro. */
.tes-cabecera {
	position: relative;
	background: #fff;
}

.tes-cabecera__fila {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	grid-template-areas: "marca menu mascota";
	align-items: center;
	column-gap: 24px;
	padding: 10px 0;
}

/* .ancho trae un clearfix (::after) que dentro de la rejilla estorba */
.tes-cabecera__fila::after { display: none; }

/* --------------------------------------------------------------------------
   2. Marca: logo a la izquierda y mascota a la derecha
   -------------------------------------------------------------------------- */

.tes-marca {
	grid-area: marca;
	justify-self: start;
	display: flex;
	align-items: center;
	text-decoration: none;
}

.tes-marca__logo,
.tes-cabecera__mascota {
	display: block;
	width: auto;
	height: auto;
}

.tes-marca__logo { height: var(--tes-logo-alto); }

.tes-cabecera__mascota {
	grid-area: mascota;
	justify-self: end;
	height: var(--tes-mascota-alto);
}

/* --------------------------------------------------------------------------
   3. Menú de escritorio
   -------------------------------------------------------------------------- */

.tes-menu {
	grid-area: menu;
	justify-self: center;
}

.tes-menu__cabecera { display: none; }   /* la barra del panel solo existe en móvil */

.tes-menu__lista {
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tes-menu__lista > li { display: flex; }

.tes-menu__enlace {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 13px;
	color: #222;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .3px;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	border-radius: 8px;
	transition: color .18s ease, background-color .18s ease;
}

.tes-menu__enlace:hover { color: var(--tes-acento); background: #faf7f0; }
.tes-menu__enlace[aria-current="page"] { color: var(--tes-acento); }

.tes-menu__icono {
	display: block;
	width: 21px;
	height: 21px;
	color: var(--tes-gris-icono);
	transition: color .18s ease;
}

.tes-menu__enlace:hover .tes-menu__icono,
.tes-menu__enlace[aria-current="page"] .tes-menu__icono { color: var(--tes-acento); }

/* --------------------------------------------------------------------------
   4. Botón hamburguesa
   -------------------------------------------------------------------------- */

.tes-burger {
	display: none;                 /* se muestra solo en móvil / tablet */
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color .18s ease;
}

.tes-burger:hover { background-color: #f4f4f4; }

.tes-burger__caja {
	position: relative;
	display: block;
	width: 24px;
	height: 16px;
}

.tes-burger__caja i {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	background: #333;
	border-radius: 2px;
	transition: top .25s ease, transform .25s ease, opacity .15s ease;
}

.tes-burger__caja i:nth-child(1) { top: 0; }
.tes-burger__caja i:nth-child(2) { top: 7px; }
.tes-burger__caja i:nth-child(3) { top: 14px; }

/* Abierto: las tres líneas forman una X (el estado lo marca aria-expanded) */
.tes-burger[aria-expanded="true"] .tes-burger__caja i:nth-child(1) { top: 7px; transform: rotate(45deg); }
.tes-burger[aria-expanded="true"] .tes-burger__caja i:nth-child(2) { opacity: 0; }
.tes-burger[aria-expanded="true"] .tes-burger__caja i:nth-child(3) { top: 7px; transform: rotate(-45deg); }

/* Versión flotante: aparece solo cuando el encabezado ya salió de la pantalla */
.tes-burger--flotante {
	position: fixed;
	top: 14px;
	right: 14px;
	z-index: 950;
	background: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .20), 0 0 0 1px rgba(0, 0, 0, .05);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-12px);
	transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}

.tes-burger--flotante.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .22s ease, transform .22s ease, visibility 0s;
}

/* --------------------------------------------------------------------------
   5. Fondo oscuro del panel
   -------------------------------------------------------------------------- */

.tes-scrim {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 0, 0, .5);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility 0s linear .25s;
}

.tes-scrim.is-visible {
	opacity: 1;
	visibility: visible;
	transition: opacity .25s ease, visibility 0s;
}

/* --------------------------------------------------------------------------
   6. Foco visible y utilidades
   -------------------------------------------------------------------------- */

.tes-marca:focus-visible,
.tes-menu__enlace:focus-visible,
.tes-burger:focus-visible,
.tes-menu__cerrar:focus-visible {
	outline: 3px solid var(--tes-foco);
	outline-offset: 2px;
}

/* Texto solo para lectores de pantalla */
.tes-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Bloqueo del scroll de fondo mientras el panel está abierto */
html.menu-abierto,
body.menu-abierto { overflow: hidden; }

/* --------------------------------------------------------------------------
   7. Móvil / tablet
   --------------------------------------------------------------------------
   Todo lo que depende de JavaScript está bajo html.tes-js, así que si el
   script no carga el menú queda en el flujo y la navegación sigue disponible.
   -------------------------------------------------------------------------- */

@media screen and (max-width: 1250px) {

	:root {
		--tes-logo-alto: 62px;
		--tes-mascota-alto: 54px;
	}

	.tes-cabecera { padding: 0 12px; }
	.tes-cabecera__fila {
		grid-template-areas: "marca mascota burger";
		column-gap: 10px;
		padding: 8px 0;
	}

	/* La mascota pasa al centro para dejar la hamburguesa a la derecha */
	.tes-cabecera__mascota { justify-self: center; }

	/* --- Sin JavaScript: el menú baja a una segunda fila completa --- */

	html:not(.tes-js) .tes-menu {
		grid-area: auto;
		grid-column: 1 / -1;
		grid-row: 2;
		display: block;
		margin: 0 0 10px;
	}
	html:not(.tes-js) .tes-menu__lista { flex-wrap: wrap; }

	/* --- Con JavaScript: botón y panel deslizante --- */

	html.tes-js .tes-burger {
		grid-area: burger;
		justify-self: end;
		display: inline-flex;
	}

	html.tes-js .tes-menu {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 1001;
		width: min(340px, 86vw);
		margin: 0;
		background: #fff;
		box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		transform: translateX(100%);
		visibility: hidden;
		transition: transform .28s ease, visibility 0s linear .28s;
	}

	html.tes-js .tes-cabecera.is-open .tes-menu {
		transform: none;
		visibility: visible;
		transition: transform .28s ease, visibility 0s;
	}

	html.tes-js .tes-menu__cabecera {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		position: sticky;
		top: 0;
		padding: 14px 16px;
		background: #fff;
		border-bottom: 1px solid var(--tes-borde);
	}

	html.tes-js .tes-menu__titulo {
		font-size: 12px;
		font-weight: 800;
		letter-spacing: 1.6px;
		text-transform: uppercase;
		color: #9a9a9a;
	}

	html.tes-js .tes-menu__cerrar {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		width: 42px;
		height: 42px;
		padding: 0;
		background: #f4f4f4;
		border: 0;
		border-radius: 50%;
		color: #444;
		cursor: pointer;
		transition: background-color .18s ease, color .18s ease;
	}

	html.tes-js .tes-menu__cerrar:hover { background: #eaeaea; color: #000; }
	html.tes-js .tes-menu__cerrar svg { width: 20px; height: 20px; }

	html.tes-js .tes-menu__lista {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 6px 0;
	}

	html.tes-js .tes-menu__lista > li { display: block; }

	html.tes-js .tes-menu__enlace {
		display: flex;
		width: 100%;
		padding: 14px 18px;
		border-radius: 0;
		font-size: 15px;
	}

	html.tes-js .tes-menu__lista > li:not(:last-child) .tes-menu__enlace {
		border-bottom: 1px solid #f2f2f2;
	}

	html.tes-js .tes-menu__enlace:hover { background: #faf7f0; }

	/* En móvil el menú es una lista: el texto de "Inicio" siempre se muestra */
	.tes-menu__enlace .tes-sr {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		overflow: visible;
		clip: auto;
		clip-path: none;
		white-space: normal;
	}
}

@media screen and (max-width: 600px) {
	:root {
		--tes-logo-alto: 54px;
		--tes-mascota-alto: 46px;
	}
}

/* --------------------------------------------------------------------------
   8. Movimiento reducido
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.tes-burger__caja i,
	.tes-burger--flotante,
	.tes-menu,
	.tes-scrim,
	.tes-menu__enlace,
	.tes-menu__cerrar {
		transition: none;
	}
}
