/**
 * CalmPet – strona sprzedażowa: wybór wagi psa, zestawu i przycisk zakupu.
 *
 * Szablon: template-parts/landing/offer.php, zachowanie: assets/js/offer.js.
 * Ładowany po landing.css. Montserrat jest wgrany tylko w wadze 400 i 600, więc nigdzie nie używamy innych wag.
 * Kolory produktów (zieleń CALMPET 600, cegła CALMPET 1200) pochodzą z opakowań i z katalogu (--cp-tile-accent).
 */

.cp-offer {
	--cp-ink: #123c3a;
	--cp-muted: #60706d;
	--cp-line: rgba(167, 198, 164, 0.55);
	--cp-cream: #fbf6ee;
	--cp-was: #d9534f;
	--cp-save-bg: #e9f5ec; /* „oszczędzasz”: jasna zieleń tła */
	--cp-save-ink: #146c2e; /* i ciemna zieleń tekstu (kontrast ok. 5,8:1) */
	--cp-accent: #123c3a;
	--cp-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);

	box-sizing: border-box;
	max-width: 950px;
	margin: 10px auto;
	color: var(--cp-ink);
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-weight: 400;
}

.cp-offer *,
.cp-offer *::before,
.cp-offer *::after {
	box-sizing: border-box;
}

.cp-offer [hidden] {
	display: none !important;
}

/* Pola wyboru są prawdziwymi przyciskami radio (klawiatura, czytniki ekranu), tylko niewidocznymi. */
.cp-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
	opacity: 0;
}

/* ---------------------------------------------------------------------------
 * Kroki: nagłówek
 * ------------------------------------------------------------------------- */

.cp-offer__step {
	min-width: 0;
	margin: 0 0 14px;
	padding: 0;
	border: 0;
}

.cp-offer__legend {
	display: flex;
	align-items: center;
	gap: 12px;
	float: left;
	width: 100%;
	margin: 0 0 12px;
	padding: 0;
}

/* Legenda jest pływająca (żeby mogła być elastycznym wierszem), więc każdy kolejny element ją omija. */
.cp-offer__legend ~ * {
	clear: both;
}

.cp-offer__num {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--cp-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
}

.cp-offer__num--muted {
	background: #d7ddd5;
	color: #fff;
}

.cp-offer__legend-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cp-offer__title {
	font-size: 19px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--cp-ink);
}

.cp-offer__sub {
	font-size: 13px;
	line-height: 1.35;
	color: var(--cp-muted);
}

.cp-offer__note {
	margin: 10px 2px 0;
	font-size: 12px;
	line-height: 1.45;
	color: var(--cp-muted);
	text-align: center;
}

/* ---------------------------------------------------------------------------
 * Krok 1: waga psa
 * ------------------------------------------------------------------------- */

.cp-weight-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.cp-weight {
	display: block;
	position: relative;
	margin: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.cp-weight__body {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	height: 100%;
	padding: 18px 10px 16px;
	border: 2px solid var(--cp-line);
	border-radius: 16px;
	background: #fff;
	text-align: center;
	transition: border-color 0.2s var(--cp-ease), background-color 0.2s var(--cp-ease), box-shadow 0.2s var(--cp-ease), transform 0.2s var(--cp-ease);
}

.cp-weight:hover .cp-weight__body {
	border-color: var(--cp-tile-accent);
}

.cp-offer .cp-weight__dog {
	display: block;
	width: 88px;
	height: 88px;
	margin-bottom: 4px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--cp-cream);
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--cp-line);
	transition: box-shadow 0.2s var(--cp-ease);
}

.cp-weight__range {
	font-size: 19px;
	font-weight: 600;
	line-height: 1.15;
	color: var(--cp-ink);
}

.cp-weight__name {
	display: inline-block;
	padding: 5px 11px;
	border-radius: 999px;
	background: var(--cp-tile-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: uppercase;
}

.cp-weight__fact {
	font-size: 12px;
	line-height: 1.35;
	color: var(--cp-muted);
	overflow-wrap: anywhere;
}

.cp-weight__volume::before {
	content: '· ';
}

.cp-weight__check {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border: 2px solid #d7ddd5;
	border-radius: 50%;
	background: #fff;
	color: #fff;
	transition: background-color 0.2s var(--cp-ease), border-color 0.2s var(--cp-ease);
}

.cp-weight__check svg {
	width: 13px;
	height: 13px;
	opacity: 0;
	transform: scale(0.6);
	transition: opacity 0.2s var(--cp-ease), transform 0.2s var(--cp-ease);
}

.cp-weight input:checked + .cp-weight__body {
	border-color: var(--cp-tile-accent);
	background: #fff;
	background: color-mix(in srgb, var(--cp-tile-accent) 6%, #fff);
	box-shadow: 0 12px 28px rgba(18, 60, 58, 0.14);
	box-shadow: 0 12px 28px color-mix(in srgb, var(--cp-tile-accent) 22%, transparent);
	transform: translateY(-3px);
}

.cp-offer .cp-weight input:checked + .cp-weight__body .cp-weight__dog {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--cp-tile-accent);
}

.cp-weight input:checked + .cp-weight__body .cp-weight__check {
	border-color: var(--cp-tile-accent);
	background: var(--cp-tile-accent);
}

.cp-weight input:checked + .cp-weight__body .cp-weight__check svg {
	opacity: 1;
	transform: scale(1);
}

.cp-weight input:focus-visible + .cp-weight__body,
.cp-pack input:focus-visible + .cp-pack__body {
	outline: 3px solid var(--cp-tile-accent, var(--cp-ink));
	outline-offset: 3px;
}

/* Kliknięcie przycisku zakupu bez wybranej wagi: podświetlamy krok 1. */
.cp-offer.is-nudge .cp-weight__body {
	border-color: var(--cp-tile-accent);
	animation: cp-nudge 0.5s var(--cp-ease);
}

@keyframes cp-nudge {
	0%,
	100% {
		transform: translateX(0);
	}

	20%,
	60% {
		transform: translateX(-6px);
	}

	40%,
	80% {
		transform: translateX(6px);
	}
}

/* ---------------------------------------------------------------------------
 * Krok 2: zestaw
 * ------------------------------------------------------------------------- */

.cp-offer__hint {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 0 0 14px;
	padding: 16px 14px;
	border: 2px dashed var(--cp-line);
	border-radius: 16px;
	color: var(--cp-muted);
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
}

.cp-offer[data-weight]:not([data-weight='']) .cp-offer__hint {
	display: none;
}

/* Rozwijanie bez mierzenia wysokości w skrypcie. */
.cp-offer__reveal {
	display: grid;
	grid-template-rows: 0fr;
	opacity: 0;
	transition: grid-template-rows 0.3s var(--cp-ease), opacity 0.25s var(--cp-ease);
}

.cp-offer__reveal[data-open='true'] {
	grid-template-rows: 1fr;
	opacity: 1;
}

.cp-offer__reveal-inner {
	min-height: 0;
	overflow: hidden;
	padding: 16px 4px 0;
	margin: -16px -4px 0;
}

.cp-pack-set {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	padding-top: 14px;
}

.cp-pack {
	display: block;
	position: relative;
	margin: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* Karta zestawu: obrazek butelek po lewej, napisy po prawej (na telefonie obrazek jest nad napisami). */
.cp-pack__body {
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
	height: 100%;
	padding: 12px 10px 12px 4px;
	border: 2px solid var(--cp-line);
	border-radius: 16px;
	background: #fff;
	transition: border-color 0.2s var(--cp-ease), background-color 0.2s var(--cp-ease), box-shadow 0.2s var(--cp-ease), transform 0.2s var(--cp-ease);
}

.cp-pack:hover .cp-pack__body {
	border-color: var(--cp-tile-accent);
}

.cp-pack input:checked + .cp-pack__body {
	border-color: var(--cp-tile-accent);
	background: var(--cp-cream);
	box-shadow: 0 10px 24px rgba(18, 60, 58, 0.14);
	box-shadow: 0 10px 24px color-mix(in srgb, var(--cp-tile-accent) 22%, transparent);
	transform: translateY(-2px);
}

.cp-pack input:disabled + .cp-pack__body {
	opacity: 0.55;
	cursor: not-allowed;
}

.cp-pack__badge {
	position: absolute;
	top: -11px;
	left: 50%;
	z-index: 2;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--cp-tile-accent);
	color: #fff;
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
	transform: translateX(-50%);
}

.cp-pack__img {
	display: flex;
	flex: 0 0 38%;
	align-items: flex-end;
	justify-content: center;
	height: 158px;
}

.cp-offer .cp-pack__img img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	object-position: center bottom;
}

.cp-pack__info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: flex-start;
	gap: 7px;
	min-width: 0;
	text-align: left;
}

.cp-pack__head {
	display: flex;
	align-items: center;
	gap: 7px;
}

.cp-pack__radio {
	position: relative;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	border: 2px solid #d7ddd5;
	border-radius: 50%;
	background: #fff;
	transition: border-color 0.2s var(--cp-ease);
}

.cp-pack__radio::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--cp-tile-accent);
	transform: translate(-50%, -50%) scale(0);
	transition: transform 0.2s var(--cp-ease);
}

.cp-pack input:checked + .cp-pack__body .cp-pack__radio {
	border-color: var(--cp-tile-accent);
}

.cp-pack input:checked + .cp-pack__body .cp-pack__radio::after {
	transform: translate(-50%, -50%) scale(1);
}

.cp-pack__title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.1;
	text-transform: uppercase;
	color: var(--cp-ink);
}

.cp-pack__prices {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 7px;
	row-gap: 1px;
}

.cp-pack__was {
	color: var(--cp-was);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

.cp-pack__now {
	font-size: 28px;
	font-weight: 600;
	line-height: 1.05;
	color: var(--cp-ink);
	white-space: nowrap;
}

.cp-pack__per {
	flex-basis: 100%;
	font-size: 11px;
	color: var(--cp-muted);
}

.cp-pack__soldout {
	font-size: 13px;
	color: var(--cp-muted);
}

.cp-pack__save {
	align-self: flex-start;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--cp-save-bg);
	color: var(--cp-save-ink);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.1;
	text-align: center;
	white-space: nowrap;
}

/* Darmowa dostawa: zielony tekst z ikoną, bez ramki. W karcie bez niej zostaje pusty wiersz (równe wysokości). */
.cp-pack__ship {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: var(--cp-save-ink);
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.1;
	white-space: nowrap;
}

.cp-pack__ship svg {
	display: block;
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	fill: currentColor;
}

.cp-pack__ship--empty {
	visibility: hidden;
}

/* Telefon: obrazek nad napisami, całość wyśrodkowana. */
@media (max-width: 519px) {
	.cp-pack__body {
		flex-direction: column;
		gap: 3px;
		padding: 21px 5px 8px;
		border-radius: 14px;
	}

	.cp-pack__img {
		flex: none;
		width: 100%;
		height: clamp(104px, 31vw, 126px);
	}

	.cp-pack__info {
		align-items: center;
		gap: 4px;
		width: 100%;
		text-align: center;
	}

	.cp-pack__title {
		font-size: 13px;
	}

	.cp-pack__prices {
		justify-content: center;
	}

	.cp-pack__was {
		font-size: 15px;
	}

	.cp-pack__now {
		font-size: 24px;
	}

	.cp-pack__per {
		display: none;
	}

	.cp-pack__save {
		align-self: center;
		padding: 4px 8px;
		font-size: 10px;
	}

	.cp-pack__badge {
		padding: 4px 7px;
		font-size: 8.5px;
	}

	.cp-pack__ship {
		gap: 4px;
		font-size: 10px;
	}

	.cp-pack__ship svg {
		width: 12px;
		height: 12px;
	}
}

/* ---------------------------------------------------------------------------
 * Przycisk zakupu
 * ------------------------------------------------------------------------- */

.cp-offer__action {
	margin-top: 16px;
	padding: 0 4px;
	text-align: center;
}

.cp-offer__summary {
	min-height: 1.4em;
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--cp-muted);
}

.cp-offer__summary:empty {
	min-height: 0;
	margin: 0;
}

.cp-offer__summary strong {
	font-weight: 600;
	color: var(--cp-ink);
}

.cp-offer .cp-offer__cta {
	display: block;
	width: 100%;
	padding: 20px 28px;
	border: 2px solid var(--cp-accent);
	border-radius: 999px;
	background: var(--cp-accent);
	color: #fff;
	font-family: inherit;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: 0 10px 25px rgba(18, 60, 58, 0.22);
	box-shadow: 0 10px 25px color-mix(in srgb, var(--cp-accent) 32%, transparent);
	transition: background-color 0.25s var(--cp-ease), color 0.25s var(--cp-ease), border-color 0.25s var(--cp-ease), box-shadow 0.25s var(--cp-ease), transform 0.2s var(--cp-ease), filter 0.2s var(--cp-ease);
}

.cp-offer .cp-offer__cta:hover {
	background: var(--cp-accent);
	transform: translateY(-1px);
	filter: brightness(1.12);
}

.cp-offer .cp-offer__cta:active {
	transform: translateY(0);
}

.cp-offer .cp-offer__cta:focus-visible {
	outline: 3px solid var(--cp-accent);
	outline-offset: 3px;
}

/* Przed wyborem wagi przycisk jest obrysem: nie wygląda na wyłączony, ale prowadzi do kroku 1. */
.cp-offer .cp-offer__cta[data-state='idle'] {
	background: #fff;
	color: var(--cp-ink);
	border-color: var(--cp-ink);
	box-shadow: none;
}

.cp-offer .cp-offer__cta[data-state='idle']:hover {
	background: var(--cp-cream);
	filter: none;
}

.cp-offer .cp-offer__cta[data-state='busy'] {
	cursor: progress;
	opacity: 0.8;
}

.cp-offer .calmpet-trust-row {
	margin-top: 14px;
}

.cp-offer__noscript {
	margin: 10px 4px 0;
	font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * Telefon
 * ------------------------------------------------------------------------- */

@media (max-width: 768px) {
	.cp-offer {
		margin: 6px auto;
	}

	.cp-offer__title {
		font-size: 17px;
	}

	.cp-offer__sub {
		font-size: 12px;
	}

	.cp-weight-grid,
	.cp-pack-set {
		gap: 10px;
	}

	.cp-weight__body {
		gap: 5px;
		padding: 14px 8px 12px;
		border-radius: 14px;
	}

	.cp-offer .cp-weight__dog {
		width: 68px;
		height: 68px;
	}

	.cp-weight__range {
		font-size: 16px;
	}

	.cp-weight__name {
		padding: 5px 9px;
		font-size: 10px;
	}

	.cp-weight__fact {
		font-size: 11px;
	}

	.cp-weight__check {
		top: 8px;
		right: 8px;
		width: 22px;
		height: 22px;
	}

	.cp-offer .cp-offer__cta {
		padding: 18px 14px;
		font-size: 15px;
	}

	.cp-offer__hint {
		padding: 14px 12px;
		font-size: 13px;
	}
}

@media (max-width: 480px) {
	.cp-weight__fact {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.cp-weight__volume::before {
		content: none;
	}
}

@media (max-width: 360px) {
	.cp-weight__range {
		font-size: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cp-offer *,
	.cp-offer *::before,
	.cp-offer *::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}

	.cp-weight input:checked + .cp-weight__body,
	.cp-pack input:checked + .cp-pack__body {
		transform: none;
	}
}
