/*
 * Shop explorer (includes/class-impact-shop-explorer.php).
 *
 * Sits on the page's own background and takes its devices from the brand guidelines: the
 * numbered contents list with the red roundel on the picked aisle, a large headline, letter-spaced
 * labels with hairlines and Plex Mono for codes. Product photos are shown as shot: they are square
 * and on white, so each fills its tile with nothing under or over it. Self-contained, so it reads
 * the same on the homepage and on /shop/, whose stylesheets are not loaded on each other's pages.
 *
 * Host pages style elements with ID selectors (`#impact-home-lab a/h2/h3/p { color }`,
 * `#impact-home-lab p { margin: 0 }`, `#impact-home-lab button { font: inherit }`), which beat any
 * class selector: colours on links, headings and paragraphs carry !important, and spacing around
 * them comes from the parent's gap or !important margins.
 */

.ise {
	--ise-red: #C00000;
	--ise-orange: #C84A1C;
	--ise-orange-2: #B03E14;
	--ise-green: #2AA000;
	--ise-slate: #3D4752;
	--ise-body: #4E555D;
	--ise-muted: #6B7480;
	--ise-quiet: #A39B8F;
	--ise-stone: #D9D2C7;
	--ise-hair: #E7E1D8;
	--ise-edge: #ECE7E0;
	position: relative;
	color: var(--ise-body);
	font-family: "IBM Plex Sans", sans-serif;
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
	-webkit-font-smoothing: antialiased;
}

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

.ise h2,
.ise h3,
.ise p,
.ise ul,
.ise li { margin: 0; padding: 0; }

.ise li { list-style: none; }
.ise li::before { content: none; }
.ise a { text-decoration: none !important; }
.ise img { display: block; max-width: 100%; }

.ise .ise-i {
	display: block;
	flex: none;
	width: 1em;
	height: 1em;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
	overflow: visible;
}

.ise-mono {
	color: var(--ise-quiet);
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ise-wrap {
	position: relative;
	width: min(100% - 128px, 1312px);
	margin-inline: auto;
}

/* Heading: label and hairline, then the headline. ---------------------------------------- */

.ise-head__bar { display: flex; align-items: center; gap: 18px; }

.ise-label {
	color: var(--ise-red);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.16em;
	line-height: 1.4;
	text-transform: uppercase;
	white-space: nowrap;
}

.ise-head__rule { flex: 1; height: 1px; background: var(--ise-hair); }

/* Phones only: "View all" sits on the label row instead of a big button. */
.ise .ise-head__all {
	display: none;
	align-items: center;
	gap: 6px;
	color: var(--ise-red) !important;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
	white-space: nowrap;
}

.ise .ise-head__all .ise-i { font-size: 13px; }

.ise-head__row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	margin-top: 22px;
}

.ise .ise-head h2 {
	color: var(--ise-slate) !important;
	font-size: 48px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.05;
}

.ise .ise-head__link {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 10px;
	padding: 12px 20px;
	border: 1.5px solid var(--ise-slate);
	border-radius: 4px;
	color: var(--ise-slate) !important;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	transition: background-color 0.18s, color 0.18s;
}

.ise .ise-head__link .ise-i { font-size: 16px; transition: transform 0.18s; }
.ise .ise-head__link:hover { background: var(--ise-slate); color: #fff !important; }
.ise .ise-head__link:hover .ise-i { transform: translateX(3px); }

.ise .ise-head__lede {
	margin-top: 12px !important;
	color: var(--ise-muted) !important;
	font-size: 16.5px;
	line-height: 1.55;
}

/* Index and stage ----------------------------------------------------------------------- */

.ise-body {
	display: grid;
	grid-template-columns: 270px minmax(0, 1fr);
	gap: 56px;
	align-items: start;
	margin-top: 40px;
}

.ise-index { position: sticky; top: 110px; display: flex; flex-direction: column; }

.ise-index__label {
	display: flex;
	align-items: center;
	min-height: 32px;
	margin-bottom: 8px;
	color: var(--ise-quiet);
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.ise-index__list { display: flex; flex-direction: column; }

.ise .ise-idx {
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr) 18px;
	align-items: center;
	min-height: 46px;
	border-top: 1px solid var(--ise-hair);
	color: var(--ise-body) !important;
	font-size: 16.5px;
	font-weight: 500;
	line-height: 1.3;
	transition: color 0.18s;
}

.ise .ise-idx:last-child { border-bottom: 1px solid var(--ise-hair); }

.ise-idx__n {
	display: grid;
	flex: none;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	color: var(--ise-quiet);
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11.5px;
	font-weight: 500;
	transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.ise-idx__t { transition: transform 0.2s; }

.ise-idx__go {
	color: var(--ise-red);
	font-size: 16px;
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity 0.2s, transform 0.2s;
}

.ise .ise-idx:hover { color: var(--ise-slate) !important; }
.ise .ise-idx:hover .ise-idx__t { transform: translateX(4px); }
.ise .ise-idx:hover .ise-idx__go { opacity: 0.5; transform: none; }

.ise .ise-idx[aria-selected="true"] { color: var(--ise-slate) !important; font-weight: 600; }
.ise .ise-idx[aria-selected="true"] .ise-idx__n { background: var(--ise-red); color: #fff; transform: scale(1.04); }
.ise .ise-idx[aria-selected="true"] .ise-idx__go { opacity: 1; transform: none; }
.ise .ise-idx:focus-visible { outline: 2px solid var(--ise-red); outline-offset: 2px; }

/* Phones only: the picked aisle on one row, opening the list. */
.ise .ise-picker { display: none; }

.ise-stage { min-width: 0; }
.ise-stage:focus { outline: none; }
.ise-stage[aria-busy="true"] { opacity: 0.55; transition: opacity 0.2s; }

.ise-stage.is-in > * { animation: ise-rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ise-stage.is-in > :nth-child(2) { animation-delay: 0.04s; }
.ise-stage.is-in > :nth-child(3) { animation-delay: 0.08s; }

@keyframes ise-rise {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

/* One row above the products: the aisle's sub-aisles, then the way into the whole aisle. */
.ise-stage__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px 24px;
	min-height: 32px;
}

.ise .ise-subs { display: flex; flex-wrap: wrap; gap: 8px; }

.ise .ise-subs a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 6px 13px;
	border: 1px solid var(--ise-stone);
	border-radius: 999px;
	color: var(--ise-body) !important;
	font-size: 11.5px;
	font-weight: 500;
	letter-spacing: 0.1em;
	line-height: 1.3;
	text-transform: uppercase;
	white-space: nowrap;
	transition: border-color 0.18s, color 0.18s;
}

.ise .ise-subs a:hover { border-color: var(--ise-red); color: var(--ise-red) !important; }

.ise .ise-stage__all {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 8px;
	min-height: 32px;
	margin-left: auto;
	color: var(--ise-red) !important;
	font-size: 12.5px;
	font-weight: 600;
	letter-spacing: 0.14em;
	line-height: 1.4;
	text-transform: uppercase;
	white-space: nowrap;
}

.ise .ise-stage__all .ise-i { font-size: 14px; transition: transform 0.18s; }
.ise .ise-stage__all:hover .ise-i { transform: translateX(3px); }

/* Products: two rows of four. ------------------------------------------------------------- */

.ise-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 28px 18px;
	margin-top: 22px;
}

.ise-card { position: relative; display: flex; flex-direction: column; min-width: 0; }

.ise .ise-card__tile {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border: 1px solid var(--ise-edge);
	border-radius: 10px;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.ise .ise-card__tile img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ise-card:hover .ise-card__tile { border-color: var(--ise-stone); box-shadow: 0 10px 24px -14px rgba(61, 71, 82, 0.35); }
.ise-card:hover .ise-card__tile img { transform: scale(1.04); }

.ise-card__copy { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 12px 2px 0; }

.ise-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 16px; }

/* Impact's own products, Go Green and stock: a dot and a word, not a badge over the photo. */
.ise-mark {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.4;
	text-transform: uppercase;
}

.ise-mark::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

.ise-mark--own { color: var(--ise-red); }
.ise-mark--green { color: var(--ise-green); }
.ise-mark--out { color: var(--ise-muted); }

.ise .ise-card__name {
	display: -webkit-box;
	min-height: 2.6em;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	color: var(--ise-slate) !important;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	transition: color 0.18s;
}

.ise .ise-card__name:hover { color: var(--ise-red) !important; }

.ise-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }

.ise-px { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; min-width: 0; color: var(--ise-slate); line-height: 1.25; }
.ise-px b { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.ise-px s { color: var(--ise-quiet); font-size: 13px; }
.ise-px small { color: var(--ise-muted); font-size: 12px; font-weight: 400; }

.ise-card__acts { display: flex; flex: none; gap: 6px; }

.ise .ise-round {
	position: relative;
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.ise .ise-round--list { border: 1px solid var(--ise-stone); background: #fff; color: var(--ise-slate); font-size: 16px; }
.ise .ise-round--list:hover { border-color: var(--ise-red); color: var(--ise-red); }
.ise .ise-round--add,
.ise .ise-round--view { color: #fff !important; font-size: 18px; }
.ise .ise-round--add { background: var(--ise-orange); }
.ise .ise-round--add:hover { background: var(--ise-orange-2); transform: scale(1.06); }
.ise .ise-round--view { background: var(--ise-slate); font-size: 16px; }
.ise .ise-round--view:hover { background: #173642; }
.ise .ise-round .ise-i--check { display: none; }
.ise .ise-round.loading { opacity: 0.6; pointer-events: none; }
.ise .ise-round.added { background: #1f7a00; }
.ise .ise-round.added .ise-i--plus { display: none; }
.ise .ise-round.added .ise-i--check { display: block; }
.ise .ise-round:focus-visible { outline: 2px solid var(--ise-red); outline-offset: 2px; }

/* The basket drawer confirms an add, so WooCommerce's inline "View basket" link stays hidden here. */
.ise .added_to_cart { display: none !important; }

/* Closing tile, when the last row is short. */
.ise .ise-tile {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 14px;
	min-height: 200px;
	padding: 22px;
	border: 1px dashed var(--ise-stone);
	border-radius: 10px;
	color: var(--ise-muted) !important;
	transition: background-color 0.2s, border-color 0.2s;
}

.ise-tile__icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--ise-red);
	color: #fff;
	font-size: 18px;
	transition: transform 0.2s;
}

.ise-tile__text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; }
.ise-tile__text b { color: var(--ise-slate); font-size: 17px; font-weight: 600; }
.ise .ise-tile:hover { border-color: var(--ise-red); background: #fff; }
.ise .ise-tile:hover .ise-tile__icon { transform: translateX(3px); }

/* Phones only: the way into the aisle after its products. */
.ise .ise-more { display: none; }

/* Responsive ------------------------------------------------------------------------------ */

@media (max-width: 1120px) {
	.ise-wrap { width: min(100% - 64px, 1056px); }
	.ise-body { grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
	.ise .ise-head h2 { font-size: 42px; }
	.ise .ise-idx { font-size: 15.5px; }
	/* Two rows of three. */
	.ise-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.ise-grid > :nth-child(n + 7) { display: none; }
}

@media (max-width: 900px) {
	.ise-wrap { width: calc(100% - 36px); }
	.ise-head__row { margin-top: 16px; }
	.ise .ise-head h2 { font-size: 34px; }
	.ise .ise-head__lede { font-size: 15px; }

	.ise-body { display: block; margin-top: 22px; }

	/* The aisles: one row showing the picked aisle; tapping it opens the numbered list over the products. */
	.ise-index { position: relative; top: auto; z-index: 5; }
	.ise-index__label { display: none; }

	.ise .ise-picker {
		display: flex;
		align-items: center;
		gap: 12px;
		width: 100%;
		min-height: 54px;
		margin: 0;
		padding: 0 16px 0 12px;
		border: 1px solid var(--ise-hair);
		border-radius: 10px;
		background: #fff;
		box-shadow: none;
		color: var(--ise-slate) !important;
		font-family: "IBM Plex Sans", sans-serif !important;
		font-size: 16px !important;
		font-weight: 600 !important;
		letter-spacing: 0 !important;
		line-height: 1.3 !important;
		text-align: left;
		text-transform: none !important;
		cursor: pointer;
	}

	.ise .ise-picker .ise-idx__n { background: var(--ise-red); color: #fff; }
	.ise-picker__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.ise-picker__chev { color: var(--ise-muted); font-size: 18px; transition: transform 0.2s; }
	.ise .ise-picker[aria-expanded="true"] { border-color: var(--ise-stone); border-radius: 10px 10px 0 0; }
	.ise .ise-picker[aria-expanded="true"] .ise-picker__chev { transform: rotate(180deg); }
	.ise .ise-picker:focus-visible { outline: 2px solid var(--ise-red); outline-offset: 2px; }

	.ise-index__list {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		max-height: min(70vh, 560px);
		overflow-y: auto;
		padding: 0 16px 6px 12px;
		border: 1px solid var(--ise-stone);
		border-top: 0;
		border-radius: 0 0 10px 10px;
		background: #fff;
		box-shadow: 0 22px 40px -18px rgba(61, 71, 82, 0.35);
	}

	.ise-index.is-open .ise-index__list { display: flex; }
	.ise .ise-idx { min-height: 48px; font-size: 15.5px; }
	.ise .ise-idx:first-child { border-top-color: transparent; }
	.ise .ise-idx:last-child { border-bottom: 0; }
	.ise-idx__go { display: none; }

	.ise-stage { margin-top: 20px; }
	.ise-grid { margin-top: 18px; gap: 22px 14px; }
}

@media (max-width: 600px) {
	.ise .ise-head__all { display: inline-flex; }
	.ise .ise-head__link { display: none; }
	.ise .ise-head h2 { font-size: 30px; }

	/* Sub-aisles and the top link give way to the products; the way in follows them. */
	.ise-stage__top { display: none; }
	.ise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; margin-top: 0; }
	.ise-grid > :nth-child(n + 5) { display: none; }

	.ise-card__copy { padding-top: 10px; }
	.ise .ise-card__name { font-size: 14px; }
	.ise-px b { font-size: 16px; }
	/* The lede says prices exclude VAT; on a phone the cards keep just the price. */
	.ise-card .ise-px__vat { display: none; }
	.ise .ise-round { width: 34px; height: 34px; }
	.ise-card__acts { gap: 5px; }
	.ise .ise-tile { padding: 16px; }

	.ise .ise-more {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20px;
		padding: 15px 16px;
		border: 1.5px solid var(--ise-slate);
		border-radius: 4px;
		color: var(--ise-slate) !important;
		font-size: 15px;
		font-weight: 600;
		line-height: 1.3;
	}

	.ise .ise-more .ise-i { color: var(--ise-red); font-size: 18px; }
}

@media (hover: none) {
	.ise-card:hover .ise-card__tile { border-color: var(--ise-edge); box-shadow: none; }
	.ise-card:hover .ise-card__tile img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.ise *,
	.ise *::before,
	.ise *::after { transition: none !important; animation: none !important; }
}
