:root {
	color-scheme: light dark;
	font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
	--bg: #f7f8fb;
	--surface: #ffffff;
	--text: #1d2433;
	--muted: #5f6b7f;
	--border: #d9deea;
	--primary-default: #3559e0;
	--primary: var(--primary-default);
	--surface-accent: #ebeff8;
}

:root[data-theme="light"] {
	color-scheme: light;
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0f1420;
	--surface: #171e2d;
	--text: #e8edf8;
	--muted: #a5b2cd;
	--border: #2b354c;
	--primary-default: #7c95ff;
	--primary: var(--primary-default);
	--surface-accent: #242f46;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		--bg: #0f1420;
		--surface: #171e2d;
		--text: #e8edf8;
		--muted: #a5b2cd;
		--border: #2b354c;
		--primary: #7c95ff;
		--surface-accent: #242f46;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	color: var(--text);
	background: var(--bg);
	position: relative;
	min-height: 100vh;
}

body.page-art-background {
	background: var(--bg);
}

body.page-art-background::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background-image: var(--page-art-background-image);
	background-size: cover;
	background-position: center;
	background-attachment: fixed;
	filter: blur(20px) brightness(0.55);
	transform: scale(1.08);
	pointer-events: none;
}

.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1.25rem;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.site-header,
.content {
	position: relative;
	z-index: 1;
}

.site-title {
	font-weight: 700;
	letter-spacing: 0.015em;
}

.header-controls {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	align-items: center;
}

.nav-toggle-button {
	display: none;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	place-items: center;
	font-size: 1.1rem;
}

.tabs {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	align-items: center;
}

.tabs-group {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.tabs-group-label {
	font-size: 0.76rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.tabs-group-buttons {
	display: flex;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.tabs-subtab {
	position: relative;
	display: inline-flex;
}

.tabs-subtab-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.tabs-subtab-chevron {
	font-size: 0.78rem;
	line-height: 1;
	opacity: 0.9;
}

.tabs-subtab-menu {
	position: absolute;
	top: calc(100% + 0.45rem);
	left: 0;
	display: none;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 180px;
	padding: 0.5rem;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: var(--surface);
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
	z-index: 30;
}

.tabs-subtab.is-open .tabs-subtab-menu {
	display: flex;
}

.tabs-subtab-menu .tab-button {
	text-align: left;
	border-radius: 10px;
}

.tab-button {
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	border-radius: 999px;
	padding: 0.45rem 0.9rem;
	cursor: pointer;
}

.share-link-button {
	margin-top: 0.55rem;
	font-size: 0.86rem;
	padding: 0.35rem 0.72rem;
}

.tab-button.is-active {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary);
}

.theme-toggle-button {
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	display: grid;
	place-items: center;
}

.theme-icon {
	font-size: 1.1rem;
	line-height: 1;
}

.content {
	max-width: 1100px;
	margin: 0 auto;
	padding: 1.25rem;
}

.tab-panel {
	display: none;
}

.tab-panel.is-active {
	display: block;
}

.markdown-content {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 1.25rem;
}

.markdown-content :first-child {
	margin-top: 0;
}

.gallery-header h1 {
	margin-bottom: 0.25rem;
}

.gallery-header p {
	margin-top: 0;
	color: var(--muted);
}

.status-message {
	margin-bottom: 0.75rem;
	color: var(--muted);
}

.gallery-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.filter-chip {
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	border-radius: 999px;
	padding: 0.3rem 0.75rem;
	cursor: pointer;
}

.filter-chip.is-active {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

.gallery-grid {
	column-width: 280px;
	column-gap: 1rem;
}

.art-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	overflow: hidden;
	display: inline-block;
	width: 100%;
	margin: 0 0 1rem;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
}

.art-preview {
	background: var(--surface-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	cursor: zoom-in;
}

.art-preview img {
	width: 100%;
	height: auto;
	object-fit: contain;
	display: block;
	-webkit-user-drag: none;
	user-select: none;
}

.art-preview-empty {
	min-height: 180px;
	display: grid;
	place-items: center;
	color: var(--muted);
	font-size: 0.9rem;
}

.art-body {
	padding: 0.85rem 0.95rem 1rem;
}

.art-body h3 {
	margin: 0 0 0.35rem;
}

.art-meta {
	font-size: 0.92rem;
	color: var(--muted);
}

.art-meta a,
.art-meta a:visited,
.art-meta a:hover,
.art-meta a:active {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: currentColor;
	text-underline-offset: 2px;
}

.art-description {
	margin-top: 0.65rem;
	font-size: 0.94rem;
}

.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.65rem;
}

.tag-pill {
	font-size: 0.8rem;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	background: var(--surface-accent);
	color: var(--muted);
}

.gallery-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.gallery-pagination.is-disabled {
	display: none;
}

.gallery-page-info {
	color: var(--muted);
	font-size: 0.92rem;
}

.gallery-page-jump {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.gallery-page-jump-input {
	width: 5.5rem;
	padding: 0.38rem 0.5rem;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
}

.gallery-pagination .tab-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.gallery-lazy-sentinel {
	height: 1px;
	width: 100%;
}

.gallery-lazy-sentinel.is-hidden {
	display: none;
}

.art-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.86);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	z-index: 1000;
}

.art-lightbox[data-bg-mode="light"] {
	background: rgba(255, 255, 255, 0.9);
}

.art-lightbox[data-bg-mode="none"] {
	background: rgba(10, 10, 10, 0.1);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.art-lightbox.is-open {
	display: flex;
}

.art-lightbox-dialog {
	width: min(96vw, 1700px);
	max-height: 94vh;
	display: block;
}

.art-lightbox-image-wrap {
	min-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: auto;
	padding-right: min(430px, 32vw);
	touch-action: none;
}

.art-lightbox-dialog.is-info-hidden .art-lightbox-image-wrap {
	padding-right: 0;
}

.art-lightbox-side {
	position: fixed;
	top: 1rem;
	right: 1rem;
	width: min(420px, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
	gap: 0.75rem;
	z-index: 1001;
}

.art-lightbox-side.is-info-hidden {
	grid-template-rows: auto;
}

.art-lightbox-toolbar {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.art-lightbox-zoom-controls {
	display: flex;
	gap: 0.45rem;
}

.art-lightbox-zoom-controls .tab-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.art-lightbox-image {
	max-width: 100%;
	max-height: 88vh;
	width: auto;
	height: auto;
	object-fit: contain;
	-webkit-user-drag: none;
	user-select: none;
	justify-self: center;
	touch-action: none;
}

.art-lightbox-close {
	font-size: 1rem;
}

.art-lightbox-meta {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 0.85rem;
	overflow: auto;
	min-height: 200px;
}

.art-lightbox-meta h3 {
	margin: 0 0 0.3rem;
}

.art-lightbox-meta .art-meta {
	margin-bottom: 0.5rem;
}

.art-lightbox-side.is-info-hidden .art-lightbox-meta {
	display: none;
}

@media (max-width: 1100px) {
	.art-lightbox-image-wrap {
		min-height: 50vh;
		padding-right: 0;
		padding-top: 17rem;
	}
	.art-lightbox-dialog.is-info-hidden .art-lightbox-image-wrap {
		padding-top: 6rem;
	}
	.art-lightbox-side {
		width: calc(100vw - 2rem);
	}
}

@media (max-width: 900px) {
	.site-header {
		align-items: flex-start;
	}
	.nav-toggle-button {
		display: grid;
	}
	.header-controls {
		display: none;
		width: 100%;
		flex-direction: column;
		align-items: stretch;
	}
	.header-controls.is-open {
		display: flex;
	}
	.tabs {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
	}
	.tabs-subtab {
		width: 100%;
		display: block;
	}
	.tabs-subtab-trigger {
		width: 100%;
		justify-content: space-between;
	}
	.tabs-subtab-menu {
		position: static;
		margin-top: 0.5rem;
		width: 100%;
		box-shadow: none;
	}
	.tabs-subtab-menu .tab-button {
		width: 100%;
	}
	.tabs-group {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		padding: 0.5rem;
		border: 1px solid var(--border);
		border-radius: 10px;
		background: var(--surface);
	}
	.tabs-group-buttons {
		width: 100%;
	}
	.tabs-group-buttons .tab-button {
		width: 100%;
		text-align: left;
	}
	.theme-toggle-button {
		align-self: flex-end;
	}
}
