/* Product-category archive — the design-matched card grid.
 *
 * Loaded only on product_cat archives, after responsive-fixes.css. Everything is
 * namespaced `pp-cat-*` on purpose: shop.css / shop-desktop-reference.css pin
 * `ul.products` / `li.product` with !important, and app.css styles the shared
 * `pp-product-card` / `pp-price` / `pp-add` / `pp-category-*` names globally, so
 * this component deliberately shares none of them.
 *
 * Card sizing follows the house technique: `container-type: inline-size` on the
 * card and every inner metric in `cqw`, so one set of numbers holds at 2, 3 or 4
 * columns. Unlike the homepage card there is no fixed aspect-ratio — every
 * vertical metric is in cqw too, so the card's own height scales with its width
 * and the shape stays constant while the content can never be clipped.
 *
 * Colours come from the panel. The light values arrive as `--cat-*-l` custom
 * properties on <body class="pp-cat-page"> (printed inline by PHP); the plain
 * `--cat-*` names are resolved here so the dark block below can win without
 * fighting an inline style.
 */

/* ------------------------------------------------------------------ page shell */

body.pp-cat-page {
	background: var(--cat-page-bg-l, #f5f6f8);
}

/* Wider than the shop's min(1120px) and a plain background so the cards sit on
   the page colour. The `main#main` id is deliberate: shop-desktop-reference.css
   pins the shop grid width with class selectors, and an id is the only way to
   out-rank it here without reaching for !important. */
body.pp-cat-page main#main.site-main,
body.pp-cat-page .woocommerce main#main.site-main {
	width: min(1360px, calc(100% - 48px));
	max-width: none;
	margin-inline: auto;
	padding: 22px 0 46px;
	background: transparent;
}

.pp-cat-archive {
	--cat-card-bg: var(--cat-card-bg-l, #ffffff);
	--cat-card-border: var(--cat-card-border-l, #eceef1);
	--cat-accent: var(--cat-accent-l, #2f6bd8);
	--cat-accent-text: var(--cat-accent-text-l, #ffffff);
	--cat-highlight: var(--cat-highlight-l, #e5484d);
	--cat-badge-bg: var(--cat-badge-bg-l, #eef2ff);
	--cat-badge-text: var(--cat-badge-text-l, #3b4bb3);
	--cat-muted: var(--cat-muted-l, #8b92a3);
	--cat-chip-bg: #f4f5f7;
	--cat-divider: #eef0f3;
	--cat-title: #101322;
	direction: rtl;
}

/* --------------------------------------------------------------- breadcrumb / header */

.pp-cat-page .woocommerce-breadcrumb {
	margin: 0 0 4px;
	color: var(--cat-muted-l, #8b92a3);
	font-size: 12.5px;
	line-height: 1.9;
	text-align: right;
}

.pp-cat-page .pp-cat-header {
	margin: 0;
}

.pp-cat-page .pp-cat-title,
.pp-cat-page .woocommerce-products-header__title.pp-cat-title {
	margin: 4px 0 0;
	color: var(--cat-title);
	font-size: clamp(22px, 2.5vw, 32px);
	font-weight: 800;
	line-height: 1.45;
	text-align: center;
}

.pp-cat-page .pp-cat-header .term-description {
	max-width: 760px;
	margin: 8px auto 0;
	color: var(--cat-muted);
	font-size: 13.5px;
	line-height: 1.9;
	text-align: center;
}

/* ------------------------------------------------------------------ count + ordering */

.pp-cat-headrow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 16px;
}

.pp-cat-page .pp-cat-count,
.pp-cat-page p.woocommerce-result-count.pp-cat-count {
	float: none;
	margin: 0;
	color: var(--cat-muted);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.9;
}

.pp-cat-ordering {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 14px 0 10px;
	border: 1px solid #e4e7ec;
	border-radius: 10px;
	background: #fff;
}

.pp-cat-ordering-label {
	color: #6b7280;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
}

/* responsive-fixes.css stretches .woocommerce-ordering to 100% below 650px,
   which would turn the pill into a full-width bar; the reference keeps it
   compact at every width. */
.pp-cat-page .pp-cat-ordering .woocommerce-ordering {
	float: none;
	width: auto;
	margin: 0;
}

.pp-cat-page .pp-cat-ordering .orderby {
	-webkit-appearance: none;
	appearance: none;
	min-width: 132px;
	padding: 9px 0 9px 20px;
	border: 0;
	background-color: transparent;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left center;
	background-size: 13px;
	color: #3c4257;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
}

/* ------------------------------------------------------------------------- grid */

.pp-cat-grid {
	display: grid;
	grid-template-columns: repeat(var(--cat-cols-d, 3), minmax(0, 1fr));
	align-items: stretch;
	gap: 18px;
	margin-top: 16px;
	direction: rtl;
}

/* The reference tablet breakpoint is 1024, which is wider than the theme's usual
   1000px desktop/tablet split — hence 1180 here. */
@media (max-width: 1180px) and (min-width: 651px) {
	.pp-cat-grid {
		grid-template-columns: repeat(var(--cat-cols-t, 2), minmax(0, 1fr));
		gap: 14px;
	}
}

@media (max-width: 650px) {
	.pp-cat-grid {
		grid-template-columns: repeat(var(--cat-cols-m, 2), minmax(0, 1fr));
		gap: 10px;
		margin-top: 12px;
	}

	.pp-cat-ordering {
		padding-inline: 10px 8px;
	}

	.pp-cat-page .pp-cat-ordering .orderby {
		min-width: 0;
		font-size: 12px;
	}
}

.pp-cat-empty {
	margin: 30px 0;
	color: var(--cat-muted);
	font-size: 15px;
	text-align: center;
}

/* --------------------------------------------------- homepage-style card grid
 *
 * The plan cards ARE the homepage product boxes: template-parts/category-card.php
 * emits the same markup as template-parts/section-card.php and
 * product-sections-final.css does the styling. It is enqueued after this sheet,
 * so these overrides are written at class-pair specificity to win rather than
 * relying on order.
 *
 * Only the section chrome is neutralised — the grid has to sit on the archive
 * page, not look like a homepage band — and `--pp-columns` is fed from the
 * panel's three per-breakpoint counts via the custom properties printed on the
 * wrapper. */

.pp-product-section.pp-cat-section {
	--pp-columns: var(--cat-cols-d, 3);
	padding: 0;
	background: transparent;
}

.pp-product-section.pp-cat-section > .pp-section-products {
	margin-top: 16px;
}

@media (max-width: 1180px) and (min-width: 651px) {
	.pp-product-section.pp-cat-section { --pp-columns: var(--cat-cols-t, 2); }
}

@media (max-width: 650px) {
	.pp-product-section.pp-cat-section {
		--pp-columns: var(--cat-cols-m, 2);
	}

	.pp-product-section.pp-cat-section > .pp-section-products { margin-top: 12px; }
}

/* The reference marks the featured plan with a coloured rail. The section card
   has no such state of its own, so it is added here. */
.pp-product-section .pp-section-card.is-featured {
	box-shadow: 0 0 0 2px var(--cat-highlight, #e5484d), 0 18px 40px rgba(27, 38, 84, .10);
}

/* ------------------------------------------------------------------------- card */

.pp-cat-card {
	container-type: inline-size;
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	/* Percentage, not cqw: the card is its own query container, so a cqw length
	   on the container itself resolves against an ancestor container (the
	   viewport) rather than the card's width — 6.4cqw came out as 92px instead
	   of 28px. Percentage padding resolves against the containing block, which
	   for a grid item is the grid area, i.e. the card's own width. */
	padding-top: 6%;
	overflow: hidden;
	border: 1px solid var(--cat-card-border);
	/* % radius, not cqw: on the container itself a cqw length would resolve
	   against an outer container. */
	border-radius: 4.7%;
	background: var(--cat-card-bg);
	box-shadow: 0 4px 14px rgba(23, 43, 77, .05);
	direction: rtl;
	/* The reference sets every line flush to the inline start — the right edge
	   in RTL. Nothing in this card is centred. */
	text-align: right;
	transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

/* Other sheets set content-box on shared card classes; keep this card and its
   subtree on border-box so the cqw maths stays honest. */
.pp-cat-card,
.pp-cat-card *,
.pp-cat-card *::before,
.pp-cat-card *::after {
	box-sizing: border-box;
}

.pp-cat-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(23, 43, 77, .10);
}

.pp-cat-card.is-featured {
	border: 1.6px solid var(--cat-highlight);
	box-shadow: 0 6px 18px rgba(229, 72, 77, .12);
}

.pp-cat-card.is-disabled {
	opacity: .72;
}

/* ------------------------------------------------------------------- card top row */

/* Logo (right), badge (middle), bookmark (left). Top-aligned rather than
   centred: in the reference the logo is the tallest of the three and the other
   two sit level with its top edge. */
.pp-cat-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 2cqw;
	padding: 0 6.5cqw;
}

.pp-cat-ribbon {
	display: inline-grid;
	flex: 0 0 auto;
	color: #a3aab6;
	place-items: center;
}

.pp-cat-ribbon svg {
	display: block;
	width: 4.7cqw;
	height: 4.7cqw;
}

.pp-cat-badge {
	display: inline-flex;
	align-items: center;
	padding: 1.1cqw 4.2cqw;
	overflow: hidden;
	border-radius: 999px;
	background: var(--cat-badge-bg);
	color: var(--cat-badge-text);
	font-size: 3cqw;
	font-weight: 700;
	line-height: 1.4;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pp-cat-card.is-featured .pp-cat-badge {
	background: var(--cat-highlight);
	color: #fff;
}

.pp-cat-logo {
	display: grid;
	flex: 0 0 auto;
	width: 19.1cqw;
	height: 19.1cqw;
	overflow: hidden;
	border-radius: 30%;
	background: #f4f6f9;
	place-items: center;
}

.pp-cat-logo a {
	display: block;
	width: 100%;
	height: 100%;
}

.pp-cat-logo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ------------------------------------------------------------------------ copy */

/* Grows to fill the card so the CTA below always lands on the bottom edge. */
.pp-cat-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.pp-cat-name {
	margin: 2cqw 0 0;
	padding: 0 6.5cqw;
	color: var(--cat-title);
	font-size: 7cqw;
	font-weight: 800;
	line-height: 1.35;
	/* Two long names must not push the price row out of a short card. */
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.pp-cat-name a {
	color: inherit;
}

.pp-cat-plan {
	margin: .5cqw 0 0;
	padding: 0 6.5cqw;
	color: var(--cat-muted);
	font-size: 4.2cqw;
	font-weight: 400;
	line-height: 1.6;
}

/* Inset grey pill with its content packed to the right: calendar icon first,
   the duration word trailing to its left. */
.pp-cat-chip {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 2cqw;
	margin: 2.8cqw 6.5cqw 0;
	padding: 2.4cqw 5cqw;
	border-radius: 2.8cqw;
	background: var(--cat-chip-bg);
	color: #4b5563;
	font-size: 4cqw;
	font-weight: 500;
	line-height: 1.6;
}

.pp-cat-chip svg {
	display: block;
	flex: 0 0 auto;
	width: 4.6cqw;
	height: 4.6cqw;
	color: #5c6470;
}

/* Hairline separating the plan block from the price block, inset to the same
   column as the chip and the CTA. */
.pp-cat-divider {
	display: block;
	height: 1px;
	margin: 4cqw 6.5cqw 0;
	background: var(--cat-divider);
}

/* ----------------------------------------------------------------------- price */

.pp-cat-pricelabel {
	margin: 3.4cqw 0 0;
	padding: 0 6.5cqw;
	color: var(--cat-muted);
	font-size: 4.2cqw;
	font-weight: 400;
	line-height: 1.6;
}

/* The amount hugs the right edge and the currency word trails it on the left. */
.pp-cat-price {
	display: flex;
	align-items: baseline;
	justify-content: flex-start;
	gap: 3cqw;
	margin: .6cqw 0 0;
	padding: 0 6.5cqw;
	color: var(--cat-title);
	font-size: 9.5cqw;
	font-weight: 800;
	line-height: 1.3;
	white-space: nowrap;
}

.pp-cat-price .pp-cat-unit {
	color: var(--cat-muted);
	font-size: 4.9cqw;
	font-weight: 400;
}

/* ------------------------------------------------------------------------- cta */

.pp-cat-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 14.6cqw;
	margin: 3.4cqw 6.5cqw 2.5cqw;
	padding: 1cqw 2cqw;
	border: 0;
	border-radius: 3.7cqw;
	background: var(--cat-accent);
	color: var(--cat-accent-text);
	font-size: 6cqw;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	cursor: pointer;
	transition: filter .16s ease;
}

.pp-cat-cta:hover {
	filter: brightness(1.07);
	color: var(--cat-accent-text);
}

.pp-cat-cta.is-disabled,
.pp-cat-card.is-disabled .pp-cat-cta {
	background: #cbd0d9;
	color: #fff;
	cursor: not-allowed;
	filter: none;
}

/* ------------------------------------------------------------------- dark theme */

html[data-theme="dark"] body.pp-cat-page {
	background: #101211;
}

html[data-theme="dark"] .pp-cat-archive {
	--cat-card-bg: #1b1d1c;
	--cat-card-border: #2c2f2e;
	--cat-chip-bg: #232625;
	--cat-divider: #2c2f2e;
	--cat-title: #f3f3f3;
	--cat-muted: #a8aaa9;
	--cat-badge-bg: rgba(28, 64, 140, .5);
	--cat-badge-text: #eaf1ff;
}

html[data-theme="dark"] .pp-cat-page .woocommerce-breadcrumb,
html[data-theme="dark"] .pp-cat-page .pp-cat-count {
	color: #a8aaa9;
}

html[data-theme="dark"] .pp-cat-ordering {
	border-color: #2c2f2e;
	background: #1b1d1c;
}

html[data-theme="dark"] .pp-cat-ordering-label {
	color: #a8aaa9;
}

html[data-theme="dark"] .pp-cat-page .pp-cat-ordering .orderby {
	color: #e8e9ea;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8aaa9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .pp-cat-logo {
	background: #232625;
}

html[data-theme="dark"] .pp-cat-ribbon {
	color: #6f7576;
}

html[data-theme="dark"] .pp-cat-chip {
	color: #c9cdcf;
}

html[data-theme="dark"] .pp-cat-chip svg {
	color: #8f9799;
}

html[data-theme="dark"] .pp-cat-cta.is-disabled,
html[data-theme="dark"] .pp-cat-card.is-disabled .pp-cat-cta {
	background: #3a3f40;
	color: #9aa0a1;
}

/* ------------------------------------------------- no container-query support */

@supports not (container-type: inline-size) {
	.pp-cat-card {
		padding-top: 27px;
		border-radius: 20px;
	}

	.pp-cat-top {
		gap: 8px;
		padding: 0 27px;
	}

	.pp-cat-ribbon svg {
		width: 20px;
		height: 20px;
	}

	.pp-cat-badge {
		padding: 5px 18px;
		font-size: 13px;
	}

	.pp-cat-logo {
		width: 81px;
		height: 81px;
	}

	.pp-cat-name {
		margin-top: 13px;
		padding: 0 27px;
		font-size: 30px;
	}

	.pp-cat-plan {
		margin-top: 2px;
		padding: 0 27px;
		font-size: 18px;
	}

	.pp-cat-chip {
		gap: 8px;
		margin: 14px 27px 0;
		padding: 10px 21px;
		border-radius: 12px;
		font-size: 17px;
	}

	.pp-cat-chip svg {
		width: 20px;
		height: 20px;
	}

	.pp-cat-divider {
		margin: 20px 27px 0;
	}

	.pp-cat-pricelabel {
		margin-top: 17px;
		padding: 0 27px;
		font-size: 18px;
	}

	.pp-cat-price {
		gap: 13px;
		padding: 0 27px;
		font-size: 41px;
	}

	.pp-cat-price .pp-cat-unit {
		font-size: 21px;
	}

	.pp-cat-cta {
		min-height: 63px;
		margin: 17px 27px 11px;
		padding: 4px 9px;
		border-radius: 16px;
		font-size: 26px;
	}
}
