/*
 * IO Illustrations
 * Uses IO_CSS_Variables.css tokens only (loaded as io-tokens.css).
 * Scoped under .io-il with light resets so Uncode/WPBakery styles don't leak in.
 * Column count follows the width of the content area (container queries), not the screen.
 */

.io-il {
	container: io-il / inline-size;

	/* shadow-card token (IO_Design.md), the only validated elevation. */
	--io-il-shadow-card: 0px 8px 30px 0px rgba(0, 0, 0, 0.1);

	color: var(--color-pure-black);
	font-family: var(--font-body-regular-family);
	font-size: var(--font-body-regular-size);
	font-weight: var(--font-body-regular-weight);
	line-height: var(--font-body-regular-line-height);
}

.io-il *,
.io-il *::before,
.io-il *::after {
	box-sizing: border-box;
}

.io-il [hidden] {
	display: none !important;
}

/* ---- Search band: mint ---- */
/* The band is widened to the edges of the screen (and up over the row's top padding) by a background
   layer whose offsets are measured by illustrations.js (--io-il-bleed-*). Without JavaScript the
   shadow below still fills the sides with flat mint. Neither causes a horizontal scrollbar. */

.io-il__search {
	position: relative;
	z-index: 0; /* own stacking context, so the background layer sits behind the heading and input */
	display: flex;
	flex-direction: column;
	align-items: center;
	background: var(--color-mint-green);
	box-shadow: 0 0 0 100vmax var(--color-mint-green);
	clip-path: inset(calc(-1 * var(--io-il-bleed-top, 0px)) -100vmax 0);
	border-radius: 0;
	padding: var(--spacing-space-100) var(--spacing-space-24) var(--spacing-space-48);
	margin: 0 0 var(--spacing-space-48);
}

.io-il__search::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: calc(-1 * var(--io-il-bleed-top, 0px));
	right: calc(-1 * var(--io-il-bleed-right, 0px));
	bottom: 0;
	left: calc(-1 * var(--io-il-bleed-left, 0px));
	background: var(--color-mint-green);
	/* To bring back a background image, add it here, e.g. url("search-header.webp") center / cover no-repeat,
	   and put the file in this assets folder. */
	pointer-events: none;
}

.io-il .io-il__heading {
	margin: 0 0 var(--spacing-space-24);
	padding: 0;
	text-align: center;
	font-family: var(--font-hero-headline-family);
	font-size: var(--font-hero-headline-size);
	font-weight: var(--font-hero-headline-weight);
	line-height: var(--font-hero-headline-line-height);
	letter-spacing: var(--font-hero-headline-letter-spacing);
	color: var(--color-pure-black);
}

.io-il .io-il__input {
	display: block;
	width: 100%;
	max-width: 720px;
	height: auto;
	margin: 0;
	padding: var(--spacing-space-16) var(--spacing-space-24);
	background: var(--color-pure-white);
	color: var(--color-pure-black);
	border: 1px solid var(--color-pure-black);
	border-radius: var(--radius-radius-2xl);
	box-shadow: none;
	font-family: var(--font-body-regular-family);
	font-size: var(--font-body-regular-size);
	font-weight: var(--font-body-regular-weight);
	line-height: var(--font-body-regular-line-height);
	text-align: left;
	-webkit-appearance: none;
	appearance: none;
}

.io-il .io-il__input::placeholder {
	color: var(--color-grey-dark);
	opacity: 1;
}

/* Same width as the bar and left aligned with it */
.io-il__hint {
	width: 100%;
	max-width: 720px;
	margin: var(--spacing-space-12) 0 0;
	text-align: left;
	font-family: var(--font-caption-small-family);
	font-size: var(--font-caption-small-size);
	font-weight: var(--font-caption-small-weight);
	line-height: var(--font-caption-small-line-height);
	color: var(--color-pure-black);
}

@container io-il (max-width: 679px) {
	.io-il .io-il__heading {
		font-size: var(--font-section-heading-size);
		line-height: var(--font-section-heading-line-height);
		letter-spacing: var(--font-section-heading-letter-spacing);
	}
}

/* ---- Result count ---- */

.io-il__count {
	display: flex;
	align-items: center;
	min-height: 40px; /* lines the first card up with the first filter box */
	margin: 0 0 var(--spacing-space-16);
	font-family: var(--font-ui-label-medium-family);
	font-size: var(--font-ui-label-medium-size);
	font-weight: var(--font-ui-label-medium-weight);
	line-height: var(--font-ui-label-medium-line-height);
	letter-spacing: -0.02em; /* token says -2%; see D-11 */
	color: var(--color-grey-dark);
}

/* ---- Layout: stays inside the page column. From 1000px: filters 20% + illustrations 80% ---- */

/* Wrapper that the layout's container queries measure (the width of the page column). */
.io-il__bleed {
	container: io-il-bleed / inline-size;
}

.io-il__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--spacing-space-24);
	padding: 0 var(--spacing-space-24); /* side gutter; set to 0 if the row already has padding */
}

.io-il__results {
	min-width: 0;
}

/* 900px+: a fixed filter column and the cards beside it (below 1000px) */
@container io-il-bleed (min-width: 900px) {
	.io-il__layout:not(.io-il__layout--no-filters) {
		grid-template-columns: 260px minmax(0, 1fr);
		align-items: start;
	}
}

/* 1000px+: filters take one fifth, the illustrations the other four fifths (same filter width as the
   Case Study Library, so the two pages line up). */
@container io-il-bleed (min-width: 1000px) {
	.io-il__layout:not(.io-il__layout--no-filters) {
		grid-template-columns: minmax(0, 1fr) minmax(0, 4fr);
	}
}

/* ---- Filters ---- */

.io-il__filters {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-space-16);
	min-width: 0;
}

.io-il__filters-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-space-12);
}

.io-il .io-il__filters-title {
	margin: 0;
	padding: 0;
	font-family: var(--font-section-heading-family);
	font-size: var(--font-card-heading-size);
	font-weight: var(--font-card-heading-weight);
	line-height: var(--font-card-heading-line-height);
	letter-spacing: var(--font-card-heading-letter-spacing);
	color: var(--color-pure-black);
}

.io-il .io-il__clear-filters,
.io-il .io-il__clear {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	max-height: 40px;
	margin: 0;
	padding: 0 var(--spacing-space-16);
	background: var(--color-pure-white);
	color: var(--color-pure-black);
	border: 1px solid var(--color-pure-black);
	border-radius: var(--radius-radius-md);
	box-shadow: none;
	font-family: var(--font-ui-label-bold-family);
	font-size: var(--font-ui-label-medium-size);
	font-weight: var(--font-ui-label-bold-weight);
	line-height: var(--font-ui-label-bold-line-height);
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.io-il .io-il__clear-filters:hover:not(:disabled),
.io-il .io-il__clear:hover {
	background: var(--color-grey-light);
	color: var(--color-pure-black);
}

.io-il .io-il__clear-filters:disabled {
	border-color: var(--color-grey-light);
	color: var(--color-grey-dark);
	cursor: default;
}

.io-il .io-il__facet {
	margin: 0;
	padding: var(--spacing-space-20);
	background: var(--color-pure-white);
	border: 1px solid var(--color-grey-light);
	border-radius: var(--radius-radius-2xl);
}

.io-il .io-il__facet-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-space-8);
	margin: 0;
	padding: 0;
	font-family: var(--font-ui-label-bold-family);
	font-size: var(--font-ui-label-bold-size);
	font-weight: var(--font-ui-label-bold-weight);
	line-height: var(--font-ui-label-bold-line-height);
	color: var(--color-pure-black);
	cursor: pointer;
}

.io-il .io-il__facet[open] > .io-il__facet-title {
	margin-bottom: var(--spacing-space-12);
}

.io-il .io-il__facet-badge {
	display: inline-block;
	min-width: 20px;
	padding: var(--spacing-space-2) var(--spacing-space-8);
	background: var(--color-mint-green);
	border-radius: var(--radius-radius-2xl);
	font-family: var(--font-ui-label-medium-family);
	font-size: var(--font-ui-label-medium-size);
	font-weight: var(--font-ui-label-medium-weight);
	line-height: var(--font-ui-label-bold-line-height);
	text-align: center;
	color: var(--color-pure-black);
}

.io-il .io-il__options {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-space-4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.io-il .io-il__options li {
	margin: 0;
	padding: 0;
}

.io-il .io-il__option {
	display: flex;
	align-items: center;
	gap: var(--spacing-space-10);
	margin: 0;
	padding: var(--spacing-space-4) 0;
	font-family: var(--font-body-regular-family);
	font-size: var(--font-micro-label-size); /* 10px */
	font-weight: var(--font-body-regular-weight);
	line-height: var(--font-caption-small-line-height);
	color: var(--color-pure-black);
	cursor: pointer;
}

.io-il .io-il__checkbox {
	flex: none;
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--color-pure-black);
	cursor: pointer;
}

.io-il .io-il__option-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

.io-il .io-il__option-count {
	flex: none;
	color: var(--color-grey-dark);
}

/* Options that would return nothing with the current search and filters */
.io-il .io-il__option.is-empty {
	color: var(--color-grey-dark);
	cursor: default;
}

.io-il .io-il__option.is-empty .io-il__checkbox {
	cursor: default;
}

.io-il .io-il__facet-note {
	margin: calc(-1 * var(--spacing-space-4)) 0 var(--spacing-space-12);
	font-family: var(--font-caption-small-family);
	font-size: var(--font-caption-small-size);
	font-weight: var(--font-caption-small-weight);
	line-height: var(--font-caption-small-line-height);
	color: var(--color-grey-dark);
}

/* Long lists (mood, keywords) scroll inside their box. The scrollbar is always shown (macOS and
   Windows 11 hide scrollbars until you scroll), so it is obvious there is more to see. */
.io-il .io-il__options--scroll {
	max-height: 320px;
	overflow-y: scroll;
	scrollbar-gutter: stable;
	padding-right: 0;
}

/* Keep the counts clear of the scrollbar. The space is on each row rather than the list, so it also
   works where the browser draws the scrollbar on top of the content (macOS overlay scrollbars). */
.io-il .io-il__options--scroll .io-il__option {
	padding-right: var(--spacing-space-16);
}

.io-il .io-il__options--scroll::-webkit-scrollbar {
	width: 8px;
}

.io-il .io-il__options--scroll::-webkit-scrollbar-track {
	background: var(--color-grey-light);
	border-radius: var(--radius-radius-base);
}

.io-il .io-il__options--scroll::-webkit-scrollbar-thumb {
	background: var(--color-grey-dark);
	border-radius: var(--radius-radius-base);
}

/* Firefox (no ::-webkit-scrollbar support). Chrome ignores the rules above if these are set, so they
   are only applied where the WebKit version isn't available. */
@supports not selector(::-webkit-scrollbar) {
	.io-il .io-il__options--scroll {
		scrollbar-width: thin;
		scrollbar-color: var(--color-grey-dark) var(--color-grey-light);
	}
}

/* ---- Card grid: as many columns as fit (min 220px) ---- */

.io-il .io-il__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--spacing-space-24);
	margin: 0;
	padding: 0;
	list-style: none;
}

.io-il .io-il__item {
	container: io-il-card / inline-size;
	margin: 0;
	padding: 0;
}

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

.io-il__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--color-pure-white);
	border: 1px solid var(--color-grey-light);
	border-radius: var(--radius-radius-2xl);
	overflow: hidden;
}

.io-il__card:hover,
.io-il__card:focus-within {
	box-shadow: var(--io-il-shadow-card);
}

/* Preview: a fixed square frame, the same size on every card in a row. The image is taken out of the
   layout (absolute) so a tall person or a wide object can never stretch the frame, and the size rules use
   !important so theme image styles (Uncode sets img height: auto) can't override them. */
.io-il__media {
	position: relative;
	flex: none;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	min-height: 0;
	overflow: hidden;
	background: var(--color-pure-white);
	border-bottom: 1px solid var(--color-grey-light);
}

.io-il .io-il__media img.io-il__img {
	position: absolute;
	inset: var(--spacing-space-24);
	display: block;
	width: calc(100% - 2 * var(--spacing-space-24)) !important;
	height: calc(100% - 2 * var(--spacing-space-24)) !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: contain;
	object-position: center;
}

/* Content: title, tags, then buttons pinned to the bottom so they line up across a row */
.io-il__content {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: var(--spacing-space-12);
	padding: var(--spacing-space-20);
}

.io-il .io-il__title {
	margin: 0;
	padding: 0;
	font-family: var(--font-ui-label-bold-family);
	font-size: var(--font-ui-label-bold-size);
	font-weight: var(--font-ui-label-bold-weight);
	line-height: var(--font-ui-label-bold-line-height);
	letter-spacing: normal;
	color: var(--color-pure-black);
	overflow-wrap: anywhere;
}

/* ---- Tags (click to search by that tag): 5px between tags and between lines ---- */

.io-il .io-il__tags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--spacing-space-5);
	margin: 0;
	padding: 0;
	list-style: none;
}

.io-il .io-il__tags li {
	margin: 0;
	padding: 0;
	max-width: 100%;
}

.io-il .io-il__tag {
	display: inline-block;
	max-width: 100%;
	margin: 0;
	background: var(--color-grey-light);
	color: var(--color-pure-black);
	border: 1px solid transparent;
	border-radius: var(--radius-radius-2xl);
	box-shadow: none;
	font-family: var(--font-body-regular-family);
	font-weight: var(--font-body-regular-weight);
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	overflow-wrap: anywhere;
	cursor: pointer;
}

.io-il .io-il__tag {
	padding: var(--spacing-space-5) var(--spacing-space-10);
	font-size: var(--font-micro-label-size); /* 10px */
	line-height: var(--font-micro-label-line-height);
}

/* Type chip (People / Object) sits first in crystal mint so it reads as the category */
.io-il .io-il__tag--type {
	background: var(--color-crystal-mint);
}

.io-il .io-il__tag:hover,
.io-il .io-il__tag[aria-pressed="true"] {
	border-color: var(--color-pure-black);
	color: var(--color-pure-black);
}

/* ---- Download buttons: stacked on narrow cards, side by side from 340px ---- */

.io-il__actions {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-space-8);
	margin-top: auto;
	padding-top: var(--spacing-space-8);
}

.io-il a.io-il__btn,
.io-il a.io-il__btn:visited {
	display: inline-flex;
	flex: 0 0 auto;
	width: 100%;
	min-width: 0;
	align-items: center;
	justify-content: center;
	gap: var(--spacing-space-8);
	min-height: 40px;
	max-height: 40px;
	padding: 0 var(--spacing-space-12);
	color: var(--color-pure-black);
	border: 1px solid var(--color-pure-black);
	border-radius: var(--radius-radius-md);
	box-shadow: none;
	font-family: var(--font-ui-label-bold-family);
	font-size: var(--font-ui-label-medium-size); /* 14px */
	font-weight: var(--font-ui-label-bold-weight);
	line-height: var(--font-ui-label-bold-line-height);
	text-decoration: none;
	white-space: nowrap;
}

/* Both download buttons use the mint style of the Case Study Library's "Web link" button */
.io-il a.io-il__btn--png,
.io-il a.io-il__btn--png:visited,
.io-il a.io-il__btn--svg,
.io-il a.io-il__btn--svg:visited {
	background: var(--color-mint-green);
}

.io-il a.io-il__btn--png:hover,
.io-il a.io-il__btn--svg:hover {
	background: var(--color-mint-dark);
	color: var(--color-pure-black);
}

@container io-il-card (min-width: 340px) {
	.io-il__actions {
		flex-direction: row;
	}

	.io-il a.io-il__btn,
	.io-il a.io-il__btn:visited {
		flex: 1 1 0; /* equal widths */
		width: auto;
	}

	/* A lone button is half the card wide: .png sits left, .svg sits right */
	.io-il a.io-il__btn:only-child {
		flex: 0 0 calc(50% - var(--spacing-space-4));
	}

	.io-il a.io-il__btn--png:only-child {
		margin-right: auto;
	}

	.io-il a.io-il__btn--svg:only-child {
		margin-left: auto;
	}
}

.io-il__btn-icon {
	flex: none;
	display: block;
	width: 18px;
	height: 18px;
}

/* ---- No bullets: override theme list styles on both lists ---- */

.io-il ul.io-il__grid,
.io-il ul.io-il__tags,
.io-il ul.io-il__options {
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.io-il ul.io-il__grid > li,
.io-il ul.io-il__tags > li,
.io-il ul.io-il__options > li {
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
	background: none !important;
	text-indent: 0 !important;
}

.io-il ul.io-il__grid > li::marker,
.io-il ul.io-il__tags > li::marker,
.io-il ul.io-il__options > li::marker {
	content: none !important;
	font-size: 0 !important;
}

.io-il ul.io-il__grid > li::before,
.io-il ul.io-il__grid > li::after,
.io-il ul.io-il__tags > li::before,
.io-il ul.io-il__tags > li::after,
.io-il ul.io-il__options > li::before,
.io-il ul.io-il__options > li::after {
	content: none !important;
	display: none !important;
}

/* ---- Focus ---- */

.io-il .io-il__input:focus-visible,
.io-il .io-il__tag:focus-visible,
.io-il .io-il__clear:focus-visible,
.io-il .io-il__clear-filters:focus-visible,
.io-il .io-il__checkbox:focus-visible,
.io-il .io-il__facet-title:focus-visible,
.io-il a.io-il__btn:focus-visible {
	outline: 3px solid var(--color-pure-black);
	outline-offset: var(--spacing-space-2);
}

/* ---- Empty state ---- */

.io-il__empty {
	margin: var(--spacing-space-24) 0 0;
	padding: var(--spacing-space-24);
	border: 1px solid var(--color-grey-light);
	border-radius: var(--radius-radius-2xl);
}

.io-il__empty p {
	margin: 0 0 var(--spacing-space-12);
}

/* ---- Utilities ---- */

.io-il__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
