/**
 * Post Layout Studio, front-end render styles.
 * Loaded only on single posts that have a saved layout (see inc/post-layout.php).
 * Scoped under .fls-post-layout so it never leaks into the rest of the theme.
 *
 * Layout model: normal block flow (not flex), so a floated photo lets the
 * paragraphs after it wrap around. Only paragraphs (.a-p) wrap; headings,
 * figures, quotes, buttons and rules clear the float and start on a fresh line.
 */

.fls-post-layout {
	--pl-accent: #F4B242;
	--pl-ink: #1A1712;
	--pl-muted: #6E665A;
	--pl-border: #E5DFD2;
	--pl-panel: #F3EFE7;
	max-width: 720px;
	margin-inline: auto;
	color: var(--pl-ink);
}
/* Contain the trailing float so following theme markup is not affected. */
.fls-post-layout::after { content: ""; display: block; clear: both; }

.fls-post-layout > * { margin: 0 0 20px; }
.fls-post-layout > *:last-child { margin-bottom: 0; }

/* Structural elements start on a fresh line instead of wrapping beside a float. */
.fls-post-layout .a-h,
.fls-post-layout .a-figure,
.fls-post-layout .a-split,
.fls-post-layout .a-quote,
.fls-post-layout .a-btn-wrap,
.fls-post-layout .a-hr { clear: both; }

.fls-post-layout .a-h {
	font-weight: 700;
	letter-spacing: -0.012em;
	line-height: 1.18;
	margin: 6px 0 12px;
	text-wrap: balance;
}
.fls-post-layout .a-h.lvl-h2 { font-size: clamp(23px, 3.4vw, 29px); }
.fls-post-layout .a-h.lvl-h3 { font-size: clamp(19px, 2.6vw, 22px); }

.fls-post-layout .a-p {
	font-size: 17px;
	line-height: 1.66;
	margin: 0 0 18px;
}
.fls-post-layout .a-p.muted-lead { font-size: 19px; color: var(--pl-muted); }
.fls-post-layout .a-p a { color: #B45309; text-decoration: underline; }
.fls-post-layout .a-p a:hover { text-decoration: none; }
.fls-post-layout .a-p ul, .fls-post-layout .a-p ol { margin: 8px 0 8px 1.3em; padding: 0; }
.fls-post-layout .a-p li { margin: 0 0 6px; }
.fls-post-layout .a-p strong, .fls-post-layout .a-p b { font-weight: 700; }

.fls-post-layout .align-left { text-align: left; }
.fls-post-layout .align-center { text-align: center; }
.fls-post-layout .align-right { text-align: right; }

/* Figures: width comes from an inline style (percent of the column). */
.fls-post-layout .a-figure { margin: 6px 0 20px; }
.fls-post-layout .a-figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	background: var(--pl-panel);
}
.fls-post-layout .a-figure.float-none.align-center { margin-left: auto; margin-right: auto; }
.fls-post-layout .a-figure.float-none.align-left { margin-left: 0; margin-right: auto; }
.fls-post-layout .a-figure.float-none.align-right { margin-left: auto; margin-right: 0; }
.fls-post-layout .a-figure.float-left { float: left; margin: 6px 26px 16px 0; }
.fls-post-layout .a-figure.float-right { float: right; margin: 6px 0 16px 26px; }

.fls-post-layout .a-cap {
	margin-top: 9px;
	font-size: 13px;
	color: var(--pl-muted);
	text-align: center;
}

.fls-post-layout .a-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: clamp(18px, 4%, 32px);
	align-items: center;
}
.fls-post-layout .a-split.img-right { direction: rtl; }
.fls-post-layout .a-split.img-right > * { direction: ltr; }
.fls-post-layout .a-split img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	background: var(--pl-panel);
}
.fls-post-layout .a-split__text { display: flex; flex-direction: column; gap: 10px; }

.fls-post-layout .a-quote {
	margin: 6px 0 20px;
	padding: 4px 0 4px 22px;
	border-left: 3px solid var(--pl-accent);
}
.fls-post-layout .a-quote p { font-style: italic; font-size: 21px; line-height: 1.5; margin: 0; }
.fls-post-layout .a-quote cite {
	display: block;
	margin-top: 11px;
	font-style: normal;
	font-size: 14px;
	font-weight: 600;
	color: var(--pl-muted);
}

.fls-post-layout .a-btn-wrap.align-center { text-align: center; }
.fls-post-layout .a-btn-wrap.align-right { text-align: right; }
.fls-post-layout .a-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 650;
	font-size: 16px;
	padding: 13px 26px;
	border-radius: 999px;
	background: var(--pl-accent);
	color: #2A1D05;
	text-decoration: none;
	transition: background 0.15s ease;
}
.fls-post-layout .a-btn:hover { background: #E39F26; }

.fls-post-layout .a-hr { border: 0; height: 1px; background: var(--pl-border); margin: 4px 0 20px; }

.fls-post-layout .a-img-missing {
	display: block;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	background: var(--pl-panel);
	border: 1px dashed var(--pl-border);
}

/* On phones, floated photos go full width and stack, wrapping would be too tight. */
@media (max-width: 640px) {
	.fls-post-layout .a-figure.float-left,
	.fls-post-layout .a-figure.float-right {
		float: none;
		width: 100% !important;
		margin: 6px 0 18px;
	}
	.fls-post-layout .a-split { grid-template-columns: 1fr; }
}
