/*
 * Rua shop and category pages.
 *
 * Loaded on product archives only (see Shop::enqueue()), after
 * woocommerce.css, which keeps the grid and the cards shared with every
 * other product list. Type follows the product page: Playfair Display for
 * titles, Poppins for the rest, small-caps labels at 600 with wide
 * tracking.
 *
 * Mobile first: base rules are the phone, media queries only add.
 */

.rua-catalog {
	--rua-shop-line: #d9c9b1;
	--rua-shop-rose: #f4e4e1;
	--rua-shop-green: #1e6b45;
}

/* Small caps, as the product page's category line. */
.rua-shop-drop__eyebrow,
.rua-shop-card__eyebrow,
.rua-shop-sheet__group legend {
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

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

.rua-shop-head {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	margin: 0 0 var(--wp--preset--spacing--30);
}

.rua-shop-head__text {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;
}

.rua-shop-head__trail ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.75rem;
	color: var(--wp--preset--color--contrast-muted);
}

.rua-shop-head__trail li + li::before {
	content: "/";
	margin-right: 0.5rem;
}

.rua-shop-head__trail a {
	color: inherit;
	text-decoration: none;
}

.rua-shop-head__trail a:hover {
	color: var(--wp--preset--color--primary);
}

.rua-shop-head__trail [aria-current] {
	color: var(--wp--preset--color--contrast);
}

.rua-shop-head__title {
	margin: 0;
	font-size: 2.25rem;
	line-height: 1.05;
}

.rua-shop-head__title em {
	color: var(--wp--preset--color--primary);
}

.rua-shop-head__intro {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--wp--preset--color--contrast-muted);
}

.rua-shop-head__note {
	display: none;
}

/* The latest drop, as a card to it. */
.rua-shop-drop {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 14px 8px 8px;
	border: var(--rua-border);
	border-radius: 16px;
	background: var(--rua-field);
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	transition: border-color var(--rua-transition);
}

.rua-shop-drop:hover {
	border-color: var(--rua-shop-line);
}

.rua-shop-drop__img {
	flex: 0 0 auto;
	width: 44px;
	height: 56px;
	border-radius: 10px;
	object-fit: cover;
}

.rua-shop-drop__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.rua-shop-drop__eyebrow {
	color: var(--wp--preset--color--primary);
}

.rua-shop-drop__name {
	overflow: hidden;
	font-size: 0.875rem;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rua-shop-drop__price {
	font-size: 0.75rem;
	color: var(--wp--preset--color--contrast-muted);
}

.rua-shop-drop__price del {
	margin-right: 0.25em;
}

.rua-shop-drop__price ins {
	text-decoration: none;
}

.rua-shop-drop > .rua-icon {
	flex: 0 0 auto;
	color: var(--wp--preset--color--contrast-muted);
	transition: transform var(--rua-transition);
}

.rua-shop-drop:hover > .rua-icon {
	transform: translateX(3px);
}

@media (min-width: 900px) {
	.rua-shop-head {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: var(--wp--preset--spacing--50);
		margin-bottom: var(--wp--preset--spacing--40);
	}

	.rua-shop-head__text {
		gap: 0.6rem;
	}

	.rua-shop-head__title {
		font-size: 3.25rem;
	}

	.rua-shop-head__intro {
		font-size: 0.9375rem;
	}

	.rua-shop-head__note {
		display: inline;
	}

	.rua-shop-drop {
		flex: 0 0 auto;
		gap: 14px;
		max-width: 22rem;
		padding: 10px 18px 10px 10px;
		border-radius: 18px;
	}

	.rua-shop-drop__img {
		width: 56px;
		height: 70px;
		border-radius: 12px;
	}

	.rua-shop-drop__name {
		font-size: 0.9375rem;
	}

	.rua-shop-drop__price {
		font-size: 0.8125rem;
	}
}

/* ------------------------------------------------------ filter bar ---- */

/*
 * Phones: the category pills scroll sideways, then the Filter and sort
 * buttons stick under the header. From 900px one bar between two rules:
 * the category tabs, then the size, price and sort menus and Hide sold out.
 */
.rua-shop-bar {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-bottom: var(--wp--preset--spacing--40);
}

.rua-shop-cats__list {
	display: flex;
	gap: 8px;
	margin: 0 calc(-1 * var(--rua-gutter));
	padding: 0 var(--rua-gutter);
	list-style: none;
	overflow-x: auto;
	/*
	 * Sideways only: overflow-x alone makes the row scroll on both axes,
	 * and a pixel of vertical overflow is enough for Chrome to hand it a
	 * vertical swipe that should scroll the page.
	 */
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scroll-padding-inline: var(--rua-gutter);
	scrollbar-width: none;
	touch-action: pan-x pan-y;
}

.rua-shop-cats__list::-webkit-scrollbar {
	display: none;
}

.rua-shop-cats__list li {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.rua-shop-cats__item {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 16px;
	border: 1px solid var(--rua-shop-line);
	border-radius: 999px;
	background: var(--rua-field);
	color: var(--wp--preset--color--contrast);
	font-size: 0.8125rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--rua-transition), color var(--rua-transition), border-color var(--rua-transition);
}

.rua-shop-cats__item:hover {
	border-color: var(--wp--preset--color--primary);
}

.rua-shop-cats__item[aria-current="page"] {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-weight: 600;
}

/* Desktop's menus; phones use the sheet. */
.rua-shop-filters {
	display: none;
}

.rua-shop-select,
.rua-shop-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	border: 1px solid var(--rua-shop-line);
	border-radius: 999px;
	background: var(--rua-field);
	color: var(--wp--preset--color--contrast);
	font-size: 0.8125rem;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color var(--rua-transition), background-color var(--rua-transition);
}

.rua-shop-select {
	padding: 0 6px 0 14px;
}

.rua-shop-select:hover,
.rua-shop-toggle:hover {
	border-color: var(--wp--preset--color--primary);
}

.rua-shop-select.is-set,
.rua-shop-toggle:has(input:checked) {
	border: 1.5px solid var(--wp--preset--color--primary);
	background: var(--rua-shop-rose);
}

.rua-shop-select__label {
	font-weight: 600;
}

.rua-shop-select select {
	height: 40px;
	padding: 0 4px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.rua-shop-select select:focus-visible {
	outline: none;
}

.rua-shop-select:focus-within {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* "Hide sold out": a checkbox drawn as a small tick box inside a pill. */
.rua-shop-toggle {
	padding: 0 14px 0 10px;
	font-weight: 500;
}

.rua-shop-toggle input {
	display: grid;
	place-content: center;
	width: 18px;
	height: 18px;
	margin: 0;
	border: 1.5px solid #b9a994;
	border-radius: 5px;
	background: var(--wp--preset--color--surface);
	appearance: none;
	cursor: pointer;
}

.rua-shop-toggle input::after {
	content: "";
	width: 9px;
	height: 5px;
	margin-top: -2px;
	border: solid var(--wp--preset--color--base);
	border-width: 0 0 2px 2px;
	transform: rotate(-45deg) scale(0);
	transition: transform 120ms ease;
}

.rua-shop-toggle input:checked {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary);
}

.rua-shop-toggle input:checked::after {
	transform: rotate(-45deg) scale(1);
}

.rua-shop-toggle input:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* For browsers without JavaScript; otherwise the menus apply as they change. */
.rua-shop-filters__apply {
	min-height: 44px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-weight: 600;
	cursor: pointer;
}

.rua-shop-filters.is-live .rua-shop-filters__apply {
	display: none;
}

/* Phones: Filter and sort, stuck under the header while the grid scrolls. */
.rua-shop-tools {
	position: sticky;
	top: var(--rua-header-offset);
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 calc(-1 * var(--rua-gutter));
	padding: 10px var(--rua-gutter);
	border-block: var(--rua-border);
	background: var(--wp--preset--color--base);
}

.rua-shop-tools__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--rua-shop-line);
	border-radius: 12px;
	background: var(--rua-field);
	color: var(--wp--preset--color--contrast);
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}

.rua-shop-tools__button--sort {
	gap: 6px;
	font-weight: 500;
}

.rua-shop-tools__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-size: 0.6875rem;
}

.rua-shop-tools__total {
	margin-left: auto;
	font-size: 0.75rem;
	color: var(--wp--preset--color--contrast-muted);
	white-space: nowrap;
}

.rua-shop-count {
	display: none;
	margin: 0 0 18px;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--contrast-muted);
}

@media (min-width: 900px) {
	.rua-shop-bar {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		margin-bottom: 18px;
		padding: 16px 0;
		border-block: var(--rua-border);
	}

	.rua-shop-cats__list {
		flex-wrap: wrap;
		margin: 0;
		padding: 0;
		overflow: visible;
	}

	.rua-shop-cats__item {
		min-height: 44px;
		padding: 0 14px;
	}

	.rua-shop-filters {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px;
		margin-left: auto;
	}

	.rua-shop-tools {
		display: none;
	}

	.rua-shop-count {
		display: block;
	}
}

/* ----------------------------------------------- filter & sort sheet -- */

/*
 * A native popover: opened by the Filter and sort buttons, closed by its
 * own button, Escape or a tap outside, with no script. A sheet from the
 * foot of the screen on phones, a centred panel on larger screens.
 */
.rua-shop-sheet {
	position: fixed;
	inset: auto 0 0;
	width: 100%;
	max-width: none;
	max-height: 88vh;
	max-height: 88dvh;
	margin: 0;
	padding: 0;
	overflow: auto;
	border: 0;
	border-radius: 26px 26px 0 0;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	overscroll-behavior: contain;
}

.rua-shop-sheet::backdrop {
	background: rgb(32 24 20 / 0.5);
}

@media (prefers-reduced-motion: no-preference) {
	.rua-shop-sheet:popover-open {
		animation: rua-sheet-up 260ms cubic-bezier(0.2, 0.7, 0.3, 1);
	}
}

/* Movement only, as the hero's words: a sheet that started transparent could be caught invisible. */
@keyframes rua-sheet-up {
	from {
		transform: translateY(40px);
	}
}

.rua-shop-sheet__form {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 8px var(--rua-gutter) calc(14px + env(safe-area-inset-bottom, 0px));
}

/* The grab handle. */
.rua-shop-sheet__form::before {
	content: "";
	align-self: center;
	width: 40px;
	height: 4px;
	border-radius: 2px;
	background: var(--rua-shop-line);
}

.rua-shop-sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.rua-shop-sheet__title {
	margin: 0;
	font-size: 1.375rem;
}

.rua-shop-sheet__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: var(--rua-border);
	border-radius: 50%;
	background: var(--rua-field);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.rua-shop-sheet__group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.rua-shop-sheet__group legend {
	margin-bottom: 6px;
	padding: 0;
	color: var(--wp--preset--color--contrast-muted);
}

.rua-shop-sheet__chips {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.rua-shop-sheet__chips--sizes {
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rua-shop-chip--wide {
	grid-column: span 2;
}

.rua-shop-chip {
	position: relative;
	display: flex;
}

.rua-shop-chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.rua-shop-chip span {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0 4px;
	border: 1px solid var(--rua-shop-line);
	border-radius: 12px;
	background: var(--rua-field);
	font-size: 0.8125rem;
	font-weight: 500;
	text-align: center;
	cursor: pointer;
}

.rua-shop-chip input:checked + span {
	border: 2px solid var(--wp--preset--color--primary);
	background: var(--rua-shop-rose);
	color: var(--wp--preset--color--primary);
	font-weight: 600;
}

.rua-shop-chip input:focus-visible + span {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.rua-shop-sheet .rua-shop-toggle {
	align-self: flex-start;
}

.rua-shop-sheet__actions {
	display: flex;
	gap: 10px;
	padding-top: 4px;
}

.rua-shop-sheet__actions .rua-button {
	min-height: 48px;
	border-radius: 14px;
}

.rua-shop-sheet__actions button.rua-button {
	flex: 1;
}

@media (min-width: 900px) {
	.rua-shop-sheet {
		inset: 0;
		width: min(480px, 100% - 2 * var(--rua-gutter));
		height: fit-content;
		margin: auto;
		border-radius: 24px;
	}
}

/* --------------------------------------------- cards in the grid ------ */

/*
 * The WhatsApp community, woven into the grid (Shop::woven_cards()) as one
 * more cell, as tall as the product photos beside it: the same ratio,
 * and not stretched to the row, which also holds the cards' three lines.
 */
.woocommerce ul.products li.rua-shop-card {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 10px;
	align-self: start;
	aspect-ratio: var(--rua-card-ratio);
	margin: 0;
	padding: 14px;
	overflow: hidden;
	border-radius: var(--rua-radius);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

.rua-shop-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-height: 0;
}

.rua-shop-card__body p {
	margin: 0;
}

.rua-shop-card__eyebrow {
	font-size: 0.625rem;
	color: var(--rua-shop-rose);
}

.rua-shop-card__title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.0625rem;
	font-style: italic;
	font-weight: 500;
	line-height: 1.25;
}

/* Room for it only from tablet width. */
.rua-shop-card__text {
	display: none;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--rua-shop-rose);
}

.rua-shop-card__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.rua-shop-card__actions .rua-button {
	gap: 6px;
	min-height: 40px;
	padding-inline: 8px;
	border-radius: 12px;
	color: var(--rua-shop-green);
	font-size: 0.6875rem;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.rua-shop-card__link {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 32px;
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.rua-shop-card__link:hover {
	text-decoration: underline;
}

@media (min-width: 700px) {
	.woocommerce ul.products li.rua-shop-card {
		gap: 14px;
		padding: 22px;
	}

	.rua-shop-card__eyebrow {
		font-size: 0.6875rem;
	}

	.rua-shop-card__title {
		font-size: 1.5rem;
		line-height: 1.2;
	}

	.rua-shop-card__text,
	.rua-shop-card__link {
		display: flex;
	}

	.rua-shop-card__actions .rua-button {
		gap: 8px;
		min-height: 44px;
		font-size: 0.8125rem;
		letter-spacing: 0.06em;
	}
}

@media (min-width: 1200px) {
	.rua-shop-card__title {
		font-size: 1.75rem;
	}
}

/* ------------------------------------------------------ load more ----- */

.rua-shop-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: var(--wp--preset--spacing--50);
}

.rua-shop-more__seen {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--contrast-muted);
}

.rua-shop-more__bar {
	width: 220px;
	height: 4px;
	border: 0;
	border-radius: 2px;
	background: var(--wp--preset--color--border);
	overflow: hidden;
	appearance: none;
}

.rua-shop-more__bar::-webkit-progress-bar {
	background: var(--wp--preset--color--border);
}

.rua-shop-more__bar::-webkit-progress-value {
	background: var(--wp--preset--color--primary);
}

.rua-shop-more__bar::-moz-progress-bar {
	background: var(--wp--preset--color--primary);
}

.rua-shop-more__next {
	width: 100%;
	margin-top: 4px;
	border-radius: 14px;
}

.rua-shop-more__next[aria-busy] {
	opacity: 0.6;
	pointer-events: none;
}

.rua-shop-more__prev {
	font-size: 0.8125rem;
	color: var(--wp--preset--color--contrast-muted);
}

@media (min-width: 600px) {
	.rua-shop-more__next {
		width: auto;
		min-width: 15rem;
	}
}

/* ---------------------------------------------------------- empty ----- */

.rua-shop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: var(--wp--preset--spacing--60) 0;
	text-align: center;
}

.rua-shop-empty p {
	margin: 0;
}

.rua-shop-empty__title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.75rem;
}

.rua-shop-empty__text {
	font-size: 0.875rem;
	color: var(--wp--preset--color--contrast-muted);
}

/* -------------------------------------------------------- reasons ----- */

.rua-shop-reasons {
	margin-top: var(--wp--preset--spacing--60);
	padding-top: var(--wp--preset--spacing--40);
	border-top: var(--rua-border);
}

.rua-shop-reasons__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rua-shop-reasons__item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.rua-shop-reasons__icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--rua-shop-rose);
	color: var(--wp--preset--color--primary);
}

.rua-shop-reasons__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

.rua-shop-reasons__title {
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.35;
}

.rua-shop-reasons__text {
	font-size: 0.75rem;
	line-height: 1.45;
	color: var(--wp--preset--color--contrast-muted);
}

@media (min-width: 900px) {
	.rua-shop-reasons__list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 24px;
	}

	.rua-shop-reasons__item {
		align-items: center;
		gap: 14px;
	}

	.rua-shop-reasons__icon {
		width: 44px;
		height: 44px;
	}

	.rua-shop-reasons__title {
		font-size: 0.875rem;
	}
}
