/**
 * Fibre Systems Core — product card + grid.
 *
 * Light-on-dark by default (product pages use a dark background). Colours are exposed as
 * --fsc-card-* variables so a light section can re-theme without editing this file.
 * A few properties use !important where Elementor/theme WooCommerce rules would otherwise win.
 */
.fsc-grid {
	--fsc-card-bg: rgba( 255, 255, 255, 0.04 );
	--fsc-card-border: rgba( 255, 255, 255, 0.14 );
	--fsc-card-title: #ffffff;
	--fsc-card-muted: rgba( 255, 255, 255, 0.65 );
	--fsc-card-accent: #4ea3ff;
	--fsc-btn-bg: rgba( 255, 255, 255, 0.10 );
	--fsc-btn-bg-hover: rgba( 255, 255, 255, 0.20 );
	--fsc-btn-color: #ffffff;

	display: grid;
	grid-template-columns: repeat( var( --fsc-cols, 4 ), minmax( 0, 1fr ) );
	gap: 16px;
}

/* Responsive by default (shortcode path). The Elementor widget sets its own
   responsive columns via its controls, which override these. */
@media ( max-width: 1024px ) {
	.fsc-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

@media ( max-width: 560px ) {
	.fsc-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) ) !important;
		gap: 10px !important; /* tighter on phones so the 2 cards are as big as possible */
	}
}

.fsc-card {
	display: flex;
	flex-direction: column;
	background: var( --fsc-card-bg );
	border: 1px solid var( --fsc-card-border );
	border-radius: 14px;
	overflow: hidden;
	transition: transform 0.18s ease, border-color 0.18s ease;
}

.fsc-card:hover {
	transform: translateY( -3px );
	border-color: var( --fsc-card-accent );
}

.fsc-card__media {
	display: block;
	position: relative; /* anchor for the badge overlay */
	aspect-ratio: 4 / 3;
	background: #ffffff;
}

/* ---------- Product badges (client-managed coloured pills) ---------- */
.fsc-badges {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	max-width: calc( 100% - 16px );
	pointer-events: none; /* clicks fall through to the product link */
}

.fsc-badge {
	display: inline-block;
	padding: 3px 9px;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	line-height: 1.35;
	text-transform: uppercase;
	border-radius: 999px;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.25 );
}

.fsc-single__image {
	position: relative; /* anchor for the badge overlay on the single product */
}

.fsc-single__image .fsc-badges {
	top: 12px;
	left: 12px;
}

.fsc-card__media img {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain;
	padding: 12px;
	box-sizing: border-box;
}

.fsc-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
	flex: 1 1 auto;
}

.fsc-card__sku {
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var( --fsc-card-muted );
}

.fsc-card__title {
	margin: 0 !important;
	font-size: 0.95rem !important;
	line-height: 1.3 !important;
	font-weight: 600 !important;
}

.fsc-card__title a {
	color: var( --fsc-card-title );
	text-decoration: none;
	font-size: inherit !important;
	/* Clamp to 2 lines so cards stay even height. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fsc-card__title a:hover {
	color: var( --fsc-card-accent );
}

.fsc-card__specs {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.fsc-card__spec {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	font-size: 0.8rem;
	color: var( --fsc-card-muted );
	border-bottom: 1px dashed var( --fsc-card-border );
	padding-bottom: 3px;
}

.fsc-card__spec-value {
	color: var( --fsc-card-title );
	text-align: right;
}

.fsc-card__actions {
	margin-top: auto;
	padding-top: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Button styles are GLOBAL (not scoped to .fsc-card) so they render consistently on the
   single page, quote list and Quick View too. !important beats theme/Elementor button rules. */
.fsc-card__btn {
	--fsc-btn-bg: rgba( 255, 255, 255, 0.10 );
	--fsc-btn-bg-hover: rgba( 255, 255, 255, 0.20 );
	--fsc-btn-color: #ffffff;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 10px 16px !important;
	font-size: 0.82rem !important;
	font-weight: 600 !important;
	line-height: 1.1 !important;
	border: 1px solid rgba( 255, 255, 255, 0.28 ) !important;
	border-radius: 8px !important;
	background: var( --fsc-btn-bg ) !important;
	color: var( --fsc-btn-color ) !important;
	text-decoration: none !important;
	text-transform: none !important;
	cursor: pointer !important;
	transition: background 0.15s ease !important;
	box-shadow: none !important;
}

.fsc-card__btn:hover {
	background: var( --fsc-btn-bg-hover ) !important;
	color: var( --fsc-btn-color ) !important;
}

/* Quote is the primary action — gradient. */
.fsc-card__btn--quote {
	border-color: transparent !important;
	background: linear-gradient( 90deg, #2161e3, #4ea3ff ) !important;
	color: #fff !important;
}

/* Inside a card, quote spans full width; others share the row. */
.fsc-card .fsc-card__btn--quote {
	flex: 1 1 100%;
}

.fsc-card .fsc-card__btn--quickview,
.fsc-card .fsc-card__btn--datasheet {
	flex: 1 1 auto;
}

/* Pagination */
.fsc-pagination {
	margin-top: 28px;
}

.fsc-pagination ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0;
	margin: 0;
	justify-content: center;
}

.fsc-pagination a,
.fsc-pagination span {
	display: inline-flex;
	min-width: 40px;
	height: 40px;
	align-items: center;
	justify-content: center;
	padding: 0 10px;
	border: 1px solid var( --fsc-card-border, rgba( 0, 0, 0, 0.15 ) );
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
}

.fsc-pagination span.current {
	background: #2161e3;
	border-color: #2161e3;
	color: #fff;
}

.fsc-grid__empty {
	opacity: 0.7;
	padding: 24px 0;
}

/* ---------- Toolbar (sort + view) ---------- */
.fsc-grid-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.fsc-grid-count {
	opacity: 0.7;
	font-size: 0.85rem;
}

.fsc-grid-tools {
	display: flex;
	gap: 12px;
	align-items: center;
}

.fsc-sort {
	background: transparent !important;
	color: inherit !important;
	border: 1px solid rgba( 255, 255, 255, 0.28 ) !important;
	border-radius: 8px !important;
	padding: 8px 12px !important;
	font-size: 0.85rem !important;
	cursor: pointer;
}

.fsc-sort option {
	color: #111;
}

.fsc-view,
.fsc-cols {
	display: inline-flex;
	border: 1px solid rgba( 255, 255, 255, 0.28 );
	border-radius: 8px;
	overflow: hidden;
}

/* Column-density switch (4 / 3 per row). */
.fsc-cols-btn {
	background: transparent !important;
	color: inherit !important;
	border: 0 !important;
	padding: 8px 12px !important;
	font-size: 0.85rem !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	cursor: pointer;
}

.fsc-cols-btn.is-active {
	background: rgba( 255, 255, 255, 0.18 ) !important;
}

/* Column density is meaningless in list view or on narrower screens (which force their
   own column counts), so hide the control there to avoid a no-op button. */
.fsc-grid-toolbar.is-list-view .fsc-cols {
	display: none;
}

@media ( max-width: 1024px ) {
	.fsc-cols {
		display: none;
	}
}

.fsc-view-btn {
	background: transparent !important;
	color: inherit !important;
	border: 0 !important;
	padding: 8px 12px !important;
	font-size: 1rem !important;
	line-height: 1 !important;
	cursor: pointer;
}

.fsc-view-btn.is-active {
	background: rgba( 255, 255, 255, 0.18 ) !important;
}

/* ---------- List view ---------- */
.fsc-grid--list {
	grid-template-columns: 1fr !important;
}

.fsc-grid--list .fsc-card {
	flex-direction: row;
}

.fsc-grid--list .fsc-card__media {
	flex: 0 0 200px;
	aspect-ratio: 1 / 1;
}

.fsc-grid--list .fsc-card__body {
	flex: 1 1 auto;
}

.fsc-grid--list .fsc-card__actions {
	max-width: 420px;
}

@media ( max-width: 600px ) {
	.fsc-grid--list .fsc-card {
		flex-direction: column;
	}
	.fsc-grid--list .fsc-card__media {
		flex: auto;
		aspect-ratio: 4 / 3;
	}
}

/* =========================================================================
 * Interaction polish — applying emil-design-eng principles:
 * custom ease-out curve, transform/opacity only, <300ms, scale-on-press,
 * hover gated to fine pointers, reduced-motion support.
 * ====================================================================== */
:root {
	--fsc-ease-out: cubic-bezier( 0.23, 1, 0.32, 1 );
}

/* Buttons must feel responsive — instant press feedback. */
.fsc-card__btn,
.fsc-qty-btn,
.fsc-view-btn,
.fsc-cols-btn,
.fsc-subnav__item a,
.fsc-quote-fab,
.fsc-quote-remove {
	transition: transform 160ms var( --fsc-ease-out ), background-color 160ms ease, color 160ms ease, border-color 160ms ease !important;
}

.fsc-card__btn:active,
.fsc-qty-btn:active,
.fsc-view-btn:active,
.fsc-cols-btn:active,
.fsc-subnav__item a:active,
.fsc-quote-fab:active {
	transform: scale( 0.97 ) !important;
}

/* Card hover — stronger, purposeful ease-out (only on real pointers). */
.fsc-card {
	transition: transform 200ms var( --fsc-ease-out ), border-color 200ms ease !important;
}

@media ( hover: hover ) and ( pointer: fine ) {
	.fsc-card:hover {
		transform: translateY( -3px );
		border-color: var( --fsc-card-accent );
	}
}

@media ( hover: none ) {
	.fsc-card:hover {
		transform: none;
	}
}

/* Accessible focus rings. */
.fsc-card__btn:focus-visible,
.fsc-view-btn:focus-visible,
.fsc-cols-btn:focus-visible,
.fsc-subnav__item a:focus-visible,
.fsc-sort:focus-visible {
	outline: 2px solid var( --fsc-card-accent, #4ea3ff ) !important;
	outline-offset: 2px !important;
}

/* Respect reduced-motion: keep opacity/colour, drop movement. */
@media ( prefers-reduced-motion: reduce ) {
	.fsc-card,
	.fsc-card__btn,
	.fsc-qty-btn,
	.fsc-view-btn,
	.fsc-subnav__item a,
	.fsc-quote-fab,
	.fsc-qv-modal,
	.fsc-quote-toast {
		transition-duration: 0.01ms !important;
		transform: none !important;
	}
}
