/* =============================================================================
   MOBILE NAV — multi-level slide-in drawer (task 2.4)
   One <dialog id="mobile-nav">, panels pushed / popped via mobile-nav.js.
   Two levels: root panel + four child panels (Products, Industries,
   Technical Center, About Us). Products scrolls (1193px per Figma).
   BUG-26: no scrim specified — scroll lock implemented, ::backdrop transparent.
   Carousel slots wired in task 2.4b.
   ============================================================================= */

/* ── Hamburger toggle ─────────────────────────────────────────────────────── */

.mobile-nav-toggle {
	display: none; /* shown only on mobile via breakpoint override below */
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	color: var(--fig-siegel-black);
	flex-shrink: 0;
}

.mobile-nav-toggle svg { display: block; }

/* ── Scroll-lock when drawer is open ────────────────────────────────────────── */

html.nav-open { overflow: hidden; }

/* Dialog - Figma 300ms EASE_OUT dissolve. */

.mobile-nav {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: 100%;
	height: 100%;
	max-height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: #fff;
	overflow: hidden;
	z-index: 300;

	/* Closed state (default while dialog is display:none).
	   Slides in from the right — the hamburger sits on that side, and it
	   matches the category filter drawer. Opacity rides along so the edge is
	   not hard. translate is a compositor property, so the slide stays cheap. */
	opacity: 0;
	translate: 100% 0;
	transition:
		translate var(--dur-base) ease-out,
		opacity var(--dur-base) ease-out,
		overlay var(--dur-base) allow-discrete,
		display var(--dur-base) allow-discrete;
	transition-behavior: allow-discrete; /* belt-and-suspenders for Safari */
}

.mobile-nav[open] {
	opacity: 1;
	translate: 0 0;
}

/* Starting point when the dialog transitions from closed → open */
@starting-style {
	.mobile-nav[open] {
		opacity: 0;
		translate: 100% 0;
	}
}

/* No scrim — dialog covers the full screen, backdrop is irrelevant visually */
.mobile-nav::backdrop { background: transparent; }

@media (prefers-reduced-motion: reduce) {
	.mobile-nav,
	.mobile-nav__panel { transition: none !important; }
}

/* ── Panel track ──────────────────────────────────────────────────────────── */

.mobile-nav__track {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

/* ── Panels — each is absolute and full-size ──────────────────────────────── */

.mobile-nav__panel {
	position: absolute;
	inset: 0;
	overflow-y: auto;
	overscroll-behavior-y: contain;
	background: #fff;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: none;
}

.mobile-nav__panel.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 2;
}

/* Root panel starts visible. Most child variants change immediately. */
.mobile-nav__panel--root {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 1;
}

/* Hide the root when a child variant is active. */
.mobile-nav--child-open .mobile-nav__panel--root {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Industries is the one mobile-menu variant with a Figma dissolve. */
.mobile-nav--dissolve .mobile-nav__panel {
	transition:
		opacity var(--dur-base) ease-out,
		visibility 0s var(--dur-base);
}

.mobile-nav--dissolve .mobile-nav__panel.is-active,
.mobile-nav--dissolve .mobile-nav__panel--root {
	transition:
		opacity var(--dur-base) ease-out,
		visibility 0s 0s;
}

/* ── BACK / close button ──────────────────────────────────────────────────── */

.mobile-nav__back {
	position: relative;
	/* flex, not inline-flex: as an inline box it sat on the parent's text
	   baseline and the descender space under it pushed everything below down
	   2px. */
	display: flex;
	align-self: flex-start;
	align-items: center;
	/* 175:14055 — gap 4, and the container's own pt-24 puts the row on y=25. */
	gap: 4px;
	padding: 24px 20px 0;
	background: none;
	border: 0;
	cursor: pointer;
	/* .t-caption-sm: Aktiv Grotesk Bold 10/12, uppercase, ls 0.6px */
	font: var(--fw-bold) 0.625rem/0.75rem var(--font-heading);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	color: var(--fig-siegel-black);
}

.mobile-nav__back svg { display: block; flex-shrink: 0; }

/* Tap-target extension to 44px */
.mobile-nav__back::after {
	content: '';
	position: absolute;
	inset: 0 0 -6px;
	min-height: 44px;
}

.mobile-nav__back:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

/* ── Panel inner padding ──────────────────────────────────────────────────── */

/*
 * Figma: outer Container x=20, width=353 inside 393px frame = 20px side gutters.
 * This wrapper is applied to all panel-level content divs.
 */
.mobile-nav__panel-inner {
	padding: 0 20px;
}

/* ── Root — main nav items (with chevron-right) ───────────────────────────── */

.mobile-nav__main-list {
	list-style: none;
	margin: 0;
	padding: 24px 0 0; /* gap from BACK to first item: ~24px */
}

.mobile-nav__main-item {
	display: block;
}

.mobile-nav__main-row {
	display: flex;
	align-items: center;
	width: 100%;
	min-height: 36px;
}

.mobile-nav__main-link {
	/* A menu item with no URL renders as a <button> so that tapping it opens
	   its panel instead of navigating. These four lines are what stop the
	   browser drawing it as a button; everything below is shared with the
	   <a> and the <span> forms. */
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: 0;
	text-align: left;
	width: 100%;
	cursor: pointer;
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	min-height: 36px;
	/* 175:14062 stacks 20px rows with gap-16, a 36px pitch. The 16 is paid as
	   padding on the row rather than as a gap on the list, so the hit areas
	   tile edge to edge with no dead strip between them — a 353×36 target,
	   rather than 353×20 islands. */
	padding: 8px 0;
	/* .t-link — 175:14068 is the heading family at Medium 16, normal leading,
	   -0.4 tracking. It was set in .t-body (Lato Regular 16/20.2), which is the
	   body face at the wrong weight. */
	/* .t-link pinned. The Link style is lineHeight:AUTO in the file, and BUG-17
	   says to pin it: "Figma AUTO uses the font's intrinsic metrics, which will
	   not match CSS normal for a different font." Figma draws these rows at 20;
	   the browser resolves `normal` to 21, which cost a pixel on every row. */
	font: var(--fw-medium) 1rem/1.25rem var(--font-heading);
	letter-spacing: var(--ls-tight);
	color: var(--text-heading-primary);
	text-decoration: none;
}

.mobile-nav__main-toggle {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--text-heading-primary);
	cursor: pointer;
}

.mobile-nav__main-link:focus-visible,
.mobile-nav__main-toggle:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

.mobile-nav__chevron-right {
	display: block;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: var(--fig-siegel-black);
}

/* ── Separator between main and secondary items ────────────────────────────── */

/*
 * Figma: Frame 40 at y=144 within Frame 41, height=32, line at y=16 within.
 * = 16px top space, 1px rule, 16px bottom space = 32px total frame.
 */
.mobile-nav__rule {
	border: 0;
	border-top: 1px solid var(--fig-neutral-200);
	margin: 16px 0;
}

/* ── Root — secondary items (FAQS, Contact Us, etc.) ─────────────────────── */

/*
 * Figma: Frame 1011 at y=235. First item at y=16 within frame.
 * Items: height ~17px, pitch 33.25px → gap ~16px.
 */
.mobile-nav__secondary-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	/* The 16 is on the row, not the list — same reason as the main list. */
	gap: 0;
	/* 175:14100 carries its own pt-16 on top of the rule's 16 below the line. */
	padding-top: 16px;
}

.mobile-nav__secondary-link,
.mobile-nav__secondary-btn {
	display: flex;
	align-items: center;
	padding: 8px 0;
	background: none;
	border: 0;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	/* .t-link pinned. The Link style is lineHeight:AUTO in the file, and BUG-17
	   says to pin it: "Figma AUTO uses the font's intrinsic metrics, which will
	   not match CSS normal for a different font." Figma draws these rows at 20;
	   the browser resolves `normal` to 21, which cost a pixel on every row. */
	font: var(--fw-medium) 1rem/1.25rem var(--font-heading);
	letter-spacing: var(--ls-tight);
	color: var(--text-heading-primary);
}

.mobile-nav__secondary-link:focus-visible,
.mobile-nav__secondary-btn:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

/* ── Country selector row ─────────────────────────────────────────────────── */

.mobile-nav__country {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	width: 100%;
	background: none;
	border: 0;
	padding: 8px 0;
	cursor: pointer;
	/* .t-link pinned. The Link style is lineHeight:AUTO in the file, and BUG-17
	   says to pin it: "Figma AUTO uses the font's intrinsic metrics, which will
	   not match CSS normal for a different font." Figma draws these rows at 20;
	   the browser resolves `normal` to 21, which cost a pixel on every row. */
	font: var(--fw-medium) 1rem/1.25rem var(--font-heading);
	letter-spacing: var(--ls-tight);
	color: var(--text-heading-primary);
}

.mobile-nav__country-flag {
	width: 24px;
	height: auto;
	flex-shrink: 0;
}

.mobile-nav__country-label {
	flex: 1;
	text-align: left;
}

.mobile-nav__country-chevron {
	display: block;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.mobile-nav__country:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

/* Chevron rotates when list is open */
.mobile-nav__country-chevron {
	transition: transform var(--dur-fast) linear;
}

.mobile-nav__country[aria-expanded="true"] .mobile-nav__country-chevron {
	transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.mobile-nav__country-chevron {
		transition: none;
	}
}

/* ── Country selector inline list ─────────────────────────────────────────── */

.mobile-nav__country-list {
	margin: 0;
	padding: 4px 0;
	list-style: none;
	border-top: 1px solid var(--fig-neutral-100);
}

.mobile-nav__country-opt {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	width: 100%;
	min-height: 44px;
	padding: 8px 0;
	background: none;
	border: none;
	cursor: pointer;
	font: var(--fw-regular) 1rem / 1.2625rem var(--font-body);
	color: var(--fig-siegel-black);
	text-align: left;
}

.mobile-nav__country-opt-flag {
	width: 24px;
	height: 18px;
	border-radius: 1px;
	flex-shrink: 0;
	object-fit: cover;
}

[role="option"][aria-selected="true"] .mobile-nav__country-opt {
	font-weight: var(--fw-bold);
}

.mobile-nav__country-opt:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

/* ── Child panel: carousel slot + cards (task 2.4b) ────────────────────── */
/*
 * Frame 39 (263:19296) is 554px wide inside a 353px container — scrolls
 * horizontally. BUG-38: Figma marks overflowDirection:VERTICAL; build
 * horizontal. Carousel starts at x=0 within the 353px content area (x=20
 * from panel edge), so padding-left:20px aligns first card with the text
 * below. Slot is placed in panel document flow 20px below BACK button bottom.
 */

.mnav-carousel-slot {
	margin-top: 20px;           /* BACK bottom (38px) → carousel top (58px) from panel */
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.mnav-carousel-slot::-webkit-scrollbar { display: none; }

/* Safety net: slot hidden when no ACF cards are rendered (PHP outputs nothing) */
.mnav-carousel-slot:empty { display: none; }

/* Flex row — full-width declared via padding so scroll end has trailing space */
.mnav-carousel {
	display: flex;
	gap: 16px;
	/* 20px left aligns cards with content; 20px right is trailing space per spec */
	padding: 0 20px;
	width: max-content;   /* prevent implicit wrapping */
}

/* ── Card ───────────────────────────────────────────────────────────────── */
/*
 * 259×160, rounded 2px, overflow:hidden so image stays clipped.
 * Entire card is an <a> — no nested interactive controls.
 * Values: image + rgba(0,0,0,0.2) overlay + body at top:20px left:16px.
 */

.mnav-card {
	position: relative;
	display: block;
	width: 259px;
	height: 160px;
	border-radius: var(--r-sm);  /* 2px */
	overflow: hidden;
	flex-shrink: 0;
	scroll-snap-align: start;
	text-decoration: none;
	background: var(--fig-neutral-100);
}

.mnav-card:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: var(--r-sm);
}

.mobile-nav .mnav-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
	display: block;
}

.mnav-card__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.2);
	transition: background var(--dur-base) ease-out;
}

@media (hover: hover) and (pointer: fine) {
	.mnav-card:hover .mnav-card__overlay { background: rgba(0,0,0,0.35); }
}

.mnav-card__body {
	position: absolute;
	top: 20px;
	left: 16px;
	right: 17px;
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.mnav-card__title {
	flex: 1 1 0;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	/* Figma: Aktiv Grotesk Bold 14px/20px, no letter-spacing */
	font: var(--fw-bold) 0.875rem/1.25rem var(--font-heading);
	color: #fff;
}

/* .mnav-card__badge removed — replaced by .badge-new (badge.css, task 2.4c) */

/* "Find Out More" text — Figma: Medium 12px/16px, tracking 0.3px, white */
.mnav-card__cta {
	position: absolute;
	top: 54px;
	left: 16px;
	font: var(--fw-medium) 0.75rem/1rem var(--font-heading);
	letter-spacing: 0.3px;
	color: #fff;
}

/* ── Child panel: link groups ─────────────────────────────────────────────── */

.mnav-groups {
	padding: var(--sp-6) 0; /* 24px top — after BACK + optional carousel */
}

/* 175:13817 separates the groups by 16, not 24. */
.mnav-group {
	margin-bottom: 16px;
}

.mnav-group:last-child { margin-bottom: 0; }

.mnav-group__heading {
	display: block;
	/* 175:13818 — Aktiv Grotesk Bold 14/16, ls 0.6. It was set at 10/12, which
	   is the caption-sm tier the BACK row uses, not this one. The source string
	   is sentence case ("Hotmelt adhesives") and renders uppercase, so the
	   transform is doing real work — copying the string gives the wrong casing. */
	font: var(--fw-bold) 0.875rem/1rem var(--font-heading);
	letter-spacing: var(--ls-wide);
	text-transform: uppercase;
	color: var(--fig-neutral-400); /* #8b8d8e — group heading grey */
	margin-bottom: 12px;           /* Frame 29 gap-12, heading to first link */
	width: fit-content;
	text-decoration: none;
}

.mnav-group__heading:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

.mnav-group__links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	/* Rows are 20 with gap-12, a 32 pitch. The 12 is paid as row padding so the
	   targets tile with no dead strip, same as the root lists. */
	gap: 0;
}

.mnav-group__link {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	padding: 6px 0;
	text-decoration: none;
	/* Same pinned .t-link as the root list — BUG-17. */
	font: var(--fw-medium) 1rem/1.25rem var(--font-heading);
	letter-spacing: var(--ls-tight);
	color: var(--text-heading-primary);
}

@media (hover: hover) and (pointer: fine) {
	.mnav-group__link:hover { text-decoration: underline; }
}

.mnav-group__link:focus-visible {
	outline: 2px solid var(--fig-siegel-black);
	outline-offset: 2px;
	border-radius: 1px;
}

/* Bottom padding for scrollable Products panel */
#mnav-products .mnav-groups {
	padding-bottom: var(--sp-10); /* 48px */
}

/* ── Mobile-only — entire mobile nav chrome hidden on desktop ─────────────── */

@media (min-width: 768px) {
	.mobile-nav-toggle { display: none; }
}

/* Keep the hamburger visible after header.css in the stylesheet cascade. */
@media (max-width: 767px) {
	.mobile-nav-toggle { display: flex; }
	body.home .mobile-nav-toggle { color: var(--fig-siegel-white); }
	body.home .site-header.is-on-light .mobile-nav-toggle { color: var(--fig-siegel-black); }

	/* Primary Nav 263:16918 — the hamburger is a 32×32 button sitting 12 after
	   the 96px icon group: 96 + 12 + 32 = the 140 the row is drawn at. A 44px
	   box filled that 12 and pulled the whole thing 13px left of the design.

	   The tap target stays 44 — it moves to a pseudo-element, which is what the
	   spec asks for (BUG-06: expand the hit area, do not change the drawn
	   size). Same treatment for the three utility buttons, which are also 32
	   and were also under the minimum. */
	.mobile-nav-toggle {
		width: 32px;
		height: 32px;
		margin-left: 12px;
		position: relative;
	}

	.mobile-nav-toggle::after,
	.header-utils__btn::after {
		content: "";
		position: absolute;
		inset: -6px;
	}

	/* The bar carries a 1px frosted border, and Figma draws its stroke inside
	   the frame — so the 8px the logo sits at is measured through the border,
	   not outside it. padding:8 on top of the border put every child 1px in. */
	.header-primary__inner {
		padding: 7px;
	}

	/* 263:16922/16924/16932 — every nav glyph is 20×20. The markup ships them
	   at 16×16 and 14×16, which reads noticeably small beside the 44×45 logo. */
	.header-utils__btn > svg,
	.header-utils__btn > img,
	.mobile-nav-toggle > svg {
		width: 20px;
		height: 20px;
	}
}
