/* ==========================================================================
   Smart Jhuri — product grid + card
   ========================================================================== */

.sj-products {
	padding: 40px 0;
}

/* -------------------------------------------------------- Section heading */

.sj-products__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 22px;
}

.sj-products__title {
	position: relative;
	margin: 0;
	padding-bottom: 10px;
	font-family: var(--sj-font-head);
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -.02em;
	color: var(--sj-ink);
}

/* Short brand underline under the heading. */
.sj-products__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 52px;
	height: 3px;
	border-radius: 3px;
	background: var(--sj-orange);
}

.sj-products__subtitle {
	margin: 6px 0 0;
	font-size: 14px;
	color: var(--sj-muted);
}

.sj-products__tools {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
}

/* Slider arrows sit next to the heading, beside "View All". */
.sj-products__nav {
	display: none;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--sj-line);
	border-radius: 50%;
	background: #fff;
	color: var(--sj-ink);
	cursor: pointer;
	transition: background var(--sj-ease), border-color var(--sj-ease), color var(--sj-ease);
}
.sj-products.has-nav .sj-products__nav { display: grid; }

.sj-products__nav:hover:not([disabled]) {
	background: var(--sj-orange-50);
	border-color: var(--sj-orange);
	color: var(--sj-orange);
}
.sj-products__nav[disabled] { opacity: .35; cursor: default; }
.sj-products__nav[data-sj-slider-prev] svg { transform: rotate(180deg); }

.sj-products__all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	height: 38px;
	padding: 0 16px;
	border: 1px solid var(--sj-line);
	border-radius: 999px;
	background: #fff;
	color: var(--sj-blue);
	font-family: var(--sj-font-head);
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	transition: background var(--sj-ease), border-color var(--sj-ease), color var(--sj-ease);
}
.sj-products__all:hover {
	background: var(--sj-blue);
	border-color: var(--sj-blue);
	color: #fff;
}

/* ------------------------------------------------------------------- Grid */

.sj-products__grid {
	display: grid;
	grid-template-columns: repeat(var(--sj-cols, 5), minmax(0, 1fr));
	gap: 18px;
}

/* ----------------------------------------------------------------- Slider */

.sj-products__grid.is-slider {
	--sj-view: var(--sj-cols, 5);

	display: flex;
	grid-template-columns: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	padding-bottom: 4px;
	/* The script owns the sideways drag; the browser keeps page scrolling. */
	touch-action: pan-y;
	scrollbar-width: none;
}
.sj-products__grid.is-slider::-webkit-scrollbar { display: none; }

.sj-products.has-nav .sj-products__grid.is-slider { cursor: grab; }
.sj-products__grid.is-slider.is-grabbing { cursor: grabbing; user-select: none; }

.sj-products__grid.is-slider .sj-card {
	flex: 0 0 calc((100% - (var(--sj-view) - 1) * 18px) / var(--sj-view));
	scroll-snap-align: start;
}

/* Lift is disabled in the slider: it clips against the scroll container. */
.sj-products__grid.is-slider .sj-card:hover { transform: none; }


/* ------------------------------------------------------------------- Card */

.sj-card {
	display: flex;
	flex-direction: column;
	position: relative;
	background: #fff;
	border: 1px solid var(--sj-line);
	border-radius: var(--sj-radius);
	overflow: hidden;
	transition: box-shadow var(--sj-ease), border-color var(--sj-ease), transform var(--sj-ease);
}
.sj-card:hover {
	border-color: transparent;
	box-shadow: var(--sj-shadow-md);
	transform: translateY(-3px);
}

/* --- Media ------------------------------------------------------------- */

.sj-card__media {
	position: relative;
	overflow: hidden;
	background: var(--sj-soft);
}

.sj-card__thumb {
	display: block;
	position: relative;
	/* Square media keeps every card in a row the same height. */
	aspect-ratio: 1 / 1;
}

.sj-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 10px;
	transition: opacity var(--sj-ease), transform 300ms cubic-bezier(.4, 0, .2, 1);
}

.sj-card:hover .sj-card__img { transform: scale(1.05); }

.sj-card__img--hover { opacity: 0; }
.sj-card:hover .sj-card__img--hover { opacity: 1; }

.sj-card.is-out .sj-card__img { opacity: .55; filter: grayscale(.4); }

/* --- Badges ------------------------------------------------------------ */

.sj-card__badges {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
}

.sj-badge {
	display: inline-flex;
	align-items: center;
	height: 22px;
	padding: 0 8px;
	border-radius: 999px;
	font-family: var(--sj-font-head);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .01em;
	color: #fff;
}

.sj-badge--sale { background: var(--sj-orange); }
.sj-badge--new  { background: var(--sj-green); }
.sj-badge--out  { background: var(--sj-ink); }

/* --- Quick view --------------------------------------------------------- */

.sj-card__quick {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	border-radius: var(--sj-radius-sm);
	background: rgba(15, 23, 42, .86);
	color: #fff;
	font-family: var(--sj-font-head);
	font-size: 12.5px;
	font-weight: 600;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity var(--sj-ease), transform var(--sj-ease);
}
.sj-card:hover .sj-card__quick,
.sj-card:focus-within .sj-card__quick {
	opacity: 1;
	transform: translateY(0);
	color: #fff;
}

/* --- Body --------------------------------------------------------------- */

.sj-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 6px;
	padding: 12px 12px 14px;
}

.sj-card__cat {
	font-family: var(--sj-font-head);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--sj-muted);
}
.sj-card__cat:hover { color: var(--sj-blue); }

.sj-card__title {
	margin: 0;
	font-family: var(--sj-font-body);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	/* Two lines, so titles of different lengths still align. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.8em;
}
.sj-card__title a { color: var(--sj-ink); }
.sj-card__title a:hover { color: var(--sj-blue); }

/* --- Rating ------------------------------------------------------------- */

.sj-card__rating {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 18px;
}

.sj-card__stars {
	display: inline-flex;
	gap: 1px;
}

.sj-card__star {
	color: var(--sj-line);
	fill: currentColor;
	stroke-width: 1;
}
.sj-card__star.is-on { color: #FBBF24; }

.sj-card__reviews {
	font-size: 11.5px;
	color: var(--sj-muted);
}

/* --- Price -------------------------------------------------------------- */

.sj-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px;
	margin-top: auto;
	padding-top: 4px;
	font-family: var(--sj-font-head);
	font-size: 16px;
	font-weight: 700;
	color: var(--sj-orange);
	line-height: 1.3;
}

/*
 * WooCommerce emits the old price (<del>) before the new one (<ins>). Shops
 * read better with the payable price first, so reorder visually with flex —
 * DOM order is untouched, so screen readers still get WooCommerce's intended
 * sequence and its screen-reader-text explanation.
 */
.sj-card__price ins { order: 1; text-decoration: none; color: var(--sj-orange); }
.sj-card__price del { order: 2; }
.sj-card__price .screen-reader-text { order: 3; }

.sj-card__price del {
	font-size: 13px;
	font-weight: 500;
	color: var(--sj-muted);
	text-decoration: line-through;
}
.sj-card__price .woocommerce-Price-currencySymbol { font-weight: 600; }

/* --- Actions ------------------------------------------------------------ */

/*
 * Full-width and stacked at every breakpoint. Side by side, "Add to Cart"
 * wrapped onto two lines inside a ~200px card column, which read as broken
 * next to the single-line Buy Now.
 */
.sj-card__actions {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	margin-top: 10px;
}

.sj-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	padding: 0 8px;
	border: 1px solid transparent;
	border-radius: var(--sj-radius-sm);
	font-family: var(--sj-font-head);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	cursor: pointer;
	transition: background var(--sj-ease), color var(--sj-ease), border-color var(--sj-ease);
}

.sj-card__btn .sj-icon { flex: none; }

/* Colours come from the Customizer so cards and the product page match. */
.sj-card__btn--cart {
	background: var(--sj-btn-cart-bg);
	border-color: var(--sj-btn-cart-border);
	color: var(--sj-btn-cart-text);
}

.sj-card__btn--buy {
	background: var(--sj-btn-buy-bg);
	border-color: var(--sj-btn-buy-bg);
	color: var(--sj-btn-buy-text);
}

/* Hover colours are their own Customizer settings rather than a blanket
   brightness filter, so a shop can invert a button on hover instead of only
   darkening it. */
.sj-card__btn--cart:hover {
	background: var(--sj-btn-cart-bg-hover);
	border-color: var(--sj-btn-cart-border-hover);
	color: var(--sj-btn-cart-text-hover);
}

.sj-card__btn--buy:hover {
	background: var(--sj-btn-buy-bg-hover);
	border-color: var(--sj-btn-buy-bg-hover);
	color: var(--sj-btn-buy-text-hover);
}

/* Defensive: if any plugin injects WooCommerce's post-add "View cart" link
   into the action row, keep it out of the two-button grid. The toast already
   offers a cart link. */
.sj-card__actions .added_to_cart { display: none; }

.sj-card__btn[disabled] {
	opacity: .5;
	cursor: not-allowed;
}

/* Loading / done states driven by the AJAX handler. */
.sj-card__btn.is-loading {
	pointer-events: none;
	opacity: .75;
}
.sj-card__btn.is-loading .sj-icon { animation: sj-spin 700ms linear infinite; }

.sj-card__btn.is-added {
	background: var(--sj-green);
	border-color: var(--sj-green);
	color: #fff;
}

@keyframes sj-spin {
	to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ Toast */

.sj-toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1200;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: min(360px, calc(100vw - 40px));
	padding: 13px 16px;
	border-radius: var(--sj-radius);
	background: var(--sj-ink);
	color: #fff;
	font-family: var(--sj-font-head);
	font-size: 13.5px;
	font-weight: 500;
	box-shadow: var(--sj-shadow-lg);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 200ms cubic-bezier(.4, 0, .2, 1), transform 200ms cubic-bezier(.4, 0, .2, 1);
}
.sj-toast.is-visible { opacity: 1; transform: translateY(0); }
.sj-toast__icon { color: var(--sj-green); flex: none; }
.sj-toast--error .sj-toast__icon { color: var(--sj-orange); }
.sj-toast a { color: #fff; text-decoration: underline; }

/* ----------------------------------------------------------- Breakpoints */

@media (max-width: 1199px) {
	.sj-products__grid { grid-template-columns: repeat(min(var(--sj-cols, 5), 4), minmax(0, 1fr)); }
	.sj-products__grid.is-slider { --sj-view: min(var(--sj-cols, 5), 4); }
}

@media (max-width: 991px) {
	.sj-products__grid { grid-template-columns: repeat(min(var(--sj-cols, 5), 3), minmax(0, 1fr)); }
	.sj-products__grid.is-slider { --sj-view: min(var(--sj-cols, 5), 3); }
	.sj-products__title { font-size: 21px; }
}

@media (max-width: 767px) {
	.sj-products { padding: 28px 0; }
	.sj-products__grid {
		grid-template-columns: repeat(min(var(--sj-cols, 5), 2), minmax(0, 1fr));
		gap: 12px;
	}
	.sj-products__grid.is-slider {
		--sj-view: min(var(--sj-cols, 5), 2);
		gap: 12px;
	}
	.sj-products__grid.is-slider .sj-card {
		flex-basis: calc((100% - (var(--sj-view) - 1) * 12px) / var(--sj-view));
	}
	.sj-products__nav { width: 34px; height: 34px; }
	.sj-products__head { margin-bottom: 16px; }
	.sj-products__title { font-size: 19px; }
	.sj-products__all { height: 34px; padding: 0 13px; font-size: 12.5px; }

	.sj-card__body { padding: 10px 10px 12px; gap: 5px; }
	.sj-card__title { font-size: 13px; }
	.sj-card__price { font-size: 15px; }

	.sj-card__actions { gap: 6px; }
	.sj-card__btn { min-height: 36px; font-size: 12.5px; }

	/* Hover has no meaning on touch. */
	.sj-card__quick { display: none; }
	.sj-card__img--hover { display: none; }

	.sj-toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

@media (max-width: 400px) {
	.sj-products__grid { gap: 10px; }
	.sj-card__title { font-size: 12.5px; }
	.sj-card__btn { font-size: 11.5px; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
	.sj-card,
	.sj-card__img,
	.sj-card__quick,
	.sj-toast { transition: none; }
	.sj-card:hover { transform: none; }
	.sj-card:hover .sj-card__img { transform: none; }
	.sj-card__btn.is-loading .sj-icon { animation: none; }
}

/* ==========================================================================
   Variation picker modal
   ========================================================================== */

.sj-modal {
	position: fixed;
	inset: 0;
	z-index: 1300;
	display: grid;
	place-items: center;
	padding: 20px;
}
.sj-modal[hidden] { display: none; }

.sj-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	opacity: 0;
	transition: opacity 200ms cubic-bezier(.4, 0, .2, 1);
}
.sj-modal.is-open .sj-modal__backdrop { opacity: 1; }

.sj-modal__dialog {
	position: relative;
	width: min(620px, 100%);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 22px 24px 24px;
	background: #fff;
	border-radius: 16px;
	box-shadow: var(--sj-shadow-lg);
	opacity: 0;
	transform: translateY(14px) scale(.98);
	transition: opacity 200ms cubic-bezier(.4, 0, .2, 1), transform 200ms cubic-bezier(.4, 0, .2, 1);
}
.sj-modal.is-open .sj-modal__dialog {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.sj-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 16px;
	margin-bottom: 18px;
	border-bottom: 1px solid var(--sj-line);
}

.sj-modal__title {
	margin: 0;
	font-family: var(--sj-font-head);
	font-size: 21px;
	font-weight: 700;
	color: var(--sj-ink);
}

.sj-modal__sub {
	margin: 4px 0 0;
	font-size: 13.5px;
	color: var(--sj-muted);
}

.sj-modal__close {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	flex: none;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sj-soft);
	color: var(--sj-ink);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.sj-modal__close:hover { background: var(--sj-blue-50); color: var(--sj-blue); }

.sj-modal__body {
	display: grid;
	grid-template-columns: 180px 1fr;
	gap: 20px;
	align-items: start;
}

.sj-modal.is-loading .sj-modal__body { opacity: .3; pointer-events: none; }

.sj-modal__loading {
	display: none;
	padding: 10px 0 0;
	font-size: 13.5px;
	color: var(--sj-muted);
}
.sj-modal.is-loading .sj-modal__loading { display: block; }

.sj-modal__media {
	border: 1px solid var(--sj-line);
	border-radius: var(--sj-radius);
	background: var(--sj-soft);
	overflow: hidden;
	aspect-ratio: 1 / 1;
}

.sj-modal__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sj-modal__info {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}

.sj-modal__name {
	margin: 0;
	font-family: var(--sj-font-head);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--sj-ink);
}

.sj-modal__field {
	display: block;
}

.sj-modal__field-label {
	display: block;
	margin-bottom: 6px;
	font-family: var(--sj-font-head);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--sj-muted);
}

.sj-modal__select {
	appearance: none;
	-webkit-appearance: none;
	width: 100%;
	height: 46px;
	padding: 0 38px 0 14px;
	border: 1.5px solid var(--sj-orange);
	border-radius: var(--sj-radius-sm);
	background-color: #fff;
	/* Inline chevron, so the select needs no extra wrapper element. */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	font-family: var(--sj-font-body);
	font-size: 14.5px;
	color: var(--sj-ink);
	cursor: pointer;
}
.sj-modal__select:focus { outline: 2px solid var(--sj-blue); outline-offset: 1px; }

.sj-modal__attrs {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sj-modal__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px;
	font-family: var(--sj-font-head);
	font-size: 22px;
	font-weight: 700;
	color: var(--sj-orange);
}

/* Payable price first, same as the card. DOM order stays as WooCommerce
   emits it, so screen readers keep its explanatory text. */
.sj-modal__price ins { order: 1; text-decoration: none; color: var(--sj-orange); }
.sj-modal__price del { order: 2; }
.sj-modal__price .screen-reader-text { order: 3; }

.sj-modal__price del {
	font-size: 15px;
	font-weight: 500;
	color: var(--sj-muted);
	text-decoration: line-through;
}

.sj-modal__stock {
	margin: 0;
	min-height: 18px;
	font-size: 13px;
	color: var(--sj-muted);
}

.sj-modal__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 48px;
	padding: 0 18px;
	border: 0;
	border-radius: var(--sj-radius-sm);
	background: var(--sj-orange);
	color: #fff;
	font-family: var(--sj-font-head);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--sj-ease);
}
.sj-modal__add:hover:not([disabled]) { background: var(--sj-orange-600); }
.sj-modal__add[disabled] {
	background: var(--sj-soft);
	color: var(--sj-muted);
	cursor: not-allowed;
}
.sj-modal__add.is-loading .sj-icon { animation: sj-spin 700ms linear infinite; }

.sj-modal__link {
	align-self: flex-start;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--sj-blue);
	text-decoration: underline;
}

body.sj-modal-open { overflow: hidden; }

@media (max-width: 575px) {
	.sj-modal { padding: 12px; }
	.sj-modal__dialog { padding: 18px 16px 20px; border-radius: 14px; }
	.sj-modal__body { grid-template-columns: 1fr; gap: 14px; }
	.sj-modal__media { width: 140px; margin: 0 auto; }
	.sj-modal__title { font-size: 18px; }
	.sj-modal__price { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
	.sj-modal__dialog,
	.sj-modal__backdrop { transition: none; }
	.sj-modal__add.is-loading .sj-icon { animation: none; }
}


/* ==========================================================================
   Breadcrumb bar — shared by the product page and the archives
   ========================================================================== */

.sj-crumbs {
	background: var(--sj-orange-50);
	border-bottom: 1px solid rgba(255, 122, 0, .18);
	margin-bottom: 26px;
}

.sj-crumbs__inner {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	min-height: 46px;
	font-size: 13.5px;
	color: var(--sj-muted);
}

.sj-crumbs__home { display: inline-flex; color: var(--sj-muted); }
.sj-crumbs__home:hover { color: var(--sj-orange); }

.sj-crumbs__trail {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.sj-crumbs__trail a { color: var(--sj-body); }
.sj-crumbs__trail a:hover { color: var(--sj-orange); }
.sj-crumbs__sep { color: var(--sj-line); }

@media (max-width: 767px) {
	.sj-crumbs { margin-bottom: 18px; }
	.sj-crumbs__inner { min-height: 42px; font-size: 12.5px; }
}
