/* color scheme */

:root {
	--switch-ball: whitesmoke;
}

.dark {
	--bg: #1a2328;
	--nav-bg: #283136;
	--card-bg: #283136;
	--text: #d0d0d0;
	--text-dim: #a0a0a0;
	--text-lit: #f0f0f0;
	--accent: #58a6ff;
	--division: #ffffff30;

	--widget-bg: #ffffff10;
	--widget-bg-hovered: #ffffff20;
	--widget-bg-selected: #ffffff30;
	--widget-bg-accent: #3a88e1;
	--widget-bg-accent-hovered: #3479c9;
	--widget-bg-warning: #ae3c47;
	--widget-bg-warning-hovered: #9c3540;

	--img-unloaded-bg: #00000020;
	--thumbnail-cw-bg: #ff384c;
	--thumbnail-indicator-bg: #00000080;

	color-scheme: dark;
}

.light {
	--bg: #f0f0f0;
	--nav-bg: #f8f8f8;
	--card-bg: #f8f8f8;
	--text: #303030;
	--text-dim: #606060;
	--text-lit: #101010;
	--accent: #4492eb;
	--division: #00000020;

	--widget-bg: #0000000c;
	--widget-bg-hovered: #00000018;
	--widget-bg-selected: #00000024;
	--widget-bg-accent: #3a88e1;
	--widget-bg-accent-hovered: #3479c9;
	--widget-bg-warning: #f65463;
	--widget-bg-warning-hovered: #de4a58;

	--img-unloaded-bg: #00000010;
	--thumbnail-cw-bg: #ff384c;
	--thumbnail-indicator-bg: #00000080;

	color-scheme: light;
}

/* page structure */

body {
	margin: 0;
	min-height: 100vh;
    display: flex;
    flex-direction: column;
	background-color: var(--bg);
	font-family: sans-serif;
	color: var(--text);
}

nav {
	background-color: var(--nav-bg);
	height: 4rem;
}

nav .container {
	height: 100%;
	padding: 0 1rem;
	box-sizing: border-box;
	max-width: 80rem;
	margin: auto;
	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
}

nav .title {
	font-size: 1.25rem;
	font-weight: bold;
}

nav a {
	color: var(--text);
	text-decoration: none;
	transition: .2s;
}

nav a:hover {
	color: var(--text-lit);
}

nav .searchbar {
	flex: 0 1 16rem;
}

nav .toolbar {
	display: flex;
	gap: .5rem;
}

nav .toolbar a {
	border-radius: 100%;
	box-sizing: border-box;
	display: block;
	width: 2.5rem;
	height: 2.5rem;
	line-height: 2.5rem;
	text-align: center;
	transition: .2s;
}

nav .toolbar a:hover {
	background-color: var(--widget-bg);
}

nav .toolbar svg {
	width: 1.25rem;
	height: 1.25rem;
	vertical-align: -.2rem;
}

main {
	width: 100%;
	word-break: break-word;
}

main.middle {
	margin-top: auto;
}

main .container {
	box-sizing: border-box;
	max-width: 48rem;
	margin: auto;
	padding: 0 1rem;
}

main .container-card {
	background-color: var(--card-bg);
	border-radius: 1rem;
	margin: 1rem auto;
	overflow: hidden;
}

main .container-card .bleed {
	margin-left: -1rem;
	width: calc(100% + 2rem);
}

main .container-card h1 {
	font-size: 1.5rem;
}

main .container-card h2 {
	font-size: 1.25rem;
}

main .container-big {
	max-width: 64rem;
}

main .container-small {
	padding: 0 1rem;
	max-width: 28rem;
}

footer {
	margin-top: auto;
	color: var(--text-dim);
}

footer a {
	color: var(--text-dim);
	text-decoration: none;
	transition: .2s;
}

footer a:hover {
	color: var(--text-lit);
}

footer .container {
	padding: .5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0 1rem;
	justify-content: center;
	align-items: center;
}

/* widgets */

.center {
	text-align: center;
}

a {
	color: var(--text-lit);
	text-decoration: none;
}

.description a > svg {
	margin-left: .2rem;
	height: .75rem;
	vertical-align: 0;
}

hr {
	border: none;
	height: 1px;
	margin: 0;
	background: var(--division);
}

h1, h2 {
	color: var(--text-lit);
	font-weight: normal;
}

.error-sign {
	margin: 1rem 0;
}

.error-sign > svg {
	width: 100%;
	height: 100%;
	max-width: 10rem;
	max-height: 10rem;
}

.button, button, .collapsed > summary {
	color: var(--text);
	background-color: var(--widget-bg);
	display: inline-block;
	padding: .5rem 1.5rem;
	border-radius: 100vw;
	font-weight: bold;
	transition: .2s;
	box-sizing: border-box;
}

.button:hover, button:hover, .collapsed > summary:hover {
	color: var(--text-lit);
	background-color: var(--widget-bg-hovered);
}

.full-width {
	width: 100%;
}

button {
	cursor: pointer;
	border: none;
	font-size: 1rem;
}

input[type=text], textarea {
	width: 100%;
	color: var(--text);
	background-color: var(--widget-bg);
	padding: .5rem 1rem;
	border: none;
	border-radius: 100vw;
	box-sizing: border-box;
	transition: background-color .2s;
}

input[type=text]:hover, textarea:hover {
	background-color: var(--widget-bg-hovered);
}

input[type=text]:focus, textarea:focus {
	background-color: var(--widget-bg);
	outline: 2px solid var(--widget-bg-accent);
}

.collapsed {
	text-align: center;
}

.collapsed > summary {
	cursor: pointer;
	list-style: none;
	margin: 1rem 0;
}

.collapsed > summary::-webkit-details-marker {
	display: none;
}

.collapsed[open] > summary {
	display: none;
}

label[for] {
	cursor: pointer;
}

.switch {
	appearance: none;
	width: 4rem;
	height: 2rem;
	background-color: var(--widget-bg-hovered);
	border-radius: 100vw;
	cursor: pointer;
	margin: 0;
	transition: .2s;
}

.switch:hover {
	background-color: var(--widget-bg-selected);
}

.switch:checked {
	background-color: var(--widget-bg-accent);
}

.switch:checked:hover {
	background-color: var(--widget-bg-accent-hovered);
}

.switch::after {
	content: '';
	position: relative;
	display: block;
	width: 1.5rem;
	height: 1.5rem;
	top: .25rem;
	left: .25rem;
	border-radius: 100vw;
	background-color: var(--switch-ball);
	transition: 0.3s;
}

.switch:checked::after {
	left: calc(100% - 1.75rem);
}

select {
	color: var(--text-lit);
	background-color: var(--widget-bg);
	border: none;
	padding: 0 1rem;
	border-radius: 100vw;
	cursor: pointer;
	text-align: center;
	height: 2rem;
	transition: .2s;
	max-width: 12rem;
	text-overflow: ellipsis;
}

select:hover {
	background-color: var(--widget-bg-hovered);
}

option {
	background-color: var(--bg);
}

img {
	background-color: var(--img-unloaded-bg);
	color: var(--text);
}

svg {
	vertical-align: -.125rem;
}

.avatar {
	width: 3rem;
	height: 3rem;
	border-radius: 100vw;
	object-fit: cover;
	object-position: center top;
}

.img-with-text {
	display: flex;
	gap: 0 .5rem;
	align-items: center;
}

.paginator {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem .5rem;
	align-items: center;
	justify-content: center;
	line-height: 2.5rem;
}

.paginator > a {
	box-sizing: border-box;
	color: var(--text);
	background-color: var(--widget-bg);
	min-width: 2.5rem;
	text-align: center;
	padding: 0 .5rem;
	border-radius: 100vw;
	font-weight: bold;
	transition: .2s;
}

.paginator a:hover {
	color: var(--text-lit);
	background-color: var(--widget-bg-hovered);
}

.paginator a.selected {
	color: var(--text-lit);
	background-color: var(--widget-bg-selected);
	cursor: default;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, 10rem);
	gap: 1rem;
	text-align: left;
	justify-content: space-evenly;
}

@media (max-width: 45rem) {
	.grid {
		grid-template-columns: repeat(2, minmax(0px, 14rem));
	}
}

.collapsed > .grid {
	margin-top: 1rem;
}

.grid > div {
	display: flex;
	flex-direction: column;
	gap: .3rem;
}

.thumbnail {
	position: relative;
	aspect-ratio: 1;
	border-radius: .5rem;
	background-color: var(--img-unloaded-bg);
	overflow: hidden;
	transition: .2s;
}

.thumbnail:hover {
	opacity: .8;
}

.thumbnail .extra-info {
	position: absolute;
	box-sizing: border-box;
	width: 100%;
	padding: 4px;
	display: flex;
	gap: .25rem;
	font-size: .75rem;
	font-weight: bold;
	line-height: 1.25rem;
	color: var(--text-lit);
	pointer-events: none;
}

.thumbnail .content-warning {
	background-color: var(--thumbnail-cw-bg);
	padding: 0 .3rem;
	border-radius: .5rem;
}

.thumbnail .aigc {
	background-color: var(--thumbnail-indicator-bg);
	padding: 0 .5rem;
	border-radius: .5rem;
	backdrop-filter: blur(4px);
}

.thumbnail .page-count {
	margin-left: auto;
	background-color: var(--thumbnail-indicator-bg);
	padding: 0 .5rem;
	border-radius: 100vw;
	backdrop-filter: blur(4px);
}

.thumbnail svg {
	width: .75rem;
	height: .75rem;
	vertical-align: -.1rem;
}

.thumbnail img {
	background-color: transparent;
	width: 100%;
}

.thumbnail .hidden {
	width: 25%;
	height: 25%;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.thumbnail .hidden svg {
	width: 100%;
	height: 100%;
}

.grid .title, .grid .username {
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.grid .author {
	display: none;
	gap: 0 .3rem;
	align-items: center;
}

.grid.show-author .author {
	display: flex;
}

.grid .avatar {
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 100vw;
	object-fit: cover;
	object-position: center top;
}

.grid .username {
	color: var(--text);
}

.expand-checkbox {
	display: none;
}

.truncated {
	max-height: 8rem;
	overflow: hidden;
	mask-image: linear-gradient(white 25%, transparent 100%);
	-webkit-mask-image: linear-gradient(white 25%, transparent 100%);
}

.expand-checkbox:checked + .truncated {
	max-height: inherit;
	mask-image: none;
	-webkit-mask-image: none;
}

.expand-checkbox:checked ~ .center {
	display: none;
}

.expand-button {
	user-select: none;
	cursor: pointer;
	color: var(--accent);
	font-weight: bold;
}

/* /artworks */

.artwork-images {
	text-align: center;
}

.artwork-images a {
	display: block;
}

.artwork-images > a, .artwork-images details:open {
	background-color: var(--img-unloaded-bg);
}

.artwork-images summary {
	margin-bottom: 0;
}

.artwork-images img {
	background-color: transparent;
	display: inline-block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 95vh;
	vertical-align: bottom;
}

.artwork-images details img {
	margin-top: 1rem;
}

.artwork-video {
	text-align: center;
	background-color: var(--img-unloaded-bg);
}

.artwork-video video {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 95vh;
	vertical-align: bottom;
}

.artwork-info {
	max-width: 36rem;
	margin: 2rem auto;
}

.description {
	margin: 1rem 0;
}

.description a {
	color: var(--accent);
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin: 1rem 0;
}

.tags a {
	color: var(--text);
	background-color: var(--widget-bg);
	padding: .3rem .75rem;
	border-radius: 100vw;
	font-size: .9rem;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
	transition: .2s;
}

.tags a:hover {
	color: var(--text-lit);
	background-color: var(--widget-bg-hovered);
}

.tags a span {
	color: var(--accent);
}

.tags .warning {
	background-color: var(--widget-bg-warning);
	color: var(--text-lit);
}

.tags .warning:hover {
	background-color: var(--widget-bg-warning-hovered);
}

.stats {
	display: flex;
	flex-wrap: wrap;
	color: var(--text-dim);
	gap: .5rem 1rem;
	margin: 1rem 0;
}

.stats div {
	display: flex;
	gap: .5rem;
}

.comments {
	max-width: 36rem;
	margin: auto;
	padding: 1rem 0;
}

.comment {
	display: flex;
	gap: 0 .5rem;
	margin-bottom: 1rem;
}

.comment > :first-child {
	flex: 0 0 auto;
}

.comment > :last-child {
	flex: 1;
}

.comment-info a {
	font-weight: bold;
	vertical-align: middle;
	margin-right: .3rem;
}

.comment-content {
	margin: .3rem 0;
}

.comment .button {
	margin-left: -.5rem;
}

.emoji {
	width: 1.25rem;
	height: 1.25rem;
	vertical-align: -.25rem;
	margin: 0 .1rem;
	background-color: transparent;
}

.stamp {
	width: 6rem;
	height: 6rem;
	border-radius: .5rem;
}

.comment-view-replies {
	margin-left: 3rem;
}

/* /users */

.category-selector {
	width: 100%;
	display: flex;
}

.category-selector a {
	border-top: 2px solid var(--division);
	color: var(--text-dim);
	padding: 1rem .5rem;
	flex: 1 1 auto;
	text-align: center;
	font-weight: bold;
	transition: .2s;
}

.category-selector a:hover {
	color: var(--text);
}

.category-selector a.selected {
	border-top: 2px solid var(--accent);
	color: var(--text-lit);
}

.category-selector + h2 {
	margin-top: 0;
}

.frequent-tags {
	display: flex;
	gap: .5rem;
	margin: 1rem 0;
	overflow-x: scroll;
	scrollbar-width: thin;
	padding-bottom: .5rem;
}

.frequent-tags a {
	color: var(--text);
	background-color: var(--widget-bg);
	padding: .3rem 1rem;
	border-radius: .5rem;
	font-size: .9rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	transition: .2s;
}

.frequent-tags a:hover {
	color: var(--text-lit);
	background-color: var(--widget-bg-hovered);
}

.frequent-tags b {
	color: var(--accent);
}

/* /tags */

.tag-bar {
	margin: 1rem 0;
}

.tag-bar img {
	width: 5rem;
	height: 5rem;
	border-radius: .5rem;
	object-fit: cover;
	object-position: center top;
}

.tag-bar h1, .tag-bar p {
	margin: 0;
}

/* /settings */

.options > div {
	margin: 1rem 0;
	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
}

.options > div :last-child {
	flex-shrink: 0;
}

/* /about */

.license pre {
	font-size: 1rem;
	margin: 1rem 0;
	max-height: 20rem;
	white-space: pre-wrap;
	overflow-y: scroll;
}

.third-party h3 {
	margin-bottom: .5rem;
}

.third-party ul {
	margin-top: 0;
	padding-left: 1rem;
}

.third-party li {
	list-style: none;
	display: flex;
	gap: .25rem;
}

.third-party a {
	color: var(--accent);
}
