/**
 * Roni Projects — Divi-era gallery + meta panel.
 * Dark editorial palette inherited from the child theme's design tokens
 * (falls back to literals so the shortcodes look right even without it).
 */

.rap-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 14px;
	margin-block: clamp(24px, 4vw, 48px);
}

.rap-gallery__item {
	margin: 0;
	border-radius: 4px;
	overflow: hidden;
}

.rap-gallery__link {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--surface, #1a1d21);
	cursor: zoom-in;
}

.rap-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transform: scale(1.03);
	transition: opacity 0.6s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1)),
		transform 0.9s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1));
}

.rap-gallery__img.is-loaded {
	opacity: 1;
	transform: scale(1);
}

.rap-gallery__link:hover .rap-gallery__img.is-loaded {
	transform: scale(1.06);
}

.rap-gallery__caption {
	margin-block-start: 8px;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--ink-muted, #9a9890);
}

/* ---------- Facts panel ---------- */
.rap-meta {
	border: 1px solid var(--line, rgba(244, 241, 236, 0.1));
	border-radius: 4px;
	padding: clamp(18px, 2vw, 28px);
	background: var(--bg-soft, #141619);
	color: var(--ink, #f4f6fa);
}

.rap-meta__list {
	margin: 0;
	display: grid;
	gap: 14px;
}

.rap-meta__row {
	display: grid;
	gap: 3px;
	padding-block-end: 12px;
	border-block-end: 1px solid var(--line, rgba(244, 241, 236, 0.1));
}

.rap-meta__row:last-child {
	border-block-end: 0;
	padding-block-end: 0;
}

.rap-meta__row dt {
	font-size: 0.72rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-muted, #9a9890);
}

.rap-meta__row dd {
	margin: 0;
	font-weight: 500;
	font-size: 1.05rem;
}

/* ---------- Skeleton shimmer ---------- */
.rap-skeleton {
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, var(--surface, #1a1d21) 30%, #23262b 50%, var(--surface, #1a1d21) 70%);
	background-size: 200% 100%;
	animation: rap-shimmer 1.4s infinite linear;
}

@keyframes rap-shimmer {
	to {
		background-position: -200% 0;
	}
}

/* ---------- Lightbox ---------- */
.rap-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 4vw, 56px);
	background: rgba(8, 9, 11, 0.97);
	/* Claim the horizontal axis. Left at `auto` the browser reads a sideways
	   drag as a pan, cancels the pointer stream part-way, and the swipe
	   handler never sees a pointerup. Vertical panning and pinch-zoom stay
	   with the browser, so a photo can still be zoomed. */
	touch-action: pan-y pinch-zoom;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0.35s;
}

.rap-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.rap-lightbox__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transform: scale(0.96);
	transition: transform 0.35s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1));
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}

.rap-lightbox.is-open .rap-lightbox__img {
	transform: scale(1);
}

/* Same reasoning as the navigation below: this sits on a near-black scrim, so
   it is painted explicitly rather than through `var(--ink)`. That token is the
   page's ink, #0c0c17, so the button was drawing dark-on-dark at 1.03:1 while
   its own fallback (#f4f6fa) never got a chance to apply. */
.rap-lightbox__close {
	position: absolute;
	/* The image carries a transform, so it paints as a stacking context at
	   z-index 0 and covers any control that precedes it in the markup. The
	   controls claim a layer of their own. */
	z-index: 2;
	top: clamp(12px, 3vw, 28px);
	inset-inline-end: clamp(12px, 3vw, 28px);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 0;
	background: rgba(18, 19, 22, 0.72);
	color: #ffffff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.25s ease, border-color 0.25s ease;
}

.rap-lightbox__close:hover,
.rap-lightbox__close:focus-visible {
	background: rgba(38, 40, 46, 0.92);
	border-color: rgba(255, 255, 255, 0.55);
}

/* The navigation has to be findable against a near-black scrim: a visible
   surface and a border, not a 6%-opacity wash that disappears into it. */
.rap-lightbox__nav {
	position: absolute;
	z-index: 2;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 0;
	background: rgba(18, 19, 22, 0.72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	color: #ffffff;
	font-size: 1.9rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.rap-lightbox__nav > span {
	display: block;
	margin-block-start: -0.12em;
}

.rap-lightbox__nav:hover,
.rap-lightbox__nav:focus-visible {
	background: rgba(255, 255, 255, 0.94);
	border-color: #ffffff;
	color: #0c0c17;
}

.rap-lightbox__nav[hidden] {
	display: none;
}

.rap-lightbox__prev {
	inset-inline-start: clamp(8px, 2vw, 24px);
}

.rap-lightbox__next {
	inset-inline-end: clamp(8px, 2vw, 24px);
}

/* The bar carries the position, the project name and the actions. It takes
   pointer events, unlike the caption-only version it replaces. */
.rap-lightbox__bar {
	position: absolute;
	z-index: 2;
	inset-inline: 0;
	bottom: clamp(10px, 2.5vh, 24px);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px clamp(14px, 3vw, 28px);
	padding-inline: clamp(12px, 4vw, 40px);
	color: rgba(255, 255, 255, 0.88);
	font-size: 0.82rem;
	letter-spacing: 0.04em;
	text-align: center;
}

.rap-lightbox__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: center;
	gap: 6px 14px;
	min-width: 0;
}

.rap-lightbox__title {
	font-size: 0.95rem;
	font-weight: 500;
	color: #ffffff;
	unicode-bidi: plaintext;
}

.rap-lightbox__actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* The way through to the full project: a real button, not a hint. */
.rap-lightbox__project {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 0 18px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	background: rgba(255, 255, 255, 0.06);
	color: #ffffff;
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.rap-lightbox__project:hover,
.rap-lightbox__project:focus-visible {
	background: #ffffff;
	border-color: #ffffff;
	color: #0c0c17;
}

.rap-lightbox__project[hidden] {
	display: none;
}

.rap-lightbox__share {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 0;
	background: rgba(255, 255, 255, 0.06);
	color: #ffffff;
	cursor: pointer;
	transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.rap-lightbox__share:hover,
.rap-lightbox__share:focus-visible {
	background: #ffffff;
	border-color: #ffffff;
	color: #0c0c17;
}

.rap-lightbox__share[hidden] {
	display: none;
}

.rap-lightbox__toast {
	min-width: 0;
	color: #9fb2cc;
	font-size: 0.76rem;
	white-space: nowrap;
}

.rap-lightbox__close:focus-visible,
.rap-lightbox__nav:focus-visible,
.rap-lightbox__share:focus-visible,
.rap-lightbox__project:focus-visible {
	outline: 2px solid #9fb2cc;
	outline-offset: 2px;
}

/* The counter reads in the page's own direction; each number is wrapped in a
   <bdi> so the bidi algorithm cannot swap the pair around the word between. */
.rap-lightbox__count {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	opacity: 0.75;
}

.rap-lightbox__caption {
	max-width: 60ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Phones: the arrows shrink but stay legible, and the bar stacks so the
   project button and the share controls keep a real tap target. */
@media (max-width: 781px) {
	.rap-lightbox__nav {
		width: 44px;
		height: 44px;
		font-size: 1.5rem;
	}
	.rap-lightbox__prev {
		inset-inline-start: 6px;
	}
	.rap-lightbox__next {
		inset-inline-end: 6px;
	}
	.rap-lightbox__bar {
		flex-direction: column;
		gap: 10px;
		bottom: 12px;
	}
	.rap-lightbox__title {
		font-size: 0.88rem;
	}
	.rap-lightbox__project,
	.rap-lightbox__share {
		min-height: 44px;
	}
	.rap-lightbox__share {
		width: 44px;
		height: 44px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rap-skeleton {
		animation: none;
	}
	.rap-gallery__img,
	.rap-lightbox,
	.rap-lightbox__img,
	.rap-lightbox__nav,
	.rap-lightbox__project,
	.rap-lightbox__share {
		transition: none;
	}
}

/* The spec panel names itself, so the facts read as a labelled block rather
   than a floating list beside the story. */
.rap-meta__title {
	margin: 0 0 clamp(14px, 1.6vw, 20px);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink, #0c0c17);
}
