/* The gallery page, gallery.html */
.gallery {
	max-width: 1100px;
	margin: 20px auto;
	padding: 0 16px;
	font-family: Arial, Helvetica, sans-serif;
	color: #222;
}

.galleryNotice:empty, .galleryStatus:empty {
	display: none;
}

.galleryNotice {
	padding: 8px 12px;
	border: 1px solid #7fa7ff;
	border-radius: 4px;
	background: #eef3ff;
}

.galleryControls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 16px 0;
}

#gallerySearch {
	flex: 1 1 220px;
	max-width: 400px;
	padding: 0.4em 0.5em;
	font-size: 16px;
}

#gallerySort {
	font-size: 16px;
}

/* The cards: a picture, a name, and who shared it when */
.galleryDrawings {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 16px;
}

/* hidden has to win over the display given here */
.gallery .button[hidden] {
	display: none;
}

.drawingCard {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	padding: 8px 8px 10px;
	border: 1px solid #e2e2e2;
	border-radius: 6px;
	background: #fff;
	color: inherit;
	text-decoration: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.drawingCard:hover, .drawingCard:focus-visible {
	border-color: #c5c5c5;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
	outline: none;
}

.drawingCard.owned {
	border-color: #7fa7ff;
}

.drawingCard img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	margin-bottom: 6px;
	border-radius: 3px;
	background: #fafafa;
}

.drawingName {
	font-weight: bold;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.drawingByline {
	font-size: 0.85em;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.drawingByline:empty {
	display: none;
}

.drawingOwned {
	position: absolute;
	top: 14px;
	right: 14px;
	padding: 2px 8px;
	border-radius: 10px;
	background: #2a5bd7;
	color: #fff;
	font-size: 0.75em;
}

.galleryMore {
	margin: 16px 0;
}

/* A drawing's window */
.drawingDialog {
	width: 760px;
	color: #222;
	border: 0;
	border-radius: 8px;
}

.drawingDialog::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

.drawingDialogHeader {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px 0 20px;
}

.drawingDialogHeader h2 {
	margin: 4px 0 0;
	font-size: 1.35em;
	overflow-wrap: anywhere;
}

.drawingDialogBody {
	display: flex;
	gap: 20px;
	padding: 14px 20px 20px;
	overflow: auto;
	max-height: calc(100vh - 90px);
	box-sizing: border-box;
}

.drawingPicture {
	flex: 0 0 min(340px, 45%);
}

.drawingPicture img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	border: 1px solid #eee;
	border-radius: 4px;
	background: #fafafa;
}

.drawingInfo {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	min-width: 0;
}

.drawingInfo .galleryNotice {
	margin: 0;
}

.drawingFacts {
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: #555;
	overflow-wrap: anywhere;
}

.drawingDescription {
	margin: 0;
	white-space: pre-line;
	overflow-wrap: anywhere;
}

.button.primary {
	border-color: #2a5bd7;
	background: #2a5bd7;
	color: #fff;
}

.button.primary:hover, .button.primary:focus {
	border-color: #1f48b0;
	background: #1f48b0;
	color: #fff;
}

.drawingDownloads, .drawingOwner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.drawingLabel {
	margin-right: 4px;
	color: #555;
}

.drawingOwner {
	gap: 10px;
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid #eee;
	align-self: stretch;
	font-size: 0.9em;
	color: #2a5bd7;
}

.drawingOwner .button {
	margin-left: auto;
}

@media only screen and (max-width: 600px) {
	.galleryDrawings {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.drawingDialogBody {
		flex-direction: column;
	}

	.drawingPicture {
		flex: none;
		align-self: center;
		width: min(100%, 320px);
	}

	.drawingLabel {
		flex-basis: 100%;
	}
}
