/**
 * Curlo Article — longform reading layout (TOC + body + further reading).
 */

.curlo-article-entry {
	position: relative;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem);
	color: var(--curlo-text);
	overflow-x: hidden;
	overflow-x: clip;
}

/*
 * Do not use width: 100vw for full-bleed — vw includes the scrollbar gutter
 * and creates a horizontal scrollbar. Fill the parent instead (flush pages
 * are already edge-to-edge).
 */
.curlo-container .curlo-article-entry.alignfull,
.entry-content .curlo-article-entry.alignfull {
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

.curlo-article-entry--pro,
.curlo-article-entry--code {
	background-color: var(--curlo-code-bg, #0b0e14);
	color: var(--curlo-code-text, #e6edf3);
}

.curlo-article-entry--pro {
	background-image:
		radial-gradient(650px circle at 12% -5%, rgb(20 53 31 / 0.22), transparent 60%),
		radial-gradient(700px circle at 100% 10%, rgb(16 35 58 / 0.22), transparent 55%);
}

.curlo-article-entry--ink { background: var(--curlo-ink); }
.curlo-article-entry--surface { background: var(--curlo-surface); }
.curlo-article-entry--surface-2 { background: var(--curlo-surface-2); }

.curlo-article-entry__progress {
	position: fixed;
	/* Sit under the fixed Curlo nav (body padding-top: 56px), not behind it. */
	top: 56px;
	left: 0;
	height: 4px;
	width: 0%;
	background: var(--curlo-primary, #1a7f4b);
	box-shadow: 0 0 0 1px rgb(26 127 75 / 0.15);
	z-index: 1040;
	pointer-events: none;
}

.admin-bar .curlo-article-entry__progress {
	top: calc(56px + 32px);
}

@media screen and (max-width: 782px) {
	.admin-bar .curlo-article-entry__progress {
		top: calc(56px + 46px);
	}
}

.curlo-article-entry__wrap {
	max-width: 1100px;
	width: 100%;
	margin: 0 auto;
	padding: 0 24px;
	box-sizing: border-box;
}

.curlo-article-entry__hero {
	margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
}

.curlo-article-entry__hero .curlo-eyebrow {
	margin: 0 0 1rem;
}

.curlo-article-entry--pro .curlo-article-entry__hero .curlo-eyebrow,
.curlo-article-entry--code .curlo-article-entry__hero .curlo-eyebrow {
	color: var(--curlo-green, #4ade80);
}

.curlo-article-entry__title {
	margin: 0 0 1rem;
	font-family: var(--curlo-font-sans, Inter, sans-serif);
	font-size: clamp(1.9rem, 1.3rem + 2vw, 2.75rem);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.1;
	color: inherit;
}

.curlo-article-entry__dek {
	margin: 0 0 1.5rem;
	max-width: 38rem;
	font-family: var(--curlo-font-sans, Inter, sans-serif);
	font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
	font-style: italic;
	line-height: 1.55;
	color: var(--curlo-muted, #5b6675);
}

.curlo-article-entry--pro .curlo-article-entry__dek,
.curlo-article-entry--code .curlo-article-entry__dek {
	color: var(--curlo-code-muted, #7e8ca0);
}

.curlo-article-entry__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 1.25rem;
	padding-top: 1.15rem;
	border-top: 1px dashed var(--curlo-line, #d8dee6);
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.75rem;
	color: var(--curlo-muted, #5b6675);
}

.curlo-article-entry--pro .curlo-article-entry__meta,
.curlo-article-entry--code .curlo-article-entry__meta {
	border-top-color: rgba(255, 255, 255, 0.12);
	color: var(--curlo-code-muted, #7e8ca0);
}

.curlo-article-entry__lead-figure {
	margin: 0 0 clamp(2rem, 4vw, 3rem);
	width: 100%;
}

.curlo-article-entry__lead-figure--full { max-width: 100%; }
.curlo-article-entry__lead-figure--wide { max-width: 42rem; }
.curlo-article-entry__lead-figure--medium { max-width: 28rem; }
.curlo-article-entry__lead-figure--narrow { max-width: 18rem; }

.curlo-article-entry__lead-figure--align-left { margin-right: auto; margin-left: 0; }
.curlo-article-entry__lead-figure--align-center { margin-left: auto; margin-right: auto; }
.curlo-article-entry__lead-figure--align-right { margin-left: auto; margin-right: 0; }

.curlo-article-entry__lead-frame {
	position: relative;
	overflow: hidden;
	border-radius: var(--curlo-radius, 8px);
	border: 1px solid var(--curlo-line, #d8dee6);
	background: var(--curlo-surface-2, #f4f6f8);
	aspect-ratio: var(--curlo-article-lead-ratio, auto);
}

.curlo-article-entry__lead-figure--ratio-16-9 { --curlo-article-lead-ratio: 16 / 9; }
.curlo-article-entry__lead-figure--ratio-4-3 { --curlo-article-lead-ratio: 4 / 3; }
.curlo-article-entry__lead-figure--ratio-1-1 { --curlo-article-lead-ratio: 1 / 1; }
.curlo-article-entry__lead-figure--ratio-3-4 { --curlo-article-lead-ratio: 3 / 4; }

.curlo-article-entry__lead-figure--ratio-auto .curlo-article-entry__lead-frame {
	aspect-ratio: auto;
}

.curlo-article-entry--pro .curlo-article-entry__lead-frame,
.curlo-article-entry--code .curlo-article-entry__lead-frame {
	border-color: rgba(255, 255, 255, 0.12);
	background: rgba(255, 255, 255, 0.04);
}

.curlo-article-entry__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 180px;
	padding: 1.25rem;
	color: var(--curlo-muted, #5b6675);
	font-size: 0.9rem;
	text-align: center;
}

.curlo-article-entry__lead-frame img {
	display: block;
	width: 100%;
	height: auto;
	vertical-align: middle;
}

.curlo-article-entry__lead-figure--ratio-16-9 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--ratio-4-3 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--ratio-1-1 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--ratio-3-4 .curlo-article-entry__lead-frame img {
	height: 100%;
	object-fit: cover;
	position: absolute;
	inset: 0;
}

.curlo-article-entry__lead-figure--fit-contain.curlo-article-entry__lead-figure--ratio-16-9 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--fit-contain.curlo-article-entry__lead-figure--ratio-4-3 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--fit-contain.curlo-article-entry__lead-figure--ratio-1-1 .curlo-article-entry__lead-frame img,
.curlo-article-entry__lead-figure--fit-contain.curlo-article-entry__lead-figure--ratio-3-4 .curlo-article-entry__lead-frame img {
	object-fit: contain;
}

.curlo-article-entry__figcaption {
	display: flex;
	gap: 0.65rem;
	align-items: baseline;
	padding: 0.65rem 0.15rem 0;
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.72rem;
	color: var(--curlo-muted, #5b6675);
}

.curlo-article-entry__fig-tag {
	flex-shrink: 0;
	border: 1px dashed var(--curlo-text);
	border-radius: 3px;
	padding: 0.1rem 0.4rem;
	color: var(--curlo-text);
}

.curlo-article-entry--pro .curlo-article-entry__fig-tag,
.curlo-article-entry--code .curlo-article-entry__fig-tag {
	border-color: rgba(255, 255, 255, 0.45);
	color: var(--curlo-code-text, #e6edf3);
}

/*
 * Default: TOC stacks above the main column (never widens the page).
 * Wide screens: place TOC in a real column inside the wrap (no gutter hang-out).
 */
.curlo-article-entry__layout {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.curlo-article-entry__main {
	min-width: 0;
	max-width: 100%;
}

.curlo-article-entry__toc {
	order: -1;
	width: 100%;
	max-width: 22rem;
	margin: 0 0 1.5rem;
	position: static;
	border: 1px solid var(--curlo-line, #d8dee6);
	background: var(--curlo-surface-2, #f4f6f8);
	border-radius: var(--curlo-radius, 8px);
	padding: 1.1rem 1.1rem 1.25rem;
	box-sizing: border-box;
	z-index: 1;
}

.curlo-article-entry--pro .curlo-article-entry__toc,
.curlo-article-entry--code .curlo-article-entry__toc {
	background: rgba(255, 255, 255, 0.03);
	border-color: rgba(255, 255, 255, 0.12);
}

/* Side rail stays inside the 1100px wrap — never hangs into the page gutter. */
@media (min-width: 960px) {
	.curlo-article-entry__layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 220px;
		gap: 1.5rem;
		align-items: start;
	}

	.curlo-article-entry__toc {
		order: 0;
		width: auto;
		max-width: none;
		margin: 0;
		position: sticky;
		top: calc(56px + 1.5rem);
	}

	.admin-bar .curlo-article-entry__toc {
		top: calc(56px + 32px + 1.5rem);
	}

	.curlo-article-entry--toc-left .curlo-article-entry__layout {
		grid-template-columns: 220px minmax(0, 1fr);
	}

	.curlo-article-entry--toc-left .curlo-article-entry__toc {
		order: -1;
	}
}

.curlo-article-entry__toc-label {
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.7rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--curlo-muted, #5b6675);
	margin: 0 0 0.75rem;
}

.curlo-article-entry__toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.curlo-article-entry__toc-list a {
	text-decoration: none;
	color: var(--curlo-muted, #5b6675);
	font-size: 0.875rem;
	line-height: 1.4;
	display: flex;
	gap: 0.55rem;
	transition: color 0.15s ease;
}

.curlo-article-entry__toc-list a:hover,
.curlo-article-entry__toc-list a.is-active {
	color: var(--curlo-text);
}

.curlo-article-entry--pro .curlo-article-entry__toc-list a:hover,
.curlo-article-entry--pro .curlo-article-entry__toc-list a.is-active,
.curlo-article-entry--code .curlo-article-entry__toc-list a:hover,
.curlo-article-entry--code .curlo-article-entry__toc-list a.is-active {
	color: var(--curlo-green, #4ade80);
}

.curlo-article-entry__toc-num {
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.7rem;
	color: var(--curlo-accent, #c9a227);
	flex-shrink: 0;
}

.curlo-article-entry__toc-empty {
	font-size: 0.8rem;
	color: var(--curlo-muted, #5b6675);
	margin: 0;
}

.curlo-article-entry__body {
	min-width: 0;
	max-width: 100%;
	font-family: var(--curlo-font-sans, Inter, sans-serif);
	font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.1rem);
	line-height: 1.75;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.curlo-article-entry__body > *:first-child {
	margin-top: 0;
}

.curlo-article-entry__body > *:last-child {
	margin-bottom: 0;
}

.curlo-article-entry__body p {
	margin: 0 0 1.2rem;
	color: var(--curlo-text);
}

.curlo-article-entry--pro .curlo-article-entry__body p,
.curlo-article-entry--code .curlo-article-entry__body p {
	color: var(--curlo-code-text, #e6edf3);
}

.curlo-article-entry__body .curlo-article-entry__lead,
.curlo-article-entry__body p.has-large-font-size {
	font-size: 1.1em;
}

.curlo-article-entry__body h2 {
	font-family: var(--curlo-font-sans, Inter, sans-serif);
	font-weight: 800;
	font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.7rem);
	letter-spacing: -0.02em;
	margin: 2.75rem 0 1rem;
	scroll-margin-top: calc(56px + 1.5rem);
	color: inherit;
}

.curlo-article-entry__body h2 .curlo-article-entry__h-num,
.curlo-article-entry__body h2 .has-accent-color {
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.85em;
	font-weight: 500;
	color: var(--curlo-accent, #c9a227);
	margin-right: 0.55rem;
}

.curlo-article-entry__body blockquote,
.curlo-article-entry__body .curlo-article-entry__pull {
	font-family: var(--curlo-font-sans, Inter, sans-serif);
	font-weight: 500;
	font-style: italic;
	font-size: 1.25rem;
	line-height: 1.5;
	color: var(--curlo-primary-ink, #15803d);
	border-left: 2px solid var(--curlo-primary, #1a7f4b);
	padding: 0.15rem 0 0.15rem 1.35rem;
	margin: 2rem 0;
}

.curlo-article-entry--pro .curlo-article-entry__body blockquote,
.curlo-article-entry--code .curlo-article-entry__body blockquote {
	color: var(--curlo-green, #4ade80);
	border-left-color: var(--curlo-green, #4ade80);
}

.curlo-article-entry__body .wp-block-image,
.curlo-article-entry__body figure:not(.curlo-article-entry__lead-figure) {
	margin: 2rem 0;
}

/* Let core Image width / alignment / resize controls win. */
.curlo-article-entry__body .wp-block-image img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: var(--curlo-radius, 8px);
	border: 1px solid var(--curlo-line, #d8dee6);
}

.curlo-article-entry__body .wp-block-image.aligncenter {
	margin-left: auto;
	margin-right: auto;
}

.curlo-article-entry__body .wp-block-image.alignleft {
	float: left;
	margin-right: 1.25rem;
	margin-bottom: 0.75rem;
}

.curlo-article-entry__body .wp-block-image.alignright {
	float: right;
	margin-left: 1.25rem;
	margin-bottom: 0.75rem;
}

.curlo-article-entry__body .wp-block-image.alignwide,
.curlo-article-entry__body .wp-block-image.alignfull {
	max-width: 100%;
}

.curlo-article-entry__body .wp-block-image figcaption,
.curlo-article-entry__body figure:not(.curlo-article-entry__lead-figure) figcaption {
	margin-top: 0.55rem;
	font-family: var(--curlo-font-mono, "JetBrains Mono", monospace);
	font-size: 0.72rem;
	color: var(--curlo-muted, #5b6675);
}

.curlo-article-entry__body hr,
.curlo-article-entry__body .wp-block-separator {
	border: none;
	border-top: 1px dashed var(--curlo-line, #d8dee6);
	margin: 2.75rem 0 2rem;
}

.curlo-article-entry__body .curlo-alert {
	margin: 1.75rem 0;
}

.curlo-article-entry-editor__row {
	display: grid;
	gap: 0.4rem;
	padding: 0.65rem 0;
	border-bottom: 1px solid #ddd;
}

.curlo-article-entry-editor__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
