/* =========================================================
   JW Clients Showcase — frontend
   Theme colours arrive as inline CSS vars:
   --jwcs-from, --jwcs-to, --jwcs-accent, --jwcs-cols
   ========================================================= */

.jwcs-showcase {
	position: relative;
	isolation: isolate;
	scroll-margin-top: 24px; /* breathing room when pagination anchors here */
	--jwcs-outer-pad: 48px 36px; /* overridden by container-size classes */
	padding: var(--jwcs-outer-pad);
	border-radius: 24px;
	overflow: hidden;
	background:
		linear-gradient(135deg,
			color-mix(in srgb, var(--jwcs-from) 10%, transparent),
			color-mix(in srgb, var(--jwcs-to) 10%, transparent));
	--jwcs-cols: 4;
	/* card sizing tokens (overridden by size classes below) */
	--jwcs-pad: 32px 24px;
	--jwcs-gap: 18px;
	--jwcs-logo: 112px;
	--jwcs-initials: 96px;
	--jwcs-initials-font: 34px;
	--jwcs-minh: 260px;
	--jwcs-name-font: clamp(14px, 1.1vw + 9px, 19px);
}

/* ---------- outer container size ---------- */
.jwcs-outer-compact { --jwcs-outer-pad: 30px 20px; }
.jwcs-outer-comfortable { --jwcs-outer-pad: 48px 36px; }
.jwcs-outer-spacious { --jwcs-outer-pad: 80px 60px; }

/* ---------- outer container width ----------
   "wide" / "full" break out of the theme's constrained content column. */
/* !important is needed to beat block themes' constrained-layout rules, whose
   :not() selector chains carry higher specificity than a single class. */
.jwcs-width-wide {
	box-sizing: border-box;
	width: min(1440px, 96vw) !important;
	max-width: min(1440px, 96vw) !important;
	left: 50%;
	transform: translateX(-50%);
}
.jwcs-width-full {
	box-sizing: border-box;
	width: 100vw !important;
	max-width: 100vw !important;
	left: 50%;
	transform: translateX(-50%);
	border-radius: 0;
}
.jwcs-width-wide .jwcs-grid { max-width: 1360px; }
.jwcs-width-full .jwcs-grid { max-width: 1600px; }

/* ---------- card size presets ---------- */
.jwcs-size-comfortable {
	--jwcs-pad: 24px 18px;
	--jwcs-gap: 14px;
	--jwcs-logo: 90px;
	--jwcs-initials: 80px;
	--jwcs-initials-font: 28px;
	--jwcs-minh: 210px;
	--jwcs-name-font: clamp(13px, 1vw + 8px, 17px);
}
.jwcs-size-large {
	--jwcs-pad: 32px 24px;
	--jwcs-gap: 18px;
	--jwcs-logo: 112px;
	--jwcs-initials: 96px;
	--jwcs-initials-font: 34px;
	--jwcs-minh: 260px;
	--jwcs-name-font: clamp(14px, 1.1vw + 9px, 19px);
}
.jwcs-size-xl {
	--jwcs-pad: 42px 30px;
	--jwcs-gap: 22px;
	--jwcs-logo: 132px;
	--jwcs-initials: 112px;
	--jwcs-initials-font: 40px;
	--jwcs-minh: 320px;
	--jwcs-name-font: clamp(15px, 1.2vw + 10px, 22px);
}

/* ---------- header: eyebrow / title / description ---------- */
.jwcs-header {
	position: relative;
	z-index: 2;
	max-width: 1200px;
	margin: 0 auto 34px;
}
.jwcs-header--left { text-align: left; }
.jwcs-header--center { text-align: center; }
.jwcs-header--right { text-align: right; }

.jwcs-eyebrow {
	margin: 0 0 12px;
	font-size: clamp(12px, 0.4vw + 10px, 15px);
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	line-height: 1.2;
}
.jwcs-title {
	margin: 0 0 14px;
	font-size: clamp(26px, 3vw + 12px, 48px);
	font-weight: 800;
	line-height: 1.22; /* enough room so descenders (g, y) aren't clipped */
	letter-spacing: -0.015em;
}
.jwcs-desc {
	margin: 0;
	font-size: clamp(15px, 0.6vw + 12px, 20px);
	font-weight: 400;
	line-height: 1.5;
	opacity: 0.92;
}

/* gradient text (applied to eyebrow/title when in gradient mode) */
.jwcs-grad-text {
	background-repeat: no-repeat;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
	/* a little bottom padding gives descenders (g, y) room inside the
	   background-clip box so they aren't clipped. */
	padding-bottom: 0.1em;
}
/* animated shine sweep — only the top streak layer moves; the base gradient
   layer stays put, so the text is always readable. Left -> right. */
.jwcs-grad-shine {
	background-size: 250% 100%, 100% 100%;
	background-position: 250% 0, 0 0;
	animation: jwcs-title-shine 5.5s linear infinite;
}
@keyframes jwcs-title-shine {
	from { background-position: 250% 0, 0 0; }
	to   { background-position: -150% 0, 0 0; }
}

/* ---------- responsive grid ---------- */
.jwcs-grid {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: repeat(var(--jwcs-cols), minmax(0, 1fr));
	gap: 22px;
	max-width: 1200px;
	margin: 0 auto;
}
@media (max-width: 1024px) {
	.jwcs-grid { grid-template-columns: repeat(min(var(--jwcs-cols), 3), minmax(0, 1fr)); }
}
@media (max-width: 720px) {
	.jwcs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
	.jwcs-showcase { --jwcs-outer-pad: 28px 16px; border-radius: 18px; }
}
@media (max-width: 420px) {
	.jwcs-grid { grid-template-columns: 1fr; }
	/* Stacked single column: let each card fit its own content instead of
	   matching the tallest (no equal-height needed when cards aren't in a row).
	   !important because these base rules are defined later in the file. */
	.jwcs-ratio-auto .jwcs-grid { grid-auto-rows: auto !important; }
	.jwcs-ratio-auto .jwcs-card { min-height: 0 !important; }
}

/* ---------- card ---------- */
.jwcs-card {
	position: relative;
	min-width: 0; /* allow the grid item to shrink so content can wrap */
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start; /* top-align so logos & names line up across a row */
	gap: var(--jwcs-gap);
	padding: var(--jwcs-pad);
	text-decoration: none;
	color: #1f2430;
	background: rgba(255, 255, 255, .72);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 20px;
	box-shadow: 0 10px 30px -12px rgba(20, 20, 50, .28);
	overflow: hidden;
	transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease;
}
.jwcs-shape-pill .jwcs-card { border-radius: 40px; }
.jwcs-shape-square .jwcs-card { border-radius: 6px; }

/* Staggered entrance animation — plays on every load, so switching pages
   fades the new cards in smoothly. `backwards` fill keeps the hover-lift
   working after the animation ends (it doesn't persist the final transform). */
@keyframes jwcs-card-in {
	from { opacity: 0; transform: translateY(20px) scale(.97); }
	to   { opacity: 1; transform: none; }
}
.jwcs-card {
	animation: jwcs-card-in .55s cubic-bezier(.2, .8, .2, 1) backwards;
	animation-delay: calc(var(--jwcs-i, 0) * 65ms);
}

/* ---------- card proportion (shape) ----------
   aspect-ratio sets the shape; overflow:visible + min-height:auto let a card
   grow taller when a name is long, so text is never clipped. */
.jwcs-ratio-auto .jwcs-card { min-height: var(--jwcs-minh); }
/* Equal-height cards: every row matches the tallest card, so all boxes line up. */
.jwcs-ratio-auto .jwcs-grid { grid-auto-rows: 1fr; }
.jwcs-ratio-square .jwcs-card,
.jwcs-ratio-tall .jwcs-card,
.jwcs-ratio-wide .jwcs-card {
	overflow: visible;      /* allow the box to expand past the ratio for long names */
	min-height: auto;
}
.jwcs-ratio-square .jwcs-card { aspect-ratio: 1 / 1; }
.jwcs-ratio-tall .jwcs-card { aspect-ratio: 3 / 4; }
.jwcs-ratio-wide .jwcs-card { aspect-ratio: 4 / 3; }

/* For shaped grids, let each card keep its own height instead of stretching
   to the tallest — so short cards stay square while a long one grows. */
.jwcs-ratio-square .jwcs-grid,
.jwcs-ratio-tall .jwcs-grid,
.jwcs-ratio-wide .jwcs-grid { align-items: start; }

/* A long-named card drops the fixed proportion → auto height (and its natural
   width within the column), so the name always fits. */
.jwcs-ratio-square .jwcs-card--long,
.jwcs-ratio-tall .jwcs-card--long,
.jwcs-ratio-wide .jwcs-card--long { aspect-ratio: auto; height: auto; width: auto; }

/* Long-name card width behaviour (works with any shape). "wide" / "both" let
   the card span two columns so the name has more horizontal room. */
.jwcs-long-wide .jwcs-card--long,
.jwcs-long-both .jwcs-card--long {
	grid-column: span 2;
	aspect-ratio: auto; /* never force a proportion on an expanded card */
}
@media (max-width: 420px) {
	/* Single-column layout — a long card can only span 1. */
	.jwcs-long-wide .jwcs-card--long,
	.jwcs-long-both .jwcs-card--long { grid-column: span 1; }
}

@media (max-width: 600px) {
	/* On phones, force auto height so shaped cards never squeeze long names. */
	.jwcs-ratio-square .jwcs-card,
	.jwcs-ratio-tall .jwcs-card,
	.jwcs-ratio-wide .jwcs-card { aspect-ratio: auto; min-height: 0; }
}

.jwcs-card:hover {
	transform: translateY(-8px);
	box-shadow: 0 26px 50px -18px color-mix(in srgb, var(--jwcs-accent) 55%, rgba(20,20,50,.4));
}

/* animated gradient border/glow on hover */
.jwcs-card-glow {
	position: absolute;
	inset: -2px;
	z-index: -1;
	border-radius: inherit;
	background: linear-gradient(135deg, var(--jwcs-from), var(--jwcs-to));
	opacity: 0;
	transition: opacity .35s ease;
}
.jwcs-card:hover .jwcs-card-glow { opacity: .18; }

/* ---------- logo ---------- */
.jwcs-logo-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--jwcs-logo);
	height: var(--jwcs-logo);
	flex: none;
}
.jwcs-logo {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: filter .3s ease, transform .3s ease;
}
.jwcs-grayscale .jwcs-logo { filter: grayscale(1); opacity: .85; }
.jwcs-grayscale .jwcs-card:hover .jwcs-logo { filter: grayscale(0); opacity: 1; }
.jwcs-card:hover .jwcs-logo { transform: scale(1.05); }

.jwcs-initials {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--jwcs-initials);
	height: var(--jwcs-initials);
	border-radius: 50%;
	color: #fff;
	font-size: var(--jwcs-initials-font);
	font-weight: 800;
	letter-spacing: 1px;
	background: linear-gradient(135deg, var(--jwcs-from), var(--jwcs-to));
	box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--jwcs-accent) 60%, transparent);
}

/* ---------- name (auto responsive) ---------- */
.jwcs-name {
	max-width: 100%;
	text-align: center;
	font-weight: 700;
	line-height: 1.25;
	/* fluid font size, scaled with the chosen card size */
	font-size: var(--jwcs-name-font);
	/* let long words / URLs wrap instead of overflowing the card */
	overflow-wrap: anywhere;
	word-break: break-word;
	hyphens: auto;
}
.jwcs-name-short { display: none; }
@media (max-width: 600px) {
	.jwcs-name-long { display: none; }
	.jwcs-name-short { display: inline; }
}

/* ---------- empty ---------- */
.jwcs-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 30px;
	opacity: .7;
}

/* ---------- pagination ---------- */
.jwcs-pagination {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 32px auto 0;
}
.jwcs-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border-radius: 12px;
	text-decoration: none;
	font-weight: 600;
	color: #2a2f3a;
	background: rgba(255, 255, 255, .8);
	border: 1px solid rgba(255, 255, 255, .7);
	box-shadow: 0 4px 12px -6px rgba(20, 20, 50, .3);
	transition: transform .2s ease, background .2s ease, color .2s ease;
}
.jwcs-page:hover { transform: translateY(-2px); }
.jwcs-page.is-current {
	color: #fff;
	background: linear-gradient(135deg, var(--jwcs-from), var(--jwcs-to));
	border-color: transparent;
}

/* =========================================================
   Animated light patterns
   ========================================================= */
.jwcs-pattern {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	overflow: hidden;
}

/* Floating dots */
.jwcs-pattern-dots .jwcs-pattern span {
	position: absolute;
	border-radius: 50%;
	background: radial-gradient(circle at 30% 30%, var(--jwcs-to), var(--jwcs-from));
	opacity: .16;
	animation: jwcs-float 14s ease-in-out infinite;
}
.jwcs-pattern-dots .jwcs-pattern span:nth-child(1) { width: 120px; height: 120px; left: 5%;  top: 15%; animation-delay: 0s; }
.jwcs-pattern-dots .jwcs-pattern span:nth-child(2) { width: 70px;  height: 70px;  left: 80%; top: 10%; animation-delay: 2s; }
.jwcs-pattern-dots .jwcs-pattern span:nth-child(3) { width: 160px; height: 160px; left: 60%; top: 60%; animation-delay: 4s; }
.jwcs-pattern-dots .jwcs-pattern span:nth-child(4) { width: 90px;  height: 90px;  left: 20%; top: 70%; animation-delay: 1s; }
.jwcs-pattern-dots .jwcs-pattern span:nth-child(5) { width: 50px;  height: 50px;  left: 45%; top: 25%; animation-delay: 3s; }
.jwcs-pattern-dots .jwcs-pattern span:nth-child(6) { width: 110px; height: 110px; left: 90%; top: 75%; animation-delay: 5s; }

@keyframes jwcs-float {
	0%, 100% { transform: translate(0, 0) scale(1); }
	33%      { transform: translate(20px, -26px) scale(1.08); }
	66%      { transform: translate(-16px, 18px) scale(.94); }
}

/* Moving grid */
.jwcs-pattern-grid .jwcs-pattern {
	background-image:
		linear-gradient(color-mix(in srgb, var(--jwcs-accent) 22%, transparent) 1px, transparent 1px),
		linear-gradient(90deg, color-mix(in srgb, var(--jwcs-accent) 22%, transparent) 1px, transparent 1px);
	background-size: 46px 46px;
	opacity: .5;
	animation: jwcs-grid-move 8s linear infinite;
}
.jwcs-pattern-grid .jwcs-pattern span { display: none; }
@keyframes jwcs-grid-move {
	from { background-position: 0 0, 0 0; }
	to   { background-position: 46px 46px, 46px 46px; }
}

/* Rising bubbles */
.jwcs-pattern-bubbles .jwcs-pattern span {
	position: absolute;
	bottom: -80px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--jwcs-from), var(--jwcs-to));
	opacity: .14;
	animation: jwcs-rise 12s linear infinite;
}
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(1) { width: 60px;  height: 60px;  left: 10%; animation-delay: 0s; }
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(2) { width: 90px;  height: 90px;  left: 30%; animation-delay: 2.5s; }
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(3) { width: 40px;  height: 40px;  left: 50%; animation-delay: 1s; }
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(4) { width: 120px; height: 120px; left: 70%; animation-delay: 3.5s; }
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(5) { width: 70px;  height: 70px;  left: 85%; animation-delay: 1.8s; }
.jwcs-pattern-bubbles .jwcs-pattern span:nth-child(6) { width: 50px;  height: 50px;  left: 45%; animation-delay: 4.5s; }
@keyframes jwcs-rise {
	0%   { transform: translateY(0) scale(.6); opacity: 0; }
	15%  { opacity: .16; }
	100% { transform: translateY(-115vh) scale(1); opacity: 0; }
}

/* Soft waves */
.jwcs-pattern-waves .jwcs-pattern {
	background:
		radial-gradient(120% 60% at 50% 120%, color-mix(in srgb, var(--jwcs-to) 40%, transparent), transparent),
		radial-gradient(120% 60% at 50% -20%, color-mix(in srgb, var(--jwcs-from) 40%, transparent), transparent);
	opacity: .5;
	animation: jwcs-wave 9s ease-in-out infinite;
}
.jwcs-pattern-waves .jwcs-pattern span { display: none; }
@keyframes jwcs-wave {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-14px); }
}

/* Aurora glow */
.jwcs-pattern-aurora .jwcs-pattern {
	background:
		radial-gradient(40% 40% at 20% 30%, color-mix(in srgb, var(--jwcs-from) 55%, transparent), transparent),
		radial-gradient(40% 40% at 80% 40%, color-mix(in srgb, var(--jwcs-to) 55%, transparent), transparent),
		radial-gradient(50% 50% at 50% 90%, color-mix(in srgb, var(--jwcs-accent) 45%, transparent), transparent);
	filter: blur(30px);
	opacity: .55;
	animation: jwcs-aurora 12s ease-in-out infinite alternate;
}
.jwcs-pattern-aurora .jwcs-pattern span { display: none; }
@keyframes jwcs-aurora {
	0%   { transform: translate(-4%, -2%) scale(1); }
	50%  { transform: translate(4%, 3%) scale(1.1); }
	100% { transform: translate(-2%, 2%) scale(1.05); }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.jwcs-pattern, .jwcs-pattern span, .jwcs-card, .jwcs-grad-shine { animation: none !important; transition: none !important; }
}

/* Dark theme readability */
.jwcs-theme-midnight .jwcs-card { color: #f4f6fb; background: rgba(20, 28, 44, .55); border-color: rgba(255,255,255,.12); }
.jwcs-theme-midnight .jwcs-page { color: #f4f6fb; background: rgba(20, 28, 44, .6); border-color: rgba(255,255,255,.12); }

/* Card content vertical position (applies to plain cards) */
.jwcs-valign-top .jwcs-card { justify-content: flex-start; }
.jwcs-valign-center .jwcs-card { justify-content: center; }
.jwcs-valign-bottom .jwcs-card { justify-content: flex-end; }

/* A card with a background image (or a logo-as-background) always reads best
   with its name at the bottom over the scrim — force it regardless of the
   global "Card text position" setting. (Same specificity as the valign rules,
   placed after them, so it wins.) */
.jwcs-card.jwcs-card--bg,
.jwcs-card.jwcs-card--logobg { justify-content: flex-end; }

/* Per-client background-image card: image + overlay, white text */
.jwcs-card--bg {
	color: #fff;
	border-color: rgba(255, 255, 255, .28);
	min-height: 240px;
}
.jwcs-card--bg .jwcs-name { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .4); }
.jwcs-card--bg .jwcs-card-glow { display: none; }
.jwcs-card--bg:hover { box-shadow: 0 26px 50px -18px rgba(10, 12, 24, .6); }

/* Logo-as-background card: logo shown large & centered on a soft theme tint */
.jwcs-card--logobg { min-height: 220px; }
.jwcs-card--logobg .jwcs-card-glow { display: none; }
.jwcs-card--logobg .jwcs-name {
	background: rgba(255, 255, 255, .78);
	padding: 6px 12px;
	border-radius: 10px;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* White theme: light badge needs dark initials + a subtle outline to be visible */
.jwcs-theme-white .jwcs-initials {
	color: #2a2f3a;
	box-shadow: inset 0 0 0 1px rgba(20, 20, 50, .12), 0 8px 20px -8px rgba(20, 20, 50, .25);
}
