/* cl-header: header avanzado, off-canvas, search modal, mega menú. */

/* ---------- Header avanzado ---------- */
[data-clh-header] { transition: background 250ms ease, box-shadow 250ms ease, padding 250ms ease, transform 300ms ease; }
[data-clh-header].is-sticky        { position: sticky; top: 0; z-index: 100; background: var(--wp--preset--color--base, #fff); }
[data-clh-header].is-transparente:not(.is-scrolled) { background: transparent; }
[data-clh-header].is-scrolled      { background: var(--wp--preset--color--base, #fff); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
[data-clh-header].is-reducible.is-scrolled { padding-top: 0.5rem; padding-bottom: 0.5rem; }
[data-clh-header].is-autohide.is-oculto    { transform: translateY(-100%); }

/* ---------- Off-canvas ---------- */
.clh-oc { display: inline-block; position: relative; }
.clh-oc.is-solo-mobile { display: none; }
@media (max-width: 767px) { .clh-oc.is-solo-mobile { display: inline-block; } }

.clh-oc-boton { background: transparent; border: 0; padding: 0.5rem; cursor: pointer; color: inherit; }
.clh-oc-lineas { display: inline-flex; flex-direction: column; gap: 4px; width: 24px; }
.clh-oc-lineas span { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform 200ms ease, opacity 200ms ease; }
.clh-oc[data-open="1"] .clh-oc-lineas span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.clh-oc[data-open="1"] .clh-oc-lineas span:nth-child(2) { opacity: 0; }
.clh-oc[data-open="1"] .clh-oc-lineas span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.clh-oc-panel {
	position: fixed; top: 0; bottom: 0; width: min(360px, 85vw);
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contraste, #111);
	padding: 3rem 1.5rem 1.5rem;
	z-index: 200;
	transform: translateX(100%);
	transition: transform 300ms ease;
	overflow-y: auto;
	box-shadow: -10px 0 30px rgba(0,0,0,0.15);
}
.clh-oc.is-izquierda .clh-oc-panel { right: auto; left: 0; transform: translateX(-100%); box-shadow: 10px 0 30px rgba(0,0,0,0.15); }
.clh-oc.is-derecha   .clh-oc-panel { left: auto; right: 0; }
.clh-oc[data-open="1"] .clh-oc-panel { transform: translateX(0); }
.clh-oc-cerrar { position: absolute; top: 0.5rem; right: 0.5rem; background: transparent; border: 0; font-size: 1.75rem; line-height: 1; cursor: pointer; color: inherit; }

.clh-oc-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; opacity: 0; transition: opacity 300ms; }
.clh-oc[data-open="1"] .clh-oc-backdrop { opacity: 1; }

body.clh-oc-abierto { overflow: hidden; }

/* ---------- Search modal ---------- */
.clh-sm-boton { background: transparent; border: 0; padding: 0.5rem; cursor: pointer; color: inherit; display: inline-flex; }
.clh-sm { border: 0; padding: 0; background: transparent; max-width: 90vw; width: 640px; margin-top: 15vh; }
.clh-sm::backdrop { background: rgba(0,0,0,0.6); }
.clh-sm-inner { background: var(--wp--preset--color--base, #fff); color: var(--wp--preset--color--contraste, #111); padding: 2rem; border-radius: 12px; position: relative; }
.clh-sm-inner form { display: flex; gap: 0.5rem; }
.clh-sm-inner input[type="search"] { flex: 1; padding: 0.75rem 1rem; border: 1px solid var(--wp--preset--color--borde, #e5e7eb); border-radius: 8px; font-size: 1.125rem; }
.clh-sm-inner button[type="submit"] { padding: 0.75rem 1.5rem; background: var(--wp--preset--color--primario, #2563eb); color: #fff; border: 0; border-radius: 8px; font-weight: 600; cursor: pointer; }
.clh-sm-cerrar { position: absolute; top: 0.5rem; right: 0.5rem; background: transparent; border: 0; font-size: 1.75rem; cursor: pointer; }
.screen-reader-text { position: absolute; left: -9999px; }

/* ---------- Mega menú ---------- */
.clh-mm { position: relative; display: inline-block; }
.clh-mm-boton { background: transparent; border: 0; padding: 0.5rem 0.75rem; cursor: pointer; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 0.25rem; }
.clh-mm-chevron { transition: transform 200ms ease; }
.clh-mm[data-open="1"] .clh-mm-chevron { transform: rotate(180deg); }
.clh-mm-panel {
	position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
	width: var(--clh-mm-ancho, 900px); max-width: 95vw;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contraste, #111);
	border-radius: 12px;
	box-shadow: 0 20px 40px rgba(0,0,0,0.12);
	padding: 1.5rem;
	z-index: 90;
	margin-top: 0.5rem;
}
@media (max-width: 900px) { .clh-mm-panel { position: static; transform: none; width: 100%; box-shadow: none; margin-top: 0.5rem; } }

@media (prefers-reduced-motion: reduce) {
	[data-clh-header], .clh-oc-panel, .clh-mm-chevron { transition: none; }
}
