/* ==========================================================================
   Unfocused Wallpapers — shared design system
   Dark, minimal, image-first. Used by index.html, gallery/index.html and
   gallery-desktop/index.html (referenced via a relative path from each).
   ========================================================================== */

:root {
	--bg: #08090c;
	--bg-elevated: #111319;
	--bg-elevated-2: #191c24;
	--border: rgba(255, 255, 255, 0.08);
	--border-strong: rgba(255, 255, 255, 0.16);
	--text: #f5f4f1;
	--text-dim: #a3a4ad;
	--text-faint: #6c6d76;
	--accent-1: #58cfca;
	--accent-2: #2f9d98;
	--accent-gradient: linear-gradient(120deg, var(--accent-1), var(--accent-2));
	--radius: 14px;
	--radius-sm: 8px;
	--container: 1200px;
	--ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
	box-sizing: border-box;
}

html {
	background: var(--bg);
	color-scheme: dark;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	line-height: 1.5;
	min-height: 100vh;
	overflow-x: hidden;
}

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

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

::selection {
	background: var(--accent-2);
	color: #fff;
}

/* Beats class-level `display` declarations on elements toggled via .hidden */
[hidden] {
	display: none !important;
}

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Focus states — visible only for keyboard users */
:focus { outline: none; }
:focus-visible {
	outline: 2px solid var(--accent-1);
	outline-offset: 3px;
	border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Ambient background — soft gradient glow + subtle animated grain
   -------------------------------------------------------------------------- */

.ambient {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
	background: var(--bg);
}

.ambient__glow {
	position: absolute;
	inset: -20%;
	background:
		radial-gradient(38% 32% at 22% 18%, rgba(88, 207, 202, 0.20), transparent 70%),
		radial-gradient(42% 38% at 82% 12%, rgba(47, 157, 152, 0.20), transparent 70%),
		radial-gradient(50% 45% at 50% 100%, rgba(88, 207, 202, 0.10), transparent 70%);
	filter: blur(10px);
	animation: drift 26s var(--ease) infinite alternate;
}

.ambient__grain {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0.05;
	mix-blend-mode: overlay;
}

.ambient__cursor {
	position: absolute;
	inset: 0;
	background: radial-gradient(360px 360px at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.05), transparent 70%);
}

.ambient__vignette {
	position: absolute;
	inset: 0;
	background: radial-gradient(120% 90% at 50% 0%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

@keyframes drift {
	0%   { transform: translate3d(0, 0, 0) scale(1); }
	50%  { transform: translate3d(-2%, 1.5%, 0) scale(1.04); }
	100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
	.ambient__glow { animation: none; }
}

.click-burst {
	position: fixed;
	z-index: 3;
	left: 0;
	top: 0;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	border-radius: 50%;
	pointer-events: none;
	background: radial-gradient(circle, rgba(88, 207, 202, 0.85), rgba(88, 207, 202, 0) 72%);
	transform: scale(0.5);
	opacity: 0.9;
	animation: click-burst 0.7s var(--ease) forwards;
}

@keyframes click-burst {
	to {
		transform: scale(9);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.click-burst { display: none; }
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.container {
	width: 100%;
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 24px;
}

/* Gallery pages run edge-to-edge so the grid uses the full display width. */
.container--wide {
	max-width: none;
	padding: 0 clamp(16px, 2.5vw, 48px);
}

main {
	position: relative;
	z-index: 1;
}

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */

.site-header {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 28px 0;
}

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.brand {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.brand strong {
	font-weight: 800;
}

.brand__tag {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-faint);
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 4px;
}

.site-nav a {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--text-dim);
	padding: 8px 14px;
	border-radius: 999px;
	transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.site-nav a:hover,
.site-nav a:focus-visible {
	color: var(--text);
	background: var(--bg-elevated);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	padding: 13px 22px;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
	white-space: nowrap;
}

.btn svg {
	width: 16px;
	height: 16px;
	flex: none;
}

.btn:active { transform: scale(0.97); }

.btn--primary {
	background: var(--text);
	color: #0a0a0c;
}

.btn--primary:hover,
.btn--primary:focus-visible {
	opacity: 0.88;
}

.btn--ghost {
	background: transparent;
	color: var(--text);
	border-color: var(--border-strong);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
	background: var(--bg-elevated);
	border-color: var(--border-strong);
}

.btn--sm {
	padding: 9px 16px;
	font-size: 13px;
}

.btn--icon {
	padding: 10px;
	border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Split-screen home layout — text panel + rotating photo panel
   -------------------------------------------------------------------------- */

#page-wrapper {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: row-reverse;
	align-items: stretch;
	min-height: 100vh;
}

@media (max-width: 980px), (orientation: portrait) {
	#page-wrapper {
		flex-direction: column-reverse;
		min-height: 0;
	}
}

#wrapper {
	width: 60%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(32px, 6vw, 96px);
}

#wrapper .inner {
	max-width: 30em;
}

@media (max-width: 980px), (orientation: portrait) {
	#wrapper {
		width: 100%;
		padding: 48px 28px;
	}
}

#wrapper .brand {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	margin-bottom: 28px;
}

#wrapper h1 {
	font-size: clamp(2.4rem, 5.2vw, 3.8rem);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.03em;
	margin: 0 0 18px;
}

#wrapper h1 em {
	font-style: normal;
	background: var(--accent-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

#wrapper p {
	color: var(--text-dim);
	font-size: 16px;
	margin: 0 0 32px;
}

#wrapper .actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin: 0 0 0;
	padding: 0;
	list-style: none;
}

#wrapper footer {
	margin-top: 48px;
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

#banner {
	position: relative;
	width: 40%;
	overflow: hidden;
	background: var(--bg-elevated);
}

@media (max-width: 980px), (orientation: portrait) {
	#banner {
		width: 100%;
		height: 46vh;
	}
}

#banner .frame {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 3vw, 48px);
	opacity: 0;
	z-index: 0;
	transition: opacity 1.2s ease;
	/* The image URL is set here by app.js; sized 0 so only ::before paints it. */
	background-size: 0 0;
	background-position: center;
}

/* Blurred copy of the same shot fills the panel, so the mockup's own backdrop
   doesn't read as a hard-edged rectangle pasted onto the page. */
#banner .frame::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: inherit;
	background-size: cover;
	background-position: center;
	filter: blur(46px) saturate(1.15) brightness(0.5);
	transform: scale(1.2);
	z-index: 0;
}

#banner .frame.is-top {
	z-index: 1;
}

#banner .frame.is-visible {
	opacity: 1;
}

/* The banner art is the wallpaper shown inside a phone mockup (same artwork as
   the gallery thumbnails, at its native 1080x1920). Displaying it contained and
   capped keeps it at or below 1:1 pixel density — full-bleed `cover` had to
   upscale it on large/HiDPI displays, which is what made it look soft. */
#banner .frame img {
	position: relative;
	z-index: 1;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: min(88%, 860px);
	object-fit: contain;
	border-radius: clamp(12px, 1.6vw, 22px);
	filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.5));
}

#banner::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background: linear-gradient(90deg, rgba(8, 9, 12, 0.35), transparent 18%);
}

@media (max-width: 980px), (orientation: portrait) {
	#banner::after {
		background: linear-gradient(180deg, rgba(8, 9, 12, 0.35), transparent 18%);
	}
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
	position: relative;
	z-index: 1;
	padding: 40px 0 48px;
	border-top: 1px solid var(--border);
	margin-top: 40px;
}

.site-footer .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
}

.footer__meta {
	font-size: 13px;
	color: var(--text-faint);
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
}

.footer__meta button {
	font: inherit;
	color: var(--text-faint);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: var(--border-strong);
	transition: color 0.2s var(--ease);
}

.footer__meta button:hover,
.footer__meta button:focus-visible {
	color: var(--text-dim);
}

.socials {
	display: flex;
	gap: 8px;
}

.socials a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: var(--text-dim);
	border: 1px solid var(--border);
	transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.socials a:hover,
.socials a:focus-visible {
	color: var(--text);
	border-color: var(--border-strong);
	background: var(--bg-elevated);
}

.socials svg {
	width: 16px;
	height: 16px;
}

/* --------------------------------------------------------------------------
   Modal / dialog (terms)
   -------------------------------------------------------------------------- */

dialog.modal {
	position: fixed;
	inset: 0;
	margin: auto;
	width: min(640px, calc(100vw - 40px));
	max-height: min(78vh, 760px);
	padding: 0;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--bg-elevated);
	color: var(--text);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

dialog.modal::backdrop {
	background: rgba(4, 5, 8, 0.7);
	backdrop-filter: blur(6px);
}

.modal__inner {
	display: flex;
	flex-direction: column;
	max-height: min(78vh, 760px);
}

.modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--border);
	flex: none;
}

.modal__header h2 {
	font-size: 16px;
	margin: 0;
	font-weight: 700;
}

.modal__progress {
	height: 2px;
	flex: none;
	background: rgba(255, 255, 255, 0.06);
	overflow: hidden;
}

.modal__progress-bar {
	height: 100%;
	width: 0;
	background: var(--accent-gradient);
	transition: width 0.15s linear;
}

.modal__body {
	padding: 20px 24px 28px;
	overflow-y: auto;
	flex: 1 1 auto;
	min-height: 0;
	overscroll-behavior: contain;
	font-size: 14px;
	color: var(--text-dim);
}

.modal__end {
	margin-top: 22px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-faint);
	text-align: center;
}

.modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 16px 24px;
	border-top: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.02);
	flex: none;
}

.modal__hint {
	font-size: 12.5px;
	color: var(--text-faint);
	display: flex;
	align-items: center;
	gap: 8px;
}

.modal__hint::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--text-faint);
	animation: pulse 1.8s ease-in-out infinite;
}

.is-unlocked .modal__hint::before {
	background: var(--accent-1);
	animation: none;
}

@keyframes pulse {
	0%, 100% { opacity: 0.35; }
	50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.modal__hint::before { animation: none; }
}

.modal__accepted {
	font-size: 12.5px;
	color: var(--accent-1);
	display: flex;
	align-items: center;
	gap: 6px;
}

.modal__accepted::before {
	content: "✓";
	font-size: 13px;
}

[data-terms-accept][disabled] {
	opacity: 0.35;
	cursor: not-allowed;
	background: var(--bg-elevated-2);
	color: var(--text-faint);
}

.is-unlocked [data-terms-accept]:not([disabled]) {
	background: var(--accent-1);
	color: #05201f;
	box-shadow: 0 0 0 0 rgba(88, 207, 202, 0.5);
	animation: accept-ready 2.4s ease-out 1;
}

@keyframes accept-ready {
	0% { box-shadow: 0 0 0 0 rgba(88, 207, 202, 0.5); }
	60% { box-shadow: 0 0 0 12px rgba(88, 207, 202, 0); }
	100% { box-shadow: 0 0 0 0 rgba(88, 207, 202, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.is-unlocked [data-terms-accept]:not([disabled]) { animation: none; }
}

.modal__body h3 {
	color: var(--text);
	font-size: 13px;
	margin: 18px 0 6px;
}

.modal__body p,
.modal__body li {
	line-height: 1.6;
}

.modal__body ul {
	padding-left: 20px;
	margin: 6px 0;
}

.modal__body strong {
	color: var(--text);
}

/* --------------------------------------------------------------------------
   Gallery header (mobile/desktop wallpaper pages)
   -------------------------------------------------------------------------- */

.gallery-hero {
	padding: 6vh 0 5vh;
}

.gallery-hero h1 {
	font-size: clamp(1.9rem, 4vw, 2.7rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	margin: 0 0 10px;
}

.gallery-hero p {
	color: var(--text-dim);
	margin: 0;
	font-size: 15px;
}

/* --------------------------------------------------------------------------
   Gallery grid
   -------------------------------------------------------------------------- */

.grid {
	display: grid;
	gap: clamp(10px, 1.4vw, 20px);
	padding-bottom: 8vh;
}

/* Tiles grow with the viewport instead of multiplying endlessly, so the grid
   fills ultrawide screens without shrinking to postage stamps, and reflows to
   fewer columns as the window narrows. */
.grid--portrait {
	grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 11vw, 240px), 1fr));
}

.grid--landscape {
	grid-template-columns: repeat(auto-fill, minmax(clamp(260px, 22vw, 440px), 1fr));
}

@media (max-width: 420px) {
	.grid--portrait {
		grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
	}

	.grid--landscape {
		grid-template-columns: 1fr;
	}
}

.thumb {
	position: relative;
	display: block;
	border-radius: var(--radius-sm);
	overflow: hidden;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
}

.grid--portrait .thumb {
	aspect-ratio: 9 / 16;
}

.grid--landscape .thumb {
	aspect-ratio: 3 / 2;
}

.thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
	opacity: 0;
}

.thumb img.is-loaded {
	opacity: 1;
}

.thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
	opacity: 0;
	transition: opacity 0.3s var(--ease);
}

.thumb:hover img,
.thumb:focus-visible img {
	transform: scale(1.05);
}

.thumb:hover::after,
.thumb:focus-visible::after {
	opacity: 1;
}

.thumb__expand {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(8, 9, 12, 0.55);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.thumb:hover .thumb__expand,
.thumb:focus-visible .thumb__expand {
	opacity: 1;
	transform: translateY(0);
}

.thumb__expand svg {
	width: 14px;
	height: 14px;
}

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

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: none;
	background: rgba(5, 6, 9, 0.92);
	backdrop-filter: blur(10px);
}

.lightbox.is-open {
	display: flex;
	flex-direction: column;
}

.lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	flex: none;
}

.lightbox__count {
	font-size: 13px;
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
}

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

[data-lightbox-download] {
	min-width: 130px;
	justify-content: center;
}

[data-lightbox-download].is-busy {
	opacity: 0.7;
	pointer-events: none;
}

.lightbox__stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 min(6vw, 80px) 24px;
}

.lightbox__img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 10px;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.lightbox__img.is-visible {
	opacity: 1;
	transform: scale(1);
}

.lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--border-strong);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s var(--ease);
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
	background: rgba(255, 255, 255, 0.14);
}

.lightbox__nav svg {
	width: 18px;
	height: 18px;
}

.lightbox__nav--prev { left: min(2vw, 24px); }
.lightbox__nav--next { right: min(2vw, 24px); }

@media (max-width: 640px) {
	.lightbox__nav { width: 38px; height: 38px; }
	.lightbox__nav--prev { left: 8px; }
	.lightbox__nav--next { right: 8px; }
	.lightbox__stage { padding: 0 4px 16px; }
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-dim);
}

.back-link:hover,
.back-link:focus-visible {
	color: var(--text);
}

.back-link svg {
	width: 14px;
	height: 14px;
}
