/*
 * News story modal — front end only (not an editor style).
 * Each card holds the full post content (hidden); assets/js/news-stories.js
 * shows it in a modal.
 */

/* stretch the Read more link over the whole card (one link, one tab stop);
   front end only so the cards stay selectable in the Site Editor */
.rceft-news-card a.rceft-news-card__more::after,
.rceft-news-teaser .rceft-news-teaser__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Story modal */
html.has-open-dialog {
	overflow: hidden;
}

.rceft-story-dialog {
	width: min(1200px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100dvh - 32px);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 24px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	overflow: hidden;
}

.rceft-story-dialog[open] {
	display: flex;
	animation: rceft-dialog-in 0.25s ease;
}

.rceft-story-dialog::backdrop {
	background: rgba(60, 58, 52, 0.72);
}

@keyframes rceft-dialog-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

.rceft-story-dialog__card {
	position: relative;
	width: 100%;
	overflow-y: auto;
}

.rceft-story-dialog__close {
	position: absolute;
	z-index: 1;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(238, 235, 227, 0.92);
	cursor: pointer;
}

.rceft-story-dialog__close::before,
.rceft-story-dialog__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 2px;
	background: var(--wp--preset--color--contrast);
	transform: translate(-50%, -50%) rotate(45deg);
}

.rceft-story-dialog__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.rceft-story-dialog__close:focus-visible {
	outline: 2px solid var(--wp--preset--color--secondary-deep);
	outline-offset: 2px;
}

.rceft-story-dialog__photo img {
	display: block;
	width: 100%;
	max-height: 62vh;
	object-fit: cover;
}

.rceft-story-dialog__body {
	padding: clamp(24px, 3vw, 48px) clamp(20px, 4vw, 64px) clamp(32px, 4vw, 64px);
}

/* Title and story share one readable column, centred under the photo */
.rceft-story-dialog__title,
.rceft-story-dialog__story {
	max-width: 760px;
	margin-inline: auto;
}

.rceft-story-dialog__title {
	margin-block: 0;
	font-size: clamp(26px, 2.2vw, 40px);
	font-weight: 400;
	line-height: 1.2;
	color: var(--wp--preset--color--primary);
	text-wrap: balance;
}

/* Post content: keep the spacing between headings, paragraphs and lists */
.rceft-story-dialog__story {
	margin-top: clamp(16px, 1.6vw, 28px);
	font-size: clamp(16px, 1.05vw, 18px);
	line-height: 1.6;
}

.rceft-story-dialog__story > * {
	margin-block: 0 1em;
}

.rceft-story-dialog__story > :last-child {
	margin-bottom: 0;
}

.rceft-story-dialog__story > p:empty {
	display: none;
}

.rceft-story-dialog__story :is(h2, h3, h4, h5, h6) {
	margin-block: 1.75em 0.5em;
	font-weight: 500;
	line-height: 1.25;
	color: var(--wp--preset--color--green-deep);
	text-wrap: balance;
}

.rceft-story-dialog__story > :is(h2, h3, h4, h5, h6):first-child {
	margin-top: 0;
}

.rceft-story-dialog__story h2 { font-size: 1.5em; }
.rceft-story-dialog__story h3 { font-size: 1.3em; }
.rceft-story-dialog__story h4 { font-size: 1.15em; }
.rceft-story-dialog__story :is(h5, h6) { font-size: 1em; }

.rceft-story-dialog__story :is(ul, ol) {
	padding-left: 1.4em;
}

.rceft-story-dialog__story li + li {
	margin-top: 0.6em;
}

.rceft-story-dialog__story li > :is(ul, ol) {
	margin-top: 0.6em;
}

.rceft-story-dialog__story a {
	color: var(--wp--preset--color--secondary-deep);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.rceft-story-dialog__story :is(figure, .wp-block-image) {
	margin-block: 1.5em;
}

.rceft-story-dialog__story img {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}

.rceft-story-dialog__story figcaption {
	margin-top: 0.5em;
	font-size: 0.875em;
	color: var(--wp--preset--color--ink-muted);
}

.rceft-story-dialog__story blockquote {
	margin-inline: 0;
	padding-left: 1em;
	border-left: 3px solid var(--wp--preset--color--primary);
	font-style: italic;
}

@media (max-width: 599px) {
	.rceft-story-dialog {
		border-radius: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rceft-story-dialog[open] {
		animation: none;
	}

	.rceft-news-card__photo img {
		transition: none;
	}
}
