/* =============================================================================
   Produktkategori section (accordion sidebar + category tile grid)
   Used on: home-new-may-2026.php and city landing pages (body.gl-city-page —
   Trondheim, Oslo, Bergen, Stavanger, Drammen, Fredrikstad, Kristiansand, Tromsø)
   Overrides legacy .shop-element styles from style.css for this section only.
   ============================================================================= */

/* ── Section header — match .trust-brands__header rhythm ───────────────────── */
body.page-template-home-new-may-2026 .home-categories-header, body.gl-city-page .home-categories-header {
	max-width: 920px;
	margin: 0 auto 2.4rem;
	padding: 0;
	text-align: center;
}

body.page-template-home-new-may-2026 .home-categories-header .single-header, body.gl-city-page .home-categories-header .single-header {
	margin: 0 0 12px;
	font-size: clamp(22px, 2.4vw, 26px);
	font-weight: 700;
	line-height: 1.25;
	color: #013b6b;
	letter-spacing: normal;
}

body.page-template-home-new-may-2026 .home-categories-header p, body.gl-city-page .home-categories-header p {
	margin: 0 auto;
	max-width: 68rem;
	color: #5d6b7a;
	font-size: 1.4rem;
	font-weight: 500;
	line-height: 1.55;
	text-align: center;
}

body.page-template-home-new-may-2026 .home-categories-header p strong, body.gl-city-page .home-categories-header p strong {
	color: #013b6b;
	font-weight: 700;
}

/* ── Layout: sidebar + grid ─────────────────────────────────────────────────── */
body.page-template-home-new-may-2026 .home-categories-layout, body.gl-city-page .home-categories-layout {
	display: flex;
	align-items: flex-start;
	gap: clamp(1.6rem, 2.2vw, 2.4rem);
	width: 100%;
}

body.page-template-home-new-may-2026 .home-categories-layout.woo-shop-layout, body.gl-city-page .home-categories-layout.woo-shop-layout {
	flex-wrap: nowrap;
	padding-top: 0;
}

body.page-template-home-new-may-2026 .home-categories-sidebar, body.gl-city-page .home-categories-sidebar {
	/* Match shop archive sidebar (.woo-shop-layout → --gl-shop-sidebar-w: 280px) */
	flex: 0 0 clamp(220px, 24%, var(--gl-shop-sidebar-w, 280px));
	width: auto;
	max-width: 100%;
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: transparent;
	border: none;
	box-shadow: none;
	overflow: hidden;
}

body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion, body.gl-city-page .home-categories-sidebar .woo-cat-accordion {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 0;
	overflow: hidden;
	/* height / max-height set by JS to match .home-categories-main */
}

body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__head, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__head {
	flex: 0 0 auto;
}

body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__list, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__list {
	flex: 1 1 auto;
	min-height: 0;
	max-height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__list::-webkit-scrollbar, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__list::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

/* Let nested panels grow inside the scroll area */
body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-acc__item.is-open > .woo-cat-acc__children, body.gl-city-page .home-categories-sidebar .woo-cat-acc__item.is-open > .woo-cat-acc__children {
	max-height: none;
	overflow: visible;
}

body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-acc__children[hidden], body.gl-city-page .home-categories-sidebar .woo-cat-acc__children[hidden] {
	max-height: 0;
	overflow: hidden;
}

/* Close control is for the mobile drawer only (shown ≤1100px). */
body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__mobile-close, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__mobile-close {
	display: none;
}

/* Toggle lives in the layout; shop-archive-b2b shows it ≤1100px. */
body.page-template-home-new-may-2026 .home-categories-layout > .woo-shop-sidebar-toggle, body.gl-city-page .home-categories-layout > .woo-shop-sidebar-toggle {
	margin-bottom: 0;
}

body.page-template-home-new-may-2026 .home-categories-main, body.gl-city-page .home-categories-main {
	flex: 1 1 280px;
	min-width: 0;
}

/* ── Category tile grid ─────────────────────────────────────────────────────── */
body.page-template-home-new-may-2026 .shop-element-box--home-categories, body.gl-city-page .shop-element-box--home-categories,
body.page-template-home-new-may-2026 .gl-home-cat-grid, body.gl-city-page .gl-home-cat-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.2rem;
	width: 100%;
	justify-content: stretch;
}

/* Reset legacy flex card chrome from style.css */
body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element, body.gl-city-page .shop-element-box--home-categories .shop-element,
body.page-template-home-new-may-2026 .gl-home-cat, body.gl-city-page .gl-home-cat {
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	text-decoration: none;
	color: #0c1c2e;
	background: #ffffff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: none;
	position: relative;
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

/* Brand red accent — draws in on hover/focus (motion 1) */
body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element::before, body.gl-city-page .shop-element-box--home-categories .shop-element::before,
body.page-template-home-new-may-2026 .gl-home-cat::before, body.gl-city-page .gl-home-cat::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	width: auto;
	height: 3px;
	background: #b80000;
	opacity: 1;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.28s ease;
	z-index: 2;
	pointer-events: none;
}

/* Media stage — full-bleed L/R inside the tile (no letterbox gutters) */
body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-image, body.gl-city-page .shop-element-box--home-categories .shop-image,
body.page-template-home-new-may-2026 .gl-home-cat__media, body.gl-city-page .gl-home-cat__media {
	flex: 0 0 auto;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: none;
	border-radius: 0;
	border-bottom: 1px solid #e8ecef;
	background: #f7f8fa;
	position: relative;
}

body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-image img, body.gl-city-page .shop-element-box--home-categories .shop-image img,
body.page-template-home-new-may-2026 .gl-home-cat__media img, body.gl-city-page .gl-home-cat__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	object-fit: cover;
	object-position: center center;
	display: block;
	transform: scale(1);
	transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	background: transparent;
	border: none;
	border-radius: 0;
}

/* Label footer — keep backend category names as-is (no forced uppercase) */
body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-link-category-enter, body.gl-city-page .shop-element-box--home-categories .shop-link-category-enter,
body.page-template-home-new-may-2026 .gl-home-cat__label, body.gl-city-page .gl-home-cat__label {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	width: 100%;
	margin: 0;
	padding: 1.2rem 1rem;
	min-height: 5.2rem;
	box-sizing: border-box;
	background: #ffffff;
	font-size: 1.4rem;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	line-height: 1.3;
	text-align: center;
	color: #0c1c2e;
	transition: color 0.2s ease, background 0.2s ease;
}

body.page-template-home-new-may-2026 .gl-home-cat__name, body.gl-city-page .gl-home-cat__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Chevron affordance (motion 2 — appears with hover) */
body.page-template-home-new-may-2026 .gl-home-cat__label::after, body.gl-city-page .gl-home-cat__label::after {
	content: "";
	display: inline-block;
	width: 1.4rem;
	height: 1.4rem;
	flex-shrink: 0;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b80000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hover / focus (desktop pointer) */
@media (hover: hover) {
	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:hover, body.gl-city-page .shop-element-box--home-categories .shop-element:hover,
	body.page-template-home-new-may-2026 .gl-home-cat:hover, body.gl-city-page .gl-home-cat:hover {
		transform: translateY(-3px);
		border-color: rgba(12, 28, 46, 0.22);
		box-shadow: 0 8px 22px rgba(12, 28, 46, 0.08);
	}

	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:hover::before, body.gl-city-page .shop-element-box--home-categories .shop-element:hover::before,
	body.page-template-home-new-may-2026 .gl-home-cat:hover::before, body.gl-city-page .gl-home-cat:hover::before {
		transform: scaleX(1);
	}

	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:hover .shop-image img, body.gl-city-page .shop-element-box--home-categories .shop-element:hover .shop-image img,
	body.page-template-home-new-may-2026 .gl-home-cat:hover .gl-home-cat__media img, body.gl-city-page .gl-home-cat:hover .gl-home-cat__media img {
		transform: scale(1.04);
	}

	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:hover .shop-link-category-enter, body.gl-city-page .shop-element-box--home-categories .shop-element:hover .shop-link-category-enter,
	body.page-template-home-new-may-2026 .gl-home-cat:hover .gl-home-cat__label, body.gl-city-page .gl-home-cat:hover .gl-home-cat__label {
		color: #b80000;
		background: #fff8f8;
	}

	body.page-template-home-new-may-2026 .gl-home-cat:hover .gl-home-cat__label::after, body.gl-city-page .gl-home-cat:hover .gl-home-cat__label::after {
		opacity: 1;
		transform: translateX(0);
	}
}

body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:focus-visible, body.gl-city-page .shop-element-box--home-categories .shop-element:focus-visible,
body.page-template-home-new-may-2026 .gl-home-cat:focus-visible, body.gl-city-page .gl-home-cat:focus-visible {
	outline: 2px solid #b80000;
	outline-offset: 2px;
}

body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:focus-visible::before, body.gl-city-page .shop-element-box--home-categories .shop-element:focus-visible::before,
body.page-template-home-new-may-2026 .gl-home-cat:focus-visible::before, body.gl-city-page .gl-home-cat:focus-visible::before {
	transform: scaleX(1);
}

body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:active, body.gl-city-page .shop-element-box--home-categories .shop-element:active,
body.page-template-home-new-may-2026 .gl-home-cat:active, body.gl-city-page .gl-home-cat:active {
	transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element, body.gl-city-page .shop-element-box--home-categories .shop-element,
	body.page-template-home-new-may-2026 .gl-home-cat, body.gl-city-page .gl-home-cat,
	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element::before, body.gl-city-page .shop-element-box--home-categories .shop-element::before,
	body.page-template-home-new-may-2026 .gl-home-cat::before, body.gl-city-page .gl-home-cat::before,
	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-image img, body.gl-city-page .shop-element-box--home-categories .shop-image img,
	body.page-template-home-new-may-2026 .gl-home-cat__media img, body.gl-city-page .gl-home-cat__media img,
	body.page-template-home-new-may-2026 .gl-home-cat__label, body.gl-city-page .gl-home-cat__label,
	body.page-template-home-new-may-2026 .gl-home-cat__label::after, body.gl-city-page .gl-home-cat__label::after,
	body.page-template-home-new-may-2026 .home-categories-sidebar, body.gl-city-page .home-categories-sidebar {
		transition: none;
	}

	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-element:hover, body.gl-city-page .shop-element-box--home-categories .shop-element:hover,
	body.page-template-home-new-may-2026 .gl-home-cat:hover, body.gl-city-page .gl-home-cat:hover {
		transform: none;
	}
}

/* ── Breakpoints ────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
	body.page-template-home-new-may-2026 .shop-element-box--home-categories, body.gl-city-page .shop-element-box--home-categories,
	body.page-template-home-new-may-2026 .gl-home-cat-grid, body.gl-city-page .gl-home-cat-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 1.2rem;
	}
}

/*
 * ≤1100px: same breakpoint as shop drawer.
 * Category panel becomes an off-canvas drawer (default closed); grid uses full width.
 */
@media (max-width: 1100px) {
	body.page-template-home-new-may-2026 .home-categories-layout, body.gl-city-page .home-categories-layout {
		flex-direction: column;
		gap: 1.6rem;
		align-items: stretch;
	}

	body.page-template-home-new-may-2026 .home-categories-layout > .woo-shop-sidebar-toggle, body.gl-city-page .home-categories-layout > .woo-shop-sidebar-toggle {
		display: inline-flex;
		flex: 1 1 100%;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		margin-bottom: 0;
		order: -1;
	}

	body.page-template-home-new-may-2026 .home-categories-sidebar, body.gl-city-page .home-categories-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 9999;
		display: flex;
		flex-direction: column;
		gap: 0;
		flex: none;
		width: min(320px, 88vw);
		max-width: min(320px, 88vw);
		max-height: 100vh;
		max-height: 100dvh;
		margin: 0;
		padding: 0;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		background: var(--hdr-gray-bg, #f4f6f9);
		box-shadow: 4px 0 24px rgba(0, 20, 40, 0.18);
		border-radius: 0;
		transform: translateX(-105%);
		transition: transform 0.3s ease, visibility 0.3s ease;
		visibility: hidden;
		pointer-events: none;
	}

	body.page-template-home-new-may-2026 .home-categories-sidebar.is-mobile-open, body.gl-city-page .home-categories-sidebar.is-mobile-open {
		transform: translateX(0);
		visibility: visible;
		pointer-events: auto;
	}

	body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion, body.gl-city-page .home-categories-sidebar .woo-cat-accordion {
		position: static;
		display: flex;
		flex-direction: column;
		width: 100%;
		height: auto;
		max-height: none;
		min-height: 0;
		overflow: visible;
		border-radius: 0;
		box-shadow: none;
	}

	body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__list, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__list {
		flex: 1 1 auto;
		max-height: none;
	}

	body.page-template-home-new-may-2026 .home-categories-sidebar .woo-cat-accordion__mobile-close, body.gl-city-page .home-categories-sidebar .woo-cat-accordion__mobile-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	body.page-template-home-new-may-2026 .home-categories-main, body.gl-city-page .home-categories-main {
		width: 100%;
		flex: 1 1 auto;
	}
}

@media (max-width: 1024px) {
	body.page-template-home-new-may-2026 .shop-element-box--home-categories, body.gl-city-page .shop-element-box--home-categories,
	body.page-template-home-new-may-2026 .gl-home-cat-grid, body.gl-city-page .gl-home-cat-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 1.2rem;
	}
}

@media (max-width: 815px) {
	body.page-template-home-new-may-2026 .shop-element-box--home-categories, body.gl-city-page .shop-element-box--home-categories,
	body.page-template-home-new-may-2026 .gl-home-cat-grid, body.gl-city-page .gl-home-cat-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 1rem;
	}

	body.page-template-home-new-may-2026 .shop-element-box--home-categories .shop-link-category-enter, body.gl-city-page .shop-element-box--home-categories .shop-link-category-enter,
	body.page-template-home-new-may-2026 .gl-home-cat__label, body.gl-city-page .gl-home-cat__label {
		font-size: 1.3rem;
		padding: 1rem 0.8rem;
		min-height: 4.8rem;
	}
}
