/* Decant — catalog M: layout, filter rail, product card, mini-cart drawer. Tokens from base.css. */

/* ---------- Layout ---------- */
.cat { padding-bottom: 72px; }
.cat-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 14px; }
.cat-head__title { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.03em; }
.cat-head__count { margin: 0; font-size: var(--fs-sm); color: var(--muted); }

.cat-tabs {
	display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 0 0 22px;
	overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs__item {
	flex: none; padding: 12px 0; font-size: var(--fs-sm); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
	white-space: nowrap; text-decoration: none !important;
}
.cat-tabs__item:hover { color: var(--text); }
.cat-tabs__item.is-active { color: var(--text); border-bottom-color: var(--tint); font-weight: 500; }

.cat-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.cat-main { min-width: 0; }

/* ---------- Filter rail ---------- */
.cat-rail {
	position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
	display: grid; gap: 22px; align-content: start; font-size: var(--fs-sm); padding-right: 6px; scrollbar-width: thin;
}
.cat-rail__head { display: none; }
.cat-facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.cat-facet__title {
	padding: 0; margin: 0 0 8px; font: 500 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.cat-check {
	display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 9px;
	padding: 4px 0; cursor: pointer; color: var(--text);
}
.cat-check input {
	appearance: none; -webkit-appearance: none; margin: 0; width: 15px; height: 15px; border: 1px solid var(--line-strong); border-radius: 4px;
	background: var(--bg) center / 11px no-repeat; cursor: pointer;
}
.cat-check input:checked {
	background-color: var(--text); border-color: var(--text);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.cat-check input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.cat-check__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-check__count { font: 400 var(--fs-xs)/1 var(--mono); color: var(--faint); }
.cat-check.is-empty { color: var(--faint); }
.cat-check:hover .cat-check__label { text-decoration: underline; text-underline-offset: 3px; }
.cat-js .cat-facet--brands:not(.is-all) .cat-check.is-more { display: none; }
.cat-facet--brands.is-searching .cat-check.is-more { display: grid; }
.cat-facet--brands .cat-check.is-hidden { display: none !important; }
.cat-facet__search {
	width: 100%; height: 34px; padding: 0 10px; margin: 0 0 6px; border: 1px solid var(--line); border-radius: var(--r-sm);
	background: var(--surface-2); font-size: var(--fs-sm);
}
.cat-facet__search:focus { outline: none; border-color: var(--text); background: var(--bg); }
.cat-facet__more {
	margin-top: 4px; padding: 4px 0; background: none; border: 0; cursor: pointer; font-size: var(--fs-sm); color: var(--muted);
	text-decoration: underline; text-underline-offset: 3px;
}
.cat-facet__more:hover { color: var(--text); }

.cat-price { display: flex; align-items: center; gap: 6px; }
.cat-price label { position: relative; flex: 1; min-width: 0; }
.cat-price__cur { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--mono); font-size: var(--fs-xs); }
.cat-price input {
	width: 100%; height: 34px; padding: 0 6px 0 20px; border: 1px solid var(--line); border-radius: var(--r-sm);
	font: 400 var(--fs-sm)/1 var(--mono); background: var(--bg); -moz-appearance: textfield;
}
.cat-price input::-webkit-outer-spin-button, .cat-price input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cat-price input:focus { outline: none; border-color: var(--text); }
.cat-price__dash { color: var(--faint); }
.cat-price__quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-price__quick .chip { height: 28px; padding: 0 10px; font-size: var(--fs-xs); font-family: var(--mono); }

.cat-rail__foot { display: grid; gap: 10px; justify-items: start; }
.cat-js .cat-rail__apply { display: none; }
.cat-rail__clear { font-size: var(--fs-sm); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Toolbar: chips + sort ---------- */
.cat-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 0 0 18px; min-height: 34px; }
.cat-bar__filters { display: none; }
.cat-bar__n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--text); color: #fff; font-size: 11px; }
.cat-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.cat-chip {
	display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-sm);
	background: var(--surface); font-size: var(--fs-xs); text-decoration: none !important; white-space: nowrap;
}
.cat-chip:hover { background: var(--line); }
.cat-chip span { color: var(--muted); font-size: 14px; line-height: 1; }
.cat-chips__clear { font-size: var(--fs-xs); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 0 4px; }
.cat-sort { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: var(--fs-sm); }
.cat-sort__label { color: var(--muted); }
.cat-sort__select {
	height: 34px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg) no-repeat right 10px center / 10px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b6b6b' stroke-width='1.4'/%3E%3C/svg%3E");
	appearance: none; -webkit-appearance: none; cursor: pointer; font-size: var(--fs-sm);
}
.cat-sort__select:focus { outline: none; border-color: var(--text); }

/* ---------- Grid + pager ---------- */
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.cat-grid.is-loading { opacity: .6; transition: opacity .2s; }
.cat-pager { display: grid; justify-items: center; gap: 16px; margin-top: 40px; }
.cat-pager__more { min-width: 220px; gap: 10px; }
.cat-pager__more.is-loading { opacity: .5; pointer-events: none; }
.cat-pager__pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: var(--fs-sm); }
.cat-pager__pages .page-numbers {
	display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: var(--r-sm);
	color: var(--muted); text-decoration: none !important;
}
.cat-pager__pages a.page-numbers:hover { background: var(--surface); color: var(--text); }
.cat-pager__pages .current { background: var(--text); color: #fff; }

.cat-empty { padding: 48px 24px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); text-align: center; display: grid; gap: 10px; justify-items: center; }
.cat-empty__title { font-size: var(--fs-xl); }
.cat-empty p { margin: 0; max-width: 46ch; }
.cat-empty__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

/* ---------- Product card (M) ---------- */
.pcard {
	border: 1px solid var(--line); border-radius: 14px; padding: 12px; gap: 8px; background: var(--bg); min-width: 0;
	transition: border-color .15s, box-shadow .2s var(--ease);
}
.pcard:hover, .pcard:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.pcard__media { position: relative; border-radius: 10px; }
.pcard__media img { padding: 8%; }
.pcard__flag {
	position: absolute; left: 8px; top: 8px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
	background: var(--bg); color: var(--muted); padding: 5px 7px; border-radius: 4px;
}
.pcard__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.pcard__brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 11px; }
a.pcard__brand:hover { color: var(--text); }
.pcard__tags { display: inline-flex; gap: 4px; flex: none; }
.pcard__tag { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); padding: 4px 5px; border-radius: 4px; }
.pcard__name { font-size: var(--fs-md); font-weight: 500; line-height: 1.25; min-height: 2.5em; overflow-wrap: anywhere; }
.pcard__name a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__buy { display: grid; gap: 8px; margin-top: auto; }
.pcard__price { margin: 0; }

.pcard__seg {
	display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
	border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
}
.pcard__size {
	display: grid; gap: 1px; justify-items: center; padding: 6px 2px; border: 0; border-right: 1px solid var(--line);
	background: var(--bg); cursor: pointer; font-size: var(--fs-xs); line-height: 1.15; min-width: 0;
}
.pcard__size:last-child { border-right: 0; }
.pcard__size span { white-space: nowrap; font-weight: 500; }
.pcard__size small { font: 400 10px/1.1 var(--mono); color: var(--muted); white-space: nowrap; }
.pcard__size:hover:not(:disabled) { background: var(--surface); }
.pcard__size.is-on, .pcard__size[aria-pressed="true"] { background: var(--tint-ink); color: #fff; }
.pcard__size.is-on small, .pcard__size[aria-pressed="true"] small { color: var(--tint-light); }
.pcard__size:disabled { cursor: not-allowed; color: var(--faint); background: var(--surface-2); }
.pcard__size:disabled span { text-decoration: line-through; }
.pcard__size:focus-visible { outline: 2px solid var(--text); outline-offset: -3px; border-radius: 6px; }

.pcard__add {
	display: flex; align-items: center; justify-content: center; gap: 5px; height: 38px; width: 100%; padding: 0 10px;
	border: 1px solid var(--accent); border-radius: 9px; background: var(--accent); color: var(--accent-ink);
	font-size: var(--fs-sm); font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap;
	transition: opacity .15s, transform .15s var(--ease);
}
.pcard__add:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pcard__add:active { transform: scale(.98); }
.pcard__add:disabled { background: var(--surface); border-color: var(--line); color: var(--faint); cursor: not-allowed; opacity: 1; }
.pcard__add--ghost { background: var(--bg); color: var(--text); border-color: var(--line-strong); }
.pcard__add.is-loading { opacity: .6; pointer-events: none; }
.pcard__add.is-loading::before {
	content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
	animation: cat-spin .7s linear infinite;
}
.pcard__add.is-done { background: var(--good); border-color: var(--good); }
@keyframes cat-spin { to { transform: rotate(360deg); } }

.pcard.is-oos .pcard__media img { opacity: .45; filter: grayscale(1); }
.pcard.is-oos .pcard__name, .pcard.is-oos .pcard__meta { opacity: .6; }

/* ---------- Mini-cart drawer ---------- */
.mcart { position: fixed; inset: 0; z-index: 120; }
.mcart[hidden] { display: none; }
.mcart__overlay { position: absolute; inset: 0; background: rgba(10,10,10,.32); opacity: 0; transition: opacity .25s; }
.mcart__panel {
	position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--bg); box-shadow: var(--shadow-lg);
	display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s var(--ease); outline: none;
}
.mcart.is-open .mcart__overlay { opacity: 1; }
.mcart.is-open .mcart__panel { transform: none; }
.mcart__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.mcart__title { font-size: var(--fs-lg); font-weight: 600; }
.mcart__count { font: 400 var(--fs-sm)/1 var(--mono); color: var(--muted); margin-left: 4px; }
.mcart__ship { padding: 14px 20px; font-size: var(--fs-sm); color: var(--muted); border-bottom: 1px solid var(--line); }
.mcart__ship:empty { display: none; }
.mcart__ship b { color: var(--text); font-weight: 500; }
.mcart__bar { height: 6px; background: var(--surface); border-radius: 6px; margin-top: 8px; overflow: hidden; }
.mcart__bar i { display: block; height: 100%; background: var(--good); border-radius: 6px; transition: width .4s var(--ease); }
.mcart__items { list-style: none; margin: 0; padding: 8px 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.mcart__item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.mcart__item:last-child { border-bottom: 0; }
.mcart__item.is-busy { opacity: .5; pointer-events: none; }
.mcart__img { width: 64px; height: 64px; border-radius: var(--r-sm); background: var(--surface); overflow: hidden; display: block; }
.mcart__img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; padding: 6px; }
.mcart__info { min-width: 0; display: grid; gap: 2px; }
.mcart__brand { font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mcart__name { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcart__size { font-size: var(--fs-xs); color: var(--muted); }
.mcart__qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-pill); margin-top: 6px; width: max-content; }
.mcart__qty button { width: 28px; height: 28px; border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; border-radius: var(--r-pill); }
.mcart__qty button:hover { background: var(--surface); }
.mcart__qty output { min-width: 22px; text-align: center; font: 500 var(--fs-sm)/1 var(--mono); }
.mcart__side { display: grid; justify-items: end; gap: 6px; }
.mcart__price { font: 500 var(--fs-sm)/1.2 var(--mono); }
.mcart__remove { background: none; border: 0; padding: 0; cursor: pointer; font-size: var(--fs-xs); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.mcart__remove:hover { color: var(--bad); }
.mcart__empty { padding: 40px 20px; text-align: center; color: var(--muted); flex: 1; }
.mcart__empty[hidden] { display: none; }
.mcart__foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; display: grid; gap: 10px; }
.mcart__foot[hidden] { display: none; }
.mcart__total { display: flex; justify-content: space-between; font-weight: 600; }
.mcart__deals:empty { display: none; }
.mcart__deals { display: grid; gap: 6px; margin-bottom: 10px; font-size: var(--fs-sm); }
.mcart__deal { display: flex; justify-content: space-between; gap: 12px; color: var(--accent); font-weight: 500; }
.mcart__nudge { margin: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--tint-wash); color: var(--tint-ink); }
.mcart__nudge b { font-weight: 600; }
.mcart__note { margin: 0; font-size: var(--fs-xs); }
.mcart__view { text-align: center; font-size: var(--fs-sm); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
html.mcart-lock, html.cat-lock { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
	.cat-body { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
	.cat-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (max-width: 900px) {
	.cat-body { display: block; }
	.cat-bar__filters { display: inline-flex; }
	.cat-sort__label { display: none; }
	.cat-bar { position: sticky; top: var(--header-h); z-index: 20; background: var(--bg); padding: 8px 0; margin-bottom: 10px; }
	.cat-chips { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.cat-chips::-webkit-scrollbar { display: none; }
	.cat-rail {
		position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 110; max-height: 86vh; overflow-y: auto;
		background: var(--bg); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
		padding: 0 var(--gutter) 0; gap: 20px; transform: translateY(105%); transition: transform .3s var(--ease); visibility: hidden;
	}
	.cat-rail.is-open { transform: none; visibility: visible; }
	.cat-rail__head {
		display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
		background: var(--bg); padding: 12px 0 8px; border-bottom: 1px solid var(--line);
	}
	.cat-rail__title { font-size: var(--fs-lg); }
	.cat-rail__foot { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 16px; border-top: 1px solid var(--line); justify-items: stretch; text-align: center; }
	.cat-js .cat-rail__apply { display: inline-flex; }
	.cat-check { padding: 7px 0; }
	.cat-sheet-backdrop { position: fixed; inset: 0; z-index: 105; background: rgba(10,10,10,.32); }
	.cat-sheet-backdrop[hidden] { display: none; }
	.cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 560px) {
	.pcard { padding: 8px; gap: 6px; border-radius: var(--r-md); }
	.pcard__size small { display: none; }
	.pcard__size { padding: 7px 0; }
	.pcard__tags .pcard__tag + .pcard__tag { display: none; }
	.pcard__name { font-size: var(--fs-sm); }
	.pcard__add { height: 36px; font-size: var(--fs-xs); padding: 0 6px; }
	.cat-head__title { font-size: var(--fs-xl); }
	.cat-tabs { gap: 18px; margin-bottom: 14px; }
}
