/* Hound's Tales Pack Builder – front end */
.htpb {
	--htpb-accent: #1B494E;
	--htpb-btn: #23656C;
	--htpb-line: #d9dfe0;
	--htpb-muted: #5f7578;
	--htpb-tint: #f3f6f6;
	--htpb-font-heading: inherit;
	--htpb-font-body: inherit;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	gap: 48px;
	align-items: start;
	margin: 24px 0;
	color: var(--htpb-accent);
	font-family: var(--htpb-font-body);
}
.htpb *, .htpb *::before, .htpb *::after { box-sizing: border-box; }
.htpb button, .htpb select { font-family: var(--htpb-font-body); }

/* ---------- left ---------- */
.htpb-kicker {
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--htpb-muted);
	margin-bottom: 8px;
}
.htpb-heading {
	margin: 0 0 28px;
	font-family: var(--htpb-font-heading);
	font-weight: 400;
	font-size: 38px;
	line-height: 1.1;
	color: var(--htpb-accent);
}
.htpb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 22px;
}
.htpb-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 0 0 14px;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	background: #fff;
	transition: border-color .15s, box-shadow .15s;
}
.htpb-card:hover { border-color: var(--htpb-accent); }
.htpb-card.is-selected { border-color: var(--htpb-accent); box-shadow: inset 0 0 0 1px var(--htpb-accent); }
.htpb-card.is-out { opacity: .55; }
.htpb-card-img {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--htpb-tint);
}
.htpb-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.htpb-card > :not(.htpb-card-img) { margin-left: 14px; margin-right: 14px; }
.htpb-card-name {
	margin-top: 6px;
	font-family: var(--htpb-font-body);
	font-size: 15px;
	line-height: 1.35;
	color: var(--htpb-accent);
}
.htpb-card-price {
	font-family: var(--htpb-font-body);
	font-size: 14px;
	color: var(--htpb-muted);
}
.htpb-var {
	width: calc(100% - 28px);
	padding: 9px 10px;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	font-size: 14px;
	color: var(--htpb-accent);
	background: #fff;
}
.htpb-var.htpb-error { border-color: #b3261e; box-shadow: 0 0 0 2px rgba(179, 38, 30, .18); }
.htpb-pick {
	margin-top: auto;
	padding: 11px 12px;
	border: 1px solid var(--htpb-btn);
	border-radius: 0;
	background: transparent;
	color: var(--htpb-btn);
	font-size: 13px;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.htpb-pick:hover:not(:disabled), .htpb-card.is-selected .htpb-pick { background: var(--htpb-btn); color: #fff; }
.htpb-pick:disabled { cursor: not-allowed; border-color: var(--htpb-line); color: var(--htpb-muted); }

.htpb-nav { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.htpb-btn {
	padding: 16px 30px;
	border: 1px solid var(--htpb-btn);
	border-radius: 0;
	font-size: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: opacity .15s, background .15s;
}
.htpb-btn-primary { background: var(--htpb-btn); color: #fff; }
.htpb-btn-primary:hover:not(:disabled) { opacity: .9; }
.htpb-btn-ghost { background: transparent; color: var(--htpb-btn); }
.htpb-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- right ---------- */
.htpb-right {
	position: sticky;
	top: 24px;
	padding: 26px;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	background: var(--htpb-tint);
}
.htpb-right-title {
	margin: 0 0 18px;
	font-family: var(--htpb-font-heading);
	font-weight: 400;
	font-size: 26px;
	text-align: center;
	color: var(--htpb-accent);
}
.htpb-board {
	display: grid;
	grid-template-columns: repeat(var(--cols, 2), 1fr);
	gap: 16px;
	aspect-ratio: 1 / 1;
	padding: 20px;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	background: #fff;
	align-content: center;
}
.htpb-slot {
	box-shadow: none;
	outline-offset: 2px;
	border-radius: 0;
	min-width: 0;
	min-height: 0;
	text-transform: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	min-width: 0;
	color: var(--htpb-accent);
}
.htpb-circle {
	width: 100%;
	max-width: 110px;
	aspect-ratio: 1 / 1;
	border-radius: 50%;
	border: 1.5px dashed #aab9bb;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #aab9bb;
	font-family: var(--htpb-font-heading);
	font-size: 22px;
	overflow: hidden;
	background: #fff;
	transition: border-color .15s;
}
.htpb-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.htpb-slot.is-current .htpb-circle { border: 2px solid var(--htpb-accent); color: var(--htpb-accent); }
.htpb-slot.is-filled .htpb-circle { border: 2px solid var(--htpb-accent); }
.htpb-slot-label {
	font-family: var(--htpb-font-body);
	font-size: 12px;
	line-height: 1.25;
	text-align: center;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.htpb-slot-var { font-size: 11px; color: var(--htpb-muted); }

.htpb-price { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 20px 0 14px; }
.htpb-price-row { display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.htpb-save {
	display: inline-block;
	padding: 3px 10px;
	background: var(--htpb-accent);
	color: #fff;
	font-family: var(--htpb-font-body);
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.htpb-price-label { color: var(--htpb-muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.htpb-price-old { color: var(--htpb-muted); }
.htpb-price-now { font-family: var(--htpb-font-body); font-weight: 400; font-size: 26px; color: var(--htpb-accent); }
.htpb-add { width: 100%; }
.htpb-hint { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--htpb-muted); }
.htpb-msg { margin-top: 12px; padding: 10px 14px; border-radius: 0; font-size: 14px; text-align: center; }
.htpb-msg-ok { background: #e3eeee; color: var(--htpb-accent); }
.htpb-msg-ok a { font-weight: 700; color: inherit; }
.htpb-msg-error { background: #fbe9e7; color: #8a2a1f; }
.htpb-admin-notice { padding: 10px 14px; background: #fff8e1; border-left: 4px solid #f0b429; }

/* ---------- mobile: pack panel sticks to the bottom of the screen ---------- */
@media (max-width: 860px) {
	.htpb {
		grid-template-columns: 1fr;
		gap: 24px;
		padding-bottom: 150px; /* room so the bar never covers the last products */
	}
	.htpb-heading { font-size: 28px; margin-bottom: 20px; }
	.htpb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.htpb-card > :not(.htpb-card-img) { margin-left: 10px; margin-right: 10px; }
	.htpb-var { width: calc(100% - 20px); }
	.htpb-nav { flex-direction: column; }
	.htpb-nav .htpb-btn { width: 100%; }

	.htpb-right {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		z-index: var(--htpb-dock-z, 999); /* below mobile menus and popups; raise it if a sticky header covers the bar */
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
		border: 0;
		border-top: 1px solid var(--htpb-line);
		background: #fff;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas: "board board" "price add" "hint hint" "msg msg";
		gap: 8px 12px;
		align-items: center;
	}
	.htpb.is-offscreen .htpb-right { display: none; }
	.htpb-right-title { display: none; }

	.htpb-board {
		grid-area: board;
		display: flex;
		justify-content: center;
		gap: 10px;
		aspect-ratio: auto;
		padding: 0;
		border: 0;
		background: transparent;
		overflow-x: auto;
	}
	.htpb-slot { flex: 0 0 auto; width: 52px; }
	.htpb-circle { width: 48px; max-width: none; font-size: 16px; }
	.htpb-slot-label, .htpb-slot-var { display: none; }

	.htpb-price { grid-area: price; margin: 0; align-items: flex-start; gap: 2px; }
	.htpb-save { font-size: 11px; padding: 2px 8px; }
	.htpb-price-label { display: none; }
	.htpb-price-now { font-size: 22px; }
	.htpb-add { grid-area: add; width: auto; padding: 14px 22px; }
	.htpb-hint { grid-area: hint; margin: 0; font-size: 12px; }
	.htpb-msg { grid-area: msg; margin: 0; padding: 8px 10px; font-size: 13px; }
}

/* ---------- clickable cards ---------- */
.htpb-card-img.is-clickable, .htpb-card-name.is-clickable { cursor: pointer; }
.htpb-card-img.is-clickable img { transition: transform .3s; }
.htpb-card-img.is-clickable:hover img { transform: scale(1.03); }
.htpb-card-name.is-clickable:hover { text-decoration: underline; }
.htpb-details {
	align-self: flex-start;
	padding: 0;
	border: 0;
	background: none;
	color: var(--htpb-muted);
	font-size: 12px;
	letter-spacing: .06em;
	text-decoration: underline;
	cursor: pointer;
}
.htpb-details:hover { color: var(--htpb-accent); }

/* ---------- product popup (lives in <body>, so it re-declares the variables) ---------- */
.htpb-modal {
	--htpb-accent: #1B494E;
	--htpb-btn: #23656C;
	--htpb-line: #d9dfe0;
	--htpb-muted: #5f7578;
	--htpb-tint: #f3f6f6;
	--htpb-font-heading: inherit;
	--htpb-font-body: inherit;
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(14, 38, 41, .6);
	color: var(--htpb-accent);
	font-family: var(--htpb-font-body);
	animation: htpb-fade .18s ease-out;
}
.htpb-modal *, .htpb-modal *::before, .htpb-modal *::after { box-sizing: border-box; }
.htpb-modal button, .htpb-modal select { font-family: var(--htpb-font-body); }
@keyframes htpb-fade { from { opacity: 0; } to { opacity: 1; } }
.htpb-modal-box {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	gap: 36px;
	width: 100%;
	max-width: 940px;
	max-height: calc(100vh - 40px);
	overflow: auto;
	padding: 36px;
	background: #fff;
	border-radius: 0;
}
.htpb-modal-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 40px;
	height: 40px;
	border: 0;
	background: none;
	color: var(--htpb-accent);
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
}
.htpb-modal-main { aspect-ratio: 1 / 1; background: var(--htpb-tint); overflow: hidden; }
.htpb-modal-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.htpb-modal-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.htpb-modal-thumb {
	width: 62px;
	height: 62px;
	padding: 0;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	background: var(--htpb-tint);
	cursor: pointer;
	opacity: .7;
}
.htpb-modal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.htpb-modal-thumb:hover { opacity: 1; }
.htpb-modal-thumb.is-active { border: 2px solid var(--htpb-accent); opacity: 1; }
.htpb-modal-info { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; min-width: 0; }
.htpb-modal-title {
	margin: 0;
	padding-right: 30px;
	font-family: var(--htpb-font-heading);
	font-weight: 400;
	font-size: 32px;
	line-height: 1.15;
	color: var(--htpb-accent);
}
.htpb-modal-price { font-family: var(--htpb-font-body); font-size: 20px; color: var(--htpb-accent); }
.htpb-modal-desc { font-family: var(--htpb-font-body); font-size: 15px; line-height: 1.6; color: #35575b; }
.htpb-modal-desc > :first-child { margin-top: 0; }
.htpb-modal-desc > :last-child { margin-bottom: 0; }
.htpb-modal-desc img { max-width: 100%; height: auto; }
.htpb-modal .htpb-var { width: 100%; }
.htpb-modal .htpb-btn { width: 100%; }
.htpb-modal-link { align-self: flex-start; font-size: 13px; color: var(--htpb-muted); text-decoration: underline; }
.htpb-modal-link:hover { color: var(--htpb-accent); }
/* the popup reuses these two classes, defined above only for .htpb */
.htpb-modal .htpb-btn {
	padding: 16px 30px;
	border: 1px solid var(--htpb-btn);
	border-radius: 0;
	font-size: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
}
.htpb-modal .htpb-btn-primary { background: var(--htpb-btn); color: #fff; }
.htpb-modal .htpb-btn:disabled { opacity: .4; cursor: not-allowed; }
.htpb-modal .htpb-var {
	padding: 11px 10px;
	border: 1px solid var(--htpb-line);
	border-radius: 0;
	font-size: 14px;
	color: var(--htpb-accent);
	background: #fff;
}
.htpb-modal .htpb-var.htpb-error { border-color: #b3261e; box-shadow: 0 0 0 2px rgba(179, 38, 30, .18); }

@media (max-width: 760px) {
	.htpb-modal { padding: 0; align-items: flex-end; }
	.htpb-modal-box {
		grid-template-columns: 1fr;
		gap: 18px;
		max-height: 92vh;
		padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
	}
	.htpb-modal-title { font-size: 26px; }
	.htpb-modal-main { aspect-ratio: 4 / 3; }
	.htpb-modal-thumbs { margin-top: 8px; }
	.htpb-modal-thumb { width: 48px; height: 48px; }
	.htpb-modal-info { gap: 10px; padding-top: 0; }
	.htpb-modal-pick { position: sticky; bottom: 0; }
}

.htpb-load-error { grid-column: 1 / -1; padding: 14px 18px; background: #fbe9e7; color: #8a2a1f; }
