/**
 * Find Your Mezcal page (page-find-your-mezcal.php)
 *
 * Split section: breadcrumb, step controls, question and answer rows on the
 * left; the step image on the right, bleeding to the viewport edge.
 *
 * The left column lines up with the site container (same stepped max-widths as
 * Tailwind's .container, which the header uses) while the right column stays a
 * true half-viewport bleed — so the copy sits on the site's grid and the image
 * still runs off the edge.
 *
 * Tokens reused from the rest of the site:
 *   --color-sand var(--color-sand), --color-forest var(--color-forest), --color-cream var(--color-cream),
 *   --font-display (IM Fell Double Pica), --font-default (Roboto Condensed).
 */

.dm-finder {
	--dm-finder-fg: var(--dm-fg-default-primary);      /* Semantics/fg/default/primary */
	--dm-finder-ink: var(--color-cream);     /* cream text on the forest rows */
	--dm-finder-accent: var(--dm-fg-accent-yellow);  /* icon yellow on the forest rows */

	/* Distance from the viewport edge to the container's content edge. Mirrors
	   .container (max-width steps at each breakpoint) + its 16px padding, so
	   the question lines up with the logo and nav above it. */
	--dm-finder-gutter: 16px;

	background: var(--color-sand, var(--color-sand));
	color: var(--dm-finder-fg);
	/* No band below: the image meets the newsletter directly (a sand strip
	   showed as a stray cream line above it). */
	padding-bottom: 0;
	overflow: hidden; /* the image bleeds to the right edge */
}

@media (min-width: 640px)  { .dm-finder { --dm-finder-gutter: calc((100vw - 640px)  / 2 + 16px); } }
@media (min-width: 768px)  { .dm-finder { --dm-finder-gutter: calc((100vw - 768px)  / 2 + 16px); } }
@media (min-width: 1024px) { .dm-finder { --dm-finder-gutter: calc((100vw - 1024px) / 2 + 16px); } }
@media (min-width: 1280px) { .dm-finder { --dm-finder-gutter: calc((100vw - 1280px) / 2 + 16px); } }
@media (min-width: 1536px) { .dm-finder { --dm-finder-gutter: calc((100vw - 1536px) / 2 + 16px); } }

/* Text column + image column. The image column runs to the viewport edge, so
   the grid is not wrapped in the site container — the panel carries the
   container inset instead. */
.dm-finder__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	align-items: stretch;
}

/* ------------------------------------------------------------ Text column */
.dm-finder__panel {
	display: flex;
	flex-direction: column;
	padding-block: 20px clamp(2rem, 4.5vw, 4.25rem);
	padding-left: var(--dm-finder-gutter);
	padding-right: clamp(1.5rem, 3vw, 3rem); /* breathing room before the image */
}

/* Breadcrumb type is centralised in style.css (.breadcrumbs.text-forest);
   only the page-specific spacing lives here. */
.dm-finder__breadcrumb {
	margin-bottom: clamp(2rem, 3.5vw, 3.25rem);
}

/* Everything that swaps between steps. A floor on the height keeps the image
   and the sand band from jumping as steps with different answer counts trade
   places. */
.dm-finder__step {
	min-height: 26rem;
}

/* The swap itself is instant — every step ships with the page — so this is a
   short fade on the new content, not a wait for anything. */
@keyframes dm-finder-enter {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.dm-finder.is-swapped .dm-finder__step,
.dm-finder.is-swapped .dm-finder__figure {
	animation: dm-finder-enter 0.22s ease both;
}

@media (prefers-reduced-motion: reduce) {
	.dm-finder.is-swapped .dm-finder__step,
	.dm-finder.is-swapped .dm-finder__figure {
		animation: none;
	}
}

/* -------------------------------------------------- Previous / Start Over */
.dm-finder__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	max-width: 44rem;
	margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

.dm-finder__back {
	display: inline-flex;
	align-items: center;
	gap: 0.875rem;
	color: var(--dm-finder-fg);
	text-decoration: none;
}

.dm-finder__back-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 1px solid color-mix(in srgb, var(--color-forest) 25%, transparent);
	border-radius: 50%;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dm-finder__back-icon svg {
	display: block;
	width: 20px;
	height: 14px;
}

.dm-finder__back:hover .dm-finder__back-icon,
.dm-finder__back:focus-visible .dm-finder__back-icon {
	background: var(--dm-finder-fg);
	border-color: var(--dm-finder-fg);
	color: var(--dm-finder-ink);
}

.dm-finder__back-label {
	font-family: var(--font-default, "Roboto Condensed", sans-serif);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
}

.dm-finder__restart {
	font-family: var(--font-default, "Roboto Condensed", sans-serif);
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.4;
	color: var(--dm-finder-fg);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.dm-finder__restart:hover,
.dm-finder__restart:focus-visible {
	text-decoration-thickness: 2px;
}

/* ------------------------------------------------------- Eyebrow/question */
.dm-finder__eyebrow {
	margin: 0 0 clamp(0.75rem, 1.4vw, 1.25rem);
	font-family: var(--font-default, "Roboto Condensed", sans-serif);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--dm-finder-fg);
}

.dm-finder__question {
	margin: 0 0 clamp(2rem, 4vw, 3.25rem);
	max-width: 30rem;
	font-family: var(--font-display, "IM Fell Double Pica", serif);
	font-weight: 400;
	font-style: normal;                        /* roman */
	font-size: clamp(2rem, 3.4vw, 3.125rem);   /* 32px mobile -> 50px desktop */
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--dm-finder-fg);
}

/* ----------------------------------------------------------- Answer rows */
.dm-finder__options {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: clamp(0.625rem, 1vw, 0.875rem);
	max-width: 44rem;
}

.dm-finder__option {
	margin: 0;
}

.dm-finder__link {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 1.7vw, 1.5rem);
	min-height: clamp(64px, 5.2vw, 76px);
	padding: 0.75rem clamp(1.25rem, 2vw, 1.75rem);
	border: 1px solid transparent;
	border-radius: 4px;
	background: var(--dm-finder-fg);
	color: var(--dm-finder-ink);
	text-decoration: none;
	transition: background-color 0.25s ease, color 0.25s ease,
		border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Selected / pointer state: the row flips to white with forest ink, and the
   icon drops its yellow (it inherits currentColor). */
.dm-finder__link:hover,
.dm-finder__link:focus-visible,
.dm-finder__link[aria-current="true"] {
	background: var(--dm-bg-default-white);
	color: var(--dm-finder-fg);
	border-color: color-mix(in srgb, var(--color-forest) 8%, transparent);
	box-shadow: 0 2px 10px color-mix(in srgb, var(--color-forest) 8%, transparent);
}

.dm-finder__link:focus-visible {
	outline: 2px solid var(--dm-finder-fg);
	outline-offset: 2px;
}

.dm-finder__icon-wrap {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	color: var(--dm-finder-accent);
	transition: color 0.25s ease;
}

.dm-finder__link:hover .dm-finder__icon-wrap,
.dm-finder__link:focus-visible .dm-finder__icon-wrap,
.dm-finder__link[aria-current="true"] .dm-finder__icon-wrap {
	color: var(--dm-finder-fg);
}

/* Icons keep their own aspect (the crown is 26x24, the rest 28x28). */
.dm-finder__icon {
	display: block;
	width: auto;
	height: auto;
	max-width: 28px;
	max-height: 28px;
}

.dm-finder__label {
	flex: 1 1 auto;
	font-family: var(--font-display, "IM Fell Double Pica", serif);
	font-weight: 400;
	font-size: clamp(1.125rem, 1.55vw, 1.4375rem); /* 18px -> 23px */
	line-height: 1.25;
}

.dm-finder__arrow {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 14px;
	transition: transform 0.25s ease;
}

.dm-finder__arrow svg {
	display: block;
	width: 20px;
	height: 14px;
}

.dm-finder__link:hover .dm-finder__arrow,
.dm-finder__link:focus-visible .dm-finder__arrow {
	transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
	.dm-finder__link,
	.dm-finder__arrow,
	.dm-finder__icon-wrap,
	.dm-finder__step,
	.dm-finder__figure {
		transition: none;
	}

	.dm-finder__link:hover .dm-finder__arrow,
	.dm-finder__link:focus-visible .dm-finder__arrow {
		transform: none;
	}
}

/* ---------------------------------------------------------- Image column */
.dm-finder__figure {
	margin: 0;
	min-height: clamp(420px, 46vw, 720px);
}

.dm-finder__figure picture {
	display: block;
	height: 100%;
}

.dm-finder__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* ---------------------------------------------------------------- Mobile */
/* One column: question and answers first, then the image full-bleed under
   them, so the choices stay above the fold. */
@media (max-width: 767px) {
	.dm-finder__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.dm-finder__panel {
		padding-block: 16px 2rem;
		padding-inline: 16px;
	}

	.dm-finder__breadcrumb {
		margin-bottom: 2rem;
	}

	.dm-finder__step {
		min-height: 0;
	}

	.dm-finder__nav,
	.dm-finder__question,
	.dm-finder__options {
		max-width: none;
	}

	.dm-finder__back-icon {
		width: 40px;
		height: 40px;
	}

	.dm-finder__figure {
		min-height: 0;
		aspect-ratio: 16 / 13;
	}
}

/* The question receives focus after a step change (see
   assets/js/find-your-mezcal.js); that is a programmatic move, not a keyboard
   landing, so it should not draw a focus ring. */
.dm-finder__question:focus {
	outline: none;
}

/* ---- Small desktop (1024-1280) ---------------------------------------
 * No Figma board; shared 1280 rules. The panel's left edge follows the
 * capped 1080 container instead of the stock 1024/1280 steps; the image
 * still runs to the viewport edge. */
@media (min-width: 1024px) and (max-width: 1280.98px) {
	.dm-finder {
		--dm-finder-gutter: calc((100vw - min(1080px, 100vw - 32px)) / 2);
		padding-bottom: 0;
	}

	.dm-finder__panel {
		padding-block: 16px 80px;
		padding-right: 48px;
	}

	.dm-finder__step {
		min-height: 24rem;
	}

	.dm-finder__question {
		font-size: 46px;
	}

	.dm-finder__options {
		gap: 12px;
	}

	.dm-finder__link {
		gap: 20px;
		min-height: 64px;
		padding: 12px 24px;
		border-radius: 4px;
	}

	.dm-finder__label {
		font-size: 20px;
	}

	.dm-finder__figure {
		min-height: 560px;
	}
}
