/* DEX Collection theme styles.
 * Every color below is a CSS custom property referenced via var(...) -
 * the whole palette can be re-themed later by editing only the :root
 * block, no other rule in this file should ever contain a literal color.
 */

:root {
	--color-primary: #1B2A4A;
	--color-primary-light: #2A3E67;
	--color-surface: #FFFFFF;
	--color-surface-alt: #F5F6F8;
	--color-accent: #E8A33D;
	--color-text: #1F2933;
	--color-muted: #6B7785;
	--color-border: #E2E5EA;

	--font-heading: 'Poppins', sans-serif;
	--font-body: 'Inter', sans-serif;

	--mobile-breakpoint: 782px;
	--hero-max-height: 50vh;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: var(--font-body);
	color: var(--color-text);
	background: var(--color-surface);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-heading);
	margin: 0 0 0.5em;
}

a {
	color: inherit;
	text-decoration: none;
}

ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

img {
	max-width: 100%;
	display: block;
}

.site-header {
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
}

/* ---- Top utility bar ---- */

.top-bar {
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
}

.top-bar .menu {
	display: flex;
	justify-content: flex-end;
	gap: 1.5rem;
	padding: 0.5rem 1.5rem;
	font-size: 0.8rem;
	color: var(--color-muted);
}

.top-bar .menu a:hover {
	color: var(--color-accent);
}

.top-bar .menu li.menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 5px;
	height: 5px;
	margin-left: 0.4em;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
}

.top-bar .menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 30;
	display: none;
	flex-direction: column;
	min-width: 200px;
	padding: 0.5rem 0;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 0 0 4px 4px;
	box-shadow: 0 8px 16px rgba(31, 41, 51, 0.12);
}

.top-bar .menu .sub-menu a {
	display: block;
	padding: 0.5rem 1rem;
	white-space: nowrap;
}

.top-bar .menu li {
	position: relative;
}

.top-bar .menu li:hover > .sub-menu,
.top-bar .menu li:focus-within > .sub-menu {
	display: flex;
}

/* ---- Main header row: logo + main nav ---- */

.main-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	max-width: 1400px;
	margin: 0 auto;
}

.site-logo img,
.site-logo svg {
	max-height: 56px;
	width: auto;
	display: block;
}

.site-logo .site-title {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 1.5rem;
	color: var(--color-primary);
}

/* ---- Search bar (UI only for now - not wired up to run a search yet) ---- */

.site-search {
	display: flex;
	align-items: stretch;
	flex: 1 1 auto;
	max-width: 480px;
	margin: 0 2rem;
}

.site-search-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.6rem 0.9rem;
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--color-text);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-right: none;
	border-radius: 4px 0 0 4px;
	outline: none;
}

.site-search-input:focus {
	border-color: var(--color-accent);
}

.site-search-button {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0 1.1rem;
	background: var(--color-primary);
	color: var(--color-surface);
	border: none;
	border-radius: 0 4px 4px 0;
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 0.9rem;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s ease;
}

.site-search-button:hover {
	background: var(--color-primary-light);
}

.site-search-icon {
	position: relative;
	width: 11px;
	height: 11px;
	border: 2px solid currentColor;
	border-radius: 50%;
	display: inline-block;
}

.site-search-icon::after {
	content: '';
	position: absolute;
	bottom: -7px;
	right: -2px;
	width: 2px;
	height: 7px;
	background: currentColor;
	transform: rotate(-45deg);
}

.main-nav {
	background: var(--color-primary);
}

.main-nav .menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	padding: 0 1rem;
}

.main-nav .menu a {
	display: block;
	padding: 0.85rem 0.75rem;
	color: var(--color-surface);
	font-weight: 500;
	font-size: 0.9rem;
	letter-spacing: 0.02em;
}

.main-nav .menu a:hover {
	background: var(--color-primary-light);
	color: var(--color-accent);
}

.main-nav .menu li {
	position: relative;
}

.main-nav .menu li.menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 5px;
	height: 5px;
	margin-left: 0.5em;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
}

.main-nav .menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 30;
	display: none;
	flex-direction: column;
	min-width: 220px;
	padding: 0.5rem 0;
	background: var(--color-surface);
	border-radius: 0 0 4px 4px;
	box-shadow: 0 12px 20px rgba(31, 41, 51, 0.18);
}

.main-nav .menu .sub-menu a {
	padding: 0.6rem 1.1rem;
	color: var(--color-text);
	font-weight: 400;
	white-space: nowrap;
}

.main-nav .menu .sub-menu a:hover {
	background: var(--color-surface-alt);
	color: var(--color-primary);
}

.main-nav .menu li:hover > .sub-menu,
.main-nav .menu li:focus-within > .sub-menu {
	display: flex;
}

/* ---- Hamburger toggle (hidden on desktop) ---- */

.menu-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
}

/* Base state for all screen sizes - only ever shown via the
 * .is-open toggle inside the mobile media query below. Without this,
 * it's an unstyled <div> with no display rule at all outside that
 * media query, which defaults to visible (display:block) and dumps
 * every menu item, including all sub-menus, onto the page on desktop. */
.mobile-menu-panel {
	display: none;
}

.menu-toggle .bar {
	display: block;
	width: 26px;
	height: 3px;
	margin: 5px 0;
	background: var(--color-primary);
	border-radius: 2px;
}

/* ---- Hero slider ----
 * Container is capped at --hero-max-height and always spans the full
 * width; the image (or placeholder block) uses object-fit: cover so it
 * always fills that box completely - scaling up and cropping top/bottom
 * as needed, never cropping left/right, since a full-width/short box is
 * always far wider than it is tall.
 */

.hero-slider {
	position: relative;
	width: 100%;
	height: var(--hero-max-height);
	overflow: hidden;
}

.hero-slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.6s ease;
}

.hero-slide.is-active {
	position: relative;
	opacity: 1;
}

.hero-slider:has(.hero-slide:only-child) .hero-slide {
	position: relative;
	opacity: 1;
}

.hero-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.hero-slide .placeholder-block {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
	color: var(--color-surface);
	font-family: var(--font-heading);
	font-size: 1.1rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hero-slide:nth-child(3n+2) .placeholder-block {
	background: linear-gradient(135deg, var(--color-accent), #c98826);
}

.hero-slide:nth-child(3n+3) .placeholder-block {
	background: linear-gradient(135deg, var(--color-muted), var(--color-primary));
}

/* ---- Hero slider controls: prev/next arrows + pagination bars ---- */

.hero-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(31, 41, 51, 0.35);
	color: var(--color-surface);
	border: none;
	border-radius: 50%;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.hero-arrow:hover {
	background: rgba(31, 41, 51, 0.6);
}

.hero-arrow-prev {
	left: 1rem;
}

.hero-arrow-next {
	right: 1rem;
}

.hero-pagination {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 1rem;
	z-index: 2;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
}

.hero-pagination-bar {
	width: 2.25rem;
	height: 0.3rem;
	padding: 0;
	border: none;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: background 0.2s ease;
}

.hero-pagination-bar:hover {
	background: rgba(255, 255, 255, 0.75);
}

.hero-pagination-bar.is-active {
	background: var(--color-surface);
}

/* ---- Product category archive: breadcrumb ---- */

.breadcrumb-nav {
	max-width: 1400px;
	margin: 0 auto;
	padding: 1rem 1.5rem 0;
	font-size: 0.85rem;
	color: var(--color-muted);
}

.breadcrumb-nav a:hover {
	color: var(--color-accent);
}

.breadcrumb-separator {
	margin: 0 0.5em;
}

.breadcrumb-current {
	color: var(--color-text);
}

.archive-title {
	max-width: 1400px;
	margin: 0.5rem auto 0;
	padding: 0 1.5rem;
	color: var(--color-primary);
}

/* ---- Product category archive: filter bar ---- */

.product-filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	max-width: 1400px;
	margin: 1.5rem auto 0;
	padding: 1rem 1.5rem;
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: 4px;
}

.filter-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1 1 140px;
	min-width: 140px;
}

.filter-field label {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--color-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.filter-field select,
.filter-field input {
	padding: 0.55rem 0.7rem;
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--color-text);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 4px;
	outline: none;
}

.filter-field select:focus,
.filter-field input:focus {
	border-color: var(--color-accent);
}

/* ---- Product category archive: grid + tiles ---- */

.product-grid {
	max-width: 1400px;
	margin: 1.5rem auto 3rem;
	padding: 0 1.5rem;
}

.product-grid-items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1.5rem;
}

.product-tile {
	border-radius: 4px;
	overflow: hidden;
	transition: box-shadow 0.2s ease;
}

.product-tile:hover {
	box-shadow: 0 8px 16px rgba(31, 41, 51, 0.12);
}

.product-tile-link {
	display: block;
}

.product-tile-image {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-tile-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 1rem;
}

.product-tile-placeholder {
	width: 40%;
	height: 40%;
	background: var(--color-border);
	border-radius: 4px;
}

.product-tile-body {
	padding: 0.75rem 1rem 1rem;
}

.product-tile-sku {
	margin: 0 0 0.25rem;
	font-size: 0.75rem;
	color: var(--color-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.product-tile-name {
	margin: 0;
	font-weight: 500;
	color: var(--color-primary);
}

.product-tile-link:hover .product-tile-name {
	color: var(--color-accent);
}

.product-tile-price {
	margin: 0.35rem 0 0;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--color-text);
}

.product-grid-empty {
	padding: 3rem 0;
	text-align: center;
	color: var(--color-muted);
}

.product-grid-sentinel {
	display: flex;
	justify-content: center;
	padding: 2rem 0;
	min-height: 1px;
}

.product-grid-sentinel:not(.is-loading) .product-grid-spinner {
	visibility: hidden;
}

.product-grid-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid var(--color-border);
	border-top-color: var(--color-accent);
	border-radius: 50%;
	animation: dex-spin 0.8s linear infinite;
}

@keyframes dex-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---- Product detail page ---- */

.product-detail {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 2.5rem;
	max-width: 1400px;
	margin: 1.5rem auto 3rem;
	padding: 0 1.5rem;
}

.product-detail-gallery {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.product-detail-main-image {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-surface-alt);
	border: 1px solid var(--color-border);
	border-radius: 4px;
	overflow: hidden;
	cursor: zoom-in;
}

.product-detail-main-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 1.5rem;
}

.product-detail-placeholder {
	width: 40%;
	height: 40%;
	background: var(--color-border);
	border-radius: 4px;
}

.product-detail-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
	gap: 0.6rem;
}

.product-detail-thumb {
	aspect-ratio: 1 / 1;
	padding: 0;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.product-detail-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 0.35rem;
}

.product-detail-thumb:hover {
	border-color: var(--color-accent);
}

.product-detail-thumb.is-active {
	border-color: var(--color-accent);
	border-width: 2px;
}

.product-detail-info {
	display: flex;
	flex-direction: column;
}

.product-detail-sku {
	margin: 0 0 0.25rem;
	font-size: 0.8rem;
	color: var(--color-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.product-detail-title {
	margin: 0 0 1rem;
	color: var(--color-primary);
}

.product-detail-links {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin-bottom: 1.5rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--color-border);
}

.product-detail-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--color-primary);
}

.product-detail-link:hover {
	color: var(--color-accent);
}

.product-detail-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	border-bottom: 1px solid var(--color-border);
}

.product-detail-tab {
	padding: 0.75rem 1rem;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	font-family: var(--font-body);
	font-weight: 500;
	font-size: 0.85rem;
	color: var(--color-muted);
	cursor: pointer;
}

.product-detail-tab:hover {
	color: var(--color-primary);
}

.product-detail-tab.is-active {
	color: var(--color-primary);
	border-bottom-color: var(--color-accent);
}

.product-detail-panels {
	padding: 1.5rem 0;
}

.product-detail-panel {
	font-size: 0.9rem;
	line-height: 1.6;
}

.product-detail-panel[hidden] {
	display: none;
}

/* ---- Product detail page: image lightbox ---- */

/* The dialog itself is an invisible full-viewport stage - only the
 * ::backdrop is visible around the image - so the prev/next/close
 * buttons (anchored to the dialog's own edges below) sit out in the
 * backdrop margin rather than on top of the picture. The image is
 * capped well under 100vw/100vh precisely to guarantee that margin
 * exists on every screen size. */
.product-detail-lightbox {
	/* Stays display:none (its own default, same as the browser's) until
	 * [open] is present - authored rules always beat the UA stylesheet
	 * regardless of specificity, so `display: flex` here unconditionally
	 * would override the browser's own `dialog:not([open]) { display:
	 * none }` and leave the dialog visible even when closed. */
	display: none;
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	max-height: 100vh;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
}

.product-detail-lightbox[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-detail-lightbox::backdrop {
	background: rgba(31, 41, 51, 0.9);
}

.product-detail-lightbox img {
	display: block;
	max-width: 70vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 4px;
	background: var(--color-surface);
}

.product-detail-lightbox-close {
	position: absolute;
	top: 1rem;
	right: 1.5rem;
	z-index: 1;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(31, 41, 51, 0.6);
	color: var(--color-surface);
	border: none;
	border-radius: 50%;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

.product-detail-lightbox-close:hover {
	background: rgba(31, 41, 51, 0.85);
}

.product-detail-lightbox-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 1;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(31, 41, 51, 0.6);
	color: var(--color-surface);
	border: none;
	border-radius: 50%;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.product-detail-lightbox-arrow:hover {
	background: rgba(31, 41, 51, 0.85);
}

.product-detail-lightbox-arrow[hidden] {
	display: none;
}

.product-detail-lightbox-prev {
	left: 1.5rem;
}

.product-detail-lightbox-next {
	right: 1.5rem;
}

/* ---- Mobile ---- */

@media (max-width: 782px) {
	.top-bar {
		display: none;
	}

	.main-header {
		flex-wrap: wrap;
	}

	.site-logo {
		order: 1;
	}

	.menu-toggle {
		display: block;
		order: 2;
	}

	.site-search {
		order: 3;
		flex: 1 1 100%;
		max-width: none;
		margin: 0.75rem 0 0;
	}

	.main-nav {
		display: none;
	}

	.mobile-menu-panel {
		display: none;
		background: var(--color-primary);
	}

	.mobile-menu-panel.is-open {
		display: block;
	}

	.mobile-menu-panel .menu {
		flex-direction: column;
		padding: 0.5rem 0;
	}

	.mobile-menu-panel .menu a {
		display: block;
		padding: 0.85rem 1.5rem;
		color: var(--color-surface);
		font-size: 0.95rem;
	}

	.mobile-menu-panel .menu a:hover {
		color: var(--color-accent);
	}

	.mobile-menu-panel .menu-divider {
		border-top: 1px solid rgba(255, 255, 255, 0.15);
		margin: 0.5rem 1.5rem;
	}

	/* Sub-menus render inline and indented rather than as hover
	 * dropdowns - hover has no touch equivalent, and this keeps every
	 * link reachable without extra tap-to-expand JS. */
	.mobile-menu-panel .sub-menu {
		display: flex;
		flex-direction: column;
		padding: 0.25rem 0 0.5rem;
	}

	.mobile-menu-panel .sub-menu a {
		padding: 0.6rem 1.5rem 0.6rem 2.5rem;
		font-size: 0.85rem;
		color: rgba(255, 255, 255, 0.75);
	}

	.mobile-menu-panel li.menu-item-has-children > a::after {
		content: '';
		display: inline-block;
		width: 5px;
		height: 5px;
		margin-left: 0.5em;
		border-right: 1px solid currentColor;
		border-bottom: 1px solid currentColor;
		transform: rotate(45deg) translateY(-2px);
	}

	.product-filter-bar {
		flex-direction: column;
	}

	.filter-field {
		flex: 1 1 auto;
		min-width: 0;
	}

	.product-grid-items {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 1rem;
	}

	.product-detail {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}
