/* ==========================================================================
   Заједнички модал (рецепти, гранични прелази) — учитава се само на насловној.
   ========================================================================== */

html.sz-modal-open,
html.sz-modal-open body {
	overflow: hidden;
}

.sz-modal {
	width: min(100% - 2 * var(--gutter), 720px);
	max-width: none;
	max-height: min(100% - 2 * var(--gutter), 900px);
	margin: auto;
	padding: 0;
	border: 0;
	border-top: 4px solid var(--dawn);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
	box-shadow: 0 20px 60px rgba(11, 26, 48, 0.35);
	overflow: hidden;
}

.sz-modal::backdrop {
	background: rgba(11, 26, 48, 0.6);
}

.sz-modal[open] {
	display: flex;
	flex-direction: column;
	animation: sz-modal-in 0.18s ease-out;
}

@keyframes sz-modal-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.sz-modal[open] {
		animation: none;
	}
}

.sz-modal__box {
	position: relative;
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	max-height: 100%;
}

.sz-modal__head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	flex: none;
	/* Мјесто за X десно. */
	padding: 16px 68px 12px 20px;
	border-bottom: 1px solid var(--line);
}

.sz-modal__title {
	flex: 1;
	margin: 0;
	font-size: clamp(1.25rem, 2.6vw, 1.625rem);
	font-weight: 800;
	line-height: 1.2;
}

/* Наслов добија фокус програмски (читачи екрана га прочитају први); оквир није потребан. */
.sz-modal__title:focus {
	outline: none;
}

.sz-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 5;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--brand);
	color: #fff;
	font-size: 1.75rem;
	line-height: 1;
	box-shadow: 0 2px 8px rgba(11, 26, 48, 0.35);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.sz-modal__close:hover,
.sz-modal__close:focus-visible {
	background: var(--brand-dark);
}

.sz-modal__close:focus-visible {
	outline: 3px solid var(--dawn);
	outline-offset: 2px;
}

/* Скролује се само садржај, не цијели дијалог. */
.sz-modal__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 16px 20px 24px;
	/* Резервисан простор док стиже одговор, да оквир не скаче. */
	min-height: 160px;
}

.sz-modal__status {
	margin: 24px 0;
	font-family: var(--sans);
	color: var(--muted);
}

.sz-modal__meta {
	margin: 0 0 14px;
	font-family: var(--sans);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--muted);
	text-transform: uppercase;
}

.sz-modal__figure {
	margin: 0 0 16px;
}

.sz-modal__figure img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: var(--paper-warm);
}

.sz-modal__figure figcaption {
	margin-top: 6px;
	font-family: var(--sans);
	font-size: 0.75rem;
	color: var(--muted);
}

.sz-modal__body .sz-ocjena {
	margin: -6px 0 14px;
}

.sz-modal__lead {
	margin: 0 0 16px;
	font-size: 1.0625rem;
	color: var(--ink-2);
}

.sz-modal__subtitle {
	margin: 20px 0 8px;
	font-family: var(--sans);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--brand);
}

.sz-modal__content > :first-child {
	margin-top: 0;
}

.sz-modal__more {
	margin: 24px 0 0;
}

.sz-modal__button {
	display: inline-block;
	padding: 10px 18px;
	background: var(--brand);
	color: #fff;
	font-family: var(--sans);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	border-radius: var(--radius);
}

.sz-modal__button:hover,
.sz-modal__button:focus-visible {
	background: var(--brand-dark);
	color: #fff;
}

/* Гранични прелази: линкови */
.prelaz-links {
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--sans);
}

.prelaz-links li + li {
	border-top: 1px solid var(--line);
}

.prelaz-links li > a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 2px;
	color: var(--ink);
	text-decoration: none;
}

.prelaz-links li > a:hover span,
.prelaz-links li > a:focus-visible span {
	text-decoration: underline;
}

.prelaz-links svg {
	flex: none;
	color: var(--brand);
}

.prelaz-links li > a::after {
	content: "↗";
	margin-left: auto;
	color: var(--muted);
}

/* Камера као слика у модалу; простор 16:9 је резервисан док се слика учитава. */
.prelaz-links .prelaz-cam {
	padding: 6px 0 12px;
}

.prelaz-cam__figure {
	margin: 0;
}

.prelaz-cam__figure img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: contain;
	background: var(--paper-warm);
}

.prelaz-cam__figure figcaption {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 6px;
	font-size: 0.875rem;
}

.prelaz-cam__figure figcaption a {
	flex: none;
	color: var(--muted);
}

.prelaz-cam__figure figcaption a::after {
	content: " ↗";
}

.prelaz-cam__error {
	display: block;
	padding: 0 0 10px 30px;
	font-size: 0.8125rem;
	color: var(--muted);
}

/* Доње дугме „Затвори“ — само на мобилном. */
.sz-modal__footer {
	display: none;
}

.sz-modal__footer-close {
	width: 100%;
	min-height: 48px;
	border: 2px solid var(--brand);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--brand);
	font-family: var(--sans);
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
}

/* Коментар: форма има своје дугме, „Затвори“ у подножју не треба. */
.sz-modal--comment .sz-modal__footer {
	display: none;
}

.sz-modal--comment .sz-modal__body {
	padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.sz-modal--comment .sz-modal__button {
	border: 0;
	cursor: pointer;
}

/* --------------------------------------------------------------------------
   Мобилни (до 768 px): модал преко цијелог видљивог екрана (100dvh), X увијек у горњем десном углу.
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
	.sz-modal {
		width: 100%;
		max-width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		margin: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.sz-modal__box {
		height: 100%;
	}

	.sz-modal__head {
		padding: max(14px, env(safe-area-inset-top)) 72px 10px max(16px, env(safe-area-inset-left));
	}

	.sz-modal__close {
		position: fixed;
		top: max(12px, env(safe-area-inset-top));
		right: max(12px, env(safe-area-inset-right));
	}

	.sz-modal__body {
		padding: 14px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
	}

	.sz-modal__footer {
		display: block;
		padding: 20px 0 max(20px, env(safe-area-inset-bottom));
	}
}
