/* ==========================================================================
 * ORESA Storefront · FACETAS (F5 · DoD #1) — sidebar + drawer + chips.
 * Consume tokens de tokens.css. Borde de controles = --oresa-control-border
 * (#8a8172, ≥3:1 s/blanco, SC 1.4.11) — el #e7e2d9 falla y queda decorativo.
 * ======================================================================== */

/* Layout 2 columnas: sidebar 288px + grid. */
.oresa-shop {
	display: grid;
	grid-template-columns: 288px minmax(0, 1fr);
	gap: 2rem;
	align-items: start;
}
.oresa-shop__results { min-width: 0; }

/* --- Sidebar (desktop, sticky) --- */
.oresa-facets {
	position: sticky;
	top: 16px;
	background: var(--oresa-color-background);
	border: 1px solid var(--oresa-color-border);
	border-radius: var(--oresa-radius-lg);
	padding: 1.25rem 1.15rem;
	box-shadow: var(--oresa-shadow-soft);
}
.oresa-facets__drawerbar { display: none; }
.oresa-facets__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 1rem;
	padding-bottom: .75rem;
	border-bottom: 1px solid var(--oresa-color-border);
}
.oresa-facets__title {
	font-family: var(--oresa-font-heading);
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--oresa-color-heading);
	margin: 0;
}
.oresa-facets__clear {
	font-size: .82rem;
	font-weight: 600;
	color: var(--oresa-color-rust);
}
.oresa-facets__clear:hover { color: var(--oresa-color-rust-deep); text-decoration: underline; }

.oresa-facet { margin-bottom: 1.35rem; }
.oresa-facet__label {
	font-family: var(--oresa-font-heading);
	font-size: .82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--oresa-color-heading);
	margin: 0 0 .6rem;
}
.oresa-facet__count { color: #6b6255; font-size: .8rem; }

/* --- Segmented (Personalización) --- */
.oresa-seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.oresa-seg__opt {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	min-height: 36px;
	padding: .35rem .7rem;
	border: 1px solid var(--oresa-control-border);
	border-radius: var(--oresa-radius-pill);
	font-size: .84rem;
	font-weight: 600;
	color: var(--oresa-color-text);
	background: #fff;
	line-height: 1.1;
}
.oresa-seg__opt:hover { border-color: var(--oresa-color-navy); }
.oresa-seg__opt.is-active {
	background: var(--oresa-color-navy);
	border-color: var(--oresa-color-navy);
	color: #fff;
}
.oresa-seg__opt.is-active .oresa-facet__count { color: #d8dce6; }
.oresa-seg__opt.is-disabled { opacity: .4; pointer-events: none; }

/* --- Checkboxes (Material / Capacidad) --- */
.oresa-facet__list { list-style: none; margin: 0; padding: 0; }
.oresa-facet__item { margin: 0; }
.oresa-facet__opt {
	display: flex;
	align-items: center;
	gap: .55rem;
	min-height: 32px;
	padding: .3rem .25rem;
	color: var(--oresa-color-text);
	font-size: .9rem;
}
.oresa-facet__opt:hover .oresa-facet__name { color: var(--oresa-color-navy); }
.oresa-facet__box {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--oresa-control-border);
	border-radius: 5px;
	background: #fff;
	position: relative;
}
.oresa-facet__opt[aria-checked="true"] .oresa-facet__box {
	background: var(--oresa-color-navy);
	border-color: var(--oresa-color-navy);
}
.oresa-facet__opt[aria-checked="true"] .oresa-facet__box::after {
	content: "";
	position: absolute;
	left: 6px; top: 2px;
	width: 5px; height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.oresa-facet__name { flex: 1; }
.oresa-facet__item.is-disabled .oresa-facet__opt { opacity: .38; pointer-events: none; }

/* --- Swatches (Color) --- */
.oresa-swatches {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; gap: .5rem;
}
.oresa-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px; height: 34px;
	border-radius: 50%;
	border: 1px solid var(--oresa-control-border);
	padding: 3px;
	background: #fff;
}
.oresa-swatch__chip {
	display: block;
	width: 100%; height: 100%;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.oresa-swatch:hover { border-color: var(--oresa-color-navy); }
.oresa-swatch.is-active {
	border-color: var(--oresa-color-navy);
	box-shadow: 0 0 0 2px var(--oresa-color-navy);
}
.oresa-swatch__item.is-disabled .oresa-swatch { opacity: .35; pointer-events: none; }

/* --- Precio --- */
.oresa-price__inputs { display: flex; gap: .6rem; }
.oresa-price__field {
	flex: 1;
	display: flex; flex-direction: column;
	font-size: .74rem; font-weight: 600; color: #6b6255; gap: .2rem;
}
.oresa-price__field input {
	min-height: 40px;
	border: 1px solid var(--oresa-control-border);
	border-radius: var(--oresa-radius);
	padding: .3rem .5rem;
	font-size: .9rem;
}
.oresa-price__apply,
.oresa-facets__apply {
	margin-top: .6rem;
	min-height: 40px;
	width: 100%;
	background: var(--oresa-color-navy);
	color: #fff;
	border: none;
	border-radius: var(--oresa-radius);
	font-weight: 600;
	cursor: pointer;
}
.oresa-price__apply:hover, .oresa-facets__apply:hover { background: var(--oresa-color-primary-hover); }

/* --- Chips de filtros activos --- */
.oresa-chips {
	display: flex; flex-wrap: wrap; gap: .5rem;
	margin: 0 0 1.1rem;
}
.oresa-chip {
	display: inline-flex; align-items: center; gap: .4rem;
	min-height: 32px;
	padding: .3rem .7rem;
	background: var(--oresa-color-surface);
	border: 1px solid var(--oresa-control-border);
	border-radius: var(--oresa-radius-pill);
	font-size: .82rem; font-weight: 600;
	color: var(--oresa-color-heading);
}
.oresa-chip:hover { border-color: var(--oresa-color-rust); color: var(--oresa-color-rust); }
.oresa-chip__x {
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; margin-right: -.35rem;
	font-size: 1.15rem; line-height: 1; color: #6b6255;
}
.oresa-chip--clear {
	background: transparent;
	border-style: dashed;
	color: var(--oresa-color-rust);
}

/* --- Estado empty --- */
.oresa-empty {
	padding: 3rem 1rem; text-align: center;
	background: var(--oresa-color-surface);
	border-radius: var(--oresa-radius-lg);
}
.oresa-empty__title { font-weight: 700; font-size: 1.1rem; color: var(--oresa-color-heading); margin: 0 0 .5rem; }
.oresa-empty__hint a { color: var(--oresa-color-rust); text-decoration: underline; }

/* --- Barra mobile (oculta en desktop) --- */
.oresa-mobilebar { display: none; }
.oresa-mobilebar__badge {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 20px; height: 20px; padding: 0 .35rem; margin-left: .35rem;
	background: var(--oresa-color-rust); color: #fff;
	border-radius: 999px; font-size: .74rem; font-weight: 700;
}

/* --- Accesibilidad: foco visible (SC 2.4.7) --- */
.oresa-facets a:focus-visible,
.oresa-facets button:focus-visible,
.oresa-chip:focus-visible,
.oresa-mobilebar__btn:focus-visible {
	outline: 3px solid var(--oresa-color-navy);
	outline-offset: 2px;
}
.oresa-facet__opt,
.oresa-seg__opt,
.oresa-swatch,
.oresa-chip { scroll-margin-top: 120px; } /* foco no tapado por header sticky (SC 2.4.11) */

/* ==========================================================================
 * MOBILE: bottom-sheet drawer (≤860px, ~55% del tráfico).
 * ======================================================================== */
@media (max-width: 860px) {
	.oresa-shop { grid-template-columns: 1fr; gap: 1rem; }

	.oresa-mobilebar { display: flex; gap: .6rem; margin-bottom: .9rem; }
	.oresa-mobilebar__btn {
		flex: 1;
		min-height: 44px;
		display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
		background: #fff;
		border: 1px solid var(--oresa-control-border);
		border-radius: var(--oresa-radius);
		font-weight: 700; color: var(--oresa-color-heading);
		cursor: pointer;
	}

	/* El aside pasa a bottom-sheet fijo, oculto hasta .is-open */
	.oresa-facets {
		position: fixed;
		left: 0; right: 0; bottom: 0;
		top: auto;
		max-height: 85vh;
		overflow-y: auto;
		border-radius: var(--oresa-radius-lg) var(--oresa-radius-lg) 0 0;
		box-shadow: 0 -8px 30px rgba(34,49,79,.22);
		transform: translateY(100%);
		transition: transform .25s ease;
		z-index: 120;
	}
	.oresa-facets.is-open { transform: translateY(0); }
	.oresa-facets__drawerbar {
		display: flex; align-items: center; justify-content: space-between;
		position: sticky; top: 0;
		margin: -1.25rem -1.15rem 1rem;
		padding: 1rem 1.15rem;
		background: #fff;
		border-bottom: 1px solid var(--oresa-color-border);
	}
	.oresa-facets__drawerbar::before {
		content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
		width: 40px; height: 4px; border-radius: 999px; background: var(--oresa-color-border);
	}
	.oresa-facets__drawertitle { font-family: var(--oresa-font-heading); font-weight: 700; color: var(--oresa-color-heading); }
	.oresa-facets__close {
		width: 44px; height: 44px; border: none; background: transparent;
		font-size: 1.6rem; line-height: 1; color: var(--oresa-color-heading); cursor: pointer;
	}
	.oresa-facets__scrim {
		position: fixed; inset: 0; background: rgba(20,26,40,.5);
		z-index: 110;
	}
	.oresa-facets__scrim[hidden] { display: none; }

	/* Targets táctiles 44px en el drawer (supera SC 2.5.8) */
	.oresa-facet__opt { min-height: 44px; }
	.oresa-seg__opt { min-height: 44px; }
	.oresa-swatch { width: 40px; height: 40px; }
}
