:root {
	--bg: #ffffff;
	--fg: #0b0b0b;
	--muted: #6a6a6a;
	--hairline: rgba(0, 0, 0, 0.08);
	--focus: rgba(11, 11, 11, 0.35);
	--max: 1200px;

	/* Gallery sizing (non-fullscreen). */
	--gallery-h: clamp(420px, 80vh, 820px);
}

@media (min-width: 900px) {
	:root {
		--gallery-h: clamp(520px, 82vh, 900px);
	}
}

* {
	box-sizing: border-box;
}

html {
	color-scheme: light;
	scroll-behavior: smooth;
}

html.fullscreen-dark {
	color-scheme: dark;
	--bg: #000000;
	--fg: #ffffff;
	--muted: rgba(255, 255, 255, 0.74);
	--hairline: rgba(255, 255, 255, 0.14);
	--focus: rgba(255, 255, 255, 0.4);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Apple Color Emoji",
		"Segoe UI Emoji";
	line-height: 1.35;
}

img {
	display: block;
	max-width: 100%;
}

a {
	color: inherit;
	text-decoration: none;
}

a:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 3px;
}

.container {
	width: min(var(--max), calc(100% - 48px));
	margin-inline: auto;
}

.skip-link {
	position: absolute;
	left: 12px;
	top: 12px;
	padding: 10px 12px;
	background: #fff;
	border: 1px solid var(--hairline);
	transform: translateY(-140%);
	transition: transform 160ms ease;
	z-index: 999;
}

.skip-link:focus {
	transform: translateY(0);
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.86);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--hairline);
}

html.fullscreen-dark .site-header {
	background: rgba(0, 0, 0, 0.72);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	letter-spacing: 0.02em;
}

.brand-logo {
	width: auto;
	height: clamp(22px, 6.2vw, 64px);
}

.header-actions {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
}

.nav-toggle {
	display: none;
}

.nav {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

@media (max-width: 760px) {
	.nav-toggle {
		display: inline-grid;
	}

	.nav {
		display: none;
		position: absolute;
		top: calc(100% + 10px);
		right: 0;
		min-width: min(320px, calc(100vw - 24px));
		max-height: calc(100vh - 96px);
		overflow: auto;
		flex-direction: column;
		align-items: stretch;
		gap: 6px;
		padding: 10px;
		border-radius: 14px;
		border: 1px solid var(--hairline);
		background: rgba(255, 255, 255, 0.96);
		backdrop-filter: blur(12px);
		box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
		z-index: 60;
	}

	html.fullscreen-dark .nav {
		background: rgba(0, 0, 0, 0.86);
	}

	html.nav-open .nav {
		display: flex;
	}

	.nav a {
		padding: 10px 12px;
		border-radius: 12px;
	}
}

.nav a {
	font-size: 14px;
	color: var(--muted);
	padding: 8px 10px;
	border-radius: 999px;
	border: 1px solid transparent;
}

.nav a:hover {
	color: var(--fg);
	border-color: var(--hairline);
}

.nav a[aria-current="page"] {
	color: var(--fg);
	border-color: var(--hairline);
	background: rgba(0, 0, 0, 0.03);
}

.btn {
	appearance: none;
	border: 1px solid var(--hairline);
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 14px;
	padding: 8px 12px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
}

.btn.btn-icon {
	width: 38px;
	height: 38px;
	padding: 0;
	display: inline-grid;
	place-items: center;
}

.btn.btn-icon .icon {
	width: 18px;
	height: 18px;
	display: none;
	pointer-events: none;
}

html:not(.grid-view) #view-toggle .icon-grid {
	display: block;
}

html.grid-view #view-toggle .icon-scroll {
	display: block;
}

.btn:hover {
	color: var(--fg);
}

.section {
	padding: 42px 0 12px;
	scroll-margin-top: 84px;
}

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 18px;
	padding-bottom: 14px;
}

.section-head h2 {
	margin: 0;
	font-size: 18px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.section-head p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

/* Horizontal gallery */
.gallery {
	position: relative;
	padding: 0 0 18px;
}

.gallery-status {
	width: min(var(--max), calc(100% - 48px));
	margin: 0 auto 10px;
	color: var(--muted);
	font-size: 13px;
}

.gallery-track {
	width: 100%;
	height: var(--gallery-h);
	display: flex;
	align-items: stretch;
	gap: 14px;

	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scroll-padding: 24px;

	padding: 6px 24px 18px;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x;
	overscroll-behavior-x: contain;
}

/* Grid view (toggle) */
html.grid-view .gallery-track {
	height: auto;
	display: grid;
	/* Masonry helper: JS sets each child to span rows */
	grid-auto-rows: 4px;
	grid-auto-flow: dense;
	grid-template-columns: 1fr;
	gap: 6px;
	overflow: visible;
	touch-action: pan-y;
	overscroll-behavior-x: auto;
	padding: 6px 12px 28px;
}

@media (min-width: 560px) {
	html.grid-view .gallery-track {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 760px) {
	html.grid-view .gallery-track {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	html.grid-view .gallery-track {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

html.grid-view .gallery-item {
	max-width: none;
	width: 100%;
	height: auto;
	aspect-ratio: auto;
	display: block;
	border-radius: 10px;
	break-inside: avoid;
}

html.grid-view .gallery-item img {
	width: 100%;
	height: auto;
	object-fit: contain;
	display: block;
}

html.grid-view .gallery-divider {
	grid-column: 1 / -1;
	width: 100%;
	height: auto;
	break-inside: avoid;
}

@media (min-width: 1100px) {
	html.grid-view .container {
		width: min(1400px, calc(100% - 32px));
	}
}

html.grid-view .gallery-track::-webkit-scrollbar {
	height: 0;
}

.gallery-track.is-dragging {
	scroll-snap-type: none;
}

@media (pointer: fine) and (hover: hover) {
	.gallery-track {
		cursor: grab;
		user-select: none;
		scroll-snap-type: none;
	}

	.gallery-track img {
		-webkit-user-drag: none;
		user-select: none;
	}

	.gallery-track:active {
		cursor: grabbing;
	}
}

@media (max-width: 640px) {
	.gallery-track {
		padding-inline: 16px;
	}
}

.gallery-item {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	height: 100%;
	max-width: 92vw;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid var(--hairline);
	scroll-snap-align: start;
	background: #f7f7f7;
	position: relative;
	scroll-snap-stop: normal;
}

.gallery-item img {
	height: 100%;
	width: 100%;
	object-fit: cover;
	object-position: center;
}

/* Touch devices (iPad/mobile): don't crop in horizontal scroll mode */
@media (pointer: coarse) {
	html:not(.grid-view) .gallery-item img {
		object-fit: contain;
		width: auto;
		max-width: 92vw;
	}
}

.gallery-divider {
	flex: 0 0 auto;
	height: 100%;
	width: min(420px, 86vw);
	border-radius: 14px;
	border: 1px solid var(--hairline);
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
	display: grid;
	align-content: center;
	padding: 22px;
	gap: 10px;
	scroll-snap-align: start;
}

.gallery-divider h3 {
	margin: 0;
	font-size: 22px;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.gallery-divider p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

.gallery-item.gallery-video::after {
	content: "";
	position: absolute;
	inset: auto 18px 18px auto;
	width: 44px;
	height: 44px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(6px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.gallery-item.gallery-video::before {
	content: "";
	position: absolute;
	inset: auto 34px 31px auto;
	border-style: solid;
	border-width: 9px 0 9px 14px;
	border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
	z-index: 1;
}

/* Hide native scrollbars; we render a custom one for scroll view */
.gallery-track {
	scrollbar-width: none; /* Firefox */
}

.gallery-track::-webkit-scrollbar {
	width: 0;
	height: 0;
}

.gallery-scrollbar {
	position: absolute;
	left: 24px;
	right: 24px;
	bottom: 10px;
	height: 18px;
	pointer-events: none;
	opacity: 0.9;
}

.gallery-scrollbar-line {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 2px;
	transform: translateY(-50%);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.18);
}

.gallery-scrollbar-knob {
	position: absolute;
	top: 50%;
	left: 0;
	width: 12px;
	height: 12px;
	transform: translate(-50%, -50%);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
	pointer-events: auto;
	cursor: grab;
}

.gallery-scrollbar-knob:active {
	cursor: grabbing;
}

html.grid-view .gallery-scrollbar,
html.fullscreen-mode .gallery-scrollbar {
	display: none;
}

.site-footer {
	margin-top: 42px;
	padding: 28px 0 42px;
	border-top: 1px solid var(--hairline);
}

.footer-inner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: var(--muted);
	font-size: 13px;
}

/* Fullscreen “viewer mode” */
html.fullscreen-mode,
html.fullscreen-mode body {
	height: 100%;
}

html.fullscreen-mode body {
	overflow: hidden;
}

html.fullscreen-mode .site-header,
html.fullscreen-mode .site-footer,
html.fullscreen-mode #contact,
html.fullscreen-mode .skip-link {
	display: none;
}

html.fullscreen-mode .section {
	padding: 0;
	scroll-margin-top: 0;
}

html.fullscreen-mode .section-head,
html.fullscreen-mode .gallery-status {
	display: none;
}

html.fullscreen-mode .gallery {
	padding: 0;
}

html.fullscreen-mode .gallery-track {
	height: 100vh;
	padding: 0;
	gap: 0;
	scroll-padding: 0;
}

html.fullscreen-mode .gallery-item img {
	object-fit: contain;
}

html.fullscreen-mode .gallery-item {
	flex: 0 0 100%;
	max-width: 100vw;
	border-radius: 0;
	border: none;
	background: #000;
}

html.fullscreen-mode .gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

html.fullscreen-mode .gallery-divider {
	display: none;
}

html.fullscreen-mode .gallery-track {
	scrollbar-width: none;
}

html.fullscreen-mode .gallery-track::-webkit-scrollbar {
	height: 0;
}
