/**
 * Страница «Галерея»: сетка разделов и лайтбокс.
 *
 * @package HotelBenedict
 */

.hb-gal {
	padding-bottom: clamp(40px, 6vw, 96px);
}

.hb-gal__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: clamp(12px, 1.6vw, 22px);
	margin-top: clamp(16px, 2.5vw, 32px);
}

.hb-gal__tile {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 3px;
	overflow: hidden;
	background: var(--hb-ink);
	color: var(--hb-white);
	font: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.hb-gal__shot {
	position: absolute;
	inset: 0;
	display: block;
}

.hb-gal__shot img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.hb-gal__tile:hover .hb-gal__shot img,
.hb-gal__tile:focus-visible .hb-gal__shot img {
	transform: scale(1.06);
}

.hb-gal__tile:focus-visible {
	outline: 2px solid var(--hb-gold);
	outline-offset: 3px;
}

.hb-gal__label {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: clamp(14px, 2vw, 22px);
	background: linear-gradient(to top, rgba(20, 20, 22, 0.86), rgba(20, 20, 22, 0));
}

.hb-gal__name {
	font-family: var(--hb-font-head);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hb-gal__count {
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--hb-sand);
}

/* ---------------------------------------------------------------
 * Лайтбокс
 * --------------------------------------------------------------- */

.hb-gal-lb {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(12px, 3vw, 48px);
	background: rgba(16, 16, 18, 0.95);
}

.hb-gal-lb[hidden] {
	display: none;
}

.hb-gal-lb__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	margin: 0;
	max-width: min(1400px, 100%);
	max-height: 100%;
}

.hb-gal-lb__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 140px);
	object-fit: contain;
	background: rgba(255, 255, 255, 0.04);
}

.hb-gal-lb__caption {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 14px;
	font-family: var(--hb-font-head);
	font-size: 0.82rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hb-white);
}

.hb-gal-lb__counter {
	color: var(--hb-sand);
}

.hb-gal-lb__btn {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.24);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.06);
	color: var(--hb-white);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.25s ease, border-color 0.25s ease;
}

.hb-gal-lb__btn:hover,
.hb-gal-lb__btn:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.5);
	outline: none;
}

.hb-gal-lb__btn--close {
	top: clamp(10px, 2vw, 24px);
	right: clamp(10px, 2vw, 24px);
	font-size: 2rem;
}

.hb-gal-lb__btn--prev {
	left: clamp(6px, 2vw, 28px);
	top: 50%;
	transform: translateY(-50%);
}

.hb-gal-lb__btn--next {
	right: clamp(6px, 2vw, 28px);
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 640px) {
	.hb-gal__grid {
		grid-template-columns: 1fr;
	}

	.hb-gal__name {
		font-size: 0.92rem;
	}

	.hb-gal-lb {
		padding: 8px;
	}

	.hb-gal-lb__img {
		max-height: calc(100vh - 160px);
	}

	.hb-gal-lb__btn {
		width: 40px;
		height: 40px;
		font-size: 1.35rem;
	}

	.hb-gal-lb__btn--prev {
		left: 4px;
	}

	.hb-gal-lb__btn--next {
		right: 4px;
	}
}

/* ---------------------------------------------------------------
 * Вводный текст — лид страницы
 * --------------------------------------------------------------- */

.hb-gal__intro {
	max-width: 760px;
	margin: 0 auto clamp(28px, 5vw, 56px);
	text-align: center;
}

.hb-gal__intro > *,
.hb-gal__intro .entry-content > * {
	margin: 0;
}

.hb-gal__intro p,
.hb-gal__intro .entry-content p {
	font-family: var(--hb-font-serif);
	font-size: clamp(1.15rem, 1.9vw, 1.55rem);
	font-weight: 500;
	line-height: 1.6;
	color: var(--hb-ink);
}

.hb-gal__intro::after {
	content: "";
	display: block;
	width: 76px;
	height: 2px;
	margin: clamp(18px, 2.6vw, 30px) auto 0;
	background: var(--hb-gold);
}

/* ---------------------------------------------------------------
 * Блоки страницы
 * --------------------------------------------------------------- */

.hb-gal__groups {
	display: flex;
	flex-direction: column;
	gap: clamp(44px, 6vw, 88px);
}

.hb-gal__group-head {
	max-width: 640px;
	margin: 0 0 clamp(18px, 2.4vw, 30px);
}

.hb-gal__group-head--center {
	margin-inline: auto;
	text-align: center;
}

.hb-gal__group-head--right {
	margin-left: auto;
	margin-right: 0;
	text-align: right;
}

.hb-gal__group-index {
	margin: 0 0 4px;
	font-family: var(--hb-font-head);
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.32em;
	color: var(--hb-gold);
}

.hb-gal__group-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px clamp(10px, 1.4vw, 18px);
	margin: 0;
	font-family: var(--hb-font-serif);
	font-size: clamp(1.7rem, 3vw, 2.5rem);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: 0.01em;
	color: var(--hb-ink);
}

/* Логотип в заголовке блока (ZIAMO у ресторана) */
.hb-gal__group-logo {
	display: block;
	width: auto;
	height: clamp(18px, 2.1vw, 26px);
	max-width: 60vw;
	object-fit: contain;
}

.hb-gal__group-note {
	max-width: 56ch;
	margin: 8px 0 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: rgba(46, 46, 48, 0.62);
}

.hb-gal__group-head--center .hb-gal__group-note {
	margin-inline: auto;
}

/* Золотая черта у шапки блока с выравниванием по левому краю */
.hb-gal__group-head--left::after {
	content: "";
	display: block;
	width: 40px;
	height: 1px;
	margin-top: clamp(14px, 1.8vw, 20px);
	background: var(--hb-gold);
}

/* Значок «открыть» на плитке */
.hb-gal__zoom {
	position: absolute;
	top: 12px;
	right: 12px;
	display: block;
	width: 30px;
	height: 30px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.3s ease;
	background:
		linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)) center / 12px 1px no-repeat,
		linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)) center / 1px 12px no-repeat;
}

.hb-gal__tile:hover .hb-gal__zoom,
.hb-gal__tile:focus-visible .hb-gal__zoom {
	opacity: 1;
}

/* ---------------------------------------------------------------
 * Раскладка «мозаика» — крупная первая плитка (Номера)
 * Высота плиток задаётся строками сетки, поэтому aspect-ratio не нужен.
 * --------------------------------------------------------------- */

.hb-gal__grid--mosaic {
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: clamp(132px, 14vw, 200px);
	gap: clamp(12px, 1.4vw, 20px);
	margin-top: 0;
}

.hb-gal__grid--mosaic .hb-gal__tile {
	aspect-ratio: auto;
}

.hb-gal__grid--mosaic .hb-gal__tile:first-child {
	grid-column: span 2;
	grid-row: span 2;
}

.hb-gal__grid--mosaic .hb-gal__tile:last-child {
	grid-column: span 2;
}

.hb-gal__grid--mosaic .hb-gal__tile:first-child .hb-gal__name {
	font-size: clamp(1.05rem, 1.7vw, 1.4rem);
	letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------
 * Раскладка «портрет» — вертикальные плитки ступенькой (Ресторан)
 * --------------------------------------------------------------- */

.hb-gal__grid--portrait {
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(14px, 1.8vw, 26px);
	margin-top: 0;
	align-items: start;
}

.hb-gal__grid--portrait .hb-gal__tile {
	aspect-ratio: 3 / 4;
}

.hb-gal__grid--portrait .hb-gal__tile:nth-child(3n + 2) {
	margin-top: clamp(18px, 3.2vw, 46px);
}

.hb-gal__grid--portrait .hb-gal__name {
	font-size: 1.02rem;
	letter-spacing: 0.08em;
}

/* ---------------------------------------------------------------
 * Раскладка «асимметрия» — широкие и квадратные плитки (Мероприятия)
 * --------------------------------------------------------------- */

.hb-gal__grid--asym {
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: clamp(118px, 12.5vw, 180px);
	gap: clamp(12px, 1.4vw, 20px);
	margin-top: 0;
}

.hb-gal__grid--asym .hb-gal__tile {
	aspect-ratio: auto;
}

.hb-gal__grid--asym .hb-gal__tile:first-child {
	grid-column: span 2;
	grid-row: span 2;
}

.hb-gal__grid--asym .hb-gal__tile::after {
	content: "";
	position: absolute;
	inset: 10px;
	border: 1px solid rgba(224, 213, 188, 0.38);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.hb-gal__grid--asym .hb-gal__tile:hover::after,
.hb-gal__grid--asym .hb-gal__tile:focus-visible::after {
	opacity: 1;
}

/* ---------------------------------------------------------------
 * Раскладка «подпись под фото» — светлые карточки (Отель и территория)
 * --------------------------------------------------------------- */

.hb-gal__grid--caption {
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(16px, 2.2vw, 30px);
	margin-top: 0;
}

.hb-gal__grid--caption .hb-gal__tile {
	display: flex;
	flex-direction: column;
	aspect-ratio: auto;
	overflow: visible;
	border-radius: 0;
	background: transparent;
	color: var(--hb-ink);
}

.hb-gal__grid--caption .hb-gal__shot {
	position: relative;
	inset: auto;
	display: block;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	border-radius: 3px;
	background: var(--hb-ink);
}

.hb-gal__grid--caption .hb-gal__zoom {
	border-color: rgba(255, 255, 255, 0.6);
}

.hb-gal__grid--caption .hb-gal__label {
	position: static;
	inset: auto;
	margin-top: 12px;
	padding: 12px 0 0;
	background: none;
	border-top: 1px solid var(--hb-line);
}

.hb-gal__grid--caption .hb-gal__name {
	color: var(--hb-ink);
	font-size: 0.95rem;
	letter-spacing: 0.06em;
}

.hb-gal__grid--caption .hb-gal__count {
	color: var(--hb-gold);
}

/* ---------------------------------------------------------------
 * Адаптивность блоков
 * --------------------------------------------------------------- */

@media (max-width: 960px) {
	.hb-gal__grid--portrait {
		grid-template-columns: repeat(2, 1fr);
	}

	.hb-gal__grid--portrait .hb-gal__tile:nth-child(3n + 2) {
		margin-top: 0;
	}

	.hb-gal__grid--mosaic {
		grid-auto-rows: clamp(110px, 20vw, 180px);
	}

	.hb-gal__grid--asym {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: clamp(110px, 20vw, 170px);
	}

	.hb-gal__grid--caption {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.hb-gal__groups {
		gap: 36px;
	}

	.hb-gal__group-head,
	.hb-gal__group-head--center,
	.hb-gal__group-head--right {
		max-width: none;
		margin-inline: 0;
		text-align: left;
	}

	.hb-gal__grid--mosaic,
	.hb-gal__grid--portrait,
	.hb-gal__grid--asym,
	.hb-gal__grid--caption {
		grid-template-columns: 1fr;
		grid-auto-rows: auto;
	}

	.hb-gal__grid--mosaic .hb-gal__tile,
	.hb-gal__grid--mosaic .hb-gal__tile:first-child,
	.hb-gal__grid--mosaic .hb-gal__tile:last-child,
	.hb-gal__grid--portrait .hb-gal__tile,
	.hb-gal__grid--asym .hb-gal__tile,
	.hb-gal__grid--asym .hb-gal__tile:first-child {
		grid-column: auto;
		grid-row: auto;
		margin-top: 0;
		aspect-ratio: 4 / 3;
	}
}

/* ---------------------------------------------------------------
 * Страница «Галерея»: контент из редактора
 * --------------------------------------------------------------- */

.hb-gal__content > .hb-gal__group {
	margin-bottom: clamp(44px, 6vw, 88px);
}

.hb-gal__content > .hb-gal__group:last-child {
	margin-bottom: 0;
}

.hb-gal__group-head > *:last-child {
	margin-bottom: 0;
}

/* Логотип внутри заголовка блока (ZIAMO): картинка стоит в строке с текстом. */
.hb-gal__group-title img,
h2 .hb-gal__group-logo {
	display: inline-block;
	width: auto;
	height: clamp(18px, 2.1vw, 26px);
	max-width: 60vw;
	object-fit: contain;
}

.hb-gal__grid {
	margin-bottom: 0;
}
