/*
 * Our Work — grid, project page, carousel.
 *
 * Colours are the site's Elementor global kit: primary #FFC20F, secondary
 * #000000, text #89877F, accent #FFFFFF, all set in Poppins.
 *
 * Three notes on specificity. Every rule for an image or a button in here is
 * written with two classes for these reasons — a single class silently loses,
 * and the failure looks like a typo rather than a cascade problem:
 *
 *  - The Elementor global kit emits `.elementor-kit-6 button { background-color:
 *    #FFFFFF00; text-transform: uppercase; ... }` into post-6.css. That is
 *    (0,1,1) against the body class, it loads after plugin CSS, and it beats a
 *    plain `.dmp-carousel__nav` (0,1,0). It cost the nav buttons and the filter
 *    pills their background, border and radius while leaving everything the kit
 *    does not set — position, top, transform — correctly applied, which is a
 *    genuinely confusing thing to look at.
 *  - Elementor also ships `.elementor img { height: auto; max-width: 100% }`,
 *    same shape of problem, so image heights need `.dmp-grid .dmp-tile__media img`.
 *  - Themes routinely style `a:hover, a:focus, a:active` globally. Every anchor
 *    below therefore states its resting colour and all three interaction states
 *    rather than relying on inheritance.
 */

.dmp-work,
.dmp-project,
.dmp-related {
	--dmp-yellow: #ffc20f;
	--dmp-black: #000000;
	--dmp-grey: #89877f;
	--dmp-white: #ffffff;
	--dmp-hairline: rgba(0, 0, 0, 0.16);
	--dmp-gap: 14px;
	--dmp-max: 1240px;
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------------------------------------------------------------- filters */

.dmp-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	width: 100%;
	max-width: var(--dmp-max);
	margin: 0 auto 28px;
	padding: 0;
}

/*
 * Joe asked for the pill row to line up with the images rather than sit in a
 * narrower centred block, so it shares the grid's max-width and left edge.
 */
.dmp-work .dmp-pill {
	appearance: none;
	margin: 0;
	padding: 9px 22px;
	border: 1px solid var(--dmp-black);
	border-radius: 0;
	background: transparent;
	color: var(--dmp-black);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.dmp-work .dmp-pill:hover,
.dmp-work .dmp-pill:focus-visible {
	background: var(--dmp-yellow);
	color: var(--dmp-black);
}

.dmp-work .dmp-pill:focus-visible {
	outline: 2px solid var(--dmp-black);
	outline-offset: 2px;
}

.dmp-work .dmp-pill.is-active {
	background: var(--dmp-yellow);
	border-color: var(--dmp-yellow);
	color: var(--dmp-black);
	font-weight: 600;
}

/* ------------------------------------------------------------------- grid */

/*
 * A six-column bento. The repeating six-tile pattern below packs the columns
 * exactly — two rows of (4 + 2 + 2) then a row of three 2-wide tiles — so the
 * grid never ends a row with a hole in it.
 */
.dmp-grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	grid-auto-rows: minmax(150px, 13vw);
	gap: var(--dmp-gap);
	width: 100%;
	max-width: var(--dmp-max);
	margin: 0 auto;
}

.dmp-grid .dmp-tile[data-slot="0"] { grid-column: span 4; grid-row: span 2; }
.dmp-grid .dmp-tile[data-slot="1"] { grid-column: span 2; grid-row: span 1; }
.dmp-grid .dmp-tile[data-slot="2"] { grid-column: span 2; grid-row: span 1; }
.dmp-grid .dmp-tile[data-slot="3"] { grid-column: span 2; grid-row: span 2; }
.dmp-grid .dmp-tile[data-slot="4"] { grid-column: span 2; grid-row: span 2; }
.dmp-grid .dmp-tile[data-slot="5"] { grid-column: span 2; grid-row: span 2; }

.dmp-grid__empty {
	max-width: var(--dmp-max);
	margin: 40px auto;
	color: var(--dmp-grey);
	text-align: center;
}

/* ------------------------------------------------------------------ tiles */

/*
 * The whole tile is the link — Joe's "have the whole square clickable, not just
 * the title". Making the tile an anchor rather than pinning a stretched
 * pseudo-element over a div means it is reachable by keyboard and announced as
 * one link, and it replaces the old script that walked the DOM after render
 * wrapping every image on the page in an <a>.
 */
.dmp-tile {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--dmp-black);
	color: var(--dmp-white);
	text-decoration: none;
}

.dmp-tile:hover,
.dmp-tile:focus,
.dmp-tile:focus-visible,
.dmp-tile:active {
	color: var(--dmp-white);
	text-decoration: none;
}

.dmp-tile:focus-visible {
	outline: 3px solid var(--dmp-yellow);
	outline-offset: 2px;
}

.dmp-tile__media {
	display: block;
	width: 100%;
	height: 100%;
}

/* Two classes: beats Elementor's `.elementor img { height: auto }`. */
.dmp-grid .dmp-tile__media img,
.dmp-related .dmp-tile__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease, opacity 0.3s ease;
}

.dmp-tile__body {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	padding: 18px 20px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.45) 55%, rgba(0, 0, 0, 0) 100%);
}

.dmp-tile__cat {
	display: inline-block;
	padding: 3px 10px;
	background: var(--dmp-yellow);
	color: var(--dmp-black);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.dmp-tile__title {
	display: block;
	color: var(--dmp-white);
	font-size: clamp(16px, 1.4vw, 22px);
	font-weight: 600;
	line-height: 1.25;
}

@media (hover: hover) {
	.dmp-tile:hover .dmp-tile__media img {
		transform: scale(1.05);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dmp-grid .dmp-tile__media img,
	.dmp-related .dmp-tile__media img {
		transition: none;
	}

	.dmp-tile:hover .dmp-tile__media img {
		transform: none;
	}
}

/* ----------------------------------------------------- grid, narrow */

@media (max-width: 1024px) {

	.dmp-grid {
		grid-template-columns: repeat(4, 1fr);
		grid-auto-rows: minmax(150px, 22vw);
	}

	.dmp-grid .dmp-tile[data-slot] { grid-column: span 2; grid-row: span 2; }
	.dmp-grid .dmp-tile[data-slot="0"] { grid-column: span 4; grid-row: span 2; }
}

@media (max-width: 600px) {

	.dmp-grid {
		grid-template-columns: 1fr;
		grid-auto-rows: auto;
	}

	.dmp-grid .dmp-tile[data-slot] {
		grid-column: 1 / -1;
		grid-row: auto;
		aspect-ratio: 4 / 3;
	}
}

/* --------------------------------------------------------- project page */

/*
 * Intro, carousel and related all share one container width and padding, so
 * the fact bar, the first photo and the "More Like This" heading line up on a
 * single left edge down the page. Changing one without the others is what
 * makes a page look subtly crooked, so they read from the same variables.
 */
.dmp-project__intro {
	max-width: var(--dmp-max);
	margin: 0 auto;
	padding: 56px 20px 34px;
	text-align: left;
}

/*
 * The fact bar. Was three stacked bold lines; now one row reading
 * "Project | Type | Location", with the separators drawn by CSS so they never
 * appear at the start or end of a wrapped line.
 */
.dmp-factbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: 8px 0;
	margin: 0 0 26px;
	padding: 0;
	list-style: none;
}

.dmp-factbar__item {
	display: inline-flex;
	align-items: baseline;
	gap: 7px;
	margin: 0;
	padding: 0 18px;
	font-size: 16px;
	line-height: 1.4;
	border-left: 1px solid var(--dmp-hairline);
}

.dmp-factbar__item:first-child {
	border-left: 0;

	/* Flush with the paragraph below it, now the bar is left-aligned. */
	padding-left: 0;
}

.dmp-factbar__label {
	color: var(--dmp-grey);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

.dmp-factbar__value {
	color: var(--dmp-black);
	font-weight: 500;
}

.dmp-project__summary {
	/* Held to a readable measure rather than running the full container. */
	max-width: 68ch;
	color: #4e4e4e;
	font-size: 16px;
	line-height: 1.75;
	text-align: left;
}

.dmp-project__summary p:last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------- carousel */

.dmp-carousel {
	margin: 0 auto 70px;
	padding: 0 20px;
	max-width: var(--dmp-max);
}

.dmp-carousel__viewport {
	position: relative;
}

.dmp-carousel__track {
	display: flex;
	gap: var(--dmp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
}

.dmp-carousel__track::-webkit-scrollbar {
	display: none;
}

.dmp-carousel__track:focus-visible {
	outline: 3px solid var(--dmp-yellow);
	outline-offset: 4px;
}

.dmp-carousel__slide {
	flex: 0 0 70%;
	margin: 0;
	scroll-snap-align: center;
	background: #f2f2f0;
}

.dmp-carousel--single .dmp-carousel__slide {
	flex-basis: 100%;
}

.dmp-carousel .dmp-carousel__slide img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.dmp-carousel .dmp-carousel__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	transform: translateY(-50%);
	border: 0;
	border-radius: 50%;
	background: var(--dmp-yellow);
	color: var(--dmp-black);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.dmp-carousel .dmp-carousel__nav--prev { left: 4px; }
.dmp-carousel .dmp-carousel__nav--next { right: 4px; }

.dmp-carousel .dmp-carousel__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

.dmp-carousel .dmp-carousel__nav:focus-visible {
	outline: 2px solid var(--dmp-black);
	outline-offset: 2px;
}

.dmp-carousel__dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.dmp-carousel .dmp-carousel__dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 1px solid var(--dmp-black);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.dmp-carousel .dmp-carousel__dot.is-active {
	background: var(--dmp-yellow);
	border-color: var(--dmp-yellow);
}

.dmp-carousel .dmp-carousel__dot:focus-visible {
	outline: 2px solid var(--dmp-black);
	outline-offset: 2px;
}

@media (max-width: 700px) {

	.dmp-carousel__slide {
		flex-basis: 92%;
	}

	.dmp-carousel .dmp-carousel__nav {
		width: 38px;
		height: 38px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.dmp-carousel__track {
		scroll-behavior: auto;
	}
}

/* -------------------------------------------------------------- related */

.dmp-related {
	max-width: var(--dmp-max);
	margin: 0 auto;
	padding: 0 20px 70px;
}

.dmp-related__heading {
	margin: 0 0 22px;
	color: var(--dmp-black);
	font-size: 26px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.dmp-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--dmp-gap);
}

.dmp-tile--related {
	aspect-ratio: 4 / 3;
}

@media (max-width: 700px) {

	.dmp-related__grid {
		grid-template-columns: 1fr;
	}
}
