/**
 * Footer design: Gallery — .esptb-ft-gallery
 *
 * A "new arrivals" shelf on the card surface opens the footer, then the
 * brand + link columns + contact on the footer colour, then the bottom
 * bar. Every colour, font and size comes from the kit tokens (the theme's
 * settings) unless the block sets its own — the shelf follows the block's
 * "Card background". Phones and tablets swipe the products sideways, edge
 * to edge; from 1024px up to six stand in one row, divided columns below.
 */

.espt-block-footer .esptb-ft-gallery {
	--gl-gap: clamp(12px, calc(var(--ftc-gap) * 0.6), 22px);
	--gl-bleed: 16px;
}

/* ================================================================ shelf */

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-shelf {
	background: var(--ftc-card);
	border-bottom: 1px solid var(--ftc-line);
	padding-bottom: calc(var(--ft-pad, var(--fk-pad-r)) * 0.62);
	padding-top: calc(var(--ft-pad, var(--fk-pad-r)) * 0.62);
}

/* Head: the title behind a small accent dot, "see all" as a pill. */
.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-head {
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 16px;
	margin-bottom: 16px;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-h {
	align-items: center;
	display: flex;
	font-size: calc(var(--ft-title-size, var(--fk-title-size)) * 1.3);
	gap: 13px;
	line-height: 1.3;
	min-width: 0;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-h::before {
	background: var(--ftc-accent);
	border-radius: 50%;
	box-shadow: 0 0 0 5px var(--ftc-accent-soft);
	content: "";
	flex: none;
	height: 8px;
	margin-left: 5px;
	width: 8px;
}

.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all {
	border: 1px solid color-mix(in srgb, var(--ftc-heading) 22%, transparent);
	border-radius: 999px;
	color: var(--ftc-heading);
	gap: 6px;
	margin-left: auto;
	min-height: 40px;
	padding: 6px 12px 6px 16px;
}

.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all:hover {
	background: var(--ftc-fill);
	border-color: var(--ftc-fill);
	color: var(--ftc-on-fill);
}

.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all .esptb-ft-ic { transition: transform 0.2s ease; }
.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all:hover .esptb-ft-ic { transform: translateX(2px); }

/* Phones: a sideways shelf that runs to the screen edges, so the next
   product peeks in. */
.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-list {
	gap: var(--gl-gap);
	grid-auto-columns: minmax(136px, 40%);
	margin: 0 calc(var(--gl-bleed) * -1);
	padding: 4px var(--gl-bleed) 6px;
	scroll-padding-inline: var(--gl-bleed);
	scrollbar-width: none;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-list::-webkit-scrollbar { display: none; }

/* A product: the photo on a white mat, then its name and price. */
.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod {
	gap: 10px;
	height: 100%;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img {
	background: #fff;
	box-shadow: 0 0 0 1px var(--ftc-line);
	isolation: isolate;
	position: relative;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img picture {
	display: block;
	height: 100%;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-n {
	color: var(--ftc-heading);
	font-size: calc(var(--ft-link-size, var(--fk-link-size)) - 0.5px);
	font-weight: 600;
	line-height: 1.45;
	min-height: 2.9em;
}

.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod:hover .esptb-ft-prod-n { color: var(--ftc-link-h); }

.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-p {
	font-size: var(--ft-link-size, var(--fk-link-size));
	line-height: 1.3;
	margin-top: auto;
}

/* Mouse: a round "view" arrow rises into the photo's corner. */
@media (hover: hover) {
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::before,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::after {
		content: "";
		opacity: 0;
		position: absolute;
		transform: translateY(6px);
		transition: opacity 0.2s ease, transform 0.2s ease;
		z-index: 1;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::before {
		background: var(--ftc-fill);
		border-radius: 50%;
		bottom: 10px;
		box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
		height: 36px;
		right: 10px;
		width: 36px;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::after {
		background: var(--ftc-on-fill);
		bottom: 21px;
		height: 14px;
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
		right: 21px;
		width: 14px;
	}

	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod:hover .esptb-ft-prod-img::before,
	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod:hover .esptb-ft-prod-img::after,
	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod:focus-visible .esptb-ft-prod-img::before,
	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prod:focus-visible .esptb-ft-prod-img::after {
		opacity: 1;
		transform: none;
	}
}

/* ================================================================= body */

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid {
	display: grid;
	gap: var(--ftc-gap);
	grid-template-columns: minmax(0, 1fr);
}

/* The kit's paragraph reset outranks its own about-text spacing. */
.espt-block-footer .esptb-ft-gallery .esptb-ft-brand > .esptb-ft-about { margin-top: 16px; }
.espt-block-footer .esptb-ft-gallery .esptb-ft-brand > .esptb-ft-about:first-child { margin-top: 0; }

/* Folded rows sit flush between hairlines; the brand block and the contact
   details keep their air. */
.espt-block-footer .esptb-ft-gallery.is-folded .esptb-ft-gl-grid { row-gap: 0; }
.espt-block-footer .esptb-ft-gallery.is-folded .esptb-ft-gl-grid > .esptb-ft-brand { padding-bottom: 24px; }

.espt-block-footer .esptb-ft-gallery.is-folded .esptb-ft-gl-grid > .is-foldable:first-child,
.espt-block-footer .esptb-ft-gallery.is-folded .esptb-ft-gl-grid > :not(.is-foldable) + .is-foldable { border-top: 1px solid var(--ftc-line); }

.espt-block-footer .esptb-ft-gallery.is-folded .esptb-ft-gl-grid > .is-foldable + :not(.is-foldable) { padding-top: 26px; }

/* Contact: a caption over each value, icons in soft accent circles. */
.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact { gap: 14px; }

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .esptb-ft-crow {
	align-items: center;
	gap: 14px;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .esptb-ft-ic {
	background: var(--ftc-accent-soft);
	border-radius: 50%;
	height: 40px;
	width: 40px;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .esptb-ft-crow-k { display: block; }

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .esptb-ft-crow-v {
	color: var(--ftc-heading);
	font-weight: 600;
}

.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .is-address { align-items: flex-start; }
.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact .is-address .esptb-ft-crow-t { padding-top: 1px; }
.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-contact a.esptb-ft-crow:hover .esptb-ft-crow-v { color: var(--ftc-link-h); }

/* =============================================================== phones */

/* Every tap target reaches 40px — the links in an opened list, the social
   icons and the bottom bar's policy and credit links (the kit draws them at
   28 / 38 / 34px). The list gap shrinks by the same amount, so an opened
   list keeps its rhythm. */
@media (max-width: 767px) {
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid .esptb-ft-links { gap: max(0px, calc(var(--ft-link-gap, var(--fk-link-gap)) - 10px)); }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid .esptb-ft-links a {
		background-origin: content-box;
		min-height: 40px;
		padding: 8px 0;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-brand a.esptb-ft-soc {
		min-height: 40px;
		min-width: 40px;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-bottom .esptb-ft-policy a,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-bottom .esptb-ft-credit a {
		background-origin: content-box;
		min-height: 40px;
		padding: 9px 0;
	}
}

/* ============================================================ ≥ 768px */

@media (min-width: 768px) {
	.espt-block-footer .esptb-ft-gallery { --gl-bleed: 24px; }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-head { margin-bottom: 20px; }

	/* Tablets keep the sideways shelf (the kit turns it into rows here). */
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-list {
		grid-auto-columns: minmax(150px, 22.5%);
		grid-auto-flow: column;
		grid-template-columns: none;
		overflow-x: auto;
		padding-bottom: 6px;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: calc(var(--ftc-gap) * 1.25);
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-1 { grid-template-columns: minmax(0, 1fr); }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child { grid-column: 1 / -1; }

	/* A column that spans the whole row spreads its list across it. */
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child .esptb-ft-gl-contact,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child .esptb-ft-gl-contact,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child .esptb-ft-links,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child .esptb-ft-links {
		column-gap: var(--ftc-gap);
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* =========================================================== ≥ 1024px */

@media (min-width: 1024px) {
	/* Up to six products stand in one row… */
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prods-list {
		grid-auto-flow: row;
		grid-template-columns: repeat(6, minmax(0, 1fr));
		margin: 0;
		overflow: visible;
		padding: 0;
	}

	/* …more keep the sideways scroll, a seventh peeking in at the edge. */
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-shelf.is-many .esptb-ft-prods-list {
		grid-auto-columns: calc((100% - 5 * var(--gl-gap)) / 6.4);
		grid-auto-flow: column;
		grid-template-columns: none;
		margin: 0 -4px;
		overflow-x: auto;
		padding: 4px 4px 14px;
		scroll-padding-inline: 4px;
		scrollbar-color: color-mix(in srgb, var(--ftc-heading) 28%, transparent) transparent;
		scrollbar-width: thin;
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-shelf.is-many .esptb-ft-prods-list::-webkit-scrollbar { display: block; height: 6px; }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-shelf.is-many .esptb-ft-prods-list::-webkit-scrollbar-thumb {
		background: color-mix(in srgb, var(--ftc-heading) 28%, transparent);
		border-radius: 999px;
	}

	/* Columns divided by hairlines, the brand column widest. */
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid > * + * {
		border-left: 1px solid var(--ftc-line);
		padding-left: var(--ftc-gap);
	}

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child { grid-column: auto; }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child .esptb-ft-gl-contact,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child .esptb-ft-gl-contact,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 > :last-child .esptb-ft-links,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 > :last-child .esptb-ft-links { display: flex; }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-3 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.25fr); }
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-4 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); }
	.espt-block-footer .esptb-ft-gallery .esptb-ft-gl-grid.has-5 { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.3fr); }
}

/* ============================================================== motion */

@media (prefers-reduced-motion: reduce) {
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::before,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::after,
	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all .esptb-ft-ic { transition: none; }

	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::before,
	.espt-block-footer .esptb-ft-gallery .esptb-ft-prod-img::after,
	.espt-block-footer .esptb-ft-gallery a.esptb-ft-prods-all:hover .esptb-ft-ic { transform: none; }
}
