/* AYATOP product listings (PS-05) and search results (PS-11). Tokens only. */

.ak-listing { padding-bottom: var(--ak-space-section); }
.ak-listing.is-loading .ak-listing__results { opacity: 0.45; pointer-events: none; transition: opacity var(--ak-motion-duration-fast) var(--ak-motion-ease-standard); }

.ak-listing__header { padding-block: var(--ak-space-4) var(--ak-space-5); }
.ak-listing__title { margin: 0; font-size: var(--ak-type-h1); }
.ak-listing__intro { margin: var(--ak-space-3) 0 0; max-width: var(--ak-measure-reading); color: var(--ak-color-text-secondary); font-size: var(--ak-type-body-large); }

/* Subcategory and suggestion links: compact, wrapping, never a hidden scroll */
.ak-subcats { margin-bottom: var(--ak-space-4); }
.ak-subcats__list { display: flex; flex-wrap: wrap; gap: var(--ak-space-2); margin: 0; padding: 0; list-style: none; }

.ak-dchip {
	display: inline-flex;
	align-items: center;
	min-height: var(--ak-target-min);
	padding: 0 var(--ak-space-4);
	border: var(--ak-border-width) solid var(--ak-color-border-strong);
	border-radius: var(--ak-radius-control);
	background: var(--ak-color-surface-default);
	color: var(--ak-color-text-primary);
	text-decoration: none;
}
.ak-dchip:hover { border-color: var(--ak-color-interactive-primary); text-decoration: none; color: var(--ak-color-text-primary); }
.ak-dchip.is-current,
.ak-dchip[aria-current="page"] { border-color: var(--ak-color-interactive-primary); border-width: var(--ak-border-width-emphasis); font-weight: var(--ak-weight-bold); }

/* ---------- Toolbar ---------- */
.ak-listing__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--ak-space-3) var(--ak-space-5);
	padding-block: var(--ak-space-3);
	border-block: var(--ak-border-width) solid var(--ak-color-border-subtle);
}

.ak-listing__count { margin: 0; color: var(--ak-color-text-secondary); font-size: var(--ak-type-body-small); }
.ak-listing__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ak-space-3); }

.ak-listing__filter-btn { gap: var(--ak-space-2); }
.ak-listing__filter-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding-inline: 0.35rem;
	border-radius: 0.75rem;
	background: var(--ak-color-interactive-primary);
	color: var(--ak-color-text-on-interactive);
	font-size: 0.8125rem;
	font-weight: var(--ak-weight-bold);
}

.ak-sort { display: flex; align-items: center; gap: var(--ak-space-2); margin: 0; }
.ak-sort__label { font-size: var(--ak-type-body-small); color: var(--ak-color-text-secondary); }
.ak-sort__select { width: auto; min-width: 11rem; padding-block: var(--ak-space-2); }

@media (max-width: 47.999rem) {
	.ak-listing__bar { gap: var(--ak-space-2); }
	.ak-listing__count { flex: 1 1 100%; }
	.ak-listing__controls { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; }
	.ak-listing__controls:has(.ak-sort:only-child) { grid-template-columns: 1fr; }
	.ak-sort { flex-direction: column; align-items: stretch; gap: 0; }
	.ak-sort__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.ak-sort__select { width: 100%; min-width: 0; min-height: var(--ak-target-min); }
}

/* ---------- Applied filters ---------- */
.ak-listing__chips { padding-top: var(--ak-space-3); }
.ak-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ak-space-2); margin: 0; padding: 0; list-style: none; }

.ak-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--ak-space-2);
	min-height: 2.25rem;
	padding: 0 var(--ak-space-3);
	border: var(--ak-border-width) solid var(--ak-color-border-strong);
	border-radius: var(--ak-radius-control);
	background: var(--ak-color-surface-default);
	color: var(--ak-color-text-primary);
	font-size: var(--ak-type-body-small);
	text-decoration: none;
}
a.ak-chip:hover { border-color: var(--ak-color-interactive-primary); border-width: var(--ak-border-width-emphasis); text-decoration: none; color: var(--ak-color-text-primary); }
.ak-chip--static { cursor: default; }
.ak-chips__clear { padding-inline: var(--ak-space-2); }

/* ---------- Results ---------- */
.ak-listing__results { padding-top: var(--ak-space-5); }
.ak-listing__results:focus,
#ak-listing-heading:focus { outline: none; }
.ak-listing__error { margin-bottom: var(--ak-space-4); }

.ak-pagination { margin-top: var(--ak-space-7); }
.ak-pagination__list { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--ak-space-2); margin: 0; padding: 0; list-style: none; }

.ak-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--ak-target-min);
	min-height: var(--ak-target-min);
	padding: 0 var(--ak-space-3);
	border: var(--ak-border-width) solid var(--ak-color-border-subtle);
	border-radius: var(--ak-radius-control);
	color: var(--ak-color-text-primary);
	text-decoration: none;
}
.ak-pagination a.page-numbers:hover { border-color: var(--ak-color-interactive-primary); text-decoration: none; }
.ak-pagination .page-numbers.current { border-color: var(--ak-color-interactive-primary); border-width: var(--ak-border-width-emphasis); font-weight: var(--ak-weight-bold); }
.ak-pagination .page-numbers.dots { border-color: transparent; }

.ak-listing__empty { padding-block: var(--ak-space-8); }
.ak-listing__empty h2 { margin-bottom: var(--ak-space-3); }
.ak-listing__suggest { font-size: var(--ak-type-body-large); }
.ak-listing__tips { display: inline-block; margin: 0 0 var(--ak-space-5); padding: 0; text-align: start; list-style: none; color: var(--ak-color-text-secondary); }
.ak-listing__tips li + li { margin-top: var(--ak-space-1); }
.ak-listing__depts { justify-content: center; }

.ak-listing__seo { max-width: var(--ak-measure-reading); margin: var(--ak-space-8) auto 0; color: var(--ak-color-text-secondary); }

/* ---------- Filter drawer ---------- */
.ak-filter-drawer { width: min(26rem, calc(100vw - 4rem)); }
.ak-filter-form { display: flex; flex: 1; flex-direction: column; min-height: 0; margin: 0; }
.ak-filter-form__body { flex: 1; padding-top: var(--ak-space-2); }

.ak-filter-form__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ak-space-4);
	padding: var(--ak-space-3) var(--ak-space-5);
	padding-bottom: max(var(--ak-space-3), env(safe-area-inset-bottom, 0px));
	border-top: var(--ak-border-width) solid var(--ak-color-border-subtle);
	background: var(--ak-color-surface-default);
}
.ak-filter-form__footer .ak-button { flex: 1; max-width: 14rem; }

.ak-filter-summary { padding-block: var(--ak-space-3) var(--ak-space-4); border-bottom: var(--ak-border-width) solid var(--ak-color-border-subtle); }
.ak-filter-summary__title { margin: 0 0 var(--ak-space-2); font-size: var(--ak-type-label); font-weight: var(--ak-weight-bold); }

.ak-filter-group { border-bottom: var(--ak-border-width) solid var(--ak-color-border-subtle); }

.ak-filter-group__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--ak-target-min);
	padding-block: var(--ak-space-2);
	font-weight: var(--ak-weight-bold);
	cursor: pointer;
	list-style: none;
}
.ak-filter-group__summary::-webkit-details-marker { display: none; }
.ak-filter-group[open] > .ak-filter-group__summary .ak-icon { transform: rotate(180deg); }
.ak-filter-group__body { padding-bottom: var(--ak-space-4); }

.ak-filter-options { max-height: 18rem; overflow-y: auto; }
.ak-filter-option { align-items: center; justify-content: flex-start; }
.ak-filter-option__text { flex: 1; }
.ak-filter-option__count { color: var(--ak-color-text-muted); font-size: var(--ak-type-body-small); font-variant-numeric: tabular-nums; }
.ak-filter-option.is-selected .ak-filter-option__text { font-weight: var(--ak-weight-bold); }

.ak-filter-price { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ak-space-3); }
.ak-filter-price__error { margin-top: var(--ak-space-2); color: var(--ak-color-error); }

/* Without JavaScript the filters sit inline under the toolbar */
html:not(.ak-js) .ak-filter-drawer {
	position: static;
	visibility: visible;
	transform: none;
	width: auto;
	box-shadow: none;
	margin-top: var(--ak-space-4);
	border: var(--ak-border-width) solid var(--ak-color-border-subtle);
}
html:not(.ak-js) .ak-filter-drawer [data-ak-close],
html:not(.ak-js) .ak-listing__filter-btn { display: none; }

/* Category links inside the filter drawer */
.ak-filter-links { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--ak-space-1); }
.ak-filter-links a { display: block; padding-block: var(--ak-space-2); color: var(--ak-color-text-primary); text-decoration: none; }
.ak-filter-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }


/* =====================================================================
 * Sort list in the site's own style (replaces the browser's cream pop-up).
 * With JavaScript the plain select is hidden and this is shown; without it the select still works.
 * A small dropdown under the button.
 * ===================================================================== */
.ak-sort__custom { display: none; position: relative; }
.ak-js .ak-sort__custom { display: block; }
.ak-js .ak-sort__select { display: none; }

.ak-sort__button {
	display: flex; align-items: center; justify-content: space-between; gap: var(--ak-space-3);
	width: 100%; min-width: 11rem; min-height: var(--ak-target-min);
	padding: var(--ak-space-2) var(--ak-space-4);
	border: var(--ak-border-width-emphasis) solid var(--ak-color-interactive-primary);
	border-radius: var(--ak-radius-control);
	background: transparent; color: var(--ak-color-text-primary);
	font: inherit; text-align: start; cursor: pointer;
}
.ak-sort__button:hover { background: var(--ak-color-canvas-secondary); }
.ak-sort__button:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--ak-color-canvas-primary), 0 0 0 4px var(--ak-color-focus-ring); }
.ak-sort__button .ak-icon { flex: none; transition: transform var(--ak-motion-duration-fast) var(--ak-motion-ease-standard); }
.ak-sort__button[aria-expanded="true"] .ak-icon { transform: rotate(180deg); }

/* One small dropdown under the button on every screen size. Its position is set by listing.js (the list sits under <body>). */
.ak-sort__sheet {
	position: fixed; z-index: var(--ak-z-drawer);
	min-width: 14rem; max-width: calc(100vw - 1rem); max-height: 70vh; overflow-y: auto;
	padding: var(--ak-space-1) var(--ak-space-4);
	background: var(--ak-color-canvas-primary); color: var(--ak-color-text-primary);
	border: var(--ak-border-width) solid var(--ak-color-border-subtle); border-radius: var(--ak-radius-control);
	box-shadow: var(--ak-shadow-overlay);
}
.ak-sort__sheet[hidden], .ak-sort__backdrop[hidden] { display: none; }
.ak-sort__backdrop { position: fixed; inset: 0; z-index: var(--ak-z-overlay); background: transparent; }
.ak-sort__sheet-title { display: none; }

.ak-sort__option {
	display: flex; align-items: center; justify-content: space-between; gap: var(--ak-space-4);
	width: 100%; min-height: 3.5rem; padding: var(--ak-space-3) 0;
	border: 0; border-top: var(--ak-border-width) solid var(--ak-color-border-subtle);
	background: transparent; color: var(--ak-color-text-primary);
	font: inherit; text-align: start; cursor: pointer;
}
.ak-sort__option:hover span:first-child { text-decoration: underline; text-underline-offset: 0.25em; }
.ak-sort__option:focus-visible { outline: 2px solid var(--ak-color-focus-ring); outline-offset: -2px; }
.ak-sort__option[aria-checked="true"] { font-weight: var(--ak-weight-medium); }
.ak-sort__radio { flex: none; width: 1.25rem; height: 1.25rem; border: 1.5px solid var(--ak-color-text-primary); border-radius: 50%; }
.ak-sort__option[aria-checked="true"] .ak-sort__radio { background: radial-gradient(circle, var(--ak-color-text-primary) 0 45%, transparent 50%); }

/* The first option has no line above it */
.ak-sort__option:first-of-type { border-top: 0; }

/* Filter drawer on the page ivory, with white fields, so it matches the rest of the theme */
.ak-filter-drawer, .ak-filter-form__footer { background: var(--ak-color-canvas-primary); }
