/* "Build Your Pack" (/pack/, page-pack.php) — own layout, not a copy of any
   reference mockup, built on the site's existing palette (navy #132040 /
   gold #c9a24b / off-white #faf8f4, same tokens as cart-drawer.css). */

.pp-pack {
	background: #faf8f4;
	padding: 40px 0 80px;
}

.pp-pack__container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 24px;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */

.pp-pack__hero {
	text-align: center;
	max-width: 640px;
	margin: 0 auto 36px;
}

.pp-pack__title {
	font-size: 34px;
	font-weight: 800;
	color: #132040;
	margin: 0 0 12px;
}

.pp-pack__subtitle {
	font-size: 15.5px;
	line-height: 1.7;
	color: #6b6b64;
	margin: 0 0 20px;
}

/* ── Shop ⇄ Build Your Pack toggle ────────────────────────────────────── */
/* Shared with woocommerce/archive-product.php via pp_render_shop_pack_toggle()
   (functions.php) — same markup/classes there, shop.css supplies the
   on-dark colors that page's hero needs; this is the light-bg default. */

.pp-view-toggle {
	display: inline-flex;
	gap: 2px;
	padding: 4px;
	border-radius: 999px;
	background: #f1efe8;
}

.pp-view-toggle__option {
	padding: 10px 22px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	color: #6b6b64;
	transition: background 0.15s ease, color 0.15s ease;
}

.pp-view-toggle__option.is-active {
	background: #fff;
	color: #132040;
	box-shadow: 0 1px 3px rgba(28, 28, 26, 0.08);
}

.pp-pack__section-title {
	font-size: 19px;
	font-weight: 700;
	color: #132040;
	margin: 0;
}

/* ── Tier bar ─────────────────────────────────────────────────────────── */

.pp-pack__tiers {
	background: #fff;
	border: 1px solid #e4e1d8;
	border-radius: 16px;
	padding: 24px;
	margin: 0 0 32px;
}

.pp-pack__tier-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 0 0 18px;
}

.pp-tier-card {
	border: 1px solid #e4e1d8;
	border-radius: 12px;
	padding: 14px 10px;
	text-align: center;
	background: #faf8f4;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.pp-tier-card__qty {
	font-size: 20px;
	font-weight: 800;
	color: #132040;
	display: block;
}

.pp-tier-card__label {
	font-size: 12.5px;
	color: #6b6b64;
	display: block;
	margin-top: 2px;
}

.pp-tier-card.is-active {
	background: #132040;
	border-color: #132040;
}

.pp-tier-card.is-active .pp-tier-card__qty,
.pp-tier-card.is-active .pp-tier-card__label {
	color: #fff;
}

.pp-tier-card.is-reached:not(.is-active) {
	border-color: #c9a24b;
}

.pp-pack__progress-track {
	height: 6px;
	border-radius: 999px;
	background: #e4e1d8;
	overflow: hidden;
}

.pp-pack__progress-fill {
	height: 100%;
	width: 0%;
	background: #c9a24b;
	border-radius: 999px;
	transition: width 0.25s ease;
}

.pp-pack__progress-text {
	font-size: 13.5px;
	color: #55554f;
	margin: 10px 0 0;
}

.pp-pack__progress-text strong {
	color: #132040;
}

.pp-pack__progress-text .pp-pack__progress-gold {
	color: #c9a24b;
	font-weight: 700;
}

/* ── Body layout ──────────────────────────────────────────────────────── */

.pp-pack__body {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 28px;
	align-items: start;
}

@media (max-width: 900px) {
	.pp-pack__body {
		grid-template-columns: 1fr;
	}

	.pp-pack__sidebar {
		order: 2;
	}
}

/* ── Choose products ──────────────────────────────────────────────────── */

.pp-pack__choose-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin: 0 0 18px;
}

.pp-pack__search {
	position: relative;
	flex: 1;
	min-width: 220px;
	max-width: 340px;
}

.pp-pack__search-icon {
	position: absolute;
	inset-inline-start: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: #6b6b64;
	pointer-events: none;
}

.pp-pack__search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 11px 14px 11px 14px;
	padding-inline-start: 38px;
	border: 1px solid #e4e1d8;
	border-radius: 999px;
	font-size: 14px;
	background: #fff;
	color: #1c1c1a;
}

.pp-pack__search-input:focus {
	outline: none;
	border-color: #132040;
}

.pp-pack__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
}

@media (max-width: 900px) {
	.pp-pack__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

.pp-pack__empty {
	text-align: center;
	color: #6b6b64;
	font-size: 14px;
	padding: 40px 0;
}

.pp-card {
	position: relative;
	background: #fff;
	border: 1px solid #e4e1d8;
	border-radius: 14px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.pp-card.is-in-pack {
	border-color: #c9a24b;
}

.pp-card__qty-badge {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	z-index: 1;
	min-width: 26px;
	height: 26px;
	padding: 0 7px;
	border-radius: 999px;
	background: #c9a24b;
	color: #132040;
	font-size: 12.5px;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pp-card__image {
	aspect-ratio: 1 / 1;
	background: #f7f6f2;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.pp-card__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.pp-card__body {
	padding: 12px 14px 14px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.pp-card__name {
	font-size: 13.5px;
	font-weight: 700;
	color: #1c1c1a;
	line-height: 1.35;
	min-height: 2.7em;
}

.pp-card__price {
	font-size: 13px;
	color: #132040;
	font-weight: 600;
}

.pp-card__price del {
	color: #6b6b64;
	font-weight: 400;
	margin-inline-end: 6px;
}

.pp-card__price ins {
	text-decoration: none;
}

.pp-card__action {
	margin-top: auto;
}

.pp-card__add {
	width: 100%;
	background: #132040;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 9px 10px;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.pp-card__add:hover {
	opacity: 0.88;
}

.pp-card__stepper {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: #f1efe8;
	border-radius: 999px;
	padding: 4px;
}

.pp-card__stepper button {
	width: 28px;
	height: 28px;
	border-radius: 999px;
	border: none;
	background: #132040;
	color: #fff;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.pp-card__stepper span {
	font-size: 14px;
	font-weight: 700;
	color: #132040;
}

/* ── Sidebar / "your pack" ────────────────────────────────────────────── */

/* Sticky lives on the grid item itself, same as .sp-sidebar on the shop
   page — align-items:start on .pp-pack__body shrinks this item's own box
   to its content height, so sticky on a child inside it (as this used to
   be) has no room to move: its containing block is already exactly its
   own height. A grid item with sticky uses the full row height instead,
   regardless of align-items, which is what actually gives it room to
   stick while the taller product grid scrolls past. */
.pp-pack__sidebar {
	position: sticky;
	top: 24px;
}

.pp-pack__sidebar-inner {
	background: #fff;
	border: 1px solid #e4e1d8;
	border-radius: 16px;
	padding: 20px;
}

.pp-pack__sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	margin: 0 0 14px;
	padding: 0;
	background: none;
	border: none;
	font: inherit;
	color: inherit;
	text-align: inherit;
	cursor: default;
}

.pp-pack__sidebar-count {
	font-size: 13px;
	font-weight: 400;
	color: #6b6b64;
	margin-inline-start: 6px;
}

.pp-pack__sidebar-chevron {
	display: none;
	flex: none;
	width: 18px;
	height: 18px;
	color: #6b6b64;
	transition: transform 0.2s ease;
}

/* ── Mobile: the sidebar becomes a fixed bottom sheet ─────────────────── */

@media (max-width: 900px) {
	.pp-pack__body {
		padding-bottom: 68px;
	}

	.pp-pack__sidebar {
		position: fixed;
		inset-inline: 0;
		top: auto;
		bottom: 0;
		z-index: 60;
		display: none;
	}

	/* Toggled by pack-builder.js the moment the pack stops being empty —
	   before that there's nothing worth surfacing, so no floating bar. */
	.pp-pack__sidebar.is-visible {
		display: block;
	}

	.pp-pack__sidebar-inner {
		position: static;
		border-radius: 16px 16px 0 0;
		border-bottom: none;
		box-shadow: 0 -8px 24px rgba(28, 28, 26, 0.1);
		padding: 14px 18px;
		max-height: 72vh;
		display: flex;
		flex-direction: column;
	}

	.pp-pack__sidebar-header {
		cursor: pointer;
		flex: none;
	}

	.pp-pack__sidebar-chevron {
		display: block;
	}

	.pp-pack__sidebar.is-open .pp-pack__sidebar-chevron {
		transform: rotate(180deg);
	}

	.pp-pack__sidebar-content {
		overflow: hidden;
		max-height: 0;
		opacity: 0;
		transition: max-height 0.25s ease, opacity 0.2s ease;
	}

	.pp-pack__sidebar.is-open .pp-pack__sidebar-content {
		max-height: 62vh;
		opacity: 1;
		overflow-y: auto;
	}
}

.pp-pack__sidebar-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 320px;
	overflow-y: auto;
}

.pp-pack__sidebar-empty {
	font-size: 13.5px;
	color: #6b6b64;
	text-align: center;
	padding: 24px 0;
	margin: 0;
}

.pp-sidebar-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	background: #faf8f4;
	border: 1px solid #e4e1d8;
	border-radius: 10px;
}

.pp-sidebar-item__image {
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.pp-sidebar-item__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.pp-sidebar-item__body {
	flex: 1;
	min-width: 0;
}

.pp-sidebar-item__name {
	font-size: 12.5px;
	font-weight: 700;
	color: #1c1c1a;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pp-sidebar-item__qty {
	font-size: 11.5px;
	color: #6b6b64;
}

.pp-sidebar-item__remove {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 999px;
	border: none;
	background: #e4e1d8;
	color: #55554f;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
}

.pp-pack__sidebar-summary {
	border-top: 1px solid #e4e1d8;
	margin-top: 14px;
	padding-top: 14px;
}

.pp-pack__summary-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 13.5px;
	color: #55554f;
	margin-bottom: 8px;
}

.pp-pack__summary-row--discount {
	color: #132040;
	font-weight: 700;
}

.pp-pack__summary-row--total {
	font-size: 16px;
	font-weight: 800;
	color: #132040;
	margin-bottom: 0;
}

.pp-pack__cta {
	width: 100%;
	margin-top: 16px;
	background: #132040;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 14px 16px;
	font-size: 14.5px;
	font-weight: 700;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.pp-pack__cta:disabled {
	background: #d8d4c8;
	color: #8a8a82;
	cursor: not-allowed;
}

.pp-pack__cta:not(:disabled):hover {
	opacity: 0.9;
}

.pp-pack__sidebar-error {
	color: #b3261e;
	font-size: 12.5px;
	text-align: center;
	margin: 10px 0 0;
}

/* Placed after the base .pp-pack__sidebar-list/.pp-sidebar-item rules
   above (not inside the earlier mobile block near the header/chevron
   rules) so this actually wins the cascade at matching widths — an
   equal-specificity override only applies if it comes later in the file
   than what it's overriding. A horizontal strip of compact square cards
   reads better in the limited height a bottom sheet can spare than the
   desktop sidebar's vertical list — same data, same buildSidebarItem()
   markup, just rearranged by CSS (row instead of column, image-on-top
   instead of image-beside-text, the remove button repositioned onto the
   image's corner via position:absolute rather than removed/rebuilt in
   JS). */
@media (max-width: 900px) {
	.pp-pack__sidebar-list {
		flex-direction: row;
		overflow-x: auto;
		overflow-y: visible;
		max-height: none;
		padding-bottom: 2px;
	}

	.pp-sidebar-item {
		position: relative;
		flex: 0 0 84px;
		flex-direction: column;
		align-items: stretch;
		gap: 4px;
		border-color: #c9a24b;
	}

	.pp-sidebar-item__image {
		width: 100%;
		height: 74px;
	}

	.pp-sidebar-item__qty {
		display: none;
	}

	.pp-sidebar-item__name {
		white-space: normal;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.pp-sidebar-item__remove {
		position: absolute;
		top: 4px;
		inset-inline-end: 4px;
		width: 18px;
		height: 18px;
		font-size: 11px;
		background: #132040;
		color: #fff;
	}
}
