/**
 * Gallery page (page-gallery.php). Mockup: docs/mockup/Gallery.dc.html.
 */

/* Year chips ------------------------------------------------------------ */

.cc-gallery-years {
	border-bottom: 1px solid var(--cc-border-cream);
}

.cc-gallery-years[hidden] {
	display: none;
}

.cc-gallery-years__list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding-block: 32px;
}

.cc-gallery-chip {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid var(--cc-border-cream);
	border-radius: var(--cc-radius-pill);
	background: var(--cc-white);
	color: var(--cc-black);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	cursor: pointer;
}

.cc-gallery-chip:hover {
	color: var(--cc-brown);
}

.cc-gallery-chip[aria-pressed="true"] {
	border-color: var(--cc-black);
	background: var(--cc-black);
	color: var(--cc-cream);
	font-weight: 600;
}

/* Empty state (year without photos) ------------------------------------ */

.cc-gallery-empty__box {
	margin-top: 56px;
	padding: 48px 32px;
	border: 1px dashed #D9CB94;
	border-radius: var(--cc-radius-md);
	background: var(--cc-white);
	color: var(--cc-text-muted);
	font-size: 16px;
	font-weight: 500;
	text-align: center;
}

.cc-gallery-empty__box[hidden] {
	display: none;
}

/* Highlight mosaic --------------------------------------------------- */

.cc-gallery-mosaic {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-auto-rows: 240px;
	grid-auto-flow: dense;
	gap: 16px;
	padding-top: 56px;
}

.cc-gallery-mosaic[hidden],
.cc-gallery-albums[hidden],
.cc-gallery-album[hidden] {
	display: none;
}

.cc-gallery-mosaic__tile {
	border-radius: var(--cc-radius-md);
}

/* Filled tiles open in the lightbox (lightbox.js). */
.cc-gallery-mosaic__link {
	position: relative;
	display: block;
	overflow: hidden;
	background: #242424;
}

.cc-gallery-mosaic__link:focus-visible {
	border-radius: var(--cc-radius-md);
}

.cc-gallery-fill {
	height: 100%;
}

.cc-gallery-fill > img.cc-ph-img,
.cc-gallery-album__cover > img.cc-ph-img {
	transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.cc-gallery-mosaic__link:hover .cc-gallery-fill > img.cc-ph-img,
	.cc-gallery-album__link:hover .cc-gallery-album__cover > img.cc-ph-img {
		transform: scale(1.04);
	}
}

.cc-gallery-mosaic__tile--big {
	grid-column: span 2;
	grid-row: span 2;
}

.cc-gallery-mosaic__tile--tall {
	grid-row: span 2;
}

.cc-gallery-mosaic__tile--wide {
	grid-column: span 2;
}

/* Albums ------------------------------------------------------------- */

.cc-gallery-albums {
	padding-top: var(--cc-section-y);
}

.cc-gallery-albums__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	margin-top: 28px;
	padding: 0;
	list-style: none;
}

.cc-gallery-album {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cc-gallery-album__cover {
	height: 260px;
	border-radius: 22px;
}

.cc-gallery-album__info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

.cc-gallery-album__title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
}

.cc-gallery-album__meta {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	color: var(--cc-text-muted);
	font-size: 13px;
}

.cc-gallery-album__year {
	font-weight: 600;
}

.cc-gallery-album__year + .cc-gallery-album__count::before {
	content: "·";
	margin-right: 10px;
}

/* Albums with photos: the whole card opens the album in the lightbox. */
.cc-gallery-album__link {
	display: flex;
	flex-direction: column;
	gap: 12px;
	color: inherit;
	text-decoration: none;
}

.cc-gallery-album__link:focus-visible {
	outline-offset: 6px;
	border-radius: 22px;
}

.cc-gallery-album__link:hover .cc-gallery-album__title {
	color: var(--cc-brown);
}

.cc-gallery-album__cover {
	overflow: hidden;
}

/* "Photos coming soon": not clickable, slightly muted. */
.cc-gallery-album--soon .cc-gallery-album__cover {
	opacity: .78;
}

.cc-gallery-album--soon:hover {
	box-shadow: none;
	transform: none;
}

/* Videos ------------------------------------------------------------- */

.cc-gallery-videos {
	padding-block: var(--cc-section-y);
}

.cc-gallery-videos__channel {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 14px 24px;
	border: 1.5px solid var(--cc-black);
	border-radius: var(--cc-radius-pill);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
}

.cc-gallery-videos__channel:hover {
	border-color: var(--cc-brown);
}

.cc-gallery-videos__grid {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	gap: 20px;
	margin-top: 28px;
}

.cc-gallery-videos__item {
	height: 300px;
	border-radius: var(--cc-radius-md);
}

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

@media (max-width: 1023px) {
	.cc-gallery-mosaic {
		grid-auto-rows: 180px;
		gap: 12px;
	}

	.cc-gallery-albums__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.cc-gallery-album__cover {
		height: 220px;
	}

	.cc-gallery-videos__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.cc-gallery-videos__item {
		height: 220px;
	}

	.cc-gallery-videos__item:first-child {
		grid-column: 1 / -1;
		height: auto;
		aspect-ratio: 16 / 9;
	}
}

@media (max-width: 767px) {
	.cc-gallery-years__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-block: 20px;
		scrollbar-width: none;
	}

	.cc-gallery-chip {
		flex-shrink: 0;
		white-space: nowrap;
	}

	.cc-gallery-mosaic {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-rows: 140px;
		gap: 10px;
		padding-top: 32px;
	}

	.cc-gallery-mosaic__tile {
		border-radius: var(--cc-radius-sm);
	}

	.cc-gallery-empty__box {
		margin-top: 32px;
	}

	.cc-gallery-albums__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
		margin-top: 20px;
	}

	.cc-gallery-album__cover {
		height: 200px;
		border-radius: var(--cc-radius-sm);
	}

	.cc-gallery-videos__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 14px;
		margin-top: 20px;
	}

	.cc-gallery-videos__item,
	.cc-gallery-videos__item:first-child {
		height: auto;
		aspect-ratio: 16 / 9;
		border-radius: var(--cc-radius-sm);
	}
}
