/* Puzzle Sync — front-end styles. Scoped under .pzs to avoid theme clashes. */

.pzs {
	--pzs-radius: 12px;
	--pzs-border: #e6e8ec;
	--pzs-muted: #6b7280;
	--pzs-accent: #1a56db;
	--pzs-ink: #111827;
	--pzs-grey: #9ca3af;
	--pzs-soft: #f3f4f6;
	font-family: inherit;
	color: var(--pzs-ink);
}

.pzs-container {
	max-width: 1140px;
	margin: 0 auto;
	padding: 2rem 1rem 4rem;
}

/* Hidden helpers driven by JS */
.pzs-card.is-hidden {
	display: none;
}
.splide__slide.is-hidden {
	display: none;
}
.pzs-section.is-empty {
	display: none;
}
.pzs-empty {
	text-align: center;
	color: var(--pzs-muted);
	padding: 2.5rem 0;
	font-size: 0.95rem;
}

/* ---------- Search ---------- */
.pzs-search {
	text-align: center;
	margin-bottom: 1.5rem;
}
.pzs-search__field {
	position: relative;
	max-width: 520px;
	margin: 0 auto;
	box-sizing: border-box;
}
.pzs-search__input {
	box-sizing: border-box;
	width: 100%;
	padding: 0.85rem 3rem 0.85rem 1.25rem;
	border: 1.5px solid var(--pzs-accent) !important;
	border-radius: 999px !important;
	background: #fff !important;
	color: var(--pzs-ink) !important;
	font-size: 1rem !important;
	line-height: 1.4 !important;
	box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.04 ) !important;
	outline: none;
	appearance: none;
}
.pzs-search__icon {
	position: absolute;
	right: 0.18rem;
	top: 50%;
	transform: translateY( -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	border-radius: 50%;
	background: var(--pzs-accent);
	color: #fff;
	pointer-events: none;
}
/* When text is present, hide the search glyph and reveal the clear (×) button. */
.pzs-search__field.is-filled .pzs-search__icon {
	display: none;
}
.pzs-search__clear {
	position: absolute;
	right: 0.18rem;
	top: 50%;
	transform: translateY( -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	width: 2.4rem;
	height: 2.4rem;
	background: var(--pzs-accent);
	color: #fff;
	cursor: pointer;
	padding: 0;
	line-height: 0;
	border-radius: 50%;
}
/* The hidden attribute must win over the display rule above. */
.pzs-search__clear[hidden] {
	display: none;
}
.pzs-search__clear:hover {
	background: #164bbd !important;
	color: #fff !important;
}
/* ---------- Tag chips (soft, filled — visually distinct from category buttons) ---------- */
.pzs-chip {
	display: inline-block;
	padding: 0.3rem 0.8rem;
	border-radius: 999px;
	border: 0;
	font-size: 0.8rem;
	color: var(--pzs-muted);
	text-decoration: none;
	background: var(--pzs-soft);
	transition: background-color 0.15s, color 0.15s;
}
.pzs-chip:hover {
	background: var(--pzs-accent);
	color: #fff;
}
.pzs-chip--ghost {
	background: transparent;
	border: 1px dashed var(--pzs-border);
	color: var(--pzs-ink);
}
.pzs-chip--ghost:hover {
	border-color: var(--pzs-accent);
	color: var(--pzs-accent);
	background: transparent;
}

/* ---------- Category bar (outlined pill buttons — the primary filter) ---------- */
.pzs-cat-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin: 1rem 0 1.25rem;
}
.pzs-cat-bar__item {
	padding: 0.5rem 1.15rem;
	border: 1.5px solid var(--pzs-border);
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 500;
	text-decoration: none;
	color: var(--pzs-ink);
	background: #fff;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.pzs-cat-bar__item.is-active,
.pzs-cat-bar__item:hover {
	background: var(--pzs-accent);
	border-color: var(--pzs-accent);
	color: #fff;
}

/* ---------- Puzzle Type filter (multi-select dropdown, top-right) ---------- */
.pzs-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 1rem;
	padding: 0 3.75rem;
}
.pzs-typedd {
	position: relative;
}
.pzs-typedd__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 0.95rem;
	border: 1.5px solid var(--pzs-border) !important;
	border-radius: 8px !important;
	background: #fff !important;
	color: var(--pzs-ink) !important;
	font-family: inherit !important;
	font-size: 0.85rem !important;
	font-weight: 400 !important;
	line-height: 1.3 !important;
	cursor: pointer;
	box-shadow: none !important;
	text-decoration: none !important;
	text-transform: none !important;
	appearance: none;
	transition: border-color 0.15s, color 0.15s;
}
.pzs-typedd__toggle:hover,
.pzs-typedd.is-open .pzs-typedd__toggle,
.pzs-typedd.has-selection .pzs-typedd__toggle {
	border-color: var(--pzs-accent) !important;
	background: #fff !important;
	color: var(--pzs-accent) !important;
}
.pzs-typedd__toggle .dashicons {
	font-size: 1rem;
	width: 1rem;
	height: 1rem;
	transition: transform 0.15s;
}
.pzs-typedd.is-open .pzs-typedd__toggle .dashicons {
	transform: rotate( 180deg );
}
.pzs-typedd__panel {
	position: absolute;
	right: 0;
	top: calc( 100% + 0.4rem );
	z-index: 20;
	min-width: 210px;
	max-height: 320px;
	overflow: auto;
	background: #fff !important;
	border: 1px solid var(--pzs-border) !important;
	border-radius: 10px !important;
	box-shadow: 0 12px 32px rgba( 17, 24, 39, 0.14 ) !important;
	padding: 0.4rem;
}
.pzs-typedd__option {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.45rem 0.6rem;
	border-radius: 6px;
	background: #fff !important;
	color: var(--pzs-ink) !important;
	font-family: inherit !important;
	font-size: 0.85rem !important;
	font-weight: 400 !important;
	line-height: 1.3 !important;
	cursor: pointer;
}
.pzs-typedd__option:hover {
	background: var(--pzs-soft) !important;
	color: var(--pzs-ink) !important;
}
.pzs-typedd__option input {
	margin: 0;
	flex: 0 0 auto;
}

/* ---------- Related tags ---------- */
.pzs-related {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	justify-content: center;
	margin-bottom: 1.25rem;
}
.pzs-related__label {
	color: var(--pzs-muted);
	font-size: 0.85rem;
}

/* ---------- Sections / carousels ---------- */
.pzs-section {
	margin-bottom: 2.5rem;
}
.pzs-section__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 1rem;
	padding: 0 3.75rem;
}
.pzs-section__title {
	font-size: 1.3rem;
	margin: 0;
}
.pzs-section__viewall {
	font-size: 0.85rem;
	color: var(--pzs-grey);
	text-decoration: none;
	transition: color 0.15s;
}
.pzs-section__viewall:hover {
	color: var(--pzs-accent);
}

/* Carousel: reserve side gutters so the arrows sit beside the cards, not over them. */
.pzs-carousel {
	position: relative;
	margin: 0 3.75rem;
}
.pzs-carousel .splide__track {
	margin: -0.45rem -0.8rem -0.85rem;
	padding: 0.45rem 0.8rem 0.85rem;
	overflow: hidden;
}
.pzs-carousel .splide__arrow {
	width: 2.4rem;
	height: 2.4rem;
	background: #fff;
	border: 1px solid var(--pzs-border);
	opacity: 1;
	transition: border-color 0.15s;
}
.pzs-carousel .splide__arrow:disabled {
	opacity: 0.35;
}
.pzs-carousel .splide__arrow:hover:not(:disabled) {
	border-color: var(--pzs-accent);
}
.pzs-carousel .splide__arrow svg {
	width: 1rem;
	height: 1rem;
	fill: var(--pzs-ink);
}
.pzs-carousel .splide__arrow--prev {
	left: -3.05rem;
}
.pzs-carousel .splide__arrow--next {
	right: -3.05rem;
}

/* While filtering, the carousel is destroyed and laid out as a plain fixed 3-column grid so a
   single visible card keeps its normal width instead of stretching. !important overrides any
   inline styles Splide may leave behind. */
.pzs-carousel.is-plain {
	margin: 0 3.75rem;
}
.pzs-carousel.is-plain .splide__track {
	overflow: visible !important;
}
.pzs-carousel.is-plain .splide__list {
	display: grid !important;
	grid-template-columns: repeat( 3, 1fr );
	gap: 1.25rem;
	transform: none !important;
	width: auto !important;
}
.pzs-carousel.is-plain .splide__slide {
	width: auto !important;
	margin: 0 !important;
}
@media ( max-width: 1024px ) {
	.pzs-carousel.is-plain .splide__list { grid-template-columns: repeat( 2, 1fr ); }
}
@media ( max-width: 640px ) {
	.pzs-carousel.is-plain .splide__list { grid-template-columns: 1fr; }
	.pzs-carousel,
	.pzs-carousel.is-plain { margin: 0; }
}

/* ---------- Grid ---------- */
.pzs-grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 1.25rem;
	padding: 0 3.75rem;
}
@media ( max-width: 1024px ) {
	.pzs-grid { grid-template-columns: repeat( 2, 1fr ); }
}
@media ( max-width: 640px ) {
	.pzs-grid { grid-template-columns: 1fr; padding: 0; }
	.pzs-section__head { padding: 0; }
	.pzs-toolbar { padding: 0; }
	.pzs-embed {
		width: 100%;
		height: 90vh;
		aspect-ratio: auto;
	}
}

/* ---------- Card (slightly smaller than before) ---------- */
.pzs-card {
	border: 1px solid var(--pzs-border);
	border-radius: var(--pzs-radius);
	overflow: hidden;
	background: #fff;
	display: flex;
	flex-direction: column;
	height: 100%;
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.pzs-card:hover {
	box-shadow: 0 8px 18px rgba( 17, 24, 39, 0.1 );
	transform: translateY( -2px );
}
.pzs-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 10;
	background: var(--pzs-soft);
	overflow: hidden;
}
.pzs-card__icon {
	max-width: 50%;
	max-height: 66%;
	width: auto;
	height: auto;
	object-fit: contain;
}
/* Featured image fills the whole media area, replacing the colour panel + icon. */
.pzs-card__media--featured {
	padding: 0;
}
.pzs-card__featured {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.pzs-card__body {
	padding: 0.7rem 0.85rem 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	flex: 1;
}
.pzs-card__title {
	font-size: 0.95rem;
	margin: 0;
	line-height: 1.3;
}
.pzs-card__title a {
	color: var(--pzs-ink);
	text-decoration: none;
}
.pzs-card__tags {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	align-content: flex-start;
	gap: 0.35rem;
	flex: 1;
}
.pzs-tag {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	font-size: 0.7rem;
	line-height: 1.2;
	padding: 0.18rem 0.55rem;
	border-radius: 999px;
	background: var(--pzs-soft);
	color: var(--pzs-muted);
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s;
}
.pzs-tag:hover {
	background: var(--pzs-accent);
	color: #fff;
}
.pzs-card__actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.35rem;
}

/* ---------- Buttons ---------- */
.pzs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	border-radius: 8px;
	padding: 0.5rem 0.9rem;
	font-size: 0.85rem;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid var(--pzs-border);
	background: #fff;
	color: var(--pzs-ink);
	font-family: inherit;
	transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.pzs-btn--icon {
	padding: 0.5rem;
	flex: 0 0 auto;
}
.pzs-btn--icon:hover {
	border-color: var(--pzs-accent);
	color: var(--pzs-accent);
}
.pzs-btn--use {
	flex: 1;
	background: #fff !important;
	border-color: var(--pzs-border) !important;
	color: var(--pzs-ink) !important;
	font-family: inherit !important;
	font-weight: 400 !important;
	text-decoration: none !important;
	text-transform: none !important;
	box-shadow: none !important;
}
.pzs-btn--use:hover,
.pzs-btn--use:focus {
	background: #fff !important;
	border-color: var(--pzs-accent) !important;
	color: var(--pzs-accent) !important;
	box-shadow: none !important;
}
.pzs-btn--lg {
	padding: 0.75rem 2rem;
	font-size: 1rem;
	background: var(--pzs-accent) !important;
	border-color: var(--pzs-accent) !important;
	color: #fff !important;
}
.pzs-btn--lg:hover,
.pzs-btn--lg:focus {
	background: #164bbd !important;
	border-color: #164bbd !important;
	color: #fff !important;
	filter: none;
}
.pzs-btn--ghost {
	background: #fff;
}

/* ---------- Footers ---------- */
.pzs-tax__footer,
.pzs-single__footer {
	text-align: center;
	margin-top: 2rem;
}

/* ---------- Single ---------- */
.pzs-single__back {
	display: inline-flex;
	width: 40px;
	height: 40px;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--pzs-border);
	border-radius: 50%;
	color: var(--pzs-ink);
	text-decoration: none;
	margin-bottom: 1rem;
	transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.pzs-single__back:hover {
	border-color: var(--pzs-accent);
	color: var(--pzs-accent);
	background: #f5f8ff;
}
.pzs-single__head {
	text-align: center;
	margin-bottom: 40px;
}
.pzs-single__title {
	font-size: 1.9rem;
	margin: 0 0 0.75rem;
}
.pzs-single__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}
.pzs-single__desc {
	max-width: 720px;
	margin: 0 auto 40px;
	text-align: center;
	color: var(--pzs-muted);
	font-size: 1rem;
	line-height: 1.6;
}
.pzs-single__desc p {
	margin: 0 0 0.75rem;
}
.pzs-embed {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	border: 1px solid var(--pzs-border);
	border-radius: var(--pzs-radius);
	overflow: hidden;
	background: #fff;
}
.pzs-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.pzs-single__cta {
	text-align: center;
	margin: 1.75rem 0;
}
.pzs-recs {
	margin-top: 3rem;
}
.pzs-recs__title {
	text-align: center;
	font-size: 1.5rem;
	margin-bottom: 1.5rem;
}

/* ---------- Use template modal ---------- */
.pzs-modal-open {
	overflow: hidden;
}
.pzs-template-modal[hidden] {
	display: none;
}
.pzs-template-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}
.pzs-template-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 17, 24, 39, 0.48 );
}
.pzs-template-modal__dialog {
	position: relative;
	width: min( 480px, calc( 100vw - 2rem ) );
	height: min( 480px, calc( 100vh - 2rem ) );
	max-height: 480px;
	overflow: hidden;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 70px rgba( 0, 0, 0, 0.28 );
	font-family: Helvetica, Arial, sans-serif;
	outline: none;
}
.pzs-template-modal__close {
	position: absolute;
	top: 0.85rem;
	right: 0.85rem;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem !important;
	height: 2rem !important;
	min-width: 2rem !important;
	min-height: 2rem !important;
	max-width: 2rem !important;
	max-height: 2rem !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #000 !important;
	color: #fff !important;
	cursor: pointer;
	line-height: 1 !important;
	aspect-ratio: 1 / 1;
	box-shadow: none !important;
}
.pzs-template-modal__close .dashicons {
	width: 1.25rem !important;
	height: 1.25rem !important;
	font-size: 1.25rem !important;
	line-height: 1 !important;
}
.pzs-template-modal__image {
	display: block;
	width: 100%;
	height: 57%;
	object-fit: cover;
}
.pzs-template-modal__body {
	padding: 1.45rem 1.55rem 1.4rem;
}
.pzs-template-modal__title {
	margin: 0 0 0.85rem;
	font-family: Helvetica, Arial, sans-serif;
	font-size: 1.35rem;
	line-height: 1.2;
	font-weight: 700;
	color: #111827;
}
.pzs-template-modal__copy {
	margin: 0;
	font-family: Helvetica, Arial, sans-serif;
	font-size: 0.92rem;
	line-height: 1.45;
	color: #374151;
}
.pzs-template-modal__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 1.45rem;
	min-height: 48px;
	border: 0 !important;
	border-radius: 4px !important;
	background: #34b17f !important;
	color: #fff !important;
	font-family: Poppins, Helvetica, Arial, sans-serif !important;
	font-size: 0.95rem !important;
	font-weight: 500 !important;
	line-height: 1.3 !important;
	text-decoration: none !important;
	text-transform: none !important;
	box-shadow: none !important;
}
.pzs-template-modal__button:hover,
.pzs-template-modal__button:focus {
	color: #fff !important;
	background: #2fa172 !important;
	box-shadow: none !important;
}
@media ( max-width: 520px ) {
	.pzs-template-modal {
		align-items: flex-end;
		padding: 0.75rem;
	}
	.pzs-template-modal__dialog {
		width: 100%;
		height: auto;
		max-height: calc( 100vh - 1.5rem );
		border-radius: 16px;
	}
	.pzs-template-modal__image {
		height: auto;
		aspect-ratio: 16 / 9;
	}
	.pzs-template-modal__body {
		padding: 1.25rem;
	}
	.pzs-template-modal__title {
		font-size: 1.2rem;
	}
}
