.gallery-app,
.gallery-app * {
	box-sizing: border-box;
}

.gallery-status {
	margin: 0 0 16px;
	color: #555;
	font-size: 15px;
}

.gallery-status:empty {
	display: none;
}

.gallery-status--error {
	color: #b00020;
}

.gallery-back {
	margin: 0 0 16px;
}

.gallery-back:empty {
	display: none;
}

.gallery-back__button,
.gallery-card,
.gallery-modal__close {
	border: 0;
	font: inherit;
	cursor: pointer;
}

.gallery-back__button {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 8px 16px;
	border-radius: 6px;
	background: #576269;
	color: #fff;
}

.gallery-back__button:hover {
	background: #992211;
}


.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 16px;
}

.gallery-card {
	position: relative;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 12px;
	overflow: hidden;
	border-radius: 8px;
	background-color: #f1f4f8;
	background-position: center 38%;
	background-repeat: no-repeat;
	background-size: 54%;
	color: #1f2933;
	text-align: center;
	text-decoration: none;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
	transition: transform .15s ease, box-shadow .15s ease;
}

.gallery-card:hover,
.gallery-card:focus {
	transform: translateY(-2px);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 8px 18px rgba(0, 0, 0, .12);
	outline: none;
}

.gallery-card--dir {
	background-image: url("../images/gallery-folder.png");
}

.gallery-card--file {
	background-image: url("../images/gallery-file.png");
}

.gallery-card--image {
	background-image: url("../images/gallery-image-file.png");
}

.gallery-card--video {
	background-image: url("../images/gallery-video-file.png");
}

.gallery-card--has-thumb {
	background-size: cover;
}

.gallery-card--has-thumb::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .65) 100%);
}

.gallery-card__title {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	min-width: 0;
	/* min-height: 46px; */
	padding: 6px 8px;
	overflow: hidden;
	border-radius: 5px;
	background: rgba(255, 255, 255, .88);
	color: #1f2933;
	font-size: 14px;
	line-height: 1.2;
}

.gallery-card__title-text {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	text-overflow: ellipsis;
}

.gallery-card--has-thumb .gallery-card__title {
	background: rgba(0, 0, 0, .58);
	color: #fff;
}

.gallery-modal[hidden] {
	display: none;
}

.gallery-modal {
	position: fixed;
	z-index: 9999;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.gallery-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .78);
}

.gallery-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: min(1100px, 96vw);
	max-height: 92vh;
}

.gallery-modal__close {
	position: absolute;
	padding: 0;
	top: 2px;
	right: 3px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	background: #fff;
	color: #576269;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .24);
	transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.gallery-modal__close::before,
.gallery-modal__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: background .2s ease;
}

.gallery-modal__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.gallery-modal__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.gallery-modal__close:hover,
.gallery-modal__close:focus {
	background: #f3f6fa;
	transform: scale(1.04);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
	outline: none;
}

.gallery-modal__close:hover {
	color: #992211;
}

.gallery-modal__media {
	display: block;
	max-width: 100%;
	max-height: 82vh;
	border-radius: 6px;
	background: #000;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

.gallery-modal__media[hidden] {
	display: none;
}

.gallery-modal__link {
	margin-top: 12px;
	color: #fff;
	text-decoration: underline;
}

.gallery-modal-open {
	overflow: hidden;
}

@media (max-width: 640px) {
	.gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.gallery-card__title {
		font-size: 12px;
	}
}
