/**
 * td/project-grid (cards: td/project-card)
 */

.td-project-grid {
	padding-block: 80px;
	background-color: var(--wp--preset--color--sand);
	color: var(--wp--preset--color--slate);
}

.td-project-grid__inner {
	display: flex;
	flex-direction: column;
	gap: 48px;
}

/* Header ------------------------------------------------------------------- */

.td-project-grid__header {
	display: flex;
	flex-direction: column;
	gap: 16px;
	text-align: center;
}

.td-project-grid__title {
	text-wrap: balance;
	font-family: var(--wp--preset--font-family--serif);
	font-size: 40px;
	font-weight: 400;
	line-height: 48px;
	color: var(--wp--preset--color--ink);
}

.td-project-grid__text {
	font-size: 14px;
	line-height: 22px;
}

.td-project-grid__button {
	width: 100%;
}

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

.td-project-grid__filter {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 8px;
	border-block: 1px solid var(--wp--preset--color--mist);
}

.td-project-grid__step {
	display: flex;
	margin: -8px;
	padding: 8px;
	border: 0;
	background: none;
	color: var(--wp--preset--color--bronze);
	cursor: pointer;
}

.td-project-grid__step .td-icon {
	width: 17px;
	height: 17px;
}

.td-project-grid__filters {
	display: flex;
	justify-content: center;
	gap: 24px;
}

.td-project-grid__filter-button {
	padding: 0;
	border: 0;
	background-color: transparent;
	color: var(--wp--preset--color--slate);
	cursor: pointer;
}

.td-project-grid__filter-button[aria-pressed="true"] {
	color: var(--wp--preset--color--bronze);
}

.td-project-grid__filter-button:not([aria-pressed="true"]) {
	display: none;
}

.td-project-grid__empty {
	text-align: center;
}

.td-project-grid__item[hidden] {
	display: none;
}

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

.td-project-grid__grid {
	display: grid;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {

	.td-project-grid__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 24px;
	}
}

@media (min-width: 1024px) {

	.td-project-grid {
		padding-block: 150px;
	}

	.td-project-grid__inner {
		gap: 64px;
	}

	.td-project-grid__header {
		display: grid;
		grid-template-columns: minmax(0, 427px) minmax(0, 427px) auto;
		align-items: end;
		justify-content: space-between;
		gap: 24px;
		text-align: left;
	}

	.td-project-grid__title {
		font-size: clamp(48px, 4.45vw, 64px);
		line-height: 1;
	}

	.td-project-grid__text {
		font-size: 16px;
		line-height: 25px;
	}

	.td-project-grid__button {
		width: auto;
	}

	.td-project-grid__filter {
		padding: 16px 64px;
	}

	.td-project-grid__step {
		display: none;
	}

	.td-project-grid__filters {
		flex: 1;
		justify-content: space-between;
	}

	.td-project-grid__filter-button,
	.td-project-grid__filter-button:not([aria-pressed="true"]) {
		display: inline-flex;
		padding: 2px 0 7px;
	}

	.td-project-grid__grid {
		row-gap: 64px;
	}
}

/* Overlay style: dark section, portrait cards with the name and location
   over the image (the arrow marks the whole card as a link) ------------- */

.td-project-grid.is-style-overlay {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--stone);
}

.td-project-grid.is-style-overlay .td-project-grid__inner {
	gap: 32px;
}

.td-project-grid__eyebrow {
	color: var(--wp--preset--color--bronze);
}

.td-project-grid.is-style-overlay .td-project-grid__eyebrow {
	color: var(--wp--preset--color--champagne);
}

.td-project-grid.is-style-overlay .td-project-grid__title {
	font-size: 36px;
	line-height: 44px;
	color: var(--wp--preset--color--ivory);
}

.td-project-grid.is-style-overlay .td-project-grid__grid {
	gap: 16px;
}

.td-project-grid.is-style-overlay .td-project-card {
	display: block;
	aspect-ratio: 350 / 450;
	overflow: hidden;
}

.td-project-grid.is-style-overlay .td-project-card__media {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
}

.td-project-grid.is-style-overlay .td-project-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 43.56%, rgba(0, 0, 0, 0.45) 83.17%);
	pointer-events: none;
}

.td-project-grid.is-style-overlay .td-project-card__info {
	position: absolute;
	right: 56px;
	bottom: 8px;
	left: 16px;
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
}

.td-project-grid.is-style-overlay .td-project-card__title {
	font-size: 24px;
	line-height: 30px;
	color: var(--wp--preset--color--ivory);
}


.td-project-grid.is-style-overlay .td-project-card__footer {
	display: block;
	padding: 0;
	border: 0;
}

.td-project-grid.is-style-overlay .td-project-card__category {
	display: none;
}

/* Link text stays for screen readers ("View project: name"); the arrow sits
   beside the name. */
.td-project-grid.is-style-overlay .td-project-card__link {
	font-size: 0;
	color: var(--wp--preset--color--ivory);
}

.td-project-grid.is-style-overlay .td-project-card__link .td-icon {
	position: absolute;
	right: 16px;
	bottom: 33px; /* centred on the name line: 8 + 22 + 30 / 2 − 12 */
	width: 24px;
	height: 24px;
	padding: 6px;
	transform: none;
}

.td-project-grid.is-style-overlay .td-project-card__link:focus-visible {
	outline: none;
}

.td-project-grid.is-style-overlay .td-project-card__link:focus-visible::after {
	outline: 2px solid var(--wp--preset--color--champagne);
	outline-offset: -2px;
}

@media (min-width: 600px) {

	.td-project-grid.is-style-overlay .td-project-grid__grid {
		gap: 24px;
	}

	.td-project-grid.is-style-overlay .td-project-card {
		aspect-ratio: 314 / 468;
	}
}

@media (min-width: 1024px) {

	.td-project-grid.is-style-overlay .td-project-grid__inner {
		gap: 48px;
	}

	.td-project-grid.is-style-overlay .td-project-grid__header {
		grid-template-columns: minmax(0, 765px) auto;
		gap: 16px 64px;
	}

	.td-project-grid.is-style-overlay .td-project-grid__eyebrow,
	.td-project-grid.is-style-overlay .td-project-grid__title,
	.td-project-grid.is-style-overlay .td-project-grid__text {
		grid-column: 1;
	}

	.td-project-grid.is-style-overlay .td-project-grid__eyebrow {
		margin-bottom: 16px;
	}

	.td-project-grid.is-style-overlay .td-project-grid__title {
		font-size: 48px;
		line-height: 56px;
	}

	.td-project-grid.is-style-overlay .td-project-grid__button {
		grid-row: 1 / span 3;
		grid-column: 2;
		width: auto;
	}

	.td-project-grid.is-style-overlay .td-project-grid__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.td-project-grid.is-style-overlay .td-project-card__info {
		right: 72px;
		bottom: 16px;
		left: 24px;
	}

	.td-project-grid.is-style-overlay .td-project-card__link .td-icon {
		right: 24px;
		bottom: 41px; /* 16 + 22 + 30 / 2 − 12 */
	}
}

/* Portfolio style (Portfolio page): dark section at the top of the page,
   centred intro (eyebrow, display heading, text), the filter tabs on a
   slate rule (a select box on phones and tablets) and the card grid in
   ivory/stone. The design's top padding includes the header bar (96px on
   phones, 80px from 1200px), which sits above the section here. ---------- */

.td-project-grid.is-style-portfolio {
	padding-block: 44px var(--td-section-space);
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--stone);
}

.is-style-portfolio .td-project-grid__header {
	align-items: center;
	max-width: 652px;
	margin-inline: auto;
}

.is-style-portfolio .td-project-grid__eyebrow {
	color: var(--wp--preset--color--champagne);
}

.is-style-portfolio .td-project-grid__title {
	color: var(--wp--preset--color--ivory);
}

.is-style-portfolio .td-project-grid__button {
	width: auto;
}

.is-style-portfolio .td-project-grid__filter {
	border-color: var(--wp--preset--color--slate);
}

.is-style-portfolio .td-project-grid__filter-button {
	color: var(--wp--preset--color--ivory);
}

.is-style-portfolio .td-project-grid__filter-button[aria-pressed="true"] {
	color: var(--wp--preset--color--bronze);
}

/* Phones and tablets: a select box instead of the tabs and arrows. */
.td-project-grid__select {
	display: none;
}

.is-style-portfolio .td-project-grid__filter {
	padding: 0;
	border: 0;
}

.is-style-portfolio .td-project-grid__step,
.is-style-portfolio .td-project-grid__filters {
	display: none;
}

.is-style-portfolio .td-project-grid__select {
	position: relative;
	display: block;
	flex: 1;
}

.td-project-grid__select-input {
	width: 100%;
	height: 38px;
	padding: 4px 36px;
	border: 1px solid var(--wp--preset--color--slate);
	border-radius: 0;
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--bronze);
	font-family: var(--wp--preset--font-family--sans);
	font-size: 12px;
	font-weight: 500;
	line-height: 13px;
	letter-spacing: 0.15em;
	text-align: center;
	text-transform: uppercase;
	cursor: pointer;
	appearance: none;
}

.td-project-grid__select-input:focus-visible {
	outline: 2px solid var(--wp--preset--color--champagne);
	outline-offset: 2px;
}

.td-project-grid__select-input option {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ivory);
}

.td-project-grid__select .td-icon {
	position: absolute;
	top: 9px;
	right: 8px;
	width: 20px;
	height: 20px;
	color: var(--wp--preset--color--bronze);
	pointer-events: none;
}

/* Cards on the dark background. */
.is-style-portfolio .td-project-card__media {
	background-color: rgba(241, 239, 231, 0.06);
}

.is-style-portfolio .td-project-card__title {
	color: var(--wp--preset--color--ivory);
}

.is-style-portfolio .td-project-card__footer {
	border-top-color: var(--wp--preset--color--slate);
}

@media (min-width: 1024px) {

	.td-project-grid.is-style-portfolio {
		padding-top: calc(var(--td-section-space) - 96px);
	}

	.is-style-portfolio .td-project-grid__header {
		display: flex;
		flex-direction: column;
		gap: 24px;
		text-align: center;
	}

	.is-style-portfolio .td-project-grid__title {
		font-size: clamp(48px, 4.45vw, 64px);
		line-height: 1;
	}

	.is-style-portfolio .td-project-grid__filter {
		padding: 16px 64px;
		border-block: 1px solid var(--wp--preset--color--slate);
	}

	.is-style-portfolio .td-project-grid__filters {
		display: flex;
	}

	.is-style-portfolio .td-project-grid__select {
		display: none;
	}
}

@media (min-width: 1200px) {

	.td-project-grid.is-style-portfolio {
		padding-top: calc(var(--td-section-space) - 80px);
	}
}

/* "Load more" (optional): projects beyond the first page wait behind the
   button (shown without JavaScript, see the noscript style in render.php). */
.td-project-grid__item.is-more {
	display: none;
}

.td-project-grid__more {
	width: 100%;
}

.td-project-grid__more[hidden] {
	display: none;
}

.td-project-grid__more .td-icon {
	width: 12px;
	height: 12px;
}

@media (min-width: 600px) {

	.td-project-grid__more {
		align-self: center;
		width: auto;
	}
}
