/*
 * Murex Resorts — site header (HOMEPAGE-SPEC §2, COMPONENTS §3)
 *   >= 1024: two-row top header + sticky single-row band (single row, no language switcher)
 *   <  1024: logo + Book now + burger, full-screen drawer
 * Semantic tokens only.
 */

.c-header {
	position: relative;
	z-index: var(--z-sticky);
	background-color: var(--color-surface-page);
}

.c-header__inner {
	position: relative;
}

/* ---------------------------------------------------------------- Top bar */
.c-header__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	column-gap: var(--space-base);
	padding-block: var(--space-md);
}

.c-header__start,
.c-header__end,
.c-header__divider,
.c-nav--top {
	display: none;
}

.c-header__mobile {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.c-header__logo {
	display: inline-flex;
	align-items: center;
	justify-self: start;
	min-inline-size: 0;
	max-inline-size: 100%;
	color: inherit;
}

/* Mobile: logo is capped to a 56px band so logo + Book now + burger fit 327px. */
.c-header__logo img {
	block-size: var(--touch-target);
	inline-size: auto;
	max-inline-size: 100%;
	object-fit: contain;
	object-position: left center;
}

/* Reversed logo on the Inverse band: white silhouette of the temporary raster stand-in (see Open Questions). */
[data-mode="inverse"] .c-header__logo img {
	filter: brightness(0) invert(1);
}

/*
 * Navy header: the solid "Book now" pill uses surface/brand (unchanged by the inverse re-alias),
 * so it would be navy-on-navy. Reuse the inverse treatment the sticky band already defines
 * (white pill, brand-blue text) for the top, mobile and drawer solid CTAs.
 */
.c-header[data-mode="inverse"] .c-button--solid {
	--btn-bg: var(--color-text-primary);
	--btn-fg: var(--color-surface-brand);
	--btn-border: var(--color-text-primary);
}

.c-header[data-mode="inverse"] .c-button--solid:hover {
	--btn-bg: var(--color-surface-subtle);
	--btn-border: var(--color-surface-subtle);
}

.c-button--compact {
	padding-inline: var(--space-lg);
}

@media (max-width: 479.98px) {
	.c-button--compact {
		padding-inline: var(--space-base);
	}
}

/* Stuck band is desktop only. */
.c-header__bar--stuck {
	display: none;
}

/* ---------------------------------------------------------------- Nav (desktop) */
.c-nav__list {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-nav__link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	min-block-size: var(--touch-target);
	padding: 0 var(--space-base);
	border: 0;
	background: none;
	color: var(--color-text-primary);
	font-family: var(--font-roboto);
	font-size: var(--fs-body);
	font-weight: 400;
	line-height: var(--lh-body);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.c-nav__link:hover {
	text-decoration: underline;
	text-underline-offset: var(--space-xs);
}

/* Current page / open panel: bar AND colour, never colour alone. */
.c-nav__link[aria-current="page"],
.c-nav__link[aria-expanded="true"] {
	color: var(--color-text-link);
}

[data-mode="inverse"] .c-nav__link[aria-current="page"],
[data-mode="inverse"] .c-nav__link[aria-expanded="true"] {
	color: var(--color-text-primary);
}

.c-nav__link[aria-current="page"]::after,
.c-nav__link[aria-expanded="true"]::after {
	content: "";
	position: absolute;
	inset-inline: var(--space-base);
	inset-block-end: var(--space-sm);
	block-size: var(--space-xs);
	border-radius: var(--radius-full);
	background-color: currentColor;
}

.c-nav__link[aria-expanded="true"] .c-icon {
	transform: rotate(180deg);
}

.c-nav__link .c-icon {
	inline-size: 20px;
	block-size: 20px;
}

/* Dropdown panel: white card, radius/base, elevation-2, always Default mode. */
.c-nav__panel {
	position: absolute;
	inset-block-start: 100%;
	inset-inline-start: 50%;
	z-index: var(--z-dropdown);
	inline-size: min(calc(100% - 2 * var(--page-gutter)), calc(var(--cols, 3) * 100% / 6));
	padding: var(--space-lg);
	border-radius: var(--radius-base);
	box-shadow: var(--elevation-2);
	transform: translateX(-50%);
}

.c-nav__panel[data-cols="2"] {
	--cols: 2;
}

.c-nav__panel[data-cols="3"] {
	--cols: 3;
}

.c-nav__panel[data-cols="6"] {
	--cols: 6;
}

.c-nav__panel-head {
	margin-block-end: var(--space-base);
}

.c-nav__cards {
	display: grid;
	grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
	gap: var(--grid-gutter);
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-nav-card {
	display: block;
	color: var(--color-text-primary);
	text-decoration: none;
}

.c-nav-card__media {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-radius: var(--radius-base);
	background-color: var(--color-surface-subtle);
}

.c-nav-card__media img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.c-nav-card__title {
	display: block;
	margin-block-start: var(--space-sm);
	font-size: var(--fs-label);
	font-weight: 500;
	line-height: var(--lh-label);
	letter-spacing: var(--ls-label);
}

.c-nav-card:hover .c-nav-card__title {
	color: var(--color-text-link);
	text-decoration: underline;
	text-underline-offset: var(--space-xs);
}

/* ---------------------------------------------------------------- Drawer (mobile) */
.c-drawer {
	position: fixed;
	inset: 0;
	z-index: var(--z-drawer);
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: var(--color-surface-page);
	color: var(--color-text-primary);
}

.c-drawer__top .c-header__row {
	padding-inline: var(--page-gutter);
}

.c-drawer__top {
	inline-size: 100%;
	border-block-end: 1px solid var(--color-border-subtle);
}

.c-drawer__list,
.c-drawer__children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-drawer__row {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-base);
	inline-size: 100%;
	min-block-size: var(--space-3xl);
	padding: var(--space-sm) var(--page-gutter);
	border: 0;
	border-block-end: 1px solid var(--color-border-subtle);
	background: none;
	color: var(--color-text-primary);
	text-align: start;
	text-decoration: none;
	cursor: pointer;
}

.c-drawer__text {
	display: flex;
	flex-direction: column;
}

.c-drawer__title {
	font-size: var(--fs-body);
	font-weight: 500;
	line-height: var(--lh-body);
}

.c-drawer__sub,
.c-drawer__desc {
	color: var(--color-text-muted);
	font-size: var(--fs-body-sm);
	line-height: var(--lh-body-sm);
}

.c-drawer__row[aria-expanded="true"] .c-icon {
	transform: rotate(180deg);
}

.c-drawer__children {
	background-color: var(--color-surface-subtle);
}

.c-drawer__child {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-block-size: var(--touch-target);
	padding: var(--space-sm) var(--page-gutter) var(--space-sm) calc(var(--page-gutter) + var(--space-lg));
	border-block-end: 1px solid var(--color-border-subtle);
	color: var(--color-text-primary);
	text-decoration: none;
}

.c-drawer__child .c-drawer__title {
	font-weight: 500;
}

/* Current page: bar + colour. */
.c-drawer__row[aria-current="page"],
.c-drawer__child[aria-current="page"] {
	color: var(--color-text-link);
}

.c-drawer__row[aria-current="page"]::before,
.c-drawer__child[aria-current="page"]::before {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	inline-size: var(--space-xs);
	background-color: var(--color-text-link);
}

.c-drawer__foot {
	margin-block-start: auto;
	padding: var(--space-lg) var(--page-gutter);
}

.c-drawer .c-lang-switch__panel {
	position: static;
	margin-block-start: var(--space-sm);
	box-shadow: none;
	border: 1px solid var(--color-border-subtle);
}

html.has-drawer-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------- Desktop (>= 1024) */
@media (min-width: 1024px) {
	.c-header__row {
		grid-template-columns: 1fr auto 1fr;
	}

	.c-header__start,
	.c-header__end {
		display: flex;
		align-items: center;
		gap: var(--space-base);
	}

	.c-header__start {
		justify-self: start;
	}

	.c-header__end {
		justify-self: end;
	}

	.c-header__logo {
		grid-column: 2;
		grid-row: 1;
	}

	.c-header__start {
		grid-column: 1;
		grid-row: 1;
	}

	.c-header__end {
		grid-column: 3;
		grid-row: 1;
	}

	.c-header__mobile,
	.c-drawer {
		display: none;
	}

	.c-header__logo img {
		block-size: auto;
	}

	.c-header__divider {
		display: block;
		margin: 0;
		border: 0;
		border-block-start: 1px solid var(--color-border-subtle);
	}

	.c-nav--top {
		display: block;
	}

	.c-nav--top .c-nav__list {
		justify-content: center;
	}

	/* Sticky single-row band: brand/primary, Inverse mode, no language switcher. */
	.c-header__bar--stuck {
		position: fixed;
		inset-block-start: var(--wp-admin--admin-bar--height, 0px);
		inset-inline: 0;
		z-index: var(--z-sticky);
		display: block;
		background-color: var(--color-surface-brand);
		box-shadow: var(--elevation-2);
		transform: translateY(-100%);
		visibility: hidden;
		transition: transform var(--duration-fast) ease-out, visibility 0s linear var(--duration-fast);
	}

	.c-header.is-stuck .c-header__bar--stuck {
		transform: none;
		visibility: visible;
		transition: transform var(--duration-fast) ease-out, visibility 0s;
	}

	.c-header__row--stuck {
		grid-template-columns: 1fr auto 1fr;
		padding-block: var(--space-lg);
	}

	.c-header__row--stuck .c-nav {
		grid-column: 1;
		grid-row: 1;
		justify-self: start;
	}

	.c-header__row--stuck .c-header__logo {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
		min-inline-size: max-content;
	}

	.c-header__row--stuck .c-nav__link {
		padding-inline: var(--space-sm);
	}

	.c-header__row--stuck .c-header__end {
		grid-column: 3;
		grid-row: 1;
		gap: var(--space-sm);
	}
}
