/*
 * Projects page (/projects/), v1.2 part 7. Loaded only on that page, after dc-flexible.css
 * (captions and tiles come from there). Every rule is scoped to .dc-proj.
 * Class names avoid the words "more-" and "less-": the legacy footer script acts on them.
 */

.dc-proj .dc-proj-list {
	padding: 0 var(--dcf-pad);
	text-align: left;
}

.dc-proj .dc-proj-sector {
	margin: 0;
	padding: 0;
}

/* Divider-style sector title: light, with a thin line under it. */
.dc-proj .dc-proj-title {
	margin: 22px 0 8px;
	padding: 0 0 6px;
	font-size: 20px;
	font-weight: 300;
	letter-spacing: -0.01em;
	color: #666;
	border-bottom: 1px solid #ccc;
}

/* A row: the sector text and three tiles, four across. */
.dc-proj .dc-proj-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: calc(var(--dcf-pad) * 2);
}

/* The rest: three across, under the tiles (the text column stays empty). */
.dc-proj .dc-proj-restgrid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: calc(var(--dcf-pad) * 2);
	margin: calc(var(--dcf-pad) * 2) 0 0 25%;
	padding-left: calc(var(--dcf-pad) * 2 / 4);
}

.dc-proj .dc-proj-panel {
	height: calc(var(--dcf-h) / 2);
	padding: 4px 14px 4px 2px;
	overflow-y: auto;
	font-size: var(--dcf-body);
	line-height: 1.5;
}

.dc-proj .dc-proj-panel p {
	margin: 0 0 var(--dcf-pb);
}

.dc-proj .dc-proj-cell {
	height: calc(var(--dcf-h) / 2);
	min-width: 0;
}

.dc-proj .dc-proj-cell .project_image_bg {
	height: 100%;
}

.dc-proj .dc-tile-link img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* See more / Show fewer: plain text, right aligned. */
.dc-proj .dc-proj-toggle-wrap {
	margin: 4px 0 0;
	padding: 0;
	text-align: right;
}

.dc-proj .dc-proj-toggle {
	margin: 0;
	padding: 2px 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 12px;
	font-weight: 400;
	color: #444;
	cursor: pointer;
}

.dc-proj .dc-proj-toggle:hover {
	text-decoration: underline;
}

.dc-proj .dc-proj-toggle:focus-visible {
	outline: 2px solid #2a7fa8;
	outline-offset: 2px;
}

/* Only the label that matches the state and screen size is shown. */
.dc-proj .dc-proj-toggle span {
	display: none;
}

/* Collapsed on screens wider than a phone: rest hidden. */
.dc-proj .dc-proj-restgrid {
	display: none;
}

.dc-proj .dc-proj-sector.is-open .dc-proj-restgrid {
	display: grid;
}

/* Desktop labels, and the button only when there is a rest. */
.dc-proj .dc-proj-toggle-wrap {
	display: none;
}

.dc-proj .dc-proj-sector.has-rest .dc-proj-toggle-wrap {
	display: block;
}

.dc-proj .dc-proj-sector:not(.is-open) .dc-t-d-closed,
.dc-proj .dc-proj-sector.is-open .dc-t-d-open {
	display: inline;
}

/* Without the script everything stays visible. */
html:not(.dc-proj-js) .dc-proj .dc-proj-restgrid {
	display: grid;
}

html:not(.dc-proj-js) .dc-proj .dc-proj-toggle-wrap {
	display: none !important;
}

@media screen and (max-width: 39.9375em) {
	.dc-proj .dc-proj-title {
		margin: 18px 0 4px;
		font-size: 18px;
	}

	/* One image per sector: no text panel, and only the first tile. */
	.dc-proj .dc-proj-grid {
		display: block;
	}

	.dc-proj .dc-proj-panel {
		display: none;
	}

	.dc-proj .dc-proj-cell {
		height: auto;
		aspect-ratio: 3 / 2;
		margin: 0 0 calc(var(--dcf-pad));
	}

	.dc-proj .dc-proj-grid .dc-proj-cell ~ .dc-proj-cell {
		display: none;
	}

	.dc-proj .dc-proj-sector.is-open .dc-proj-grid .dc-proj-cell ~ .dc-proj-cell {
		display: block;
	}

	.dc-proj .dc-proj-restgrid,
	.dc-proj .dc-proj-sector.is-open .dc-proj-restgrid {
		display: none;
		margin: 0;
		padding: 0;
	}

	.dc-proj .dc-proj-sector.is-open .dc-proj-restgrid {
		display: block;
	}

	html:not(.dc-proj-js) .dc-proj .dc-proj-grid .dc-proj-cell ~ .dc-proj-cell,
	html:not(.dc-proj-js) .dc-proj .dc-proj-restgrid {
		display: block;
	}

	.dc-proj .dc-proj-restgrid .dc-proj-cell {
		margin: 0 0 calc(var(--dcf-pad));
	}

	/* The button shows on every sector with more than one project. */
	.dc-proj .dc-proj-toggle-wrap,
	.dc-proj .dc-proj-sector.has-rest .dc-proj-toggle-wrap {
		display: block;
	}

	.dc-proj .dc-proj-sector.is-single .dc-proj-toggle-wrap {
		display: none;
	}

	.dc-proj .dc-proj-toggle-wrap {
		text-align: left;
		padding-left: 4px;
	}

	.dc-proj .dc-proj-sector:not(.is-open) .dc-t-d-closed,
	.dc-proj .dc-proj-sector.is-open .dc-t-d-open {
		display: none;
	}

	.dc-proj .dc-proj-sector:not(.is-open) .dc-t-p-closed,
	.dc-proj .dc-proj-sector.is-open .dc-t-p-open {
		display: inline;
	}
}
