/* ==========================================================================
   TopBar — barra fija crema con borde teal oscuro, esquinas redondeadas. Se oculta al bajar el scroll
   (ver assets/js/topbar.js).
   ========================================================================== */

:root {
	--dh-topbar-h: 96px;
	--dh-topbar-gap: 10px; /* separación con el borde de la ventana */
	--dh-topbar-ink: #0f2a2c; /* teal oscuro del borde y de los íconos */
	--dh-topbar-text: #04322f; /* verde del logotipo */
}

/* Reserva el alto de la barra para que no tape el inicio de la página. */
body {
	padding-top: calc(var(--dh-topbar-h) + var(--dh-topbar-gap) * 2);
}

.dh-topbar {
	position: fixed;
	top: var(--dh-topbar-gap);
	left: var(--dh-topbar-gap);
	right: var(--dh-topbar-gap);
	z-index: 4000;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	height: var(--dh-topbar-h);
	padding: 0 clamp(1.5rem, 3vw, 2.75rem);
	box-sizing: border-box;
	background: var(--wp--preset--color--crema, #ede6dc);
	border: 3px solid var(--dh-topbar-ink);
	border-radius: 26px;
	box-shadow: 0 6px 18px rgba(15, 42, 44, 0.14);
	overflow: hidden;
	transform: translateY(0);
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.dh-topbar.is-hidden {
	transform: translateY(calc(-100% - var(--dh-topbar-gap) - 8px));
}

/* Sincronización inicial: nunca se anima como si fuera un scroll. */
.dh-topbar.dh-topbar--init,
.dh-topbar.dh-topbar--init * {
	transition: none !important;
}

/* -- Logo -------------------------------------------------------------------- */

.dh-topbar__logo {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	text-decoration: none;
}

.dh-topbar__logo img {
	display: block;
	height: clamp(26px, calc(var(--dh-topbar-h) * 0.36), 38px); /* logo horizontal: mucho más ancho que alto */
	margin-left: 0.4rem;
	width: auto;
}

/* -- Menú -------------------------------------------------------------------- */

.dh-topbar__menu {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(1rem, 3vw, 2.75rem);
	flex: 1 1 auto;
}

.dh-topbar__menu a {
	font-family: var(--wp--preset--font-family--sans, "Hanken Grotesk", system-ui, sans-serif);
	font-size: 15px;
	font-weight: 600;
	color: var(--dh-topbar-text);
	text-decoration: none;
	padding: 8px 4px;
	background: linear-gradient(currentColor, currentColor) 50% 100% / 0 2px no-repeat;
	transition: background-size 0.25s ease;
}

.dh-topbar__menu a:hover,
.dh-topbar__menu a:focus-visible {
	background-size: 100% 2px;
}

/* -- Acciones ---------------------------------------------------------------- */

.dh-topbar__actions {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
}

.dh-topbar__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--dh-topbar-ink);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.dh-topbar__icon:hover,
.dh-topbar__icon:focus-visible {
	background: rgba(15, 42, 44, 0.09);
}

.dh-topbar__icon svg {
	width: 24px;
	height: 24px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Íconos rellenos (WhatsApp de Font Awesome) en vez de trazo. */
.dh-topbar__icon svg.is-fill {
	width: 27px; /* el dibujo de FA trae aire alrededor: a 22px se veía chico junto al de perfil */
	height: 27px;
	fill: currentColor;
	stroke: none;
}

/* El mundo se ve chico junto a los otros (como en la tienda): un poco más grande y con el trazo compensado. */
.dh-topbar__icon--lang svg {
	transform: translateY(2px) scale(1.12);
	stroke-width: 1.8;
}

/* Menú de idioma (va en <body>, bajo el mundo). Mismo diseño que el de la tienda. */
.dh-topbar__langmenu {
	position: fixed;
	z-index: 4001;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 190px;
	padding: 6px;
	border-radius: 18px;
	background: var(--wp--preset--color--crema, #ede6dc);
	border: 1px solid rgba(255, 255, 255, 0.85);
	box-shadow: 0 12px 40px rgba(4, 50, 47, 0.18);
	color: var(--dh-topbar-text);
	transform-origin: 85% 0;
	animation: dh-topbar-lang-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes dh-topbar-lang-in {
	from { opacity: 0; transform: translateY(-6px) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
	.dh-topbar__langmenu { animation: none; }
}

.dh-topbar__langmenu[hidden] {
	display: none;
}

.dh-topbar__langmenu button {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 15px;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.dh-topbar__langmenu button:hover,
.dh-topbar__langmenu button:focus-visible {
	background: rgba(4, 50, 47, 0.06);
	outline: none;
}

/* El idioma elegido: fondo de campo y negritas, como en la tienda. */
.dh-topbar__langmenu [aria-selected="true"] {
	background: #f4edda;
	font-weight: 600;
}

.dh-topbar__langmenu b {
	min-width: 32px;
	font-size: 12px;
	letter-spacing: 0.06em;
}

.dh-topbar__langmenu svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
	margin-left: auto;
	opacity: 0;
}

.dh-topbar__langmenu [aria-selected="true"] svg {
	opacity: 1;
}

/* -- Móvil: sin menú de texto (queda para un drawer), logo más chico ------------ */

@media (max-width: 900px) {
	:root {
		--dh-topbar-h: 76px;
		--dh-topbar-gap: 8px;
	}

	.dh-topbar {
		gap: 12px;
		padding: 0 1rem;
		border-radius: 20px;
	}

	.dh-topbar__menu {
		display: none;
	}

	.dh-topbar__actions {
		margin-left: auto;
	}
}
