/* Catalogue: product cards, grids, filters, and the single product layout. */

.product-grid {
	display: grid;
	gap: var(--myco-space-lg);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
}

.product-card {
	display: flex;
	overflow: hidden;
	flex-direction: column;
	border: 1px solid var(--myco-color-border);
	border-radius: var(--myco-radius-xl);
	background: var(--myco-color-white);
	box-shadow: var(--myco-shadow-soft);
	transition: transform var(--myco-transition-slow), box-shadow var(--myco-transition-slow), border-color var(--myco-transition);
}

.product-card:hover,
.product-card:focus-within {
	transform: translateY(-4px);
	border-color: rgba(242, 107, 15, 0.4);
	box-shadow: var(--myco-shadow-lift);
}

.product-card__link {
	display: flex;
	flex: 1;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
}

.product-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: var(--myco-color-surface);
}

.product-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--myco-transition-slow);
}

.product-card__image--placeholder {
	padding: 18%;
	object-fit: contain;
	opacity: 0.45;
}

.product-card:hover .product-card__image {
	transform: scale(1.05);
}

.product-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--myco-space-2xs);
	padding: var(--myco-space-lg);
}

.product-card__category {
	color: var(--myco-color-accent-ink);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.product-card__title {
	margin: 0;
	color: var(--myco-color-primary);
	font-size: 1.05rem;
	line-height: 1.3;
}

.product-card__text {
	color: var(--myco-color-muted);
	font-size: var(--myco-font-size-sm);
}

.product-card__cta {
	margin-top: auto;
	padding-top: var(--myco-space-md);
	color: var(--myco-color-primary);
	font-size: var(--myco-font-size-sm);
	font-weight: 700;
}

.product-card__cta::after {
	content: " \2192";
	color: var(--myco-color-accent-ink);
}

/* Category filter bar */

.category-filter {
	position: sticky;
	z-index: 10;
	top: 4.75rem;
	padding: var(--myco-space-sm) 0;
	background: var(--myco-color-white);
	border-bottom: 1px solid var(--myco-color-border);
}

.category-filter__list {
	display: flex;
	overflow-x: auto;
	gap: var(--myco-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
	scrollbar-width: thin;
}

.category-filter__link {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	padding: 0.5rem 0.95rem;
	border: 1px solid var(--myco-color-border);
	border-radius: 999px;
	color: var(--myco-color-muted);
	font-size: var(--myco-font-size-sm);
	font-weight: 600;
	text-decoration: none;
	transition: background var(--myco-transition), color var(--myco-transition), border-color var(--myco-transition);
}

.category-filter__link:hover {
	border-color: var(--myco-color-accent);
	color: var(--myco-color-accent-ink);
}

.category-filter__link.is-current {
	background: var(--myco-color-primary);
	border-color: var(--myco-color-primary);
	color: var(--myco-color-white);
}

.page-hero--catalogue {
	background: linear-gradient(160deg, var(--myco-color-primary) 0%, var(--myco-color-primary-deep) 100%);
	border-bottom: 0;
	color: var(--myco-color-white);
}

.page-hero--catalogue h1 {
	color: var(--myco-color-white);
	font-size: clamp(1.9rem, 4.4vw, 2.9rem);
}

.page-hero--catalogue .page-hero__description,
.page-hero--catalogue .page-hero__description p {
	color: rgba(255, 255, 255, 0.76);
}

.page-hero--catalogue .breadcrumbs,
.page-hero--catalogue .breadcrumbs a {
	color: rgba(255, 255, 255, 0.72);
}

.page-hero--catalogue .breadcrumbs a:hover {
	color: var(--myco-color-white);
}

/* Single product */

.product-single__top {
	padding-top: var(--myco-space-xl);
}

.product-single__layout {
	display: grid;
	gap: var(--myco-space-2xl);
}

.product-single__figure {
	overflow: hidden;
	margin: 0;
	border: 1px solid var(--myco-color-border);
	border-radius: var(--myco-radius-xl);
	background: var(--myco-color-surface);
}

.product-single__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.product-single__title {
	margin-bottom: var(--myco-space-md);
	font-size: clamp(1.7rem, 4vw, 2.4rem);
	line-height: 1.15;
}

.product-single__summary {
	margin-bottom: var(--myco-space-lg);
	color: var(--myco-color-muted);
	font-size: var(--myco-font-size-lg);
}

.product-features {
	display: grid;
	gap: var(--myco-space-xs);
	margin: 0 0 var(--myco-space-xl);
	padding: 0;
	list-style: none;
}

.product-features__item {
	position: relative;
	padding-left: 1.75rem;
	color: var(--myco-color-text);
}

.product-features__item::before {
	content: "";
	position: absolute;
	top: 0.55em;
	left: 0;
	width: 0.7rem;
	height: 0.38rem;
	border-bottom: 2px solid var(--myco-color-accent);
	border-left: 2px solid var(--myco-color-accent);
	transform: rotate(-45deg);
}

.product-single__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--myco-space-sm);
	margin-bottom: var(--myco-space-xl);
}

.product-specs {
	width: 100%;
	border: 1px solid var(--myco-color-border);
	border-collapse: collapse;
	border-radius: var(--myco-radius-lg);
	font-size: var(--myco-font-size-sm);
}

.product-specs th,
.product-specs td {
	padding: var(--myco-space-sm) var(--myco-space-md);
	border-bottom: 1px solid var(--myco-color-border);
	text-align: left;
}

.product-specs tr:last-child th,
.product-specs tr:last-child td {
	border-bottom: 0;
}

.product-specs th {
	width: 45%;
	background: var(--myco-color-surface);
	color: var(--myco-color-muted);
	font-weight: 600;
}

@media (min-width: 900px) {
	.product-single__layout {
		align-items: start;
		grid-template-columns: 1.05fr 1fr;
	}
}

/* --- Product gallery -----------------------------------------------------
   Fixed-ratio stage + object-fit: contain, so mixed upload sizes never crop
   and the box never resizes between slides. */

.product-gallery__stage {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	border: 1px solid var(--myco-color-border);
	border-radius: var(--myco-radius-xl);
	background: var(--myco-color-surface);
}

.product-gallery__slides {
	margin: 0;
	padding: 0;
	height: 100%;
	list-style: none;
}

.product-gallery__slide {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--myco-space-md);
	opacity: 0;
	visibility: hidden;
	cursor: zoom-in;
	transition: opacity var(--myco-transition);
}

.product-gallery__slide.is-active {
	opacity: 1;
	visibility: visible;
}

/* No JS: show the first slide rather than an empty box. */
html:not(.js) .product-gallery__slide:first-child {
	opacity: 1;
	visibility: visible;
}

.product-gallery__image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.product-gallery__nav,
.myco-lightbox__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--myco-color-border);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background var(--myco-transition), border-color var(--myco-transition);
}

.product-gallery__nav:hover {
	background: var(--myco-color-white);
	border-color: var(--myco-color-accent);
}

.product-gallery__nav--prev { left: var(--myco-space-sm); }
.product-gallery__nav--next { right: var(--myco-space-sm); }

.product-gallery__nav span,
.myco-lightbox__nav span {
	width: 0.6rem;
	height: 0.6rem;
	border-top: 2px solid var(--myco-color-primary);
	border-right: 2px solid var(--myco-color-primary);
}

.product-gallery__nav--prev span,
.myco-lightbox__nav--prev span { transform: translateX(2px) rotate(-135deg); }
.product-gallery__nav--next span,
.myco-lightbox__nav--next span { transform: translateX(-2px) rotate(45deg); }

.product-gallery__zoom {
	position: absolute;
	z-index: 2;
	right: var(--myco-space-sm);
	bottom: var(--myco-space-sm);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--myco-color-border);
	border-radius: var(--myco-radius-md);
	background: rgba(255, 255, 255, 0.92);
	cursor: pointer;
}

.product-gallery__zoom svg {
	/* min-width beats the flex-shrink that was collapsing this to a sliver. */
	width: 1.15rem;
	min-width: 1.15rem;
	height: 1.15rem;
	min-height: 1.15rem;
	display: block;
	fill: var(--myco-color-primary);
	pointer-events: none;
}

.product-gallery__counter {
	position: absolute;
	z-index: 2;
	bottom: var(--myco-space-sm);
	left: var(--myco-space-sm);
	margin: 0;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: rgba(15, 27, 45, 0.72);
	color: var(--myco-color-white);
	font-size: 0.78rem;
	font-weight: 600;
}

/* Thumbnails: exactly 5 visible, the rest scroll. */

.product-gallery__thumbs-wrap {
	margin-top: var(--myco-space-sm);
}

.product-gallery__thumbs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (4 * var(--myco-space-sm))) / 5);
	gap: var(--myco-space-sm);
	overflow-x: auto;
	margin: 0;
	padding: 0 0 var(--myco-space-2xs);
	list-style: none;
	scroll-behavior: smooth;
	scrollbar-width: thin;
}

.product-gallery__thumb button {
	display: block;
	width: 100%;
	padding: 0;
	overflow: hidden;
	aspect-ratio: 1;
	border: 2px solid transparent;
	border-radius: var(--myco-radius-md);
	background: var(--myco-color-surface);
	cursor: pointer;
	transition: border-color var(--myco-transition), opacity var(--myco-transition);
}

.product-gallery__thumb button:hover {
	opacity: 0.85;
}

.product-gallery__thumb.is-active button {
	border-color: var(--myco-color-accent);
}

.product-gallery__thumb-image {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
}

/* --- Lightbox ----------------------------------------------------------- */

.myco-lightbox {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: var(--myco-space-xl);
	background: rgba(8, 16, 28, 0.94);
}

.myco-lightbox.is-open {
	display: flex;
}

body.myco-lightbox-open {
	overflow: hidden;
}

.myco-lightbox__figure {
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
}

.myco-lightbox__image {
	max-width: min(92vw, 1400px);
	max-height: 86vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--myco-radius-md);
}

.myco-lightbox__close {
	position: absolute;
	top: var(--myco-space-lg);
	right: var(--myco-space-lg);
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.14);
	color: var(--myco-color-white);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.myco-lightbox__close:hover {
	background: rgba(255, 255, 255, 0.26);
}

.myco-lightbox__nav {
	background: rgba(255, 255, 255, 0.14);
	border-color: transparent;
}

.myco-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.26);
}

.myco-lightbox__nav span {
	border-color: var(--myco-color-white);
}

.myco-lightbox__nav {
	z-index: 2;
	width: 3rem;
	height: 3rem;
}

.myco-lightbox__nav--prev { left: clamp(var(--myco-space-md), 4vw, var(--myco-space-3xl)); }
.myco-lightbox__nav--next { right: clamp(var(--myco-space-md), 4vw, var(--myco-space-3xl)); }

/* Keep the image clear of the arrows on narrow screens. */
@media (max-width: 900px) {
	.myco-lightbox__image {
		max-width: 78vw;
	}
}

.myco-lightbox__counter {
	position: absolute;
	bottom: var(--myco-space-lg);
	left: 50%;
	margin: 0;
	color: rgba(255, 255, 255, 0.78);
	font-size: var(--myco-font-size-sm);
	transform: translateX(-50%);
}

@media (max-width: 640px) {
	.product-gallery__thumbs {
		grid-auto-columns: calc((100% - (3 * var(--myco-space-sm))) / 4);
	}
}

/* Single-image gallery: same stage, zoomable, but no slide navigation. */

/* Single-image gallery: the slide stays absolutely positioned like every other
   slide. Switching it to `position: relative` drops the `inset: 0` that bounds
   it to the stage, so a portrait image grew to its natural height and spilled
   out the bottom of the box. Only the visibility needs overriding here. */
/* Single-image gallery: the slide is never toggled by JS, so it must not
   inherit the `opacity: 0` + transition starting state the multi-image slides
   use — with nothing to trigger the transition the image can stay unpainted.
   Keep it absolutely positioned (that is what bounds it to the stage and stops
   a portrait image spilling out the bottom); only neutralise the fade. */
.product-gallery--single .product-gallery__slide {
	opacity: 1;
	visibility: visible;
	transition: none;
}
