/**
 * Hero post type archives (brands, retailers, events) and the team
 * directory toolbar: filter tabs, search, one gallery grid.
 * Page header, label, container and the accent-rule title come from
 * editorial.css.
 *
 * @package GeneratePress_Child
 */

/*--------------------------------------------------------------
# Toolbar label
--------------------------------------------------------------*/
/* "Explore by …" label with a hairline running to the container edge. */
.editorial-archive__label {
	display: flex;
	align-items: center;
	gap: var(--editorial-space-sm);
	width: 100%;
	margin: 0;
	color: var(--editorial-accent-text);
}

.editorial-archive__label::after {
	content: "";
	flex: 1;
	order: 2; /* between the text and the count */
	height: 1px;
	background: currentColor;
	opacity: 0.35;
}

/* "8 categories" after the hairline: phones only, where the chips scroll
   and the number says how many there are. */
.editorial-archive__count {
	display: none;
	order: 3;
	color: var(--editorial-muted-text);
	font-weight: 400;
	text-transform: none;
}

/* "Showing: Beauty — Clear": phones only; the desktop tabs show the state.
   The attribute rule keeps [hidden] winning over the phone display. */
.editorial-grid-status,
.editorial-grid-status[hidden] {
	display: none;
}

/*--------------------------------------------------------------
# Toolbar: label above, then tabs left and search right on one row
--------------------------------------------------------------*/
.editorial-grid-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
	column-gap: var(--editorial-space-lg);
	row-gap: 0;
	padding-block: var(--editorial-space-sm) var(--editorial-space-sm);
}

.editorial-archive__label {
	grid-column: 1 / -1;
}

.editorial-grid-filters__buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 2.25rem;
}

/* Filter tabs, shared by the brands, retailers, events and team rows:
   plain uppercase sans in black, widely spaced; the checked one sits in a
   hairline box and goes bold. The box is on every tab, transparent until
   checked, so the text doesn't shift when the selection moves. GP paints
   every button:hover/:focus dark, so all states stay transparent. */
.editorial-grid-filters__button {
	padding: 0.35em 0.55em;
	margin: 0;
	border: 1px solid transparent;
	border-radius: 0;
	background: none;
	color: var(--editorial-heading);
	font-family: var(--wc-font-sans);
	font-size: 0.85rem;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: uppercase;
	cursor: pointer;
	transition: opacity 160ms ease, border-color 160ms ease;
}

.editorial-grid-filters__button:is(:hover, :focus, :active) {
	background: none;
	color: inherit;
}

.editorial-grid-filters__button:focus-visible {
	outline: 1px solid var(--editorial-accent-rule);
	color: var(--editorial-heading);
	outline-offset: 2px;
}

.editorial-grid-filters__button.is-checked {
	border-color: currentColor;
	color: var(--editorial-heading);
	font-weight: 700;
}

/* While searching, the filter isn't applied: the row reads as inactive. */
.editorial-grid-filters.is-searching .editorial-grid-filters__button {
	opacity: 0.35;
}

.editorial-grid-filters.is-searching .is-checked {
	border-color: transparent;
}

/* Search, in black like the tabs: icon on the left, underline field;
   sits at the row's right edge. */
.editorial-grid-search {
	position: relative;
	min-width: min(280px, 100%);
	color: var(--editorial-heading);
	font-weight: 600;
}

/* Element prefix: GP's input[type=search] padding would otherwise win. */
input.editorial-grid-search__input {
	padding: 0 0.25em 0 1.6rem;
	font-size: 0.8rem;
	line-height: 2;
}

input.editorial-grid-search__input::placeholder {
	color: var(--editorial-heading);
}

.editorial-grid-search__icon {
	position: absolute;
	left: 0.25em;
	top: 50%;
	width: 15px;
	height: 15px;
	transform: translateY(-50%);
	pointer-events: none;
}

/*--------------------------------------------------------------
# Phones: label with count, boxed search, a scrolling row of chips, then
# "Showing: … — Clear" (the design's mobile toolbar)
--------------------------------------------------------------*/
@media ( max-width: 782px ) {
	.editorial-grid-toolbar {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--editorial-space-sm);
	}

	/* Label, hairline, count on one line: the words never wrap, the
	   hairline takes what is left (and can shrink to a dash). */
	.editorial-archive__label {
		order: 1;
		font-size: 1rem;
	}

	.editorial-archive__label > span {
		flex: 0 0 auto;
		white-space: nowrap;
	}

	.editorial-archive__label::after {
		flex: 1 1 1rem;
		min-width: 1rem;
	}

	.editorial-archive__count {
		display: inline;
	}

	.editorial-grid-search {
		order: 2;
		min-width: 0;
	}

	.editorial-grid-filters {
		order: 3;
	}

	.editorial-grid-status {
		order: 4;
	}

	/* Boxed search: a rounded field with the icon inside. */
	input.editorial-grid-search__input {
		padding: 0.75em 1em 0.75em 2.75rem;
		border: 1px solid var(--editorial-border);
		border-radius: 10px;
		font-size: 1rem;
		line-height: 1.5;
	}

	.editorial-grid-search__icon {
		left: 1.1rem;
		width: 18px;
		height: 18px;
	}

	/* Chips in one row that scrolls sideways, running out to the viewport
	   edge (negative gutter) so the clipped chip hints that there are more. */
	.editorial-grid-filters__buttons {
		flex-wrap: nowrap;
		gap: 0.5rem;
		margin-inline: calc(-1 * var(--editorial-gutter));
		padding-inline: var(--editorial-gutter);
		overflow-x: auto;
		scroll-padding-inline: var(--editorial-gutter);
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.editorial-grid-filters__buttons::-webkit-scrollbar {
		display: none;
	}

	.editorial-grid-filters__button {
		flex: 0 0 auto;
		padding: 0.5em 1em;
		border-color: var(--editorial-muted);
		border-radius: 0;
		font-size: 0.9rem;
		text-transform: none;
		white-space: nowrap;
	}

	/* The chosen chip fills black; :active (the tap) must not clear it. */
	.editorial-grid-filters__button.is-checked,
	.editorial-grid-filters__button.is-checked:is(:hover, :focus, :active) {
		border-color: var(--editorial-heading);
		background: var(--editorial-heading);
		color: var(--editorial-page);
		font-weight: 600;
	}

	.editorial-grid-filters.is-searching .is-checked {
		border-color: var(--editorial-muted);
		background: none;
		color: var(--editorial-heading);
	}

	.editorial-grid-status {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: var(--editorial-space-sm);
		margin: 0;
		padding-block: var(--editorial-space-xs) var(--editorial-space-sm);
		border-bottom: 1px solid var(--editorial-border);
		color: var(--editorial-text);
		font-family: var(--wc-font-sans);
		font-size: 0.95rem;
	}

	.editorial-grid-status[hidden] {
		display: none;
	}

	.editorial-grid-status__text {
		color: var(--editorial-muted-text);
	}

	.editorial-grid-status__term {
		color: var(--editorial-text);
	}

	.editorial-grid-status__clear,
	.editorial-grid-status__clear:is(:hover, :focus, :active) {
		padding: 0;
		border: 0;
		background: none;
		color: var(--editorial-heading);
		font: inherit;
		text-decoration: underline;
		text-underline-offset: 0.2em;
		cursor: pointer;
	}
}

/*--------------------------------------------------------------
# Gallery: one 12-column grid of every card
--------------------------------------------------------------*/
/* Edge to edge. Crossfade class is set by editorial-grid.js (FADE_MS = 180). */
.editorial-grid-content {
	width: 100%;
	padding-block-end: var(--space-section);
	transition: opacity 180ms ease, transform 180ms ease;
}

.editorial-grid-content.is-transitioning {
	opacity: 0;
	transform: translateY(6px);
}

/* The tabs and the search hide cards one by one (data-terms / title). */
.editorial-grid-card.is-hidden-by-filter,
.editorial-grid-card.is-hidden-by-search {
	display: none;
}

/* 12 tracks so editorial-grid.js can rotate a big/small pattern. */
.editorial-grid {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	grid-auto-rows: clamp(220px, 26vw, 420px);
	gap: var(--editorial-gap);
	width: 100%;
}

/* Card: image, a gradient scrim (::after) and the name over it. On hover
   the image zooms and dims, the scrim deepens to a darker wash, and the
   name grows from label size to heading size while rising. Growth is
   font-size (transform needed a narrower title box, which wrapped short
   names); small cards grow less so the text doesn't re-wrap mid-motion. */
.editorial-grid-card {
	--card-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--card-title-size: var(--editorial-font-size-h5);
	--card-title-size-hover: var(--editorial-font-size-h3);
	position: relative;
	display: block;
	grid-column: span 4;
	overflow: hidden;
	color: var(--editorial-on-image);
	text-decoration: none;
	container-type: inline-size;
}

@container (max-width: 480px) {
	.editorial-grid-card {
		--card-title-size-hover: var(--editorial-font-size-h4);
	}
}

.editorial-grid-card::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(to top, rgb(0 0 0 / 0.6), transparent 45%),
		rgb(0 0 0 / 0);
	transition: background 600ms var(--card-ease);
	pointer-events: none;
}

/* Pinned to the card's box rather than sized with height: 100% — Safari
   doesn't resolve a percentage height inside a stretched grid item, which
   left a portrait photo (Perroy) at its natural height and showed only
   its top. The crop is always the middle of the picture. */
.editorial-grid-card__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 900ms var(--card-ease), filter 600ms var(--card-ease);
	will-change: transform;
}

/* The card title is a plain <h3>; the resets keep the global h3 (sans,
   medium, margins, balance) off it so it stays the serif caption. */
.editorial-grid-card h3 {
	position: absolute;
	max-width: none;
	margin: 0;
	font-weight: 400;
	letter-spacing: normal;
	text-transform: none;
	text-wrap: wrap;
	inset: auto 0 0 0;
	z-index: 1;
	padding: 1em;
	color: var(--editorial-on-image); /* on the title itself: GP recolours a:hover */
	font-family: var(--wc-font-serif);
	font-size: var(--card-title-size);
	line-height: 1.1;
	text-shadow: 0 2px 8px rgb(0 0 0 / 0.35);
	transition: font-size 600ms var(--card-ease), transform 600ms var(--card-ease);
}

/* Hover dims the card so the name stands out: the picture zooms a
   little while a tint settles over all of it, deepest at the foot where
   the title sits. Several images are pale (posters, white backdrops)
   and the white title got lost on them; this keeps it readable on any
   photo. */
.editorial-grid-card:is(:hover, :focus-visible) .editorial-grid-card__image {
	transform: scale(1.06);
	filter: none;
}

.editorial-grid-card:is(:hover, :focus-visible)::after {
	background:
		linear-gradient(to top, rgb(0 0 0 / 0.55), transparent 60%),
		rgb(0 0 0 / 0.4);
}

.editorial-grid-card:is(:hover, :focus-visible) h3 {
	font-size: var(--card-title-size-hover);
	transform: translateY(-0.3em);
}

.editorial-grid-card:focus-visible {
	outline: 2px solid var(--editorial-accent);
	outline-offset: -2px;
}

@media ( max-width: 600px ) {
	.editorial-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.editorial-grid-card {
		grid-column: span 1 !important;
	}
}
