/*
 * DiunaDent — site header (fixed bar, logo, primary navigation).
 *
 * Mobile-first: base rules below are the mobile off-canvas panel,
 * overridden for the horizontal desktop layout at min-width: 991px.
 */

body {
	padding-top: var(--dd-header-height);
	overflow-x: hidden;
}

body.dd-nav-open {
	overflow: hidden;
}

/* --- Bar ---------------------------------------------------------------- */

.dd-header {
	position: fixed;
	inset-block-start: 0;
	inset-inline: 0;
	z-index: 1000;
	height: var(--dd-header-height);
	background: var(--dd-color-black);
}

.dd-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 100%;
}

/*
 * Logo — stable top-left position, no transforms.
 *
 * The bar carries the FULL lockup (logo-diunadent.webp, 1073x651), signature
 * included. It used to carry the wordmark-only cut, because in a 72px bar the
 * "DiunaDent Clinic" line under DIUNA came out below 5px x-height — noise
 * rather than type. The client read that as the logo losing a piece of itself
 * on the way into the corner and asked for it back; the bar is now twice as
 * tall (see --dd-header-height), which is what makes the signature legible:
 * at a 96px box the line renders at ~12px.
 *
 * Docking target for the intro (D20). The intro scales its full-screen logo
 * by WIDTH onto this element's box and aligns top-left corners, so the file
 * must keep the source frame: same 1073px width, same column positions, same
 * top edge. The intro's own lockup is this exact artwork, so the two now have
 * the same proportions and the mark docks 1:1 with nothing cropped away —
 * integration.js skips both its crop and its signature blackout when the
 * target is as tall as the source. Do not re-frame, re-pad or re-scale the
 * artwork inside the file, and do not set a fixed width here that fights the
 * intrinsic ratio.
 *
 * Height: 96px box in a 144px bar — the same two-thirds the 48px mark took in
 * the 72px bar, so the logo keeps its old breathing room on both sides.
 */

.dd-header__logo {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}

.dd-header__logo-img {
	display: block;
	/* two-thirds of the bar, whatever the bar currently is — the short-viewport
	   rule in main.css halves the token and the lockup follows it down instead
	   of standing 96px tall in a 72px bar */
	height: calc(var(--dd-header-height) * 2 / 3);
	width: auto;
}

/* --- Navigation links (shared mobile/desktop typography) ----------------- */

.dd-nav {
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: 0;
}

.dd-nav li + li {
	border-top: 1px solid rgb(255 255 255 / 8%);
}

.dd-nav a {
	display: flex;
	align-items: center;
	min-height: 48px;
	padding-inline: var(--dd-gutter);
	font-family: var(--dd-font-body);
	font-weight: 600;
	font-size: 0.875rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--dd-color-accent);
	text-decoration: none;
	white-space: nowrap;
}

.dd-nav a:hover,
.dd-nav a:focus-visible {
	color: var(--dd-color-accent-light);
}

.dd-nav a[aria-current='page'],
.dd-nav .current-menu-item > a {
	color: var(--dd-color-accent-light);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

/* --- Hamburger toggle ------------------------------------------------------ */

.dd-header__toggle {
	position: relative;
	z-index: 1002;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	flex-shrink: 0;
}

.dd-header__toggle-bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--dd-color-accent);
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.dd-header__toggle.is-open .dd-header__toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.dd-header__toggle.is-open .dd-header__toggle-bar:nth-child(2) {
	opacity: 0;
}

.dd-header__toggle.is-open .dd-header__toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* --- Overlay backdrop ------------------------------------------------------ */

.dd-header__overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgb(0 0 0 / 55%);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease;
}

.dd-header__overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* --- Off-canvas panel (mobile, ≤ 990px) ------------------------------------ */

.dd-header__nav {
	position: fixed;
	inset-block: 0;
	inset-inline-end: 0;
	z-index: 1001;
	width: 320px;
	max-width: 100%;
	overflow-y: auto;
	background: var(--dd-color-black);
	padding-block-start: var(--dd-header-height);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.3s ease;
}

.dd-header__nav.is-open {
	transform: translateX(0);
	visibility: visible;
}

/*
 * Inside the off-canvas panel the focus ring turns inward. The links run the
 * full 320px of the panel, and `overflow-y: auto` forces `overflow-x: auto` on
 * the same box, so an outline drawn 2px outside the link is clipped left and
 * right — leaving the visitor with the top and bottom edges of a ring and no
 * sides. Only below 991px: above it the panel is a plain static bar that clips
 * nothing, and the ring belongs outside the link as everywhere else.
 */
@media (max-width: 990.98px) {
	.dd-header__nav .dd-nav a:focus-visible {
		outline-offset: -3px;
	}
}

/* --- Desktop (≥ 991px) ------------------------------------------------------ */

@media (min-width: 991px) {
	.dd-header__toggle,
	.dd-header__overlay {
		display: none;
	}

	.dd-header__nav {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		background: transparent;
		padding-block-start: 0;
		transform: none;
		visibility: visible;
		transition: none;
	}

	.dd-nav {
		flex-direction: row;
		align-items: center;
		gap: 2rem;
	}

	.dd-nav li + li {
		border-top: 0;
	}

	/*
	 * Touch target. The link's own font-size is deliberately untouched by the
	 * taller bar — the client asked for the bar to grow and the tab labels to
	 * stay exactly as they are — so the hit area is grown with vertical
	 * padding instead: a 23.1px line box + 2x12px = 47.1px, which clears the
	 * 44px minimum with room for the 2px focus ring at its 2px offset.
	 *
	 * This matters most between 991 and 1023px, where the menu is still
	 * inline (the hamburger starts at 990px) and is reached by finger on a
	 * landscape tablet.
	 *
	 * min-height is the floor for the case where the webfont is missing and
	 * the line box collapses; padding is what actually does the work.
	 */
	.dd-nav a {
		min-height: 44px;
		padding-block: 12px;
		padding-inline: 0;
	}
}
