/*
 * Photo comparison cards — shared responsive 3-card row.
 *
 * Same behaviour as the approved homepage "Guía de tejidos" block (home.css
 * .ed-fabrics__grid / .ed-fabric-card), extracted as a reusable component:
 *
 * - >= 1024px: 3 cards in one row, no scrolling.
 * - 768–1023px: one horizontal row, ~2.2 cards visible.
 * - < 768px: one horizontal row, one card (86%) + a peek of the next.
 *
 * Native overflow-x + CSS scroll-snap only (no library, no autoplay, no
 * dots/arrows). The row bleeds to the viewport edges (negative gutter
 * margins + matching padding) so the peek reaches the edge, and snaps to the
 * content edge via scroll-padding. Only the track scrolls horizontally —
 * never the page. assets/js/photo-cards.js only brings a keyboard-focused,
 * partially visible card fully into view.
 *
 * Markup:
 *   <div class="ed-photo-cards [ed-photo-cards--portrait]">
 *     <a class="ed-photo-card" href="…">               (or <article class="ed-photo-card ed-photo-card--static">)
 *       <span class="ed-photo-card__media">
 *         <img class="ed-photo-card__img" …>
 *         <span class="ed-photo-card__badge">…</span>     (optional)
 *       </span>
 *       <span class="ed-photo-card__body">
 *         <span class="ed-photo-card__title">…</span>   (h3 when the card is not a link)
 *         <span class="ed-photo-card__meta">…</span>     (optional)
 *         <span class="ed-photo-card__desc">…</span>
 *         <span class="ed-photo-card__cta">… <icon></span>
 *       </span>
 *     </a>
 *   </div>
 */

/* -------------------------------------------------------------------- */
/* Track                                                                  */
/* -------------------------------------------------------------------- */

.ed-photo-cards {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 86%;
	gap: var(--ed-space-md);
	margin: 0 calc(-1 * var(--ed-container-gutter)) var(--ed-space-lg);
	padding: 4px var(--ed-container-gutter); /* 4px: room for the hover lift */
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--ed-container-gutter);
	scrollbar-width: none;
}

.ed-photo-cards::-webkit-scrollbar {
	display: none;
}

@media (min-width: 768px) {
	.ed-photo-cards {
		grid-auto-columns: calc((100% - var(--ed-space-md)) / 2.2);
	}
}

@media (min-width: 1024px) {
	.ed-photo-cards {
		grid-auto-flow: row;
		grid-template-columns: repeat(3, 1fr);
		margin-inline: 0;
		padding: 0;
		overflow: visible;
	}
}

/* -------------------------------------------------------------------- */
/* Card                                                                   */
/* -------------------------------------------------------------------- */

.ed-photo-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	background-color: var(--ed-color-surface);
	border: 1px solid var(--ed-color-border);
	border-radius: var(--ed-radius-md);
	scroll-snap-align: start;
	transition: border-color var(--ed-transition-fast), transform var(--ed-transition-fast);
}

/* Links only, mouse/trackpad only: a tap on touch never leaves a stuck hover. */
@media (hover: hover) {
	a.ed-photo-card:hover {
		color: inherit;
		border-color: var(--ed-color-primary);
		transform: translateY(-2px);
	}
}

a.ed-photo-card:focus-visible {
	border-color: var(--ed-color-primary);
	outline: var(--ed-focus-outline);
	outline-offset: -3px; /* inside the card: the scroller would clip an outer ring */
}

@media (prefers-reduced-motion: reduce) {
	.ed-photo-card {
		transition: none;
	}

	a.ed-photo-card:hover {
		transform: none;
	}
}

.ed-photo-card__media {
	position: relative;
	display: block;
}

.ed-photo-card__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3; /* source photos are exactly 4:3 — no crop */
	object-fit: cover;
}

/* Screen apertura photos are 4:5 portraits: shown whole, never cropped. */
.ed-photo-cards--portrait .ed-photo-card__img {
	aspect-ratio: 4 / 5;
}

/* Small technical overlay (e.g. "Apertura 1–3%"), bottom-left over the floor: never covers the estor. */
.ed-photo-card__badge {
	position: absolute;
	bottom: var(--ed-space-sm);
	left: var(--ed-space-sm);
	padding: 0.3em 0.7em;
	color: #ffffff;
	background-color: rgba(16, 19, 20, 0.82);
	border-radius: var(--ed-radius-sm);
	font-size: var(--ed-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.4;
}

.ed-photo-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: var(--ed-space-lg);
}

.ed-photo-card__title {
	display: block;
	margin: 0 0 var(--ed-space-3xs);
	color: var(--ed-color-heading);
	font-family: var(--ed-font-heading);
	font-size: var(--ed-font-size-lg);
	font-weight: 500;
	line-height: 1.2;
}

.ed-photo-card__meta {
	display: block;
	margin-bottom: var(--ed-space-2xs);
	color: var(--ed-color-link);
	font-size: var(--ed-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ed-photo-card__desc {
	display: block;
	margin: 0;
	color: var(--ed-color-muted);
	font-size: var(--ed-font-size-sm);
}

.ed-photo-card__cta {
	display: inline-flex;
	align-items: center;
	gap: var(--ed-space-3xs);
	margin-top: auto;
	padding-top: var(--ed-space-md);
	color: var(--ed-color-link);
	font-size: var(--ed-font-size-sm);
	font-weight: 600;
}

/* Card without a working destination yet: same layout, no CTA, a muted note instead. */
.ed-photo-card__note {
	display: block;
	margin-top: auto;
	padding-top: var(--ed-space-md);
	color: var(--ed-color-muted);
	font-size: var(--ed-font-size-xs);
	font-weight: 600;
}
