/* ===========================================================================
   Vaak Studio — gallery styles
   Minimal, editorial, photos-first. Light + dark via prefers-color-scheme.
   =========================================================================== */

:root {
	--bg: #fbfbf9;
	--bg-soft: #f2f2ee;
	--fg: #16160f;
	--muted: #8c8c82;
	--line: rgba(20, 20, 12, 0.12);
	--card: #ffffff;
	--danger: #b03a2e;
	--radius: 2px;
	--maxw: 1500px;
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0c0c0b;
		--bg-soft: #161614;
		--fg: #ededea;
		--muted: #7e7e76;
		--line: rgba(255, 255, 255, 0.14);
		--card: #161614;
		--danger: #e0685a;
	}
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 5vw, 64px); }

.site-main { flex: 1 0 auto; }

/* --- header / footer ----------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 40;
	backdrop-filter: saturate(140%) blur(12px);
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	border-bottom: 1px solid var(--line);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 92px;
}

.brand { display: inline-flex; align-items: center; }
.brand img { height: 60px; width: auto; display: block; }

/* Homepage leads with a large centered logo instead of the header mark. */
.page-home .site-header { display: none; }
.home-logo { text-align: center; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.home-logo img { height: clamp(150px, 20vw, 230px); width: auto; display: inline-block; }

.site-footer {
	border-top: 1px solid var(--line);
	margin-top: 6rem;
	padding: 2rem 0;
	color: var(--muted);
	font-size: 0.82rem;
}

.footer-note { color: var(--muted); font-size: 0.82rem; line-height: 1.5; max-width: 62ch; margin: 0 0 1.4rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.6rem; flex-wrap: wrap; }
.footer-right { display: inline-flex; align-items: center; gap: 1.3rem; flex-wrap: wrap; }
.footer-inner a:hover { color: var(--fg); }

.footer-social { display: inline-flex; align-items: center; color: var(--muted); transition: color 0.3s var(--ease); }
.footer-social:hover { color: var(--fg); }
.footer-social svg { width: 20px; height: 20px; display: block; fill: currentColor; }

/* --- homepage ------------------------------------------------------------ */

.home { padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: 2rem; }

.home-intro {
	font-family: var(--serif);
	font-size: clamp(1.3rem, 3.4vw, 2.1rem);
	line-height: 1.3;
	max-width: 36ch;
	margin: 0 0 clamp(2.5rem, 6vw, 4.5rem);
	color: var(--fg);
}

.cover-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: clamp(1.6rem, 3.5vw, 3rem) clamp(1.4rem, 3vw, 2.4rem);
}

.cover { display: block; }

.cover-frame {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 5;
	background: var(--bg-soft);
	border-radius: var(--radius);
}

.cover-frame img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
}

.cover:hover .cover-frame img { transform: scale(1.045); }

.cover-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 0.85rem; }

.cover-title {
	font-family: var(--serif);
	font-size: 1.18rem;
	position: relative;
}

.cover-title::after {
	content: "";
	position: absolute;
	left: 0; bottom: -3px;
	width: 0; height: 1px;
	background: currentColor;
	transition: width 0.5s var(--ease);
}

.cover:hover .cover-title::after { width: 100%; }

.cover-count { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; white-space: nowrap; }

/* --- collection page ----------------------------------------------------- */

.collection-head { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: clamp(1.6rem, 4vw, 2.6rem); text-align: center; }

.link-back {
	display: inline-block;
	color: var(--muted);
	font-size: 0.74rem;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	margin-bottom: 1.6rem;
	transition: color 0.3s var(--ease);
}
.link-back:hover { color: var(--fg); }

.collection-title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 5vw, 3.1rem); margin: 0; }

.collection-desc { color: var(--muted); max-width: 52ch; margin: 1rem auto 0; font-size: 1.02rem; }

.inquire-cta { margin-top: 1.8rem; }

/* justified rows; per-tile size is set by public.js */
.photo-grid { display: flex; flex-wrap: wrap; gap: var(--gap, 10px); padding-bottom: 2rem; }

.tile {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--bg-soft);
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.tile.visible { opacity: 1; transform: none; }

.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease), filter 0.6s var(--ease); }
.tile:hover img { transform: scale(1.04); filter: brightness(1.03); }
.tile::after {
	content: "";
	position: absolute; inset: 0;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
	pointer-events: none;
}

/* Deter save on public gallery + lightbox images: drag-to-save, text selection,
   and the iOS Safari long-press "Save Image" callout (which ignores contextmenu). */
.tile img, .cover-frame img, .pswp__img {
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
}

.empty { color: var(--muted); padding: 3rem 0; text-align: center; }

/* --- buttons ------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	font-family: var(--sans);
	font-size: 0.74rem;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	padding: 0.78em 1.5em;
	border: 1px solid var(--fg);
	background: var(--fg);
	color: var(--bg);
	border-radius: var(--radius);
	cursor: pointer;
	transition: opacity 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:hover { opacity: 0.82; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); }
.btn.ghost:hover { background: var(--fg); color: var(--bg); opacity: 1; }
.btn.small { padding: 0.55em 1.05em; font-size: 0.68rem; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); }
.btn.danger.ghost:hover { background: var(--danger); color: #fff; }

/* --- inquiry modal ------------------------------------------------------- */

body.modal-open { overflow: hidden; }

.modal { position: fixed; inset: 0; z-index: 100050; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal[hidden] { display: none; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 8, 6, 0.55); backdrop-filter: blur(4px); animation: fade 0.3s var(--ease); }

.modal-card {
	position: relative;
	width: min(440px, 100%);
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: clamp(1.8rem, 4vw, 2.6rem);
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5);
	animation: pop 0.4s var(--ease);
}

.modal-card h2 { font-family: var(--serif); font-weight: 500; margin: 0 0 0.3rem; font-size: 1.5rem; }
.modal-sub { color: var(--muted); margin: 0 0 1.4rem; font-size: 0.9rem; }
.modal-close { position: absolute; top: 0.7rem; right: 0.9rem; background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-close:hover { color: var(--fg); }

#inquiry-form label, .stack-form label, .login-card label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 1rem; }

#inquiry-form input, #inquiry-form textarea,
.stack-form input, .stack-form textarea, .stack-form select,
.login-card input, .inline-form input, .inline-form select, .bulk-bar select {
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.7em 0.8em;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--fg);
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
}
#inquiry-form input:focus, #inquiry-form textarea:focus, .stack-form input:focus, .stack-form textarea:focus, .login-card input:focus {
	outline: none;
	border-color: var(--fg);
}
.form-status { font-size: 0.84rem; color: var(--muted); min-height: 1.2em; margin: 0.6rem 0 0; }

/* --- PhotoSwipe overrides ------------------------------------------------ */

.pswp__bg { background: #0b0b0a; }
.pswp-caption {
	position: absolute;
	left: 0; right: 0; bottom: 16px;
	text-align: left;
	color: rgba(255, 255, 255, 0.92);
	font-family: var(--sans);
	pointer-events: none;
	padding: 0 1.5rem;
}
.pswp-caption .cap-title { font-family: var(--serif); font-size: 1.05rem; display: block; }
.pswp-caption .cap-exif { font-size: 0.74rem; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.6); display: block; margin-top: 0.2rem; }
.pswp-caption .cap-desc { font-size: 0.86rem; color: rgba(255, 255, 255, 0.8); display: block; margin: 0.25rem 0 0; max-width: 62ch; }
.pswp-caption .cap-loc { font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); display: block; margin-top: 0.3rem; }
.pswp-caption .cap-loc a { color: rgba(255, 255, 255, 0.9); text-decoration: underline; text-underline-offset: 2px; pointer-events: auto; }

.pswp__button--buy {
	width: auto !important;
	padding: 0 14px;
	font-size: 0.66rem;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: #fff;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: var(--radius);
	margin: 9px 6px;
	cursor: pointer;
}
.pswp__button--buy:hover { background: rgba(255, 255, 255, 0.14); }

/* --- video --------------------------------------------------------------- */

.tile video, .pcard video, .cover-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-tile { cursor: pointer; }

.play-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	border: 1px solid rgba(255, 255, 255, 0.75);
	pointer-events: none;
	transition: background 0.3s var(--ease);
}
.play-badge::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 8px 0 8px 14px;
	border-color: transparent transparent transparent #fff;
}
.tile:hover .play-badge, .cover:hover .play-badge { background: rgba(0, 0, 0, 0.65); }
.pcard .play-badge { width: 32px; height: 32px; }
.pcard .play-badge::after { border-width: 6px 0 6px 10px; }

.video-lightbox { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.video-lightbox[hidden] { display: none; }
.vl-backdrop { position: absolute; inset: 0; background: rgba(6, 6, 5, 0.92); backdrop-filter: blur(4px); animation: fade 0.3s var(--ease); }
.vl-video { position: relative; max-width: 100%; max-height: 96vh; background: #000; box-shadow: 0 24px 90px -24px rgba(0, 0, 0, 0.8); }
.vl-close { position: absolute; top: 12px; right: 18px; z-index: 2; background: none; border: none; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; opacity: 0.85; }
.vl-close:hover { opacity: 1; }

/* --- reveal animation ---------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--i, 0) * 60ms); }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	* { animation: none !important; transition: none !important; }
	.reveal, .tile { opacity: 1 !important; transform: none !important; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ===========================================================================
   Admin
   =========================================================================== */

.page-login .site-header, .page-login .site-footer { display: none; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem; }
.login-card h1 { font-family: var(--serif); font-weight: 500; margin: 0; font-size: 1.6rem; }
.login-sub { color: var(--muted); margin: 0.2rem 0 1.8rem; font-size: 0.85rem; }
.login-card .btn { width: 100%; margin-top: 0.6rem; }
.login-error { color: var(--danger); font-size: 0.85rem; margin: 0 0 1rem; }

.admin-nav { display: flex; gap: 1.4rem; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.admin-nav a:hover { color: var(--fg); }

.admin { padding-top: 2.2rem; padding-bottom: 4rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2rem); margin-bottom: 1.6rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.panel-title { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 1.1rem; }
.panel-head .panel-title { margin: 0; }
.muted { color: var(--muted); font-size: 0.85rem; }

.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 2.4rem 1rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color 0.3s var(--ease), background 0.3s var(--ease); }
.dropzone:hover, .dropzone.over { border-color: var(--fg); background: var(--bg-soft); color: var(--fg); }
.dropzone .link { text-decoration: underline; }
.hidden { display: none; }
[x-cloak] { display: none !important; }

.upload-log { list-style: none; margin: 1rem 0 0; padding: 0; font-size: 0.85rem; }
.upload-log li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.upload-log .upload-state { color: var(--muted); }
.upload-log li.done .upload-state { color: #2e7d4f; }
.upload-log li.error .upload-state, .upload-log li.failed .upload-state { color: var(--danger); }

.inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.inline-form input { flex: 1 1 220px; width: auto; margin: 0; }
.inline-form select { width: auto; margin: 0; }

.collection-list { list-style: none; margin: 0; padding: 0; }
.collection-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1rem; user-select: none; }
.collection-thumb { width: 46px; height: 46px; flex: 0 0 auto; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); display: grid; place-items: center; }
.collection-thumb img { width: 100%; height: 100%; object-fit: cover; }
.collection-thumb .no-cover { color: var(--muted); }
.collection-name { flex: 1; font-family: var(--serif); font-size: 1.05rem; }
.badge { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); border: 1px solid var(--line); border-radius: 100px; padding: 0.18em 0.7em; }

.stack-form { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.form-row .grow { flex: 1 1 220px; }
.form-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-top: 0.4rem; }
.share-url { font-size: 0.82rem; color: var(--muted); }
.share-url a { text-decoration: underline; }

.slug-input { display: flex; align-items: stretch; margin-top: 0.4rem; }
.slug-prefix { display: flex; align-items: center; padding: 0 0.7em; background: var(--bg-soft); border: 1px solid var(--line); border-right: none; border-radius: var(--radius) 0 0 var(--radius); color: var(--muted); }
.slug-input input { flex: 1; margin-top: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.field-hint { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 0.4rem; text-transform: none; letter-spacing: normal; }

.bulk-bar { position: sticky; top: 100px; z-index: 20; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 1rem; margin-bottom: 1.2rem; font-size: 0.85rem; }
.bulk-bar select { width: auto; margin: 0; }
.flash { color: #2e7d4f; }

.photo-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
.pcard { position: relative; aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--radius); background: var(--bg-soft); cursor: pointer; }
.pcard img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.pcard:hover img { transform: scale(1.05); }
.pcard .check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; font-size: 0.7rem; opacity: 0; transform: scale(0.6); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); }
.pcard.selected { outline: 2px solid var(--fg); outline-offset: -2px; }
.pcard.selected .check { opacity: 1; transform: none; }
.photo-admin-grid.sortable { min-height: 132px; }
.drop-hint { grid-column: 1 / -1; align-self: stretch; display: grid; place-items: center; min-height: 120px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.pcard-meta {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	padding: 16px 6px 4px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
	pointer-events: none;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.pcard-name { color: #fff; font-size: 0.66rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-tags { color: rgba(255, 255, 255, 0.68); font-size: 0.6rem; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-edit {
	position: absolute;
	top: 4px; left: 4px;
	width: 24px; height: 24px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	font-size: 0.78rem;
	line-height: 1;
	opacity: 0;
	transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
	z-index: 3;
}
.pcard:hover .pcard-edit { opacity: 1; }
.pcard-edit:hover { background: rgba(0, 0, 0, 0.8); }
.pcard.ordered { cursor: grab; }
.pcard[draggable="true"] { cursor: grab; }
.pcard img, .pcard video { -webkit-user-drag: none; }
.collection-row.drop-target { background: var(--bg-soft); box-shadow: inset 0 0 0 1.5px var(--fg); border-radius: var(--radius); }
.pcard-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; font-size: 1rem; line-height: 1; opacity: 0; transition: opacity 0.2s var(--ease); }
.pcard.ordered:hover .pcard-remove { opacity: 1; }
.sortable .sortable-ghost { opacity: 0.4; }

.inquiry-list { list-style: none; margin: 0; padding: 0; }
.inquiry { display: flex; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.inquiry.handled { opacity: 0.5; }
.inquiry-subject { margin: 0.3rem 0 0; color: var(--fg); }
.inquiry-msg { margin: 0.4rem 0 0; color: var(--fg); }
.inquiry-main a { text-decoration: underline; }

/* Admin-only index of private (unlisted) collections at /privat */
.private-index { padding-top: clamp(2rem, 5vw, 3.5rem); padding-bottom: 2rem; }
.private-index h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0 0 1.6rem; }
.private-list { list-style: none; margin: 0; padding: 0; max-width: 680px; }
.private-item { display: flex; align-items: center; gap: 1.1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); transition: opacity 0.3s var(--ease); }
.private-item:hover { opacity: 0.72; }
.private-thumb { position: relative; width: 54px; height: 54px; flex: 0 0 auto; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.private-thumb img { width: 100%; height: 100%; object-fit: cover; }
.private-title { font-family: var(--serif); font-size: 1.12rem; flex: 1; }
.private-link { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

.message-page { padding: 5rem 0; text-align: center; }
.message-page h1 { font-family: var(--serif); font-weight: 500; }

@media (max-width: 640px) {
	.header-inner { height: 70px; }
	.brand img { height: 48px; }
	.home-logo img { height: clamp(120px, 36vw, 180px); }
	.cover-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
