/* Montserrat variable font, self-hosted (SIL Open Font License, see /fonts/OFL.txt) */
@font-face {
	font-family: "Montserrat";
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url(/fonts/montserrat-latin-ext-wght-normal.woff2) format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Montserrat";
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url(/fonts/montserrat-latin-wght-normal.woff2) format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	--bg: #111;
	--text: #e6e6e6;
	--muted: #8c8c8c;
	--tile: #1c1c1c;
	--line: #2c2c2c;
	color-scheme: dark;
	--gap: 10px;
	--header: 64px;
	--stage-pad: 32px;
	--font: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 300 14px/1.6 var(--font);
	-webkit-font-smoothing: antialiased;
}

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

button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

.caps {
	text-transform: uppercase;
	letter-spacing: .2em;
}

/* Header */

.header {
	position: sticky;
	top: 0;
	z-index: 10;
	height: var(--header);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 24px;
	background: var(--bg);
}

.brand-title {
	display: block;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .15em;
	text-transform: uppercase;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.brand-sub {
	display: block;
	font-size: 9px;
	font-weight: 500;
	color: var(--muted);
	letter-spacing: .25em;
	text-transform: uppercase;
}

.icon-btn {
	width: 40px;
	height: 40px;
	display: inline-grid;
	place-items: center;
	color: var(--text);
	opacity: .75;
	transition: opacity .2s;
}

.icon-btn:hover { opacity: 1; }

.icon-btn svg { width: 20px; height: 20px; }

/* Cover */

.cover {
	position: relative;
	height: 100vh;
	height: 100svh;
	color: #fff;
	overflow: hidden;
	background: #111;
}

.cover img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cover::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(rgba(0, 0, 0, .1), rgba(0, 0, 0, .45));
}

.cover-center {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 16px;
	text-align: center;
}

.cover h1 {
	margin: 0 0 10px;
	font-size: clamp(28px, 5vw, 52px);
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	line-height: 1.15;
}

.cover p {
	margin: 0;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .3em;
	text-transform: uppercase;
	opacity: .9;
}

.cover-center .btn-outline { margin-top: 32px; }

.cover-name {
	position: absolute;
	inset: auto 0 32px;
	z-index: 1;
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .3em;
	text-transform: uppercase;
}

.btn-outline {
	display: inline-block;
	padding: 13px 30px;
	border: 1px solid #fff;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .3em;
	text-transform: uppercase;
	transition: background .25s, color .25s;
}

.btn-outline:hover { background: #fff; color: var(--bg); }

/* Masonry grid */

.grid {
	display: flex;
	gap: var(--gap);
	padding: 0 16px;
}

.grid-col {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--gap);
}

.tile {
	position: relative;
	display: block;
	background: var(--tile);
	overflow: hidden;
}

.tile img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity .5s, transform .6s;
}

.tile img.loaded { opacity: 1; }

.tile-actions {
	position: absolute;
	right: 8px;
	bottom: 8px;
	opacity: 0;
	transition: opacity .2s;
}

.tile-actions .icon-btn {
	width: 34px;
	height: 34px;
	color: #fff;
	opacity: .9;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
}

@media (hover: hover) {
	.tile:hover img.loaded { transform: scale(1.015); }
	.tile:hover .tile-actions { opacity: 1; }
	.tile::after {
		content: "";
		position: absolute;
		inset: 0;
		background: linear-gradient(transparent 70%, rgba(0, 0, 0, .25));
		opacity: 0;
		transition: opacity .2s;
		pointer-events: none;
	}
	.tile:hover::after { opacity: 1; }
}

/* Album list (home) */

.albums {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
	gap: 48px 24px;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 24px;
}

.album-card .tile { aspect-ratio: 3 / 2; }

.album-card h2 {
	margin: 18px 0 4px;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.album-card span {
	color: var(--muted);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

/* Home and private folders */

.collection { padding-top: 72px; }

.folder-name svg {
	width: 16px;
	height: 16px;
	flex: none;
}

.notice {
	min-height: 70vh;
	display: grid;
	place-content: center;
	padding: 0 16px;
	text-align: center;
}

.notice h1 {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 400;
	letter-spacing: .3em;
	text-transform: uppercase;
}

.notice p {
	margin: 0;
	color: var(--muted);
	font-size: 13px;
}

/* Admin mock */

.admin {
	max-width: 860px;
	margin: 0 auto;
	padding: 24px 24px 0;
}

.admin-note {
	margin: 0 0 32px;
	padding: 10px 14px;
	border: 1px solid var(--line);
	color: var(--muted);
	font-size: 12px;
}

.admin-h {
	margin: 40px 0 16px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .25em;
	text-transform: uppercase;
}

.folder-list {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--line);
}

.folder-row {
	display: grid;
	grid-template-columns: 180px 1fr auto;
	align-items: center;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid var(--line);
	transition: background 1.5s;
}

.folder-row.fresh { background: #1f2a1f; }

.folder-name {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
}

.folder-meta {
	display: block;
	color: var(--muted);
	font-size: 11px;
}

.row-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.field {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--line);
	background: var(--tile);
	color: var(--text);
	font: inherit;
	font-size: 13px;
}

.field:focus { outline: 1px solid var(--muted); }

.link-field { color: var(--muted); font-size: 12px; }

.btn-small {
	padding: 7px 12px;
	border: 1px solid var(--line);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .15em;
	text-transform: uppercase;
	white-space: nowrap;
}

.btn-small:hover { border-color: var(--text); }
.btn-small.danger { color: #e08080; }

.cover-picker { grid-column: 1 / -1; }

.cover-picker summary {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	list-style: none;
}

.cover-picker summary::-webkit-details-marker { display: none; }

.cover-picker summary img {
	width: 72px;
	height: 48px;
	object-fit: cover;
	background: var(--tile);
}

.cover-picker summary span {
	color: var(--muted);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.cover-picker summary small {
	font-size: 11px;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.cover-picker[open] summary small { visibility: hidden; }

.cover-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
	gap: 6px;
	margin-top: 12px;
}

.cover-thumb {
	aspect-ratio: 1;
	background: var(--tile);
	outline: 2px solid transparent;
	outline-offset: 2px;
	opacity: .65;
	transition: opacity .15s;
}

.cover-thumb:hover { opacity: 1; }
.cover-thumb.selected { outline-color: var(--text); opacity: 1; }

.cover-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.label {
	margin-top: 8px;
	color: var(--muted);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.admin-hint {
	margin: 4px 0 12px;
	color: var(--muted);
	font-size: 12px;
}

select.field { appearance: auto; }

.inline-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
}

.inline-form .field { width: auto; flex: 1 1 180px; }
.inline-form .btn-small { padding: 9px 16px; }

.album-form {
	display: grid;
	gap: 8px;
	max-width: 420px;
}

.album-form .row-actions { margin-top: 12px; }

.album-row {
	display: grid;
	grid-template-columns: 72px 1fr auto;
	align-items: center;
	gap: 16px;
	padding: 10px 0;
	border-bottom: 1px solid var(--line);
}

.album-thumb {
	display: block;
	width: 72px;
	height: 48px;
	background: var(--tile);
}

.album-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dropzone {
	display: grid;
	place-items: center;
	gap: 6px;
	padding: 36px 16px;
	border: 1px dashed var(--muted);
	text-align: center;
	cursor: pointer;
	transition: background .15s;
}

.dropzone.over,
.dropzone:hover { background: var(--tile); }
.dropzone input { display: none; }

.dropzone span {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.dropzone small { color: var(--muted); font-size: 12px; }

.photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 8px;
}

.photo-cell {
	position: relative;
	aspect-ratio: 1;
	background: var(--tile);
	outline: 2px solid transparent;
	outline-offset: 2px;
}

.photo-cell.selected { outline-color: var(--text); }

.photo-cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.photo-actions {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	justify-content: space-between;
	padding: 6px;
	background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}

.photo-actions .btn-small {
	padding: 4px 8px;
	border-color: rgba(255, 255, 255, .3);
	background: rgba(0, 0, 0, .4);
}

.login {
	display: grid;
	gap: 12px;
	width: min(320px, 100%);
}

.login h1 { margin-bottom: 12px; }
.login .btn-outline { border-color: var(--text); }
.login-error { min-height: 1.5em; color: #e08080; font-size: 12px; }

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100;
	transform: translateX(-50%);
	padding: 10px 18px;
	background: var(--text);
	color: var(--bg);
	font-size: 12px;
}

.footer {
	padding: 72px 16px 48px;
	text-align: center;
	color: var(--muted);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .25em;
	text-transform: uppercase;
}

/* Lightbox */

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: grid;
	grid-template-rows: var(--header) 1fr;
	background: var(--bg);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s, visibility .25s;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px 0 24px;
}

.lightbox-count {
	color: var(--muted);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .25em;
}

.lightbox-stage {
	position: relative;
	min-height: 0;
	display: grid;
	place-items: center;
	padding: 0 72px var(--stage-pad);
	touch-action: pan-y;
}

.lightbox-stage img {
	max-width: 100%;
	max-height: calc(100vh - var(--header) - var(--stage-pad));
	max-height: calc(100dvh - var(--header) - var(--stage-pad));
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transition: opacity .2s;
}

.lightbox-stage img.fading { opacity: 0; }

.lightbox-nav {
	position: absolute;
	top: 0;
	bottom: 32px;
	width: 72px;
	display: grid;
	place-items: center;
	opacity: .55;
	transition: opacity .2s;
}

.lightbox-nav:hover { opacity: 1; }
.lightbox-nav svg { width: 28px; height: 28px; }
.lightbox-nav.prev { left: 0; }
.lightbox-nav.next { right: 0; }
.lightbox-nav[hidden] { display: none; }

.download-label {
	margin-left: 4px;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: .25em;
	text-transform: uppercase;
}

.download-btn {
	display: inline-flex;
	align-items: center;
	height: 40px;
	padding: 0 12px;
	opacity: .75;
	transition: opacity .2s;
}

.download-btn:hover { opacity: 1; }
.download-btn svg { width: 18px; height: 18px; }

@media (max-width: 700px) {
	:root { --gap: 6px; --header: 56px; --stage-pad: 16px; }
	.header { padding: 0 8px 0 16px; }
	.grid { padding: 0 6px; }
	.albums { padding-left: 16px; padding-right: 16px; gap: 40px; }
	.collection { padding-top: 48px; }
	.lightbox-bar { padding: 0 8px 0 16px; }
	.lightbox-stage { padding: 0 0 var(--stage-pad); }
	.lightbox-nav { display: none; }
	.download-label { display: none; }
	.folder-row { grid-template-columns: 1fr; gap: 10px; }
	.album-row { grid-template-columns: 56px 1fr; }
	.album-row .row-actions { grid-column: 2; }
	.album-thumb { width: 56px; height: 40px; }
	.admin { padding: 16px 16px 0; }
}
