/* =========================================
 *  TASTE GARDEN — Recipe modal
 * ========================================= */

/* Button-as-card reset (recipe-card is now a <button>). */
button.recipe-card {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	width: 100%;
	display: block;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

button.recipe-card:focus-visible {
	outline: 2px solid #C9A86A;
	outline-offset: 4px;
	border-radius: 4px;
}

/* The <template> elements must never render visually, even with stray CSS. */
.recipe-card .tg-modal-template {
	display: none !important;
}

/* ----- Modal shell ----- */
.tg-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 4vw, 60px);
	background: rgba(0, 0, 0, .55);
	opacity: 0;
	transition: opacity .25s ease;
	-webkit-overflow-scrolling: touch;
}

.tg-modal.is-open {
	display: flex;
	opacity: 1;
}

.tg-modal__panel {
	position: relative;
	width: 100%;
	max-width: 880px;
	max-height: calc(100dvh - 80px);
	overflow-y: auto;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
	transform: translateY(20px) scale(.97);
	transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}

.tg-modal.is-open .tg-modal__panel {
	transform: translateY(0) scale(1);
}

.tg-modal__close {
	position: sticky;
	top: 12px;
	float: right;
	margin: 12px 12px 0 0;
	width: 44px;
	height: 44px;
	border: 0;
	background: rgba(255, 255, 255, .95);
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
	z-index: 5;
	transition: background .2s, transform .2s;
}

.tg-modal__close:hover {
	background: #fff;
	transform: scale(1.05);
}

.tg-modal__close::before,
.tg-modal__close::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 2px;
	background: #111;
	border-radius: 1px;
	transform-origin: center;
}

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

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

.tg-modal__close-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
}

/* ----- Modal content blocks ----- */
.tg-modal__media {
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f4f1ea;
}

.tg-modal__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tg-modal__body {
	padding: clamp(24px, 4vw, 40px) clamp(20px, 5vw, 56px) clamp(40px, 6vw, 60px);
}

.tg-modal__title {
	font-family: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', sans-serif;
	font-size: clamp(20px, 2.6vw, 28px);
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1.5;
	margin: 0 0 24px;
	color: #111;
}

.tg-modal__ingredients {
	background: #faf8f3;
	border-left: 3px solid #C9A86A;
	padding: 16px 18px;
	margin: 0 0 28px;
	border-radius: 0 4px 4px 0;
}

.tg-modal__ingredients-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .14em;
	color: #C9A86A;
	text-transform: uppercase;
	margin-bottom: 6px;
}

.tg-modal__ingredients-value {
	display: block;
	font-size: 13px;
	line-height: 1.85;
	color: #333;
}

.tg-modal__content {
	font-size: 15px;
	line-height: 1.95;
	color: #333;
}

.tg-modal__content p {
	margin: 0 0 1em;
}

.tg-modal__content p:last-child {
	margin-bottom: 0;
}

.tg-modal__footer {
	margin-top: 32px;
	text-align: center;
}

/* Lock body scroll while modal is open. */
body.tg-modal-open {
	overflow: hidden;
}

/* Mobile tweaks */
@media (max-width: 600px) {
	.tg-modal {
		padding: 0;
	}
	.tg-modal__panel {
		max-height: 100dvh;
		max-width: 100%;
		border-radius: 0;
	}
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.tg-modal,
	.tg-modal__panel,
	.tg-modal__close {
		transition: none;
	}
}
