/* Gran Castillo de Pedraza Essentials · Cabecera GCP
 * Una sola fila siempre. Con .is-collapsed el menú se oculta (sigue midiéndose)
 * y aparece el botón que abre el desplegable.
 */

.gcpe-header {
	--gcpe-bar-bg: #005377;
	--gcpe-link: #ffffff;
	--gcpe-link-hover: #f7d547;
	--gcpe-link-hover-bg: rgba(7, 65, 90, 0.55);
	--gcpe-link-active: #f7d547;
	--gcpe-cta: #0c5475;
	--gcpe-cta-bg: #f7d547;
	--gcpe-cta-hover: #0c5475;
	--gcpe-cta-hover-bg: #ffffff;
	--gcpe-toggle: #ffffff;
	--gcpe-toggle-hover-bg: rgba(255, 255, 255, 0.1);
	--gcpe-toggle-size: 24px;
	--gcpe-panel-bg: #0c5475;
	--gcpe-panel-link: #ffffff;
	--gcpe-panel-hover: #f7d547;
	--gcpe-panel-hover-bg: rgba(255, 255, 255, 0.06);
	--gcpe-panel-active: #f7d547;
	--gcpe-panel-divider: rgba(255, 255, 255, 0.12);
	--gcpe-pad-left: 32px;
	--gcpe-pad-right: 32px;
	--gcpe-focus: #f7d547;
	--gcpe-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

	position: relative;
	z-index: 20;
	width: 100%;
	background: var(--gcpe-bar-bg);
	box-sizing: border-box;
	/* El menú plegado se sigue midiendo fuera de la vista: que nunca cree scroll lateral */
	overflow-x: clip;
}

.gcpe-header *,
.gcpe-header *::before,
.gcpe-header *::after {
	box-sizing: border-box;
}

/* Valores por defecto de lo que también controla Elementor: especificidad cero
   con :where() para que los ajustes del panel siempre ganen. */
:where(.gcpe-header) :where(.gcpe-menu) { column-gap: 4px; }
:where(.gcpe-header) :where(.gcpe-menu a) { padding: 10px 16px; border-radius: 6px; }
:where(.gcpe-header) :where(.gcpe-cta) { padding: 12px 24px 10px; border-radius: 8px; }
:where(.gcpe-header) :where(.gcpe-panel-menu a) {
	padding: 18px var(--gcpe-pad-right) 18px var(--gcpe-pad-left);
	text-align: right;
}

/* ─── Barra ─────────────────────────────────────────────────────────── */

/* El contenido de la barra respeta el mismo ancho máximo que las páginas y el pie */
.gcpe-bar {
	max-width: calc(var(--gcpe-content, 1360px) + var(--gcpe-pad-left, 32px) + var(--gcpe-pad-right, 32px));
	margin-left: auto;
	margin-right: auto;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	column-gap: 32px;
	min-height: 77px;
	padding: 4px 32px;
}

.gcpe-logo {
	flex: 0 0 auto;
	display: block;
	line-height: 0;
	border-radius: 4px;
}

.gcpe-logo img {
	display: block;
	width: 89px;
	max-width: none;
	height: auto;
}

/* ─── Menú en la barra ──────────────────────────────────────────────── */

.gcpe-nav {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	justify-content: center;
}

.gcpe-header ul.gcpe-menu,
.gcpe-header ul.gcpe-menu ul,
.gcpe-header ul.gcpe-panel-menu,
.gcpe-header ul.gcpe-panel-menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gcpe-header ul.gcpe-menu {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
}

.gcpe-menu > li {
	position: relative;
	flex: 0 0 auto;
	margin: 0;
}

.gcpe-header .gcpe-menu a {
	display: block;
	color: var(--gcpe-link);
	white-space: nowrap;
	text-decoration: none;
	transition: color 180ms ease-out, background-color 180ms ease-out;
}

.gcpe-header .gcpe-menu a:hover,
.gcpe-header .gcpe-menu li:focus-within > a {
	color: var(--gcpe-link-hover);
	background-color: var(--gcpe-link-hover-bg);
}

.gcpe-header .gcpe-menu .current-menu-item > a,
.gcpe-header .gcpe-menu .current-menu-ancestor > a,
.gcpe-header .gcpe-menu a[aria-current="page"] {
	color: var(--gcpe-link-active);
}

/* Submenús (si el menú los tiene): caja bajo el elemento al pasar o con foco */
.gcpe-header .gcpe-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 50%;
	z-index: 30;
	min-width: 220px;
	padding: 6px;
	border-radius: 8px;
	background: var(--gcpe-panel-bg);
	box-shadow: 0 14px 32px rgba(0, 25, 38, 0.35);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 6px);
	transition: opacity 180ms ease-out, transform 260ms var(--gcpe-ease-out), visibility 0s linear 260ms;
}

.gcpe-header .gcpe-menu li:hover > .sub-menu,
.gcpe-header .gcpe-menu li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition-delay: 0s;
}

.gcpe-header .gcpe-menu .sub-menu a {
	font-size: 0.8em;
	padding: 10px 14px;
}

/* ─── Botón de entradas ─────────────────────────────────────────────── */

.gcpe-actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	column-gap: 8px;
	margin-left: auto;
}

.gcpe-header .gcpe-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: var(--gcpe-cta-bg);
	color: var(--gcpe-cta);
	white-space: nowrap;
	text-decoration: none;
	box-shadow: 0 2px 6px rgba(0, 25, 38, 0.18);
	transition: background-color 220ms ease-out, color 220ms ease-out, box-shadow 220ms ease-out, transform 220ms var(--gcpe-ease-out);
}

.gcpe-header .gcpe-cta:hover {
	background-color: var(--gcpe-cta-hover-bg);
	color: var(--gcpe-cta-hover);
	box-shadow: 0 6px 16px rgba(0, 25, 38, 0.28);
	transform: translateY(-1px);
}

.gcpe-header .gcpe-cta:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(0, 25, 38, 0.18);
}

.gcpe-cta-short {
	display: none;
}

/* ─── Botón del desplegable (anula el estilo de botón del tema) ─────── */

.gcpe-header button.gcpe-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--gcpe-toggle);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 180ms ease-out;
}

.gcpe-header button.gcpe-toggle:hover,
.gcpe-header button.gcpe-toggle:focus,
.gcpe-header.is-open button.gcpe-toggle {
	background: var(--gcpe-toggle-hover-bg);
	color: var(--gcpe-toggle);
}

.gcpe-toggle-icon {
	position: relative;
	display: block;
	width: var(--gcpe-toggle-size);
	height: calc(var(--gcpe-toggle-size) * 0.75);
}

.gcpe-toggle-icon span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform 320ms var(--gcpe-ease-out), opacity 160ms ease-out;
}

.gcpe-toggle-icon span:nth-child(1) { top: 0; }
.gcpe-toggle-icon span:nth-child(2) { top: calc(50% - 1px); }
.gcpe-toggle-icon span:nth-child(3) { bottom: 0; }

.gcpe-header.is-open .gcpe-toggle-icon span:nth-child(1) {
	transform: translateY(calc(var(--gcpe-toggle-size) * 0.375 - 1px)) rotate(45deg);
}

.gcpe-header.is-open .gcpe-toggle-icon span:nth-child(2) {
	opacity: 0;
	transform: scaleX(0.4);
}

.gcpe-header.is-open .gcpe-toggle-icon span:nth-child(3) {
	transform: translateY(calc(var(--gcpe-toggle-size) * -0.375 + 1px)) rotate(-45deg);
}

/* ─── Estado plegado: el menú se aparta pero se sigue midiendo ──────── */

.gcpe-header.is-collapsed .gcpe-nav {
	position: absolute;
	inset: 0 auto auto 0;
	width: 0;
	overflow: hidden;
	visibility: hidden;
	pointer-events: none;
}

.gcpe-header.is-collapsed button.gcpe-toggle {
	display: inline-flex;
}

/* ─── Panel desplegable ─────────────────────────────────────────────── */

.gcpe-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 40;
	max-height: calc(100vh - 80px);
	max-height: calc(100dvh - 80px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--gcpe-panel-bg);
	box-shadow: 0 18px 40px rgba(0, 25, 38, 0.35);
	visibility: hidden;
	opacity: 0;
	clip-path: inset(0 0 100% 0);
	transition: clip-path 420ms var(--gcpe-ease-out), opacity 200ms ease-out, visibility 0s linear 420ms;
}

.gcpe-header:not(.is-collapsed) .gcpe-panel {
	display: none;
}

.gcpe-header.is-open .gcpe-panel {
	visibility: visible;
	opacity: 1;
	clip-path: inset(0 0 0 0);
	transition-delay: 0s;
}

.gcpe-header ul.gcpe-panel-menu {
	padding: 6px 0 10px;
}

.gcpe-panel-menu li {
	margin: 0;
}

.gcpe-panel-menu > li + li {
	border-top: 1px solid var(--gcpe-panel-divider);
}

.gcpe-header .gcpe-panel-menu a {
	display: block;
	color: var(--gcpe-panel-link);
	text-decoration: none;
	transition: color 160ms ease-out, background-color 160ms ease-out;
}

.gcpe-header .gcpe-panel-menu a:hover {
	color: var(--gcpe-panel-hover);
	background-color: var(--gcpe-panel-hover-bg);
}

.gcpe-header .gcpe-panel-menu .current-menu-item > a,
.gcpe-header .gcpe-panel-menu a[aria-current="page"] {
	color: var(--gcpe-panel-active);
}

.gcpe-header .gcpe-panel-menu .sub-menu a {
	padding-top: 12px;
	padding-bottom: 12px;
	font-size: 0.85em;
	opacity: 0.85;
}

/* Los enlaces del panel entran escalonados al abrir */
.gcpe-panel-menu > li {
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 240ms ease-out, transform 360ms var(--gcpe-ease-out);
}

.gcpe-header.is-open .gcpe-panel-menu > li {
	opacity: 1;
	transform: none;
}

.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(2) { transition-delay: 30ms; }
.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(3) { transition-delay: 60ms; }
.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(4) { transition-delay: 90ms; }
.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(5) { transition-delay: 120ms; }
.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(6) { transition-delay: 150ms; }
.gcpe-header.is-open .gcpe-panel-menu > li:nth-child(n+7) { transition-delay: 180ms; }

/* ─── Foco visible ──────────────────────────────────────────────────── */

.gcpe-header a:focus-visible,
.gcpe-header button:focus-visible {
	outline: 2px solid var(--gcpe-focus);
	outline-offset: 3px;
}

.gcpe-header a:focus:not(:focus-visible),
.gcpe-header button:focus:not(:focus-visible) {
	outline: none;
}

.gcpe-empty {
	flex: 1 1 auto;
	margin: 0;
	color: var(--gcpe-link);
	font-size: 14px;
	opacity: 0.8;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.gcpe-header *,
	.gcpe-header *::before,
	.gcpe-header *::after,
	.gcpe-panel {
		transition-duration: 1ms !important;
		transition-delay: 0s !important;
	}
}
