/* Uniphar Promo Hub - frontend styles
 * Aesthetic: luxury pharmaceutical editorial.
 * Palette: deep navy + gold + cream. Typography: Playfair Display (italic) + Outfit.
 */

.uph-hub {
	--uph-navy: #0a1a32;
	--uph-navy-elev: #11244a;
	--uph-navy-deeper: #163056;
	--uph-gold: #c9a961;
	--uph-gold-line: rgba(201, 169, 97, 0.18);
	--uph-gold-line-soft: rgba(201, 169, 97, 0.07);
	--uph-cream: #f5f1e8;
	--uph-cream-muted: #d9d3c4;
	--uph-text-secondary: #a8a190;
	--uph-text-muted: #6a624c;
	--uph-text-faint: #5a5346;

	/* Full-width breakout - granatowy zajmuje pełną szerokość viewportu
	 * niezależnie od constraint'u theme container'a. */
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	width: 100vw;
	overflow: hidden;

	background-color: var(--uph-navy);
	color: var(--uph-cream);
	font-family: 'Outfit Variable', 'Outfit', -apple-system, system-ui, sans-serif;
	letter-spacing: 0.005em;
	padding: 4.5rem 0 3.75rem;
	box-sizing: border-box;
}
.uph-hub *, .uph-hub *::before, .uph-hub *::after { box-sizing: border-box; }

/* Header (opcjonalny - show_header="true") */
.uph-hub__header {
	text-align: center;
	padding: 0 1.5rem 2.5rem;
}
.uph-hub__eyebrow {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--uph-gold);
	font-weight: 500;
	margin-bottom: 1rem;
}
.uph-hub__title {
	font-family: 'Playfair Display Variable', 'Playfair Display', Georgia, serif;
	font-size: 42px;
	font-style: italic;
	font-weight: 400;
	margin: 0;
	color: var(--uph-cream);
	line-height: 1.12;
	letter-spacing: -0.005em;
}
.uph-hub__subtitle {
	font-size: 14px;
	color: var(--uph-text-secondary);
	margin: 0.85rem auto 0;
	max-width: 480px;
	line-height: 1.6;
	letter-spacing: 0.02em;
	font-weight: 400;
}
.uph-hub__divider {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 1.5rem;
}
.uph-hub__divider span {
	display: block;
	width: 28px;
	height: 1px;
	background: var(--uph-gold);
}
.uph-hub__divider i {
	display: block;
	width: 4px;
	height: 4px;
	background: var(--uph-gold);
	transform: rotate(45deg);
}

/* Większy odstęp header → grid na desktopie (od 1024px). */
@media (min-width: 1024px) {
	.uph-hub__header {
		padding-bottom: 5rem;
	}
	.uph-hub {
		padding-bottom: 6.25rem;
	}
}

/* Grid */
.uph-grid {
	display: grid;
	gap: 1.75rem 1rem;
	grid-template-columns: 1fr;
	padding: 0 1.5rem;
	max-width: 1320px;
	margin: 0 auto;
}
@media (min-width: 768px) {
	.uph-grid {
		grid-template-columns: repeat(var(--uph-cols-tablet, 2), 1fr);
		gap: 2rem 1.1rem;
	}
}
@media (min-width: 1024px) {
	.uph-grid {
		grid-template-columns: repeat(var(--uph-cols-desktop, 3), 1fr);
		gap: 2.25rem 1.25rem;
	}
}

/* Card */
.uph-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--uph-navy-elev);
	border: 0.5px solid var(--uph-gold-line);
	border-radius: 4px;
	transition: border-color 0.2s ease;
	/* Note: brak overflow:hidden - badge może wystawać powyżej karty.
	 * Rounded corners zachowane przez radius na samej karcie + radius na visual top. */
}
.uph-card:hover { border-color: rgba(201, 169, 97, 0.45); }

/* Badge - pill floating above card, centered horizontally, slight overlap with top edge */
.uph-card__badge {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--uph-gold);
	color: var(--uph-navy);
	padding: 5px 14px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.06em;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
	white-space: nowrap;
	z-index: 2;
}

/* Visual */
.uph-card__visual {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 200px;
	background: var(--uph-navy-deeper);
	border-bottom: 0.5px solid rgba(201, 169, 97, 0.1);
	border-top-left-radius: 4px;
	border-top-right-radius: 4px;
	overflow: hidden;
	text-decoration: none;
}
.uph-card__visual img {
	max-width: 65%;
	max-height: 80%;
	object-fit: contain;
	mix-blend-mode: luminosity;
	opacity: 0.88;
	transition: opacity 0.2s ease;
}
.uph-card:hover .uph-card__visual img { opacity: 1; }

/* Custom media variant - operator wgrał własne zdjęcie lub video zamiast WC product image.
 * Wypełnia kontener całkowicie (object-fit: cover), bez mix-blend nadającego navy ton. */
.uph-card__visual.uph-card__visual--custom img,
.uph-card__visual.uph-card__visual--custom video {
	max-width: none;
	max-height: none;
	width: 100%;
	height: 100%;
	object-fit: cover;
	mix-blend-mode: normal;
	opacity: 1;
}
.uph-card:hover .uph-card__visual--custom img,
.uph-card:hover .uph-card__visual--custom video { opacity: 1; }

/* Sound toggle button - widoczny tylko przy video.
 * Default state: muted (icon-off widoczny, icon-on ukryty).
 * Po kliknięciu: JS dodaje .is-unmuted - icons swap. */
.uph-card__sound-toggle {
	position: absolute;
	bottom: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(10, 26, 50, 0.65);
	border: 1px solid rgba(201, 169, 97, 0.5);
	color: var(--uph-gold);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 3;
	opacity: 0.7;
	transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}
.uph-card__visual:hover .uph-card__sound-toggle { opacity: 1; }
.uph-card__sound-toggle:hover {
	background: rgba(10, 26, 50, 0.92);
	border-color: var(--uph-gold);
	transform: scale(1.06);
}
.uph-card__sound-toggle:focus-visible {
	outline: 2px solid var(--uph-gold);
	outline-offset: 2px;
	opacity: 1;
}
.uph-card__sound-toggle .uph-icon { display: block; }
.uph-card__sound-toggle .uph-icon--on { display: none; }
.uph-card__sound-toggle.is-unmuted .uph-icon--off { display: none; }
.uph-card__sound-toggle.is-unmuted .uph-icon--on { display: block; }

/* Content */
.uph-card__ctx {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 1.4rem 1.4rem 1.2rem;
}
.uph-card__eyebrow {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--uph-gold);
	font-weight: 500;
	margin-bottom: 0.75rem;
}
.uph-card__hook {
	font-family: 'Playfair Display Variable', 'Playfair Display', Georgia, serif;
	font-size: 22px;
	font-style: italic;
	font-weight: 400;
	margin: 0 0 0.85rem;
	color: var(--uph-cream);
	line-height: 1.25;
}
.uph-card__name {
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-weight: 500;
	color: var(--uph-cream-muted);
	margin-bottom: 1rem;
}

/* Price row - margin-top:auto kotwiczy do dołu content area */
.uph-card__price-row {
	margin-top: auto;
	border-top: 0.5px solid rgba(201, 169, 97, 0.13);
	padding-top: 1rem;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 12px;
}

.uph-card__cta {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--uph-gold);
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	align-self: flex-end;
}
.uph-card__cta:hover { color: var(--uph-cream); }

/* Price - regular (struck) + sale (gold).
 * Wspólny rendering dla wszystkich promocji - struktura zależy od has_price_reduction. */
.uph-price__regular {
	font-size: 11px;
	color: var(--uph-text-muted);
	text-decoration: line-through;
	margin-bottom: 2px;
}
.uph-price__regular .woocommerce-Price-amount,
.uph-price__regular bdi { color: inherit; }

.uph-price__sale {
	font-family: 'Playfair Display Variable', 'Playfair Display', Georgia, serif;
	font-size: 20px;
	font-weight: 500;
	color: var(--uph-gold);
	line-height: 1.1;
}
.uph-price__sale .woocommerce-Price-amount,
.uph-price__sale bdi { color: inherit; }

/* Omnibus footer - zawsze 40px wysokości dla wyrównania siatki */
.uph-card__omnibus {
	height: 40px;
	padding: 0 1.4rem;
	font-size: 9px;
	letter-spacing: 0.02em;
	line-height: 1.3;
	display: flex;
	align-items: center;
}
.uph-card__omnibus.is-active {
	color: var(--uph-text-faint);
	border-top: 0.5px solid var(--uph-gold-line-soft);
}
.uph-card__omnibus .woocommerce-Price-amount,
.uph-card__omnibus bdi {
	color: inherit;
	margin-left: 4px;
}

/* Mobile adjustments */
@media (max-width: 767px) {
	.uph-hub { padding: 2.75rem 0 2rem; }
	.uph-hub__title { font-size: 32px; }
	.uph-card__hook { font-size: 20px; }
	.uph-card__visual { height: 220px; }
}

/* ===========================================================
 * Product page CTA - desktop full-width section + mobile sticky bar.
 * =========================================================== */

.uph-product-cta {
	background: #0a1a32;
	color: #f5f1e8;
	font-family: 'Outfit Variable', 'Outfit', -apple-system, system-ui, sans-serif;
	letter-spacing: 0.005em;

	/* Desktop: full-width breakout, inline at bottom of product page */
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	width: 100vw;
	overflow: hidden;
	box-sizing: border-box;
	padding: 2.5rem 1.5rem;
	margin-top: 3rem;
}

.uph-product-cta__inner {
	max-width: 1320px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
}

.uph-product-cta__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.uph-product-cta__eyebrow {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #c9a961;
	font-weight: 500;
}

.uph-product-cta__hook {
	font-family: 'Playfair Display Variable', 'Playfair Display', Georgia, serif;
	font-size: 22px;
	font-style: italic;
	font-weight: 400;
	color: #f5f1e8;
	line-height: 1.25;
}

.uph-product-cta__btn {
	background: #c9a961;
	color: #0a1a32;
	padding: 14px 26px;
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	border: 0.5px solid #c9a961;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.uph-product-cta__btn:hover,
.uph-product-cta__btn:focus {
	background: transparent;
	color: #c9a961;
}

/* Mobile: sticky bar at bottom with iOS safe-area handling */
@media (max-width: 767px) {
	.uph-product-cta {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		margin: 0;
		width: 100%;
		max-width: 100vw;
		z-index: 9999;
		padding: 12px 14px;
		/* Padding-bottom respektuje iPhone home indicator (safe-area-inset-bottom).
		 * Przy iPhonach z home button = 0, przy iPhonach z indicator'em ~34px. */
		padding-bottom: calc(12px + env(safe-area-inset-bottom));
		border-top: 0.5px solid rgba(201, 169, 97, 0.3);
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.18);
	}

	.uph-product-cta__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
	}

	.uph-product-cta__text {
		flex: 1;
		min-width: 0;
		gap: 2px;
	}

	.uph-product-cta__eyebrow {
		font-size: 9px;
		letter-spacing: 0.14em;
	}

	.uph-product-cta__hook {
		font-size: 13px;
		line-height: 1.3;
		/* Truncate hook na mobile, żeby nie pchało button'a poza ekran */
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.uph-product-cta__btn {
		padding: 10px 16px;
		font-size: 11px;
		letter-spacing: 0.08em;
	}

	/* Body padding-bottom, żeby content produktu nie był chowany pod sticky barem.
	 * Aktywne tylko przy is-active, dodawane przez body_class filter. */
	body.uph-has-product-cta {
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}
}
