/**
 * Diamond tiles and their lightbox.
 *
 * Everything with a `d-` prefix lives here because it is shared: the tiles are
 * what the dialog reads, and the dialog is printed once per page however many
 * galleries asked for it. The grid that positions the tiles belongs to the
 * gallery block instead.
 */

/* ---------- Tiles ---------- */

.d-tile {
	border-radius: 30px;
	overflow: hidden;
	position: relative;
	border: none;
	padding: 0;
	background: transparent;
}

/* Photo tiles are real buttons: the static site used plain divs, so the
   gallery could not be reached or opened with a keyboard. */
.d-tile.photo {
	cursor: pointer;
	box-shadow: 0 10px 26px rgba(35, 41, 48, 0.16);
}

.bg-navy .d-tile.photo,
.bg-ink .d-tile.photo {
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

/* The field is rotated 45deg, so the photo inside is counter-rotated and
   oversized to keep the frame filled at every corner. */
.d-tile.photo img {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 150%;
	height: 150%;
	object-fit: cover;
	transform: translate(-50%, -50%) rotate(-45deg) scale(1.02);
	transition: transform 0.45s ease;
}

.d-tile.photo:hover img,
.d-tile.photo:focus-visible img {
	transform: translate(-50%, -50%) rotate(-45deg) scale(1.12);
}

.d-tile.d-honey {
	background: var(--wp--preset--color--honey);
}

.d-tile.d-navy {
	background: var(--wp--preset--color--navy);
}

.d-tile.d-mist {
	background: var(--wp--preset--color--mist);
}

.d-tile.d-carbon {
	background: var(--wp--preset--color--ink);
}

.d-tile.d-empty {
	background: transparent;
}

.d-tile.d-half {
	opacity: 0.92;
}

.d-tile .d-chip {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%) rotate(-45deg);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	font-size: 0.8rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--navy);
	text-align: center;
	line-height: 1.3;
}

.d-tile.d-navy .d-chip,
.d-tile.d-carbon .d-chip {
	color: var(--wp--preset--color--honey);
}

.d-tile.d-honey .d-chip,
.d-tile.d-mist .d-chip {
	color: var(--wp--preset--color--ink);
}

/* ---------- Lightbox ---------- */

.d-lb {
	position: fixed;
	inset: 0;
	z-index: 999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: color-mix(in srgb, var(--wp--preset--color--ink) 93%, transparent);
	backdrop-filter: blur(8px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s ease;
}

.d-lb.open {
	opacity: 1;
	pointer-events: auto;
}

.d-lb-stage {
	position: relative;
	max-width: min(88vw, 1080px);
	display: flex;
	flex-direction: column;
	align-items: center;
}

.d-lb-img {
	max-width: 100%;
	max-height: 76vh;
	border-radius: 26px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
	transform: scale(0.94);
	transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.d-lb.open .d-lb-img {
	transform: scale(1);
}

.d-lb-caption {
	margin-top: 18px;
	display: flex;
	align-items: center;
	gap: 14px;
	color: var(--wp--preset--color--cream);
	font-size: 0.95rem;
}

.d-lb-caption .d-diamond-dot {
	width: 10px;
	height: 10px;
	background: var(--wp--preset--color--honey);
	border-radius: 3px;
	transform: rotate(45deg);
	flex: none;
}

.d-lb-counter {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	color: var(--wp--preset--color--honey);
	font-size: 0.85rem;
	letter-spacing: 0.08em;
}

/* Both navigation arrows and the close button are the same diamond. */
.d-lb-nav,
.d-lb-close {
	border: none;
	cursor: pointer;
	background: color-mix(in srgb, var(--wp--preset--color--cream) 12%, transparent);
	display: flex;
	align-items: center;
	justify-content: center;
	transform: rotate(45deg);
	transition: background 0.2s ease;
	color: var(--wp--preset--color--cream);
}

.d-lb-nav:hover,
.d-lb-close:hover {
	background: var(--wp--preset--color--honey);
	color: var(--wp--preset--color--ink);
}

.d-lb-nav svg,
.d-lb-close svg {
	transform: rotate(-45deg);
	display: block;
}

.d-lb-nav {
	position: absolute;
	top: 50%;
	width: 54px;
	height: 54px;
	margin-top: -27px;
	border-radius: 16px;
}

.d-lb-prev {
	left: -84px;
}

.d-lb-next {
	right: -84px;
}

.d-lb-close {
	position: fixed;
	top: 26px;
	right: 30px;
	width: 46px;
	height: 46px;
	border-radius: 14px;
}

@media (max-width: 900px) {
	.d-lb-prev {
		left: 8px;
		top: auto;
		bottom: -76px;
		margin-top: 0;
	}

	.d-lb-next {
		right: 8px;
		top: auto;
		bottom: -76px;
		margin-top: 0;
	}

	.d-lb-nav {
		width: 46px;
		height: 46px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.d-tile.photo img,
	.d-lb,
	.d-lb-img {
		transition: none;
	}
}
