/* MegaMasterok — reading views (single posts and standard Pages): frame,
   breadcrumbs, H1, featured image, body typography. Scoped by the
   `megam-reading` body class. PHP: inc/content.php. Post-only parts:
   single.css; Page-only parts: page.css. */

.megam-reading {
	--megam-measure: 46rem;          /* article text column (~70 ch at 17 px) */
	--megam-measure-wide: 54rem;     /* breadcrumbs + H1 */
}

/* GeneratePress frame: same container as the header and footer, no boxed article. */
.megam-reading .site.grid-container {
	box-sizing: border-box;
	max-width: calc(var(--megam-content) + 2 * var(--megam-gutter));
	padding-inline: var(--megam-gutter);
}

/* The reading column (H1 width) is centred in the container; body text keeps
   its shorter measure on the same left edge. Narrower screens: full width.
   Body class doubled to outrank GP's `.separate-containers.no-sidebar .site-main`. */
.megam-reading.megam-reading .site-main {
	max-width: var(--megam-measure-wide);
	margin: 0 auto;
	padding: 20px 0 0;
}

.megam-reading .inside-article {
	padding: 0;
	background: none;
}

/* Header ------------------------------------------------------------------ */

/* The rule spans the reading column; breadcrumbs and title keep their own width. */
.megam-reading .entry-header {
	margin-bottom: 28px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--megam-line);
}

.megam-reading .entry-header > * {
	max-width: var(--megam-measure-wide);
}

.megam-breadcrumbs {
	margin-bottom: 14px;
	font-size: var(--megam-fs-sm);
	line-height: 1.35;
}

.megam-breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.megam-breadcrumbs__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	margin: 0;
	color: var(--megam-muted);
}

.megam-breadcrumbs__item a {
	color: var(--megam-muted);
	text-decoration: none;
	transition: color 0.15s ease;
}

.megam-breadcrumbs__item a:hover {
	color: var(--megam-accent-strong);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.megam-breadcrumbs .megam-icon {
	color: var(--megam-subtle);
}

/* The current article repeats the H1 right below, so it stays on one line. */
.megam-breadcrumbs__item--current {
	flex: 1 1 10rem;
	color: var(--megam-subtle);
}

.megam-breadcrumbs__item--current span {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.megam-reading .entry-title {
	margin: 0;
	color: var(--megam-ink);
	font-family: var(--megam-font);
	font-size: clamp(1.75rem, 1.15rem + 1.9vw, 2.5rem);
	font-weight: 800;
	line-height: 1.14;
	letter-spacing: -0.018em;
	text-wrap: pretty;
	overflow-wrap: break-word;
}

/* Titles over ~90 characters (megam_reading_title_class()). */
.megam-reading .megam-title-long .entry-title {
	font-size: clamp(1.4375rem, 1.1rem + 1.1vw, 2rem);
	line-height: 1.18;
}

.megam-breadcrumbs a:focus-visible,
.megam-reading .entry-content a:focus-visible {
	outline: none;
	border-radius: 2px;
	box-shadow: var(--megam-focus);
}

/* Featured image (rendered only when its file exists) --------------------- */

.megam-article__image {
	max-width: var(--megam-measure);
	margin: 0 0 28px;
}

.megam-article__image-img {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: var(--megam-radius);
}

.megam-article__image figcaption {
	margin-top: 8px;
	color: var(--megam-muted);
	font-size: var(--megam-fs-sm);
	line-height: 1.4;
}

/* Article body ------------------------------------------------------------ */

.megam-reading .entry-content {
	max-width: var(--megam-measure);
	margin-top: 0;
	color: var(--megam-text);
	font-size: var(--megam-fs-md);
	line-height: 1.65;
	overflow-wrap: break-word;
}

.megam-reading .entry-content > :first-child {
	margin-top: 0;
}

.megam-reading .entry-content p,
.megam-reading .entry-content ul,
.megam-reading .entry-content ol,
.megam-reading .entry-content table,
.megam-reading .entry-content figure,
.megam-reading .entry-content pre {
	margin: 0 0 1.1em;
}

.megam-reading .entry-content h2,
.megam-reading .entry-content h3,
.megam-reading .entry-content h4 {
	color: var(--megam-ink);
	font-family: var(--megam-font);
	text-wrap: pretty;
}

.megam-reading .entry-content h2 {
	margin: 1.9em 0 0.6em;
	font-size: clamp(1.375rem, 1.15rem + 0.7vw, 1.75rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.012em;
}

.megam-reading .entry-content h3 {
	margin: 1.6em 0 0.5em;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
}

.megam-reading .entry-content h4 {
	margin: 1.4em 0 0.4em;
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.35;
}

.megam-reading .entry-content a {
	color: var(--megam-blue);
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--megam-blue) 35%, transparent);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.megam-reading .entry-content a:hover {
	color: var(--megam-accent-strong);
	text-decoration-color: currentColor;
}

.megam-reading .entry-content ul,
.megam-reading .entry-content ol {
	padding-left: 1.4em;
}

.megam-reading .entry-content li {
	margin: 0 0 0.4em;
	padding-left: 0.2em;
}

.megam-reading .entry-content li > ul,
.megam-reading .entry-content li > ol {
	margin: 0.4em 0 0;
}

.megam-reading .entry-content ul > li::marker {
	color: var(--megam-accent);
}

.megam-reading .entry-content ol > li::marker {
	color: var(--megam-muted);
	font-weight: 600;
}

.megam-reading .entry-content blockquote {
	margin: 1.4em 0;
	padding: 14px 20px;
	border-left: 3px solid var(--megam-accent);
	border-radius: 0 var(--megam-radius-sm) var(--megam-radius-sm) 0;
	background: var(--megam-surface-alt);
	color: var(--megam-text);
	font-size: 1em;
	font-style: normal;
}

.megam-reading .entry-content blockquote > :last-child {
	margin-bottom: 0;
}

.megam-reading .entry-content img {
	max-width: 100%;
	height: auto;
}

.megam-reading .entry-content figcaption,
.megam-reading .entry-content .wp-caption-text {
	margin-top: 6px;
	color: var(--megam-muted);
	font-size: var(--megam-fs-sm);
	line-height: 1.4;
}

.megam-reading .entry-content iframe,
.megam-reading .entry-content video,
.megam-reading .entry-content embed,
.megam-reading .entry-content object {
	max-width: 100%;
}

/* Legacy video embeds carry fixed 500×375 attributes. */
.megam-reading .entry-content iframe[src*="youtube.com"],
.megam-reading .entry-content iframe[src*="youtu.be"] {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	margin-inline: auto;
	border: 0;
	border-radius: var(--megam-radius-sm);
}

.megam-reading .entry-content table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--megam-line);
	font-size: 0.9375rem;
	line-height: 1.45;
}

.megam-reading .entry-content th,
.megam-reading .entry-content td {
	padding: 8px 12px;
	border: 1px solid var(--megam-line);
	text-align: left;
	vertical-align: top;
}

.megam-reading .entry-content th,
.megam-reading .entry-content thead td {
	background: var(--megam-surface-alt);
	color: var(--megam-ink);
	font-weight: 700;
}

.megam-reading .entry-content code,
.megam-reading .entry-content kbd {
	padding: 0.1em 0.35em;
	border-radius: 4px;
	background: var(--megam-surface-alt);
	font-family: Consolas, "SFMono-Regular", Menlo, "Liberation Mono", monospace;
	font-size: 0.9em;
}

.megam-reading .entry-content pre {
	padding: 14px 16px;
	overflow-x: auto;
	border: 1px solid var(--megam-line);
	border-radius: var(--megam-radius);
	background: var(--megam-surface-alt);
	font-size: 0.875rem;
	line-height: 1.55;
}

.megam-reading .entry-content pre code {
	padding: 0;
	background: none;
}

.megam-reading .entry-content hr {
	height: 0;
	margin: 2em 0;
	border: 0;
	border-top: 1px solid var(--megam-line);
	background: none;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 760px) {
	/* Wide legacy tables scroll inside the column instead of widening the page. */
	.megam-reading .entry-content table {
		display: block;
		width: auto;
		max-width: 100%;
		overflow-x: auto;
	}
}

@media (max-width: 600px) {
	.megam-reading.megam-reading .site-main {
		padding-top: 14px;
	}

	/* Titles over ~140 characters (megam_reading_title_class()). */
	.megam-reading .megam-title-xlong .entry-title {
		font-size: 1.25rem;
		line-height: 1.2;
		letter-spacing: -0.01em;
	}

	.megam-reading .entry-header {
		margin-bottom: 22px;
		padding-bottom: 16px;
	}

	.megam-breadcrumbs {
		margin-bottom: 10px;
		font-size: var(--megam-fs-xs);
	}

	.megam-reading .entry-content {
		font-size: var(--megam-fs-base);
		line-height: 1.6;
	}

	.megam-reading .entry-content h2 {
		margin-top: 1.7em;
	}

	.megam-reading .entry-content blockquote {
		padding: 12px 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.megam-breadcrumbs__item a {
		transition: none;
	}
}
