/* =========================================================
   Editorial styling (POSTS ONLY)
   - Front-end: scoped to .single-post
   - Editor: only enqueued for post type "post" (see functions.php),
     and scoped to the writing canvas.
   ========================================================= */

/* =========================================================
   Editorial tokens
   ========================================================= */

:root {
	--aligned-measure: min(65ch, 90vw);

	--aligned-body-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.225rem);
	--aligned-leading: 1.75;

	--aligned-link: #1e40af;
	--aligned-link-hover: #1a3697;

	--aligned-ink: rgba(0, 0, 0, 0.85);
	--aligned-zebra: rgba(0, 0, 0, 0.035);
}
/* =========================================================
   Reading column + base type
   ========================================================= */

.single-post .wp-block-post-content,
.editor-styles-wrapper .is-root-container {
	--wp--style--global--content-size: var(--aligned-measure);
	--wp--style--global--wide-size: calc(var(--aligned-measure) + 20ch);

	max-width: var(--aligned-measure) !important;
	margin-left: auto;
	margin-right: auto;

	font-family: var(--wp--preset--font-family--libre-baskerville);
	font-size: var(--aligned-body-size);
	line-height: var(--aligned-leading);

	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

/* Make editor width reflect content width */
.block-editor-block-list__layout.is-root-container > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: inherit !important;
}

/* Mobile: reduce side padding */
@media (max-width: 781px) {
	.single-post .wp-block-post-content {
		padding-left: 0;
		padding-right: 0;
	}
	main > .wp-block-group.alignfull {
		padding-left: var(--wp--preset--spacing--30) !important;
		padding-right: var(--wp--preset--spacing--30) !important;
	}
}

/* =========================================================
   Paragraph rhythm + long text handling
   ========================================================= */

.single-post .wp-block-post-content p,
.editor-styles-wrapper .is-root-container p {
	margin-top: 0;
	margin-bottom: 1.05em;
}

.single-post .wp-block-post-content :is(p, li),
.editor-styles-wrapper .is-root-container :is(p, li) {
	overflow-wrap: break-word;
	word-break: normal;
	hyphens: none;
}

/* =========================================================
   Links (exclude buttons)
   ========================================================= */

.single-post .wp-block-post-content a:not(.wp-block-button__link, .pdf-button__link),
.editor-styles-wrapper .is-root-container a:not(.wp-block-button__link, .pdf-button__link) {
	font-family: inherit;
	color: var(--aligned-link);
	text-decoration: underline;
	text-decoration-thickness: 0.1em;
	text-underline-offset: 0.18em;
	text-decoration-skip-ink: auto;
}

.single-post .wp-block-post-content a:not(.wp-block-button__link, .pdf-button__link):hover,
.editor-styles-wrapper .is-root-container a:not(.wp-block-button__link, .pdf-button__link):hover {
	color: var(--aligned-link-hover);
	text-decoration-thickness: 0.12em;
}

.single-post .wp-block-post-content a:not(.wp-block-button__link, .pdf-button__link):focus,
.editor-styles-wrapper .is-root-container a:not(.wp-block-button__link, .pdf-button__link):focus {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 2px;
}

/* =========================================================
   Headings
   ========================================================= */

.single-post h1.wp-block-post-title,
.editor-styles-wrapper h1.wp-block-post-title {
	font-family: var(--wp--preset--font-family--bitter);
}

.single-post .wp-block-post-content :is(h1, h2, h3, h4, h5, h6),
.editor-styles-wrapper .is-root-container :is(h1, h2, h3, h4, h5, h6) {
	line-height: 1.2;
	letter-spacing: -0.01em;
	margin-bottom: 0.6em;
}

.single-post .wp-block-post-content > :is(h1, h2, h3):first-child,
.editor-styles-wrapper .is-root-container > :is(h1, h2, h3):first-child {
	margin-top: 0;
}

.single-post .wp-block-post-content h1,
.editor-styles-wrapper .is-root-container h1 {
	font-size: clamp(2.15rem, 2.8vw, 2.85rem);
	margin-top: 2.5em;
}

.single-post .wp-block-post-content h2,
.editor-styles-wrapper .is-root-container h2 {
	font-size: clamp(1.85rem, 2.05vw, 2.15rem);
	margin-top: 1.85em;
}

.single-post .wp-block-post-content h3,
.editor-styles-wrapper .is-root-container h3 {
	font-size: clamp(1.55rem, 1.65vw, 1.85rem);
	margin-top: 1.7em;
}

.single-post .wp-block-post-content h4,
.editor-styles-wrapper .is-root-container h4 {
	font-size: 1.48rem;
	margin-top: 1.55em;
}

.single-post .wp-block-post-content h5,
.editor-styles-wrapper .is-root-container h5 {
	font-size: 1.35rem;
	margin-top: 1.35em;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.92;
}

.single-post .wp-block-post-content h6,
.editor-styles-wrapper .is-root-container h6 {
	font-size: 1.16rem;
	margin-top: 1.2em;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.82;
}

.single-post .wp-block-post-content h5,
.single-post .wp-block-post-content h6 {
	margin-left: 0 !important;
}

/* =========================================================
   Lists
   ========================================================= */

.single-post .wp-block-post-content :is(ul, ol),
.editor-styles-wrapper .is-root-container :is(ul, ol) {
	margin-top: 0.25em;
	margin-bottom: 1.05em;
	padding-left: 1.25em;
}

.single-post .wp-block-post-content li,
.editor-styles-wrapper .is-root-container li {
	margin-bottom: 0.45em;
}

/* =========================================================
   Blockquotes
   ========================================================= */

.single-post .wp-block-post-content blockquote,
.editor-styles-wrapper .is-root-container blockquote {
	margin: 1.6em 0;
	padding: 0.75em 1.1em;
	border-left: 4px solid rgba(0, 0, 0, 0.55);
}

.single-post .wp-block-post-content blockquote cite,
.editor-styles-wrapper .is-root-container blockquote cite {
	display: inline-block;
	margin-top: 0.25em;
	font-style: normal;
	opacity: 0.85;
}

/* =========================================================
   Tables
   ========================================================= */

.single-post .wp-block-post-content .wp-block-table,
.editor-styles-wrapper .is-root-container .wp-block-table {
	display: block;              /* ensures overflow works consistently */
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	margin: 1.25em 0;
}

/* Prevent WP/table styles from forcing fixed layout (which can cause squishing) */
.single-post .wp-block-post-content .wp-block-table table,
.editor-styles-wrapper .is-root-container .wp-block-table table {
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: auto;
	width: max-content;          /* allows table to be wider than column */
	min-width: 100%;             /* but never smaller than the column */
	font-size: 0.98em;
	border-top: 2px solid var(--aligned-ink);
	border-bottom: 2px solid var(--aligned-ink);
}

/* Cell styling */
.single-post .wp-block-post-content .wp-block-table :is(th, td),
.editor-styles-wrapper .is-root-container .wp-block-table :is(th, td) {
	padding: 0.6em 0.75em;
	vertical-align: top;
	text-align: left;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
}

/* Header row */
.single-post .wp-block-post-content .wp-block-table thead th,
.editor-styles-wrapper .is-root-container .wp-block-table thead th {
	font-weight: 700;
	border-top: none;
	background: rgba(0, 0, 0, 0.02);
}

/* Zebra striping (tbody only so headers aren’t counted) */
.single-post .wp-block-post-content .wp-block-table tbody tr:nth-child(even),
.editor-styles-wrapper .is-root-container .wp-block-table tbody tr:nth-child(even) {
	background: var(--aligned-zebra);
}

/* Keep table content from forcing weird wraps (lets columns stay readable) */
.single-post .wp-block-post-content .wp-block-table :is(th, td),
.editor-styles-wrapper .is-root-container .wp-block-table :is(th, td) {
	white-space: nowrap;
}

/* Allow explicit line breaks / paragraphs inside cells to wrap normally */
.single-post .wp-block-post-content .wp-block-table :is(th, td) :is(p, ul, ol),
.editor-styles-wrapper .is-root-container .wp-block-table :is(th, td) :is(p, ul, ol) {
	white-space: normal;
	margin: 0;
}

/* Optional: a little breathing room between multiple blocks inside a cell */
.single-post .wp-block-post-content .wp-block-table :is(th, td) > * + *,
.editor-styles-wrapper .is-root-container .wp-block-table :is(th, td) > * + * {
	margin-top: 0.4em;
}


/* =========================================================
   Images + captions
   ========================================================= */

.single-post .wp-block-post-content figcaption,
.editor-styles-wrapper .is-root-container figcaption {
	margin-top: 0.6em;
	font-size: 0.92em;
	line-height: 1.45;
	opacity: 0.85;
}

/* =========================================================
   Front-end only: byline + related content
   ========================================================= */

.single-post .post-byline,
.single-post .wp-block-post-date,
.single-post .wp-block-post-author-name {
	font-size: 0.95rem;
	opacity: 0.85;
}

.single-post .wp-block-query h2 {
	font-size: 1.25rem;
	margin-top: 2.5rem;
	line-height: 1.25;
}
