/* ==========================================================
   Photography section — Aperture structure, Precision metadata.
   Consumes the design tokens declared in style.css and adds no
   new global selectors outside the .photo-* / .series-* / .lightbox-*
   namespaces.
   ========================================================== */

/* ---------- Hero ---------- */

.photo-hero {
	padding: clamp(64px, 9vw, 128px) 0 clamp(32px, 4vw, 56px);
	background:
		radial-gradient(120% 100% at 15% 0%, var(--teal-050) 0%, transparent 62%),
		var(--paper);
	border-bottom: 1px solid var(--ink-100);
}

.photo-title {
	/* Same eyebrow-to-heading gap as .page-hero h1, so the photography hero
	   reads as the same component as the archive hero. */
	margin: 14px 0 0;
	font-size: var(--step-3);
	font-weight: 700;
	line-height: 1.04;
	letter-spacing: -0.03em;
	color: var(--ink-900);
}

.photo-intro {
	max-width: 58ch;
	margin: 20px 0 0;
	font-size: var(--step-0);
	line-height: 1.7;
	color: var(--ink-500);
}

.photo-stats {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(28px, 5vw, 64px);
	margin: clamp(32px, 4vw, 48px) 0 0;
}

.photo-stats div {
	display: flex;
	flex-direction: column-reverse;
	gap: 4px;
}

.photo-stats dt {
	font-size: var(--step--1);
	letter-spacing: 0.08em;
	color: var(--ink-400);
}

.photo-stats dd {
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--step-1);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--ink-900);
}

/* ---------- Year navigation ---------- */

.photo-yearbar {
	position: sticky;
	top: 0;
	z-index: 20;
	background: rgb(255 255 255 / 82%);
	backdrop-filter: saturate(180%) blur(18px);
	border-bottom: 1px solid var(--ink-100);
}

.photo-yearbar-inner {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-block: 12px;
	scrollbar-width: none;
}

.photo-yearbar-inner::-webkit-scrollbar {
	display: none;
}

.year-chip {
	flex: 0 0 auto;
	padding: 7px 18px;
	border: 1px solid var(--ink-200);
	border-radius: var(--r-chip);
	font-family: var(--font-mono);
	font-size: var(--step--1);
	font-weight: 600;
	text-decoration: none;
	color: var(--ink-700);
	background: var(--paper);
	cursor: pointer;
	transition: color var(--dur-fast) var(--ease-out),
		background-color var(--dur-fast) var(--ease-out),
		border-color var(--dur-fast) var(--ease-out);
}

.year-chip:hover,
.year-chip:focus-visible {
	color: var(--paper);
	background: var(--teal-700);
	border-color: var(--teal-700);
}

/* ---------- Year sections ---------- */

.photo-years {
	padding-block: clamp(48px, 7vw, 96px);
}

.photo-year + .photo-year {
	margin-top: clamp(56px, 8vw, 112px);
}

.photo-year {
	scroll-margin-top: 96px;
}

.photo-year-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 18px;
	margin-bottom: clamp(24px, 3vw, 40px);
	border-bottom: 1px solid var(--ink-100);
}

.photo-year-title {
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--step-2);
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--ink-900);
}

.photo-year-count {
	margin: 0;
	font-size: var(--step--1);
	color: var(--ink-400);
}

/* ---------- Series cards ---------- */

.series-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: clamp(20px, 2.5vw, 32px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.series-card-link {
	display: block;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
}

.series-cover {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--r-media);
	background: var(--paper-3);
	box-shadow: var(--shadow-1);
	transition: box-shadow var(--dur-base) var(--ease-out);
}

.series-card-link:hover .series-cover,
.series-card-link:focus-visible .series-cover {
	box-shadow: var(--shadow-2);
}

.series-cover-img,
.series-cover-empty {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: var(--paper-3);
	transition: transform var(--dur-slow) var(--ease-out);
}

.series-card-link:hover .series-cover-img {
	transform: scale(1.03);
}

.series-count {
	position: absolute;
	right: 10px;
	bottom: 10px;
	min-width: 28px;
	padding: 4px 9px;
	border-radius: var(--r-chip);
	font-family: var(--font-mono);
	font-size: var(--step--1);
	font-weight: 600;
	text-align: center;
	color: var(--paper);
	background: rgb(11 28 32 / 68%);
	backdrop-filter: blur(6px);
}

.series-body {
	display: block;
	padding-top: 14px;
}

.series-date {
	display: block;
	font-family: var(--font-mono);
	font-size: var(--step--1);
	letter-spacing: 0.04em;
	color: var(--teal-700);
}

.series-name {
	display: block;
	margin-top: 4px;
	font-size: var(--step-0);
	font-weight: 600;
	line-height: 1.4;
	color: var(--ink-900);
}

/* ---------- Single series ---------- */

.series-hero {
	padding: clamp(48px, 7vw, 96px) 0 clamp(28px, 3.5vw, 48px);
}

.series-crumbs {
	display: flex;
	gap: 8px;
	font-size: var(--step--1);
	color: var(--ink-400);
}

.series-crumbs a {
	color: var(--teal-700);
	text-decoration: none;
}

.series-crumbs a:hover,
.series-crumbs a:focus-visible {
	text-decoration: underline;
}

.series-title {
	margin: 16px 0 0;
	font-size: var(--step-2);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.025em;
	color: var(--ink-900);
}

.series-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 14px 0 0;
	font-family: var(--font-mono);
	font-size: var(--step--1);
	color: var(--ink-500);
}

/* The mono stack has no CJK glyphs, so Chinese falls back to a face with
   different metrics and drops below the Latin baseline. Neutralising the
   line box and centring each span keeps all three items on one line. */
.series-meta span {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.series-intro,
.series-note {
	max-width: 62ch;
	margin-top: 20px;
	font-size: var(--step-0);
	line-height: 1.75;
	color: var(--ink-500);
}

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

/* Column masonry: every frame keeps its own proportions and carries no box,
   border, or radius, so the photograph itself is the only shape on screen. */
.photo-grid {
	columns: 3;
	column-gap: clamp(16px, 2.2vw, 32px);
	margin: 0;
	padding: 0 0 clamp(48px, 7vw, 96px);
	list-style: none;
}

.photo-cell {
	break-inside: avoid;
	margin-bottom: clamp(16px, 2.2vw, 32px);
}

/* With JS the columns are packed shortest-first, which mixes portrait and
   landscape frames and keeps every column ending at roughly the same height.
   Without JS the CSS `columns` rules above still produce a usable gallery. */
.photo-grid.is-masonry {
	columns: auto;
	display: flex;
	align-items: flex-start;
	gap: clamp(16px, 2.2vw, 32px);
}

.photo-col {
	flex: 1 1 0;
	min-width: 0;
}

.photo-col-list {
	display: flex;
	flex-direction: column;
	gap: clamp(16px, 2.2vw, 32px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.photo-grid.is-masonry .photo-cell {
	margin-bottom: 0;
}

.photo-button {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
}

.photo-thumb {
	display: block;
	width: 100%;
	height: auto;
	transition: opacity var(--dur-base) var(--ease-out);
}

.photo-button:hover .photo-thumb,
.photo-button:focus-visible .photo-thumb {
	opacity: 0.82;
}

.photo-button:focus-visible {
	outline: 2px solid var(--teal-700);
	outline-offset: 4px;
}

@media (max-width: 1024px) {
	.photo-grid {
		columns: 2;
	}
}

@media (max-width: 600px) {
	.photo-grid {
		columns: 1;
	}
}

.photo-empty {
	padding-block: 48px;
	color: var(--ink-400);
}

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

body.has-lightbox {
	overflow: hidden;
}

.photo-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9000;
	display: grid;
	place-items: center;
	padding: clamp(16px, 4vw, 56px);
}

.photo-lightbox[hidden] {
	display: none;
}

.lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgb(11 28 32 / 92%);
	backdrop-filter: blur(10px);
	cursor: pointer;
}

.lightbox-figure {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	max-width: min(1200px, 100%);
	margin: 0;
}

.lightbox-image {
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	border-radius: var(--r-media);
	background: var(--ink-900);
}

.lightbox-caption {
	max-width: 62ch;
	font-size: var(--step--1);
	line-height: 1.6;
	text-align: center;
	color: var(--ink-200);
}

.lightbox-caption[hidden] {
	display: none;
}

.lightbox-counter {
	position: absolute;
	bottom: clamp(16px, 3vw, 32px);
	z-index: 1;
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--step--1);
	font-variant-numeric: tabular-nums;
	color: var(--ink-400);
}

.lightbox-btn {
	position: absolute;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 1px solid rgb(255 255 255 / 18%);
	border-radius: var(--r-chip);
	font-size: 26px;
	line-height: 1;
	color: var(--paper);
	background: rgb(255 255 255 / 8%);
	cursor: pointer;
	transition: background-color var(--dur-fast) var(--ease-out),
		border-color var(--dur-fast) var(--ease-out);
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
	background: var(--teal-700);
	border-color: var(--teal-700);
}

.lightbox-close {
	top: clamp(12px, 3vw, 28px);
	right: clamp(12px, 3vw, 28px);
}

.lightbox-prev {
	left: clamp(12px, 3vw, 28px);
}

.lightbox-next {
	right: clamp(12px, 3vw, 28px);
}

@media (max-width: 600px) {
	.lightbox-prev,
	.lightbox-next {
		top: auto;
		bottom: clamp(48px, 12vw, 76px);
	}

	.series-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.series-cover-img,
	.photo-thumb,
	.series-cover,
	.photo-button,
	.year-chip,
	.lightbox-btn {
		transition: none;
	}

	.series-card-link:hover .series-cover-img {
		transform: none;
	}
}

@media (prefers-color-scheme: dark) {
	/* The theme ships a light-only palette; photography follows it so the
	   gallery never renders half-dark against the rest of the site. */
	.photo-hero,
	.photo-yearbar {
		color-scheme: light;
	}
}
