/*
 * The site's index pages in the new design, light theme (pul_website/templates/index_v2/:
 * recipes, articles, videos and the general search), after the app's tablet Recipes tab and the
 * web app: the title with the filter button, the search's tabs, the chosen filters, the results
 * and the filter panel (docked from 1,000px, a drawer below that). Mobile first, scoped to .ix.
 * The shared parts (tokens, search pill, pills, cards, "more") are in ix_base.css (.ix-kit),
 * which loads first. index_styles.css and index_script.js stay with the other index pages
 * (shop, ebooks, support...).
 * Ads: the two slots keep their partials; nothing above them sets overflow or transform.
 */

.ix {
	background: linear-gradient(var(--ix-canvas) 0, var(--ix-canvas) 30rem, var(--ix-surface) 100%);
}

/* The page under the translucent navbar matches the top of the page */
body:has(> .ix) {
	background: #EEEFEB;
}

/* ---------- Title and search ---------- */

.ix-head {
	padding-top: clamp(1.5rem, 4vw, 2.75rem);
}

.ix .ix-title {
	margin: 0 0 .9rem;
	color: var(--ix-ink);
	font-family: var(--ix-display);
	font-size: clamp(2.25rem, 7vw, 3.25rem);
	font-weight: normal;
	line-height: 1.05;
	letter-spacing: -.015em;
	text-transform: none;
	overflow-wrap: anywhere;
}

.ix-searchrow {
	display: flex;
	align-items: center;
	gap: .6rem;
	max-width: 44rem;
}

/* The filter button: the apps' green circle, with "Filters" and a count from 600px */
.ix .ix-filterbtn {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	height: 3rem;
	min-width: 3rem;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--ix-green);
	color: #fff;
	font: 600 1rem/1 var(--ix-sans);
	cursor: pointer;
	transition: background-color .2s;
}

.ix .ix-filterbtn:hover,
.ix .ix-filterbtn[aria-expanded="true"] {
	background: var(--ix-green-dark);
}

.ix-filterbtn svg {
	width: 1.15rem;
	height: 1.15rem;
}

.ix-filterbtn__label {
	display: none;
	padding-top: .15rem;
}

.ix-filterbtn__count {
	position: absolute;
	top: -.3rem;
	right: -.3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: .1rem .3rem 0;
	border-radius: 999px;
	background: var(--ix-lime);
	color: var(--ix-ink);
	font-size: .8rem;
	font-weight: 700;
}

@media (min-width: 600px) {
	.ix .ix-filterbtn {
		padding: 0 1.2rem 0 1.05rem;
	}

	.ix-filterbtn__label {
		display: inline;
	}

	.ix-filterbtn__count {
		position: static;
		margin-left: .1rem;
	}
}

.ix .ix-note {
	margin: .9rem 0 0;
	color: var(--ix-text);
}

/* ---------- The forest top (index_page.HEAD = 'forest'; 'paper' is the rules above) ----------
 * As the rest of the site opens (the support page, the about page, the article and video pages):
 * the forest band (ix_base.css .ix-forest) with the title, the search pill and the filter button
 * centred; under it, on the page's light ground, the quick pills and the filters in use, centred
 * too. On the green the search pill loses its green ring (it lifts off with a shadow, lime while
 * typing), and the filter button is glass with a cream edge: the green one would hardly show. */
.ix-head--forest {
	padding: clamp(1.75rem, 5vw, 3.25rem) 0 clamp(2.5rem, 6vw, 3.75rem);
	text-align: center;
}

.ix .ix-head--forest .ix-title {
	margin-bottom: 1.1rem;
	color: var(--ix-cream);
	text-wrap: balance;
}

.ix-head--forest .ix-searchrow {
	max-width: 40rem;
	margin-inline: auto;
	text-align: left;
}

.ix-kit .ix-head--forest .ix-search__input {
	border-color: transparent;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}

.ix-kit .ix-head--forest .ix-search__input:focus {
	border-color: var(--ix-lime);
	outline: none;
	box-shadow: 0 0 0 4px rgba(190, 227, 120, .3), 0 10px 30px rgba(0, 0, 0, .28);
}

.ix .ix-head--forest .ix-filterbtn {
	background: rgba(248, 255, 246, .1);
	box-shadow: inset 0 0 0 1.5px rgba(248, 255, 246, .32);
	color: var(--ix-cream);
}

.ix .ix-head--forest .ix-filterbtn:hover,
.ix .ix-head--forest .ix-filterbtn[aria-expanded="true"] {
	background: rgba(248, 255, 246, .18);
}

.ix .ix-head--forest .ix-note {
	max-width: 36rem;
	margin-inline: auto;
	color: var(--ix-sage);
}

/* The quick row centred while it fits, and from its start when it swipes (auto margins: a row
   centred by justify-content couldn't be scrolled back to its first pills) */
.ix--forest .ix-quick {
	margin-top: 1.35rem;
}

.ix--forest .ix-quick__row > :first-child {
	margin-left: auto;
}

.ix--forest .ix-quick__row > :last-child {
	margin-right: auto;
}

.ix--forest .ix-chosen {
	justify-content: center;
}

/* The general search's tabs: one track, the current tab solid (the apps' source control) */
.ix-segments {
	display: inline-flex;
	gap: .2rem;
	max-width: 100%;
	padding: .25rem;
	border: 1px solid var(--ix-line);
	border-radius: 999px;
	background: rgba(249, 251, 248, .85);
	overflow-x: auto;
	scrollbar-width: none;
}

.ix-segments::-webkit-scrollbar {
	display: none;
}

.ix .ix-segment {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: .4rem;
	min-height: 2.25rem;
	padding: .32rem 1rem .2rem;
	border-radius: 999px;
	color: var(--ix-text);
	font-size: .9375rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s, color .2s;
}

.ix .ix-segment:hover {
	background: rgba(80, 113, 55, .08);
	color: var(--ix-ink);
	text-decoration: none;
}

.ix .ix-segment.is-active {
	background: var(--ix-green);
	color: #fff;
}

.ix .ix-segment.is-empty:not(.is-active) {
	color: rgba(26, 37, 24, .4);
}

.ix-segment__count {
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	opacity: .8;
}

/* Phones: tighter, so the four usually fit (index_page.js scrolls to the current one otherwise) */
@media (max-width: 575px) {
	.ix .ix-segment {
		gap: .3rem;
		padding: .32rem .7rem .2rem;
		font-size: .875rem;
	}
}

/* ---------- The chosen filters (the app's chosen row), each with its × ---------- */

.ix-chosen {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin-top: .75rem;
}

.ix .ix-chip {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	min-height: 2rem;
	padding: .28rem .55rem .18rem .85rem;
	border-radius: 999px;
	color: #fff;
	font-size: .875rem;
	font-weight: 500;
	line-height: 1.3;
	text-decoration: none;
}

.ix .ix-chip:hover {
	color: #fff;
	text-decoration: none;
	filter: brightness(1.08);
}

.ix-chip svg {
	width: 1.05rem;
	height: 1.05rem;
	margin-top: -.12rem;
}

.ix-chip--green { background: var(--ix-green); }
.ix-chip--mustard { background: var(--ix-mustard); }
.ix-chip--grey { background: #7A8277; }

.ix .ix-chip--glass {
	padding-right: .85rem;
	border: 1px solid var(--ix-line);
	background: rgba(249, 251, 248, .8);
	color: var(--ix-ink);
}

.ix .ix-chip--glass:hover {
	color: var(--ix-ink);
}

/* ---------- Ads ---------- */

.ix-ad {
	margin-top: 1.25rem;
}

.ix-ad .row {
	margin: 0 !important;
}

/* ---------- Results and the filter panel ---------- */

.ix-body {
	display: grid;
	align-items: start;
	gap: 1.5rem;
	padding-bottom: 1rem;
}

.ix-results {
	container-type: inline-size;
	min-width: 0;
}

.ix .ix-page-note {
	margin: 0 0 .9rem;
	color: var(--ix-muted);
	font-size: .9375rem;
}

.ix .ix-page-note a {
	color: var(--ix-green-dark);
	text-decoration: underline;
	text-underline-offset: .18em;
}

/* Nothing matches */
.ix-empty {
	display: grid;
	justify-items: center;
	gap: .5rem;
	padding: 3rem 1rem 2rem;
	text-align: center;
}

.ix-empty > svg {
	width: 4.5rem;
	height: 4.5rem;
	color: #57701B;
}

.ix .ix-empty h2 {
	margin: .5rem 0 0;
	font-family: var(--ix-display);
	font-size: 1.6rem;
	font-weight: normal;
}

.ix .ix-empty p {
	margin: 0 0 .75rem;
	color: var(--ix-text);
}

/* ---------- The filter panel ---------- */

.ix-filters {
	display: none;
	flex-direction: column;
	background: var(--ix-paper);
}

/* Below 1,000px: a drawer from the right, over a soft scrim */
.ix--filters-open .ix-filters {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 1060;   /* over the navbar (21) and the footer (999) */
	display: flex;
	width: min(22rem, 88vw);
	box-shadow: -18px 0 40px -20px rgba(0, 0, 0, .45);
	animation: ix-drawer .3s var(--ix-ease);
}

.ix-scrim {
	position: fixed;
	inset: 0;
	z-index: 1050;
	background: rgba(26, 37, 24, .3);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

@keyframes ix-drawer {
	from { transform: translateX(100%); }
	to { transform: none; }
}

.ix-filters__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.1rem 1.25rem .5rem;
}

.ix .ix-filters__title {
	margin: 0;
	font-family: var(--ix-display);
	font-size: 1.6rem;
	font-weight: normal;
}

.ix .ix-filters__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ix-canvas);
	color: var(--ix-ink);
	cursor: pointer;
}

.ix-filters__close svg {
	width: 1rem;
	height: 1rem;
}

.ix-filters__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 0 1.25rem 1rem;
	overscroll-behavior: contain;
}

.ix-section {
	margin: 0;
	padding: 1rem 0 .25rem;
	border: 0;
	border-top: 1px solid var(--ix-line);
	min-width: 0;
}

.ix-section:first-child {
	border-top: 0;
	padding-top: .25rem;
}

/* float: the legend in normal flow, below the divider rather than on it */
.ix .ix-section legend {
	float: left;
	width: 100%;
	margin: 0 0 .55rem;
	padding: 0;
	color: var(--ix-ink);
	font-family: var(--ix-display);
	font-size: 1.2rem;
	line-height: 1.2;
}

.ix .ix-section__search {
	width: 100%;
	height: 2.4rem;
	margin-bottom: .6rem;
	padding: .2rem .9rem 0;
	border: 1.5px solid var(--ix-line);
	border-radius: 999px;
	background: #fff;
	color: var(--ix-ink);
	font: 1rem var(--ix-sans);
}

.ix .ix-section__search:focus {
	border-color: var(--ix-green-2);
	outline: none;
}

.ix-opts,
.ix .ix-section__search {
	clear: both;
}

.ix-opts {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
}

.ix-opts--scroll {
	max-height: 12.5rem;
	overflow-y: auto;
	padding: .1rem;
}

/* An option: the apps' pill. The field inside is visually hidden; chosen turns lime with a tick */
.ix-opt {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	min-height: 2rem;
	margin: 0;
	padding: .28rem .85rem .18rem;
	border-radius: 999px;
	background: var(--ix-green);
	color: #fff;
	font-size: .875rem;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	user-select: none;
	transition: background-color .15s, color .15s, filter .15s;
}

.ix-opt:hover {
	filter: brightness(1.1);
}

.ix-opt--mustard { background: var(--ix-mustard); }
.ix-opt--grey { background: #7A8277; }

.ix-opt input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.ix-opt:has(input:checked) {
	padding-left: .55rem;
	background: var(--ix-lime);
	color: var(--ix-ink);
}

.ix-opt:has(input:checked)::before {
	content: '';
	width: .95rem;
	height: .95rem;
	margin-top: -.12rem;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.6 8.4l2.9 2.9 5.9-6.6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.6 8.4l2.9 2.9 5.9-6.6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ix-opt:has(input:focus-visible) {
	outline: 3px solid var(--ix-green-2);
	outline-offset: 2px;
}

.ix-opt[hidden] {
	display: none;
}

/* Free recipes only: a switch */
.ix-switch {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin: .5rem 0 0;
	padding-top: 1rem;
	border-top: 1px solid var(--ix-line);
	cursor: pointer;
}

.ix-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.ix-switch__track {
	position: relative;
	flex: none;
	width: 2.75rem;
	height: 1.6rem;
	border-radius: 999px;
	background: #C9CEC6;
	transition: background-color .2s;
}

.ix-switch__track::after {
	content: '';
	position: absolute;
	top: .2rem;
	left: .2rem;
	width: 1.2rem;
	height: 1.2rem;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .2s var(--ix-ease);
}

.ix-switch input:checked + .ix-switch__track {
	background: var(--ix-green);
}

.ix-switch input:checked + .ix-switch__track::after {
	transform: translateX(1.15rem);
}

.ix-switch input:focus-visible + .ix-switch__track {
	outline: 3px solid var(--ix-green-2);
	outline-offset: 2px;
}

.ix-switch__label {
	color: var(--ix-ink);
	font-weight: 600;
	line-height: 1.3;
}

.ix-switch__label span {
	color: var(--ix-muted);
	font-weight: 400;
}

.ix-filters__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .85rem 1.25rem 1.1rem;
	border-top: 1px solid var(--ix-line);
	background: var(--ix-paper);
}

.ix .ix-filters__clear {
	color: var(--ix-green-dark);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: .2em;
}

.ix .ix-filters__apply {
	min-height: 2.75rem;
	padding: .6rem 1.4rem .5rem;
	border: 0;
	border-radius: 999px;
	background: var(--ix-green);
	color: #fff;
	font: 600 1rem/1.2 var(--ix-sans);
	cursor: pointer;
}

.ix .ix-filters__apply:hover {
	background: var(--ix-green-dark);
}

/* From 1,000px: docked beside the grid, sticky under the navbar, scrolling on its own */
@media (min-width: 1000px) {
	.ix--filters-open .ix-body {
		grid-template-columns: minmax(0, 1fr) 19.5rem;
	}

	.ix--filters-open .ix-filters {
		position: sticky;
		top: calc(var(--ix-nav) + 1rem);
		right: auto;
		bottom: auto;
		z-index: 1;
		width: auto;
		max-height: calc(100vh - var(--ix-nav) - 2rem);
		border: 1px solid var(--ix-line);
		border-radius: 20px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
		animation: none;
		transition: top .6s, max-height .6s;
	}

	.ix--filters-open .ix-scrim {
		display: none;
	}

	.ix-filters__foot {
		border-radius: 0 0 20px 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ix--filters-open .ix-filters {
		transition: none;
		animation: none;
	}
}
