/* Product category and search pages (woocommerce/archive-product.php,
 * search.php): the language of the home page — dark header, rounded cards,
 * PHACON navy and orange. Only these pages load this file. */

.cat {
	--c-navy: #00416a;
	--c-text: #1d1d1f;
	--c-muted: #6e6e73;
	--c-soft: #f5f5f7;
	--c-line: #e5e5ea;
	--c-accent: #f97316;
	--c-accent-dark: #ea580c;
	--c-bar-top: 0px;
	margin-top: -25px; /* main.page padding: the header band starts right under the site header */
	color: var(--c-text);
	-webkit-font-smoothing: antialiased;
}

/* The site header is fixed from 1181px; main.page leaves it room plus 26px. */
@media (min-width: 1181px) {
	.cat { margin-top: -26px; --c-bar-top: calc(var(--phacon-main-top, 200px) - 26px); }
}

/* Below 1200px the menu can wrap in DE/ES and the header grows to 188-195px:
   the script in patient-filter.php measures it into --c-head. */
@media (min-width: 1181px) and (max-width: 1199.98px) {
	.cat { margin-top: calc(var(--c-head, 200px) - 200px); --c-bar-top: var(--c-head, 200px); }
}

.cat *, .cat *::before, .cat *::after { box-sizing: border-box; }

/* Same edges as the header: Bootstrap's container, then 5% from 1200px. */
@media (min-width: 1200px) {
	.cat .cat-wrap { max-width: none; padding-inline: max(24px, 5%); }
}

.cat-eyebrow { margin: 0 0 10px; font-size: 14px; font-weight: 600; letter-spacing: .01em; color: var(--c-accent); }

.cat-h2 {
	margin: 0 0 clamp(24px, 3vw, 40px);
	padding: 0;
	font-size: clamp(1.75rem, 3vw, 2.6rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.03em;
	color: inherit;
}

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

.cat-hero {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: center;
	/* Kept low so the first row of products is on screen as the page opens. */
	min-height: 220px;
	padding: 36px 0;
	overflow: hidden;
	background: #0b0d10;
	color: #fff;
}

/* Category images are 600-1140px wide: they fill the right side only, fading
   into the black from the text side (like the home hero's gradient). */
.cat-hero__img {
	position: absolute;
	inset: 0 0 0 auto;
	z-index: -1;
	width: 55%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 40%;
	-webkit-mask-image: linear-gradient(to right, transparent 0%, #000 45%);
	mask-image: linear-gradient(to right, transparent 0%, #000 45%);
}

.cat-hero h1 {
	max-width: 26ch;
	margin: 0 0 12px;
	padding: 0;
	font-size: clamp(2rem, 2.9vw, 2.7rem);
	font-weight: 500;
	line-height: 1.12;
	letter-spacing: -.02em;
	color: #fff;
}

/* Two lines at most; the full text stays in the page for search engines. */
.cat-hero__lead {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	max-width: 700px;
	margin: 0;
	overflow: hidden;
	font-size: 1rem;
	line-height: 1.6;
	color: rgba(255, 255, 255, .8);
}

/* Laptops (1366x768 and the like): a little lower, so the cards start sooner. */
@media (min-width: 768px) and (max-height: 820px) {
	.cat-hero { min-height: 180px; padding: 28px 0; }
	.cat #catalog { padding-top: 24px; }
}

.cat-hero--plain { min-height: 0; background: var(--c-navy); }
.cat-hero--plain h1 { max-width: none; margin: 0; }

@media (max-width: 767px) {
	.cat-hero { min-height: 0; padding: 24px 0; }
	.cat-hero__img { width: 100%; opacity: .38; -webkit-mask-image: none; mask-image: none; }
}

/* ----------------------------------------------------------------- the bar */

.cat-list { padding-bottom: clamp(48px, 6vw, 88px); background: var(--c-soft); }

.cat-bar {
	position: sticky;
	top: var(--c-bar-top);
	z-index: 1020;
	border-bottom: 1px solid var(--c-line);
	background: rgba(255, 255, 255, .92);
	-webkit-backdrop-filter: saturate(1.8) blur(14px);
	backdrop-filter: saturate(1.8) blur(14px);
}

.cat-bar__inner { display: flex; align-items: center; gap: 16px; padding-block: 12px; }

.cat-chips {
	display: flex;
	flex: 1 1 auto;
	gap: 8px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
	/* chips that do not fit fade out at the right edge */
	-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
	mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}
.cat-chips::-webkit-scrollbar { display: none; }

.cat-chip,
.cat-filter-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border: 1px solid var(--c-line);
	border-radius: 999px;
	background: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--c-text);
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .2s, border-color .2s, color .2s;
}
.cat-chip:hover:not(:disabled), .cat-filter-btn:hover { border-color: var(--c-navy); }
.cat-chip[aria-pressed="true"] { border-color: var(--c-navy); background: var(--c-navy); color: #fff; }
.cat-chip:disabled { opacity: .35; cursor: default; }
.cat-chip:focus-visible, .cat-filter-btn:focus-visible, .cat-more:focus-visible { outline: 3px solid #5ee1ff; outline-offset: 2px; }

.cat-filter-btn { font-weight: 600; }

.cat-badge {
	display: inline-grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--c-accent);
	font-size: 12px;
	font-weight: 700;
	color: #fff;
}
.cat-badge[hidden] { display: none; }

.cat-bar__tools { display: flex; flex: none; align-items: center; gap: 12px; margin-left: auto; }
.cat-count { font-size: 14px; color: var(--c-muted); white-space: nowrap; }

/* style.css floats .product-sort into the old title row from 1181px */
.cat .product-sort { float: none; width: auto; margin: 0; }
.cat #orderby-select {
	width: auto;
	max-width: 260px;
	padding: 8px 36px 8px 16px;
	border-color: var(--c-line);
	border-radius: 999px;
	font-size: 14px;
	line-height: 1.3;
	color: var(--c-text);
	cursor: pointer;
}

@media (max-width: 767px) {
	.cat-bar__inner { flex-wrap: wrap; gap: 10px; padding-block: 10px; }
	.cat-chips { flex-basis: 100%; }
	.cat-bar__tools { width: 100%; }
	.cat-count { margin-right: auto; }
	.cat-bar #orderby-select { max-width: 46vw; }
}

/* Phones: the count is in the header and on the drawer's button; filter and sort share the row. */
@media (max-width: 575px) {
	.cat-count { display: none; }
	.cat-bar .product-sort { flex: 1; min-width: 0; }
	.cat-bar #orderby-select { width: 100%; max-width: none; }
}

/* -------------------------------------------------------------- the drawer */

/* Above the fixed site header (z-index 9999) and its backdrop too. */
.cat-drawer.offcanvas { z-index: 10050; width: min(420px, 100%); }
.offcanvas-backdrop { z-index: 10040; }

.cat-drawer .offcanvas-header { padding: 20px 24px; border-bottom: 1px solid var(--c-line); }
.cat-drawer h2 { margin: 0; padding: 0; font-size: 20px; font-weight: 700; color: var(--c-text); }
.cat-drawer .offcanvas-body { padding: 4px 24px 16px; }
.cat-drawer .product-filter { margin: 0; padding: 0; border: 0; background: none; }
.cat-drawer .accordion-button { padding-inline: 0; font-weight: 600; }
.cat-drawer .accordion-body { padding: 0 0 16px; }

.cat-drawer__foot { display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--c-line); }
.cat-drawer__foot button { flex: 1; padding: 12px 16px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.cat-drawer__reset { border: 1px solid var(--c-line); background: #fff; color: var(--c-text); }
.cat-drawer__apply { border: 0; background: var(--c-navy); color: #fff; }

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

.cat #catalog { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 28px; }
@media (min-width: 576px) { .cat #catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 992px) { .cat #catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 36px; } }
@media (min-width: 1200px) { .cat #catalog { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .cat #catalog { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.cat .catalog-item[hidden] { display: none; }
.cat .catalog-empty, .cat #catalog .pagination { grid-column: 1 / -1; }
.cat .catalog-empty { margin: 24px 0; text-align: center; color: var(--c-muted); }

.cat-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 30, 50, .08);
	transition: transform .3s, box-shadow .3s;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 18px 40px rgba(0, 30, 50, .14); }

.cat-card__img { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #e9ebee; }
.cat-card__img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cat-card:hover .cat-card__img img { transform: scale(1.04); }

.cat-card__badge {
	position: absolute;
	top: 14px;
	left: 14px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--c-accent);
	font-size: 13px;
	font-weight: 700;
	color: #fff;
}

.cat-card__body { display: flex; flex: 1; flex-direction: column; padding: 16px 18px 18px; }

.cat-card__type { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-accent); }

.cat-card__title { margin: 0 0 12px; padding: 0; font-size: 16px; font-weight: 700; line-height: 1.35; }
.cat-card__title a { color: var(--c-navy); text-decoration: none; }
.cat-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* the whole card is the link */
.cat-card__title a:focus-visible { outline: none; }
.cat-card:has(.cat-card__title a:focus-visible) { outline: 3px solid #5ee1ff; outline-offset: 2px; }

.cat-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.cat-card__tags li { padding: 3px 10px; border-radius: 999px; background: #eef4fa; font-size: 12px; line-height: 1.5; color: var(--c-navy); }
.cat-card__tags .cat-card__more { background: none; color: var(--c-muted); }

.cat-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	padding-top: 16px;
	border-top: 1px solid var(--c-line);
}

.cat-card__price { font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--c-text); }
.cat-card__price del { display: block; font-size: 13px; font-weight: 500; color: var(--c-muted); }
.cat-card__price ins { text-decoration: none; }
.cat-card__price .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cat-card__price small, .cat-card__price .woocommerce-price-suffix { display: block; font-size: 12px; font-weight: 400; color: var(--c-muted); }

.cat-card .button {
	position: relative;
	z-index: 2; /* above the card link */
	flex: none;
	padding: 9px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--c-accent);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s;
}
.cat-card .button:hover { background: var(--c-accent-dark); color: #fff; }
.cat-card .button.loading { opacity: .6; }
.cat-card .added_to_cart { position: relative; z-index: 2; font-size: 13px; font-weight: 600; color: var(--c-navy); }
.cat-card .add_to_cart_button.added { display: none; }

/* Phones: one card per row, photo beside the text, like an app list. */
@media (max-width: 575px) {
	.cat-card { flex-direction: row; border-radius: 18px; }
	.cat-card__img { flex: 0 0 38%; aspect-ratio: auto; min-height: 150px; }
	.cat-card__body { padding: 14px 16px; }
	.cat-card__title { margin-bottom: 8px; font-size: 15px; }
	.cat-card__tags { display: none; }
	.cat-card__foot { padding-top: 10px; border: 0; }
	.cat-card__badge { top: 10px; left: 10px; font-size: 12px; }
}

.cat #catalog .pagination { display: flex; justify-content: center; gap: 6px; margin: 16px 0 0; }
.cat-more {
	padding: 14px 28px;
	border: 1px solid var(--c-navy);
	border-radius: 999px;
	background: #fff;
	font: inherit;
	font-weight: 600;
	color: var(--c-navy);
	cursor: pointer;
	transition: background-color .2s, color .2s;
}
.cat-more:hover { background: var(--c-navy); color: #fff; }

/* ------------------------------------------------------------ the closing */

.cat-custom { padding: clamp(56px, 7vw, 104px) 0; background: var(--c-navy); color: #fff; }
.cat-custom__grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 992px) { .cat-custom__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; } }
.cat-custom img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 24px; }
.cat-custom p:not(.cat-eyebrow) { max-width: 520px; margin: 0 0 28px; font-size: clamp(1rem, 1.2vw, 1.1rem); line-height: 1.6; color: rgba(255, 255, 255, .8); }

.cat-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 13px 24px;
	border-radius: 4px;
	background: var(--c-accent);
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	transition: background-color .2s;
}
.cat-btn::after { content: "›"; font-size: 1.3em; line-height: .8; }
.cat-btn:hover { background: var(--c-accent-dark); color: #fff; }

.cat-specs { padding: clamp(56px, 7vw, 104px) 0; background: #fff; }
.cat-specs .cat-h2 { color: var(--c-text); }
.cat-specs__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 575px) { .cat-specs__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

.cat-spec { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 20px; background: #111; color: #fff; text-decoration: none; }
.cat-spec img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cat-spec:hover img { transform: scale(1.05); }
.cat-spec::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0) 60%); }
.cat-spec span { position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 1; font-size: 18px; font-weight: 700; line-height: 1.2; }
.cat-spec small { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, .75); }
.cat-spec:hover { color: #fff; }

@media (prefers-reduced-motion: reduce) {
	.cat-card, .cat-card__img img, .cat-spec img { transition: none; }
	.cat-card:hover { transform: none; }
	.cat-card:hover .cat-card__img img, .cat-spec:hover img { transform: none; }
}

/* ===================================================================
 * Second proposal (templates/catalog-v2.php, /produkt-kategorie/{slug}2/):
 * the old structure — filters on the left, one product per row — in the
 * same look as above.
 * =================================================================== */

.cat--v2 { padding-bottom: clamp(48px, 6vw, 88px); background: var(--c-soft); }

.cat2-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; padding: 36px 0 28px; }
.cat2-head .cat-eyebrow { margin-bottom: 6px; }
.cat2-head h1 { margin: 0; padding: 0; font-size: clamp(1.9rem, 2.8vw, 2.6rem); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; color: var(--c-text); }

.cat2-layout { display: grid; gap: 20px; }
@media (min-width: 992px) {
	.cat2-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 32px; align-items: start; }
	/* Sticky, and scrolls on its own when an open filter makes it taller than the screen. */
	.cat2-side { position: sticky; top: calc(var(--c-bar-top) + 24px); max-height: calc(100vh - var(--c-bar-top) - 48px); overflow-y: auto; overscroll-behavior: contain; border-radius: 20px; scrollbar-width: thin; }
}

/* Filters: a white rounded panel; on phones it opens from a button. */
.cat2-filter { padding: 6px 20px 18px; border-radius: 20px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 30, 50, .06); }
.cat2-filter__title { margin: 14px 0 4px; padding: 0; font-size: 18px; font-weight: 700; color: var(--c-text); }
.cat2-filter .product-filter { margin: 0; padding: 0; border: 0; background: none; }
.cat2-filter .accordion-item { border-color: var(--c-line); }
.cat2-filter .accordion-button { padding: 14px 0; background: none; box-shadow: none; font-size: 15px; font-weight: 600; color: var(--c-text); }
.cat2-filter .accordion-body { padding: 0 0 14px; }
.cat2-filter__toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--c-text); }
.cat2-reset { width: 100%; margin-top: 14px; padding: 10px 16px; border: 1px solid var(--c-line); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--c-text); }
.cat2-reset:hover { border-color: var(--c-navy); }
@media (min-width: 992px) {
	.cat2-filter__toggle { display: none; }
	.cat2-filter__body.collapse { display: block; } /* always open beside the list */
}

/* The list: one rounded card per product. */
.cat--v2 #catalog { display: flex; flex-direction: column; gap: 16px; padding-top: 0; }

.cat-row {
	position: relative;
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr) 250px;
	overflow: hidden;
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 30, 50, .07);
	transition: transform .3s, box-shadow .3s;
}
.cat-row:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 18px 40px rgba(0, 30, 50, .13); }

.cat-row__img { position: relative; min-height: 190px; overflow: hidden; background: #e9ebee; }
.cat-row__img img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cat-row:hover .cat-row__img img { transform: scale(1.04); }

.cat-row__main { padding: 22px 26px; }
.cat-row__title { margin: 0 0 12px; padding: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.cat-row__title a { color: var(--c-navy); text-decoration: none; }
.cat-row__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* the whole row is the link */
.cat-row .cat-card__tags { margin-bottom: 8px; }
.cat-card__tags--alt li { background: #f1f1f3; color: var(--c-text); }
.cat-row .hidden-tag { display: none; }
.cat-row ul.expanded .hidden-tag { display: block; }
.cat-row .more-tag { position: relative; z-index: 2; background: none; color: var(--c-muted); cursor: pointer; }
.cat-row .more-tag:hover { color: var(--c-navy); }

.cat-row__buy { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 22px 24px; border-left: 1px solid var(--c-line); }
.cat-row__cart { display: flex; gap: 8px; margin: 0; }
.cat-row__cart .qty { width: 64px; padding: 8px 6px; border: 1px solid var(--c-line); border-radius: 999px; text-align: center; font: inherit; }
.cat-row__cart button, .cat-row__buy .button {
	flex: 1;
	padding: 9px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--c-accent);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s;
}
.cat-row__cart button:hover, .cat-row__buy .button:hover { background: var(--c-accent-dark); color: #fff; }
.cat-row__details {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--c-navy);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--c-navy);
	text-decoration: none;
	transition: background-color .2s, color .2s;
}
.cat-row__details:hover { background: var(--c-navy); color: #fff; }

@media (max-width: 1199px) { .cat-row { grid-template-columns: 180px minmax(0, 1fr) 220px; } }

/* Narrow: photo and text side by side, price and buttons across the bottom. */
@media (max-width: 767px) {
	.cat-row { grid-template-columns: 120px minmax(0, 1fr); border-radius: 18px; }
	.cat-row__img { min-height: 140px; }
	.cat-row__main { padding: 14px 16px; }
	.cat-row__title { font-size: 15px; }
	.cat-row .cat-card__tags { display: none; }
	.cat-row__buy { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-top: 1px solid var(--c-line); border-left: 0; }
	.cat-row__buy .cat-card__price { flex: 1 1 100%; }
	.cat-row__cart { flex: 1; }
}

.cat2-desc { max-width: 900px; margin-top: 48px; font-size: 15px; line-height: 1.7; color: var(--c-muted); }

@media (prefers-reduced-motion: reduce) {
	.cat-row, .cat-row__img img { transition: none; }
	.cat-row:hover, .cat-row:hover .cat-row__img img { transform: none; }
}
