/**
 * MEMOT theme styles — product-single.
 *
 * Single product template: spec sheet + gallery.
 * Split out of theme.css so it loads only on the template(s) that need it —
 * see memot_enqueue_assets() in functions.php. Reuses the same
 * theme.json custom properties and memot-* class hooks as theme.css.
 */

/* -------------------------------------------------------------------------- *
 * Product specs
 * -------------------------------------------------------------------------- */

.memot-specs {
	position: relative;
	background: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--memot-radius-lg);
	box-shadow: var(--memot-shadow-sm);
	overflow: hidden;
}

/* Amber tick along the top edge — the same signature mark as the eyebrow,
   here signalling "certified spec" rather than a section intro. */
.memot-specs::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	background: var(--wp--preset--color--harvest);
}

.memot-specs table {
	width: 100%;
	border-collapse: collapse;
}

.memot-specs th,
.memot-specs td {
	padding: 0.875rem 1.25rem;
	text-align: left;
	font-size: 0.9375rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.memot-specs th {
	width: 40%;
	font-weight: 600;
	color: var(--wp--preset--color--slate);
}

.memot-specs td {
	font-variant-numeric: tabular-nums;
}

.memot-specs tr:last-child th,
.memot-specs tr:last-child td {
	border-bottom: none;
}

.memot-specs tr:nth-child(even) {
	background: var(--wp--preset--color--sand);
}

.memot-specs__summary {
	padding: 1.5rem 1.25rem 1.25rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.memot-specs__facts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	margin: 0;
}

.memot-specs__fact {
	background: var(--wp--preset--color--sand);
	border-radius: var(--memot-radius);
	padding: 0.6rem 1.1rem 0.75rem;
	min-width: 6.5rem;
}

.memot-specs__fact dt {
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
}

.memot-specs__fact dd {
	margin: 0.15rem 0 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.375rem;
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

.memot-specs__apps {
	margin-top: var(--wp--preset--spacing--30);
}

.memot-specs__apps-label {
	display: block;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--slate);
	margin-bottom: 0.5rem;
}

.memot-specs__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.memot-specs__chip {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	padding: 0.3rem 0.8rem;
}

.memot-specs-datasheet {
	padding: 0 1.25rem 1.25rem;
	margin-top: var(--wp--preset--spacing--50);
}

.memot-specs-datasheet__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.memot-specs-datasheet__icon {
	width: 1.1rem;
	height: 1.1rem;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.memot-specs .memot-specs-download {
	margin-top: var(--wp--preset--spacing--50);
}

/* Product description (post-content), rendered under the spec card in the
   same column so it reads as one continuous fact sheet instead of a
   separate block floating below the gallery/specs row. */
.memot-product-overview {
	color: var(--wp--preset--color--slate);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.7;
}

.memot-product-overview > * + * {
	margin-top: var(--wp--preset--spacing--30);
}

/* -------------------------------------------------------------------------- *
 * Product gallery — main stage image + vertical thumbnail rail (single
 * product page). The stage/thumb swap runs on plain radio inputs + labels so
 * it works with no JavaScript; memot-product-gallery.js only adds the
 * up/down rail buttons and keeps the active thumbnail scrolled into view.
 * -------------------------------------------------------------------------- */

/* Sticks alongside the taller spec/description column so the product image
   stays in view while that column scrolls; unsticks naturally once the
   column (and the row it's in) runs out of height. Desktop only — see the
   width:781px reset below, where the two columns stack instead. */
.memot-product-gallery-col {
	position: sticky;
	top: calc(var(--memot-header-space) + var(--wp--preset--spacing--40));
	align-self: flex-start;
}

.memot-gallery {
	display: flex;
	flex-direction: row-reverse;
	gap: var(--wp--preset--spacing--40);
}

.memot-gallery__radio {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.memot-gallery__stage {
	position: relative;
	flex: 1 1 auto;
	aspect-ratio: 4 / 5;
	margin: 0;
	background: var(--wp--preset--color--sand);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--memot-radius-lg);
	box-shadow: var(--memot-shadow-sm);
	overflow: hidden;
}

.memot-gallery__slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	cursor: zoom-in;
	transition: opacity 0.25s var(--memot-ease-out, ease), transform 0.4s var(--memot-ease-out, ease);
}

.memot-gallery--single .memot-gallery__slide {
	opacity: 1;
}

.memot-gallery__stage:hover .memot-gallery__slide {
	transform: scale(1.03);
}

/* Each radio's :checked state (radio 1 is checked by default in the markup)
   picks the matching slide by DOM position — see product-gallery/render.php. */
.memot-gallery__radio:nth-of-type(1):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(1),
.memot-gallery__radio:nth-of-type(2):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(2),
.memot-gallery__radio:nth-of-type(3):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(3),
.memot-gallery__radio:nth-of-type(4):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(4),
.memot-gallery__radio:nth-of-type(5):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(5),
.memot-gallery__radio:nth-of-type(6):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(6),
.memot-gallery__radio:nth-of-type(7):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(7),
.memot-gallery__radio:nth-of-type(8):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(8),
.memot-gallery__radio:nth-of-type(9):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(9),
.memot-gallery__radio:nth-of-type(10):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(10),
.memot-gallery__radio:nth-of-type(11):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(11),
.memot-gallery__radio:nth-of-type(12):checked ~ .memot-gallery__stage .memot-gallery__slide:nth-of-type(12) {
	opacity: 1;
}

.memot-gallery__thumbs {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	flex: 0 0 5.5rem;
}

.memot-gallery__nav {
	display: flex;
	justify-content: center;
	width: 100%;
}

.memot-gallery__nav[hidden] {
	display: none;
}

.memot-gallery__nav-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	background: var(--wp--preset--color--paper);
	box-shadow: var(--memot-shadow-sm);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.memot-gallery__nav .memot-gallery__nav-button svg {
	width: 1.05rem;
	height: 1.05rem;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.memot-gallery__nav-button:disabled {
	opacity: 0.35;
	cursor: default;
	box-shadow: none;
	transform: none;
}

.memot-gallery__nav-button:hover:not(:disabled) {
	box-shadow: var(--memot-shadow-md);
	transform: translateY(-1px);
}

.memot-gallery__viewport {
	width: 100%;
	max-height: 32rem;
	overflow-y: auto;
	scrollbar-width: none;
}

.memot-gallery__viewport::-webkit-scrollbar {
	display: none;
}

.memot-gallery__track {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
}

.memot-gallery__thumb {
	display: block;
	flex: none;
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: var(--memot-radius);
	overflow: hidden;
	border: 2px solid transparent;
	box-shadow: var(--memot-shadow-sm);
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

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

.memot-gallery__thumb:hover {
	box-shadow: var(--memot-shadow-md);
}

.memot-gallery__radio:nth-of-type(1):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(1),
.memot-gallery__radio:nth-of-type(2):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(2),
.memot-gallery__radio:nth-of-type(3):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(3),
.memot-gallery__radio:nth-of-type(4):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(4),
.memot-gallery__radio:nth-of-type(5):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(5),
.memot-gallery__radio:nth-of-type(6):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(6),
.memot-gallery__radio:nth-of-type(7):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(7),
.memot-gallery__radio:nth-of-type(8):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(8),
.memot-gallery__radio:nth-of-type(9):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(9),
.memot-gallery__radio:nth-of-type(10):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(10),
.memot-gallery__radio:nth-of-type(11):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(11),
.memot-gallery__radio:nth-of-type(12):checked ~ .memot-gallery__thumbs .memot-gallery__thumb:nth-of-type(12) {
	border-color: var(--wp--preset--color--brand);
	box-shadow: var(--memot-shadow-md);
}

@media (max-width: 781px) {

	.memot-product-gallery-col {
		position: static;
	}

	.memot-gallery {
		flex-direction: column-reverse;
	}

	.memot-gallery__thumbs {
		flex-direction: row;
		flex: none;
	}

	.memot-gallery__nav {
		display: none;
	}

	.memot-gallery__viewport {
		max-height: none;
		overflow-x: auto;
		overflow-y: visible;
	}

	.memot-gallery__track {
		flex-direction: row;
	}

	.memot-gallery__thumb {
		width: 4.5rem;
		flex: none;
	}
}

