/* ==========================================================================
   Case Studies Grid — scoped to .csg-*
   Breakpoints used in this file: 1299px, 999px, 690px (project standard)
   ========================================================================== */

   .csg-section {
	--csg-accent: #FE5000;
	--csg-border: #000000;
	--csg-surface: #ffffff;
	--csg-muted: #000;
	--csg-ink: #000000;
	--csg-overlay: #00000099;
	--csg-radius: 16px;
	--csg-radius-sm: 5px;
	--csg-gap: 40px;
	--csg-menu-width: 440px;
	--csg-card-space: 14px; /* space between title, text and CTA */

	position: relative;
	width: 100%;
	box-sizing: border-box;
}

.csg-section *,
.csg-section *::before,
.csg-section *::after {
	box-sizing: border-box;
}

/* Full width — spacing is controlled by the parent row/column */
.csg-container {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
}

/* --------------------------------------------------------------------------
   Controls row: filter on the left, search button beside it
   -------------------------------------------------------------------------- */

.csg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 68px;
}

.csg-search {
    flex: 0 0 auto;
    min-width: 200px;
    padding: 15px 30px;
    background: var(--csg-accent);
    border: unset !important;
    border-radius: var(--csg-radius-sm);
    color: #000;
    font: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
    font-family: 'PantonRegular';
    font-size: 16px;
    font-style: normal;
    font-weight: 330;
    line-height: normal;
}

.csg-search:hover,
.csg-search:focus-visible {
	opacity: 0.88;
}

/* --------------------------------------------------------------------------
   Filter dropdown
   -------------------------------------------------------------------------- */

.csg-filter {
	position: relative;
	z-index: 20;
}

.csg-filter__label {
	display: block;
	margin-bottom: 8px;
	color: var(--csg-accent);
    font-family: 'PantonRegular';
    font-size: 16px;
    font-style: normal;
    font-weight: 330;
    line-height: normal;
}

.csg-filter__control {
	position: relative;
	width: var(--csg-menu-width);
	max-width: 100%;
}

.csg-filter__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	width: 100%;
	margin: 0;
	padding: 14px 18px;
	background: var(--csg-surface);
	border: 1px solid var(--csg-border);
	border-radius: var(--csg-radius-sm);
	color: var(--csg-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

/* Open state: toggle and list read as one panel */
.csg-filter__control.is-open .csg-filter__toggle {
	border-bottom-color: transparent;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.csg-filter__value {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
    font-family: 'PantonRegular';
    font-size: 16px;
    font-style: normal;
    font-weight: 330;
    line-height: normal;
    opacity: 0.6;
}

.csg-filter__value.is-placeholder {
	color: var(--csg-muted);
}

.csg-filter__chevron {
    flex: 0 0 auto;
    color: var(--csg-accent);
    transition: transform 0.2s ease;
    width: 15px;
    height: 15px;
}

.csg-filter__control.is-open .csg-filter__chevron {
	transform: rotate(180deg);
}

.csg-filter__menu {
    position: absolute;
    top: 90%;
    left: 0;
    width: 100%;
    background: var(--csg-surface);
    border: 1px solid var(--csg-border);
    border-top: 0;
    border-bottom-left-radius: var(--csg-radius-sm);
    border-bottom-right-radius: var(--csg-radius-sm);
    z-index: 30;
    padding: 19px 14px;
    padding-bottom: 28px;
}

.csg-filter__menu[hidden] {
	display: none;
}

.csg-filter__list, .csg-filter__sublist {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.csg-filter__item,
.csg-filter__subitem {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

.csg-filter__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent !important;
    border: 0;
    border-radius: 0;
    color: var(--csg-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-family: 'PantonRegular';
    font-size: 16px;
    font-style: normal;
    font-weight: 330;
    line-height: normal;
}

.csg-filter__option:hover,
.csg-filter__option:focus-visible,
.csg-filter__option.is-active {
	color: var(--csg-accent);
}

.csg-filter__option--deep {
	padding-left: 34px;
}

.csg-filter__arrow {
	flex: 0 0 auto;
	color: var(--csg-accent);
	opacity: 0;
	transition: opacity 0.15s ease;
}

.csg-filter__item--parent:hover .csg-filter__arrow,
.csg-filter__item--parent.is-open .csg-filter__arrow,
.csg-filter__option--top:focus-visible .csg-filter__arrow {
	opacity: 1;
}

/* Second level — desktop opens to the right */
.csg-filter__submenu {
    position: absolute;
    top: -10px;
    left: 100%;
    display: none;
    min-width: 353px;
    padding: 21px 14px;
    margin-left: 24px;
    background: var(--csg-surface);
    border: 1px solid var(--csg-border);
    border-radius: var(--csg-radius-sm);
    box-shadow: 0 18px 40px rgba(16, 21, 28, 0.12);
    z-index: 40;
}

/* Invisible bridge so the cursor can travel into the submenu */
.csg-filter__submenu::before {
	content: "";
	position: absolute;
	top: 0;
	right: 100%;
	width: 16px;
	height: 100%;
}

.csg-filter__item--parent.is-open > .csg-filter__submenu {
	display: block;
}

.csg-filter__submenu--flip {
	left: auto;
	right: 100%;
	margin-left: 0;
	margin-right: 12px;
}

.csg-filter__submenu--flip::before {
	right: auto;
	left: 100%;
}

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

.csg-results {
	position: relative;
}

.csg-grid {
	display: grid;
	gap: var(--csg-gap);
	transition: opacity 0.2s ease;
}

.csg-grid--cols-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.csg-grid--cols-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.csg-grid--cols-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.csg-empty {
	grid-column: 1 / -1;
	margin: 0;
	padding: 40px 0;
	color: var(--csg-muted);
}

/* Loading state */
.csg-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    pointer-events: none;
    background: #fff;
}

.csg-results.is-loading .csg-grid {
	opacity: 0.35;
	pointer-events: none;
}

.csg-results.is-loading .csg-loader {
	display: flex;
}

.csg-loader__spinner {
	width: 34px;
	height: 34px;
	border: 3px solid rgba(16, 21, 28, 0.15);
	border-top-color: var(--csg-accent);
	border-radius: 50%;
	animation: csg-spin 0.8s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Card — image only, content revealed on hover
   -------------------------------------------------------------------------- */

.csg-card {
	position: relative;
	margin: 0;
}

.csg-card__link {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--csg-radius);
	background: #eceff2;
	text-decoration: none;
	color: inherit;
}

.csg-card__link:focus-visible {
	outline: 2px solid var(--csg-accent);
	outline-offset: 3px;
}

.csg-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 440 / 392;
	overflow: hidden;
}

.csg-card__media .csg-card__img {
    width: 100%;
    height: 100% !important;
    display: block;
    object-fit: cover;
    transform: scale(1.001);
    transition: transform 0.6s ease;
    margin: 0 !important;
}

.csg-card__link:hover .csg-card__img,
.csg-card__link:focus-visible .csg-card__img {
	transform: scale(1.05);
}

.csg-card__media-fallback {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #dfe3e8 0%, #c9ced6 100%);
}

.csg-card__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	padding: 26px;
	background: var(--csg-overlay);
	color: #fff;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.csg-card__link:hover .csg-card__overlay,
.csg-card__link:focus-visible .csg-card__overlay {
	opacity: 1;
}

/*
 * Content layout (4 rows):
 *   1fr  -> empty space above
 *   auto -> title
 *   auto -> text
 *   1fr  -> space below, CTA sits at the bottom of this row
 * The two 1fr rows are equal, so title + text stay in the true centre of
 * the card while the CTA stays pinned to the bottom. If the text gets long,
 * the bottom row never shrinks below the CTA height, so nothing overlaps.
 */
.csg-card__content {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: 1fr auto auto 1fr;
	justify-items: stretch;
	flex: 1 1 auto;
	align-self: stretch;
	min-height: 0;
	width: 100%;
	text-align: center;
}

.csg-card .csg-card__content .csg-card__title {
    grid-row: 2;
    margin: 0;
    color: #FFF;
    text-align: center;
    font-family: 'PantonExtraBold';
    font-size: 24px;
    font-style: normal;
    font-weight: 370;
    line-height: 24px;
}

.csg-card__excerpt {
	grid-row: 3;
	margin-top: var(--csg-card-space);
	display: -webkit-box;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: rgba(255, 255, 255, 0.9);
}

/* Solid CTA bar pinned to the bottom of the card */
.csg-card__cta {
    grid-row: 4;
    align-self: end;
    display: block;
    width: 100%;
    margin-top: var(--csg-card-space);
    padding: 15px 20px;
    background: var(--csg-accent);
    border-radius: var(--csg-radius-sm);
    text-align: center;
    transition: 0.2s ease;
    color:#000;
    font-family: 'PantonRegular';
    font-size: 16px;
    font-style: normal;
    font-weight: 330;
    line-height: normal;
}

.csg-card__link:hover .csg-card__cta:hover {
    background: #ffffff;
}

/* --------------------------------------------------------------------------
   Pagination / load more
   -------------------------------------------------------------------------- */

.csg-foot:empty {
	display: none;
}

.csg-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 44px;
}

.csg-pagination__page,
.csg-pagination__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	background: var(--csg-surface);
	border: 1px solid var(--csg-border);
	border-radius: var(--csg-radius-sm);
	color: var(--csg-ink);
	font: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.csg-pagination__page:hover,
.csg-pagination__nav:hover:not([disabled]) {
	border-color: var(--csg-accent);
	color: var(--csg-accent);
}

.csg-pagination__page.is-current {
	background: var(--csg-accent);
	border-color: var(--csg-accent);
	color: #fff;
	cursor: default;
}

.csg-pagination__nav[disabled] {
	opacity: 0.4;
	cursor: default;
}

.csg-pagination__prev svg {
	transform: rotate(90deg);
}

.csg-pagination__next svg {
	transform: rotate(-90deg);
}

.csg-pagination__dots {
	padding: 0 4px;
	color: var(--csg-muted);
}

.csg-loadmore {
	display: flex;
	justify-content: center;
	margin-top: 44px;
}

.csg-loadmore[hidden] {
	display: none;
}

.csg-loadmore__btn {
	padding: 14px 34px;
	background: var(--csg-accent);
	border: 1px solid var(--csg-accent);
	border-radius: var(--csg-radius-sm);
	color: #fff;
	font: inherit;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.csg-loadmore__btn:hover {
	opacity: 0.88;
}

.csg-loadmore__btn.is-busy {
	opacity: 0.6;
	cursor: default;
}

/* --------------------------------------------------------------------------
   1299 and below
   -------------------------------------------------------------------------- */

@media (max-width: 1299px) {
	.csg-section {
		--csg-gap: 20px;
	}

	.csg-card__overlay {
		padding: 22px;
	}

	.csg-grid--cols-4 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* --------------------------------------------------------------------------
   999 and below — no reliable hover: stack the submenu, show card content
   -------------------------------------------------------------------------- */

@media (max-width: 999px) {
	.csg-section {
		--csg-card-space: 10px;
	}

	.csg-controls {
		align-items: flex-end;
		gap: 14px;
		margin-bottom: 24px;
	}

	.csg-grid--cols-3,
	.csg-grid--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.csg-filter__control {
		width: 320px;
	}

	.csg-filter__menu {
		max-height: 70vh;
		overflow-y: auto;
	}

	/* Child levels render inside the parent dropdown */
	.csg-filter__submenu, .csg-filter__submenu--flip {
    position: static;
    left: auto;
    right: auto;
    min-width: 0;
    margin: 0;
    padding: 20px 10px 20px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

	.csg-filter__submenu::before {
		display: none;
	}

	.csg-filter__arrow {
		opacity: 1;
		transform: rotate(90deg);
		transition: transform 0.2s ease;
	}

	.csg-filter__item--parent.is-open .csg-filter__arrow {
		transform: rotate(-90deg);
	}

	/* Touch: the overlay stays on so title, text and CTA are reachable */
	.csg-card__overlay {
		padding: 20px;
	}

	.csg-card__excerpt {
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.csg-card__cta {
		padding: 12px 16px;
	}
}

/* --------------------------------------------------------------------------
   690 and below
   -------------------------------------------------------------------------- */

@media (max-width: 690px) {
	.csg-grid--cols-2,
	.csg-grid--cols-3,
	.csg-grid--cols-4 {
		grid-template-columns: minmax(0, 1fr);
	}

	.csg-controls {
		align-items: stretch;
		gap: 12px;
	}

	.csg-filter,
	.csg-filter__control {
		width: 100%;
	}

	.csg-search {
		width: 100%;
	}

	.csg-pagination {
		gap: 6px;
		margin-top: 32px;
	}

	.csg-loadmore {
		margin-top: 32px;
	}
}

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.csg-section .csg-card__img,
	.csg-section .csg-card__overlay,
	.csg-section .csg-card__content,
	.csg-section .csg-filter__chevron {
		transition: none;
	}

	.csg-loader__spinner {
		animation-duration: 2s;
	}
}