* {
	box-sizing: border-box;
}

:root {
	--bg: #e8dfd6;
	--ink: #3f372f;
	--pad: clamp(10px, 2.2vw, 24px);
}

body {
	margin: 0;
	background: var(--bg);
	font-family: 'Georgia', serif;
}

/* Сцена: центрируем и даём безопасные отступы */
.stage {
	min-height: 100svh;
	display: grid;
	place-items: center;
	padding: var(--pad);
}

/* Открытка: всегда влезает в экран и сохраняет пропорции */
.card {
	position: relative;

	/* Формат A6: 105 × 148 мм */
	width: min(
		calc(100vw - (var(--pad) * 2)),
		calc((100svh - (var(--pad) * 2)) * 105 / 148)
	);
	height: calc(width * 148 / 105);

	/* Надежный вариант через aspect-ratio */
	aspect-ratio: 105 / 148;

	/* Не даем вылезать за экран */
	max-width: calc(100vw - (var(--pad) * 2));
	max-height: calc(100svh - (var(--pad) * 2));

	margin: 0 auto;
	background: url('img/invitetwo.png') center/cover no-repeat;

	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
	border-radius: clamp(10px, 1.2vw, 18px);
	overflow: hidden;
}

/* Фолбэк для старых браузеров без aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
	.card {
		width: min(100%, 1600px);
		height: auto;
	}
	.card::before {
		content: '';
		display: block;
		padding-top: 150%; /* 2400/1600 = 1.5 */
	}
}

/* ===== ШТОРКА ===== */
.curtain {
	position: absolute;
	inset: 0;
	display: flex;
	z-index: 5;
	pointer-events: none;
}

.panel {
	flex: 1;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.08)),
		linear-gradient(90deg, #e7dccf, #d9cbbd);
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
	transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: transform;
}

.left {
	transform: translateX(0);
}
.right {
	transform: translateX(0);
}

body.open .left {
	transform: translateX(-100%);
}
body.open .right {
	transform: translateX(100%);
}

/* ===== ТЕКСТ ПО ЦЕНТРУ (адаптивно, без налезаний) ===== */
.overlay-text {
	position: absolute;
	inset: 0;
	pointer-events: none;
	color: var(--ink);

	/* Центрируем весь блок */
	display: grid;
	place-items: center;
	padding: clamp(16px, 3vw, 42px);
}

.stack {
	width: min(92%, 1100px);
	display: flex;
	flex-direction: column;
	align-items: center;
	font-weight: 500;
	/* расстояние между строками */
	gap: clamp(10px, 1.6vw, 18px);

	/* можно чуть приподнять выше/ниже центра */
	transform: translateY(-30%);
}

.line {
	margin: 0;
	text-align: center;
	max-width: 100%;

	/* линия под текстом */
	padding-bottom: clamp(4px, 0.6vw, 10px);
	border-bottom: clamp(2px, 0.35vw, 4px) solid var(--underline);
}

/* Шрифты */
.names {
	font-size: clamp(26px, 3.6vw, 28px);
}

.names:first-child {
	font-size: clamp(26px, 4vw, 40px);
}

.date {
	font-size: clamp(14px, 1.4vw, 1.8vw);
}

.place {
	font-size: clamp(14px, 1.3vw, 1.7vw);
}

/* Адаптив только для центрального текста */
@media (max-width: 600px) {
	.overlay-text {
		padding: 20px;
	}

	.stack {
		width: 86%;
		gap: 7px;
		transform: translateY(-28%);
	}

	.names {
		font-size: 18px;
		line-height: 1.1;
	}

	.names:first-child {
		font-size: 20px;
	}

	.place {
		font-size: 12px;
		line-height: 1.2;
	}
}

@media (max-width: 430px) {
	.stack {
		width: 84%;
		gap: 6px;
		transform: translateY(-26%);
	}

	.names {
		font-size: 17px;
		line-height: 1.08;
	}

	.names:first-child {
		font-size: 19px;
	}

	.place {
		font-size: 11px;
		line-height: 1.18;
	}
}

@media (max-width: 360px) {
	.overlay-text {
		padding: 14px;
	}

	.stack {
		width: 86%;
		gap: 5px;
		transform: translateY(-24%);
	}

	.names {
		font-size: 16px;
	}

	.names:first-child {
		font-size: 18px;
	}

	.place {
		font-size: 10.5px;
	}
}

.original {
	font-weight: 700;
	color: var(--ink);
}

/* Уважаем настройки “меньше анимаций” */
@media (prefers-reduced-motion: reduce) {
	.panel {
		transition: none;
	}
}

.event-info {
	position: absolute;
	left: clamp(14px, 2.6vw, 38px);
	bottom: clamp(14px, 2.6vw, 38px);
	z-index: 4; /* под шторкой (у шторки 5), но над фоном */
	color: var(--ink);
	text-align: left;
	max-width: min(49%, 520px);
	display: flex;
	flex-direction: column;
	gap: clamp(4px, 0.6vw, 8px);
}

.event-info {
	pointer-events: none;
}

.event-info a {
	pointer-events: auto;
}

.event-date {
	margin: 0;
	font-size: clamp(12px, 1vw, 20px);
	font-weight: 600;
	letter-spacing: 0.02em;
}

.event-place {
	margin: 0;
	font-size: clamp(12px, 1vw, 20px);
	opacity: 0.85;
	font-weight: 600;
	line-height: 1.2;
}

/* строки центра */
.line {
	opacity: 0;
	transform: translateY(12px);
	transition:
		opacity 0.6s ease,
		transform 0.6s ease;
}

body.open .line:nth-child(1) {
	opacity: 1;
	transform: none;
	transition-delay: 0.55s;
}
body.open .line:nth-child(2) {
	opacity: 1;
	transform: none;
	transition-delay: 0.7s;
}
body.open .line:nth-child(3) {
	opacity: 1;
	transform: none;
	transition-delay: 0.85s;
}
body.open .line:nth-child(4) {
	opacity: 1;
	transform: none;
	transition-delay: 1s;
}

.event-info p {
	opacity: 0;
	transform: translateY(12px);
	transition:
		opacity 0.6s ease,
		transform 0.6s ease;
}

/* дата после основного текста */
body.open .event-date {
	opacity: 1;
	transform: none;
	transition-delay: 1.15s;
}

/* место после даты */
body.open .event-place {
	opacity: 1;
	transform: none;
	transition-delay: 1.3s;
}

.event-place a {
	color: inherit;
	text-decoration: none;
	/* border-bottom: 1px solid rgba(0, 0, 0, 0.25); */
	transition:
		opacity 0.25s ease,
		border-color 0.25s ease;
}

.event-place a:hover {
	opacity: 0.7;
	border-color: transparent;
}
