/* Grip aid finder. Colours come from the theme palette variables, so dark mode follows. */
.pff-grip-finder {
	--pff-gf-primary: var(--wp--preset--color--primary, #a15a6d);
	--pff-gf-primary-dark: var(--wp--preset--color--primary-dark, #713a4c);
	--pff-gf-primary-light: var(--wp--preset--color--primary-light, #dfa8b7);
	--pff-gf-surface: var(--wp--preset--color--surface, #f3e4e8);
	--pff-gf-base: var(--wp--preset--color--base, #faf7f5);
	--pff-gf-text: var(--wp--preset--color--contrast, #29232b);
	--pff-gf-muted: var(--wp--preset--color--muted, #6b5e66);
	--pff-gf-heading: var(--wp--preset--font-family--heading, "Cormorant Garamond", Georgia, serif);
	--pff-gf-line: color-mix(in srgb, var(--pff-gf-primary) 28%, transparent);
	--pff-gf-error: var(--pff-con, #b3261e);
	margin-block: 2.5rem;
}

/* Remove the browser's paragraph margins; :where() keeps this weaker than every rule below. */
:where(.pff-grip-finder) p {
	margin: 0;
}

/* ---------- Call-to-action panel ---------- */

.pff-grip-finder__panel {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	gap: 1.25rem 1.75rem;
	align-items: center;
	padding: 1.75rem 2rem;
	border-radius: 12px;
	background:
		radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--pff-gf-primary-light) 45%, transparent), transparent 55%),
		var(--pff-gf-surface);
	color: var(--pff-gf-text);
	overflow: hidden;
}

.pff-grip-finder__motif {
	display: grid;
	gap: 0.55rem;
	justify-items: center;
}

.pff-grip-finder__motif span {
	display: block;
	width: 0.85rem;
	height: 0.85rem;
	background: var(--pff-gf-primary);
	transform: rotate(45deg);
}

.pff-grip-finder__motif span:nth-child(2) {
	width: 1.15rem;
	height: 1.15rem;
	background: var(--pff-gf-primary-light);
}

.pff-grip-finder__motif span:nth-child(3) {
	background: transparent;
	box-shadow: inset 0 0 0 2px var(--pff-gf-primary);
}

.pff-grip-finder .pff-grip-finder__intro > * + * {
	margin-top: 0.35rem;
}

.pff-grip-finder__kicker,
.pff-grip-finder__match-kicker,
.pff-grip-finder__best {
	color: var(--pff-gf-primary-dark);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pff-grip-finder__title {
	font-family: var(--pff-gf-heading);
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
	font-weight: 600;
	line-height: 1.1;
}

.pff-grip-finder__title em {
	color: var(--pff-gf-primary);
	font-style: italic;
}

.pff-grip-finder__text {
	color: var(--pff-gf-muted);
	font-size: 1.0625rem;
	line-height: 1.5;
}

/* ---------- Buttons ---------- */

.pff-grip-finder__open,
.pff-grip-finder__next,
.pff-grip-finder .pff-grip-finder__shop,
.pff-grip-finder .pff-grip-finder__shop:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.55em;
	min-height: 48px;
	padding: 0.8em 1.6em;
	border: 0;
	border-radius: 999px;
	background: var(--pff-gf-primary);
	color: var(--pff-gf-base);
	font-family: inherit;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--pff-gf-primary-dark) 70%, transparent);
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.pff-grip-finder__open:hover,
.pff-grip-finder__next:hover,
.pff-grip-finder .pff-grip-finder__shop:hover {
	background: var(--pff-gf-primary-dark);
	color: var(--pff-gf-base);
	transform: translateY(-2px);
}

.pff-grip-finder__open:active,
.pff-grip-finder__next:active,
.pff-grip-finder .pff-grip-finder__shop:active {
	transform: translateY(0);
}

.pff-grip-finder__arrow {
	flex: none;
	transition: transform 0.2s ease;
}

.pff-grip-finder__open:hover .pff-grip-finder__arrow,
.pff-grip-finder__shop:hover .pff-grip-finder__arrow {
	transform: translateX(3px);
}

.pff-grip-finder__back,
.pff-grip-finder__retake {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-height: 48px;
	padding: 0.7em 1.4em;
	border: 2px solid var(--pff-gf-line);
	border-radius: 999px;
	background: transparent;
	color: var(--pff-gf-primary-dark);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pff-grip-finder__back:hover,
.pff-grip-finder__retake:hover {
	border-color: var(--pff-gf-primary);
	background: var(--pff-gf-surface);
}

.pff-grip-finder :is(button, a):focus-visible {
	outline: 3px solid var(--pff-gf-primary-light);
	outline-offset: 3px;
}

/* ---------- Dialog ---------- */

html.pff-grip-finder-open {
	overflow: hidden;
}

.pff-grip-finder__dialog {
	width: min(40rem, calc(100vw - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 16px;
	background: var(--pff-gf-base);
	color: var(--pff-gf-text);
	box-shadow: 0 30px 80px -20px rgb(26 23 30 / 0.55);
	overflow: hidden;
}

.pff-grip-finder__dialog[open] {
	display: flex;
	animation: pff-grip-finder-in 0.25s ease-out;
}

.pff-grip-finder__dialog::backdrop {
	background: rgb(41 35 43 / 0.62);
	backdrop-filter: blur(3px);
}

@keyframes pff-grip-finder-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
}

.pff-grip-finder__sheet {
	--pff-gf-pad-bottom: 1.75rem;
	flex: 1;
	min-width: 0;
	max-height: calc(100dvh - 2rem);
	padding: 1.25rem 1.75rem var(--pff-gf-pad-bottom);
	overflow-y: auto;
	overscroll-behavior: contain;
	box-sizing: border-box;
}

.pff-grip-finder__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-bottom: 1rem;
	margin-bottom: 1.25rem;
	border-bottom: 1px solid var(--pff-gf-line);
}

.pff-grip-finder__dialog-title {
	font-family: var(--pff-gf-heading);
	font-size: 1.625rem;
	font-weight: 600;
	font-style: italic;
	line-height: 1.1;
	color: var(--pff-gf-primary-dark);
}

.pff-grip-finder__close {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--pff-gf-surface);
	color: var(--pff-gf-text);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.pff-grip-finder__close:hover {
	background: var(--pff-gf-primary-light);
}

/* ---------- Questions ---------- */

.pff-grip-finder__progress {
	display: grid;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.pff-grip-finder__count {
	color: var(--pff-gf-muted);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.pff-grip-finder__bar {
	display: block;
	height: 6px;
	border-radius: 999px;
	background: var(--pff-gf-surface);
	overflow: hidden;
}

.pff-grip-finder__fill {
	display: block;
	width: 33.333%;
	height: 100%;
	border-radius: inherit;
	background: var(--pff-gf-primary);
	transition: width 0.3s ease;
}

.pff-grip-finder__step {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.pff-grip-finder__step:focus {
	outline: none;
}

.pff-grip-finder__step[hidden] {
	display: none;
}

.pff-grip-finder__question {
	padding: 0;
	font-family: var(--pff-gf-heading);
	font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
	font-weight: 600;
	line-height: 1.15;
}

.pff-grip-finder .pff-grip-finder__hint {
	margin: 0.4rem 0 1rem;
	color: var(--pff-gf-muted);
	font-size: 1rem;
	line-height: 1.5;
}

.pff-grip-finder__options {
	display: grid;
	gap: 0.6rem;
}

.pff-grip-finder__option {
	display: flex;
	align-items: flex-start;
	gap: 0.85rem;
	padding: 0.85rem 1rem;
	border: 1.5px solid var(--pff-gf-line);
	border-radius: 12px;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.pff-grip-finder__option:hover {
	border-color: var(--pff-gf-primary);
}

.pff-grip-finder__option:has(:checked) {
	border-color: var(--pff-gf-primary);
	background: var(--pff-gf-surface);
	box-shadow: inset 0 0 0 1px var(--pff-gf-primary);
}

.pff-grip-finder__option:has(:focus-visible) {
	outline: 3px solid var(--pff-gf-primary-light);
	outline-offset: 2px;
}

.pff-grip-finder__radio {
	flex: none;
	width: 1.2rem;
	height: 1.2rem;
	margin: 0.15rem 0 0;
	accent-color: var(--pff-gf-primary);
}

.pff-grip-finder__radio:focus-visible {
	outline: none;
}

.pff-grip-finder__option-text {
	display: grid;
	gap: 0.15rem;
	min-width: 0;
}

.pff-grip-finder__option-label {
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
}

.pff-grip-finder__option-hint {
	color: var(--pff-gf-muted);
	font-size: 0.9375rem;
	line-height: 1.4;
}

.pff-grip-finder .pff-grip-finder__error {
	min-height: 1.5em;
	margin-top: 0.6rem;
	color: var(--pff-gf-error);
	font-size: 0.9375rem;
	font-weight: 600;
}

/* Stays at the foot of the sheet while the options scroll, so Next is always in reach. */
.pff-grip-finder__nav {
	position: sticky;
	bottom: calc(-1 * var(--pff-gf-pad-bottom));
	z-index: 1;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: space-between;
	margin: 0.25rem 0 calc(-1 * var(--pff-gf-pad-bottom));
	padding: 0.75rem 0 var(--pff-gf-pad-bottom);
	background: var(--pff-gf-base);
	box-shadow: 0 -12px 16px -12px color-mix(in srgb, var(--pff-gf-base) 90%, transparent);
}

.pff-grip-finder__next {
	margin-left: auto;
}

.pff-grip-finder__form[hidden],
.pff-grip-finder__after[hidden],
.pff-grip-finder__back[hidden] {
	display: none;
}

/* ---------- Result ---------- */

.pff-grip-finder__result:empty {
	display: none;
}

.pff-grip-finder .pff-grip-finder__match > * + * {
	margin-top: 1rem;
}

.pff-grip-finder__match-kicker {
	display: flex;
	align-items: center;
	gap: 0.6em;
}

.pff-grip-finder__match-kicker::before {
	content: "";
	width: 0.6em;
	height: 0.6em;
	background: var(--pff-gf-primary);
	transform: rotate(45deg);
}

.pff-grip-finder__card {
	display: grid;
	grid-template-columns: 200px minmax(0, 1fr);
	gap: 1.5rem;
	align-items: center;
}

.pff-grip-finder__card:not(:has(.pff-grip-finder__media)) {
	grid-template-columns: minmax(0, 1fr);
}

.pff-grip-finder__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	border-radius: 12px;
	background: var(--pff-gf-surface);
}

.pff-grip-finder .pff-grip-finder__card-body > * + * {
	margin-top: 0.4rem;
}

.pff-grip-finder__best {
	color: var(--pff-gf-primary);
	font-size: 0.8125rem;
}

.pff-grip-finder__name {
	font-family: var(--pff-gf-heading);
	font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
	font-weight: 700;
	line-height: 1.05;
}

.pff-grip-finder__name:focus {
	outline: none;
}

.pff-grip-finder__answers {
	color: var(--pff-gf-muted);
	font-size: 0.9375rem;
	line-height: 1.4;
}

.pff-grip-finder__reason {
	font-size: 1.0625rem;
	line-height: 1.6;
}

.pff-grip-finder .pff-grip-finder__tip {
	padding: 0.85rem 1rem;
	border-radius: 12px;
	background: var(--pff-gf-surface);
	font-size: 1rem;
	line-height: 1.5;
}

.pff-grip-finder__tip strong {
	color: var(--pff-gf-primary-dark);
}

.pff-grip-finder__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1.5rem;
	padding-top: 0.25rem;
}

.pff-grip-finder .pff-grip-finder__shop {
	min-height: 54px;
	padding-inline: 1.9em;
	font-size: 1.125rem;
}

.pff-grip-finder .pff-grip-finder__review {
	color: var(--pff-gf-primary-dark);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--pff-gf-primary-light);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.pff-grip-finder .pff-grip-finder__review:hover {
	text-decoration-color: currentColor;
}

.pff-grip-finder__after {
	display: grid;
	gap: 1rem;
	justify-items: start;
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--pff-gf-line);
}

.pff-grip-finder .pff-grip-finder__note {
	color: var(--pff-gf-muted);
	font-size: 0.875rem;
	line-height: 1.5;
}

.pff-grip-finder__note a {
	color: inherit;
}

.pff-grip-finder__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* Editor only. */
.pff-grip-finder__editor-info {
	margin: 0.5rem 0 0;
	color: var(--pff-gf-muted);
	font-size: 0.8125rem;
}

/* ---------- Phones ---------- */

@media (max-width: 700px) {
	.pff-grip-finder__panel {
		grid-template-columns: minmax(0, 1fr);
		padding: 1.5rem 1.25rem;
	}

	.pff-grip-finder__motif {
		position: absolute;
		top: 1.25rem;
		right: 1.25rem;
		opacity: 0.55;
	}

	.pff-grip-finder__motif span {
		width: 0.6rem;
		height: 0.6rem;
	}

	.pff-grip-finder__motif span:nth-child(2) {
		width: 0.8rem;
		height: 0.8rem;
	}

	.pff-grip-finder__intro {
		padding-right: 1.5rem;
	}

	.pff-grip-finder__open {
		width: 100%;
	}
}

@media (max-width: 600px) {
	.pff-grip-finder__dialog {
		width: calc(100vw - 1rem);
		max-height: calc(100dvh - 1rem);
	}

	.pff-grip-finder__sheet {
		--pff-gf-pad-bottom: 1.25rem;
		max-height: calc(100dvh - 1rem);
		padding: 1rem 1.1rem var(--pff-gf-pad-bottom);
	}

	.pff-grip-finder__card {
		grid-template-columns: 112px minmax(0, 1fr);
		gap: 1rem;
	}

	.pff-grip-finder__name {
		font-size: 1.625rem;
	}

	.pff-grip-finder__actions {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}

	.pff-grip-finder .pff-grip-finder__shop {
		white-space: normal;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pff-grip-finder *,
	.pff-grip-finder__dialog[open] {
		animation: none !important;
		transition: none !important;
	}
}
