/**
 * Game Site Reading Enhancer front-end styles.
 *
 * Every rule is scoped to the body class added by the plugin on public,
 * ordinary single-post pages. This supports classic themes such as
 * mistfall-hunter-theme and block themes such as Twenty Twenty-Five.
 */

body.game-site-reading-enhancer {
	--gsre-content-width: var(--gsf-article-width, 820px);
	--gsre-mobile-gutter: var(--gsf-mobile-padding, 18px);
	--gsre-scroll-offset: 112px;
	--gsre-text: var(--body-color, #262b33);
	--gsre-heading: var(--heading-color, var(--gsre-text));
	--gsre-muted: var(--muted-color, #5d6673);
	--gsre-border: var(--content-border-color, var(--border-color, #dce2e8));
	--gsre-surface: var(--surface-raised, #f6f8fa);
	--gsre-surface-alt: var(--surface-bg, #fff);
	--gsre-link: var(--link-color, #286b77);
	--gsre-accent: var(--accent-color, #286b77);
	--gsre-accent-soft: var(--accent-soft, #eaf5f6);
}

body.game-site-reading-enhancer :where(.entry-header, .wp-block-post-title) {
	box-sizing: border-box;
	width: min(100%, var(--gsre-content-width));
	max-width: var(--gsre-content-width);
	margin-inline: auto;
}

body.game-site-reading-enhancer :where(h1.entry-title, .wp-block-post-title) {
	color: var(--gsre-heading);
	font-size: clamp(2rem, 3.4vw, 40px);
	line-height: 1.15;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) {
	box-sizing: border-box;
	width: min(100%, var(--gsre-content-width));
	max-width: var(--gsre-content-width);
	margin-inline: auto;
	color: var(--gsre-text);
	font-size: 18px;
	line-height: 1.7;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) > :where(p, ul, ol, blockquote, figure, table, .wp-block-table) {
	margin-block: 0 1.4em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(ul, ol) {
	padding-inline-start: 1.35em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) li + li {
	margin-block-start: 0.45em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(h2, h3) {
	clear: both;
	color: var(--gsre-heading);
	line-height: 1.25;
	letter-spacing: -0.015em;
	text-wrap: balance;
	scroll-margin-top: var(--gsre-scroll-offset);
}

body.admin-bar.game-site-reading-enhancer {
	--gsre-scroll-offset: 144px;
}

/* Generated in the rendered DOM only when the article contains 3+ H2s. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc {
	width: 100%;
	margin-block: 0 2.25em;
	border: 1px solid var(--gsre-border);
	border-radius: 12px;
	background: var(--gsre-surface);
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__toggle {
	min-height: var(--gsf-touch-target-min-height, 44px);
	padding: 0.85em 1em;
	cursor: pointer;
	color: var(--gsre-heading);
	font-weight: 700;
	line-height: 1.35;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__toggle:focus-visible {
	outline: 3px solid var(--gsre-link);
	outline-offset: 3px;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__navigation {
	padding: 0 1em 1em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-toc__list, .mh-toc__sublist) {
	margin: 0;
	padding-inline-start: 1.3em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__sublist {
	margin-block-start: 0.2em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__item {
	margin: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__item--h3 {
	font-size: 0.92em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__link {
	display: inline-block;
	padding-block: 0.3em;
	color: var(--gsre-text);
	text-decoration: none;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__link:hover,
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__link:focus-visible,
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__link.is-active {
	color: var(--gsre-link);
	text-decoration: underline;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc__link.is-active {
	font-weight: 700;
}

/* Responsive images, captions, and classified embeds. Existing frames are reused. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(img, .mh-media-frame img) {
	max-width: 100%;
	height: auto;
	object-fit: contain;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) img.mh-media-frame {
	display: block;
	width: auto;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.mh-media-frame:not(.mh-content-wide):not(.mh-content-full) {
	max-width: 100%;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(figcaption, .wp-element-caption) {
	margin-block-start: 0.65em;
	color: var(--gsre-muted);
	font-size: 0.84em;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-video-frame {
	display: block;
	position: relative;
	max-width: none;
	aspect-ratio: var(--gsf-video-aspect-ratio, 16 / 9);
	overflow: hidden;
	background: #000;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(iframe.mh-video-frame, video.mh-video-frame),
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-video-frame :where(iframe, video) {
	width: 100%;
	max-width: 100%;
	height: 100%;
	aspect-ratio: var(--gsf-video-aspect-ratio, 16 / 9);
	border: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.wp-block-embed.mh-video-frame {
	display: grid;
	aspect-ratio: auto;
	background: transparent;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.wp-block-video.mh-video-frame {
	display: grid;
	aspect-ratio: auto;
	overflow: visible;
	background: transparent;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.wp-block-video.mh-video-frame video {
	width: 100%;
	height: auto;
	aspect-ratio: var(--gsf-video-aspect-ratio, 16 / 9);
	background: #000;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.wp-block-embed.mh-video-frame .wp-block-embed__wrapper {
	aspect-ratio: var(--gsf-video-aspect-ratio, 16 / 9);
	overflow: hidden;
	background: #000;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-map-frame {
	max-width: none;
	overflow: visible;
	background: transparent;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-map-frame :where(iframe, .wp-block-embed__wrapper) {
	width: 100%;
	max-width: 100%;
	min-height: 360px;
	aspect-ratio: auto;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) iframe.mh-map-frame {
	width: 100%;
	max-width: 100%;
	min-height: 360px;
	aspect-ratio: auto;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-embed-frame {
	width: 100%;
	max-width: 100%;
	overflow: visible;
	aspect-ratio: auto;
	background: transparent;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.mh-embed-frame {
	margin-inline: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-embed-frame :where(iframe, .wp-block-embed__wrapper) {
	width: 100%;
	max-width: 100%;
	aspect-ratio: auto;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) iframe.mh-embed-frame {
	width: 100%;
	max-width: 100%;
	aspect-ratio: auto;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) h2 {
	margin-block: 2em 0.65em;
	font-size: 28px;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) h3 {
	margin-block: 1.65em 0.55em;
	font-size: 22px;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(h2, h3) + :where(p, ul, ol, table, .wp-block-table) {
	margin-block-start: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) a {
	color: var(--gsre-link);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.16em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(table, .wp-block-table table) {
	width: 100%;
	border-collapse: collapse;
	color: var(--gsre-text);
	background: var(--gsre-surface-alt);
	font-size: 0.94em;
	line-height: 1.5;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(th, td) {
	padding: 0.75em 0.85em;
	border: 1px solid var(--gsre-border);
	text-align: start;
	vertical-align: top;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) th {
	color: var(--gsre-heading);
	background: var(--gsre-surface);
	font-weight: 700;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) td {
	color: var(--gsre-text);
	background: var(--gsre-surface-alt);
}

/*
 * Wide-table component. JavaScript reuses a Core Table block's figure as the
 * component shell, or creates the same shell for an unwrapped classic table.
 * Only the viewport scrolls; the hint remains below the table.
 */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll {
	display: grid;
	position: relative;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	grid-template-columns: minmax(0, 1fr);
	margin-block: 0 1.4em;
	overflow: hidden;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) figure.mh-table-scroll {
	margin-inline: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport {
	grid-row: 1;
	grid-column: 1;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport:focus-visible {
	outline: 3px solid var(--gsre-link);
	outline-offset: -3px;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport > table {
	margin: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll.is-scrollable:not(.is-at-end)::after {
	content: "";
	grid-row: 1;
	grid-column: 1;
	justify-self: end;
	align-self: stretch;
	z-index: 1;
	width: 52px;
	pointer-events: none;
	background: linear-gradient(to right, transparent, var(--gsre-surface-alt));
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__hint {
	display: flex;
	grid-column: 1;
	align-items: center;
	justify-content: flex-end;
	gap: 0.45em;
	padding-block-start: 0.5em;
	color: var(--gsre-muted);
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.35;
	transition: opacity 160ms ease;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll > figcaption {
	grid-column: 1;
	width: 100%;
	min-width: 0;
	overflow-wrap: anywhere;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__hint[hidden] {
	display: none;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll.has-scrolled:not(.is-at-end) .mh-table-scroll__hint {
	opacity: 0.78;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__arrow {
	font-size: 1.05em;
	line-height: 1;
}

/* Reusable editorial modules. Empty authored shells remain absent. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-faq, .mh-official-sources)[hidden] {
	display: none !important;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-official-sources) {
	min-width: 0;
	border: 1px solid var(--gsre-border);
	border-radius: 12px;
	color: var(--gsre-text);
	overflow-wrap: anywhere;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-official-sources) > :first-child {
	margin-block-start: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-official-sources) > :last-child {
	margin-block-end: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-faq, .mh-official-sources) > :where(h2, h3):first-child {
	margin-block: 0 0.65em;
	font-size: 1.25em;
}

/* Quick Answer has the strongest editorial priority without resembling an ad. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-quick-answer {
	margin-block: 0 1.25em;
	padding: 1.2em 1.35em;
	border-inline-start: 5px solid var(--gsre-accent);
	background: linear-gradient(135deg, var(--gsre-accent-soft), var(--gsre-surface));
	box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}

/* Key Takeaways uses a quieter scan-focused treatment. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-key-takeaways {
	margin-block: 0 1.75em;
	padding: 1.1em 1.3em;
	border-inline-start: 5px solid var(--gsre-link);
	background: var(--gsre-surface);
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-key-takeaways :where(ul, ol) {
	margin: 0;
	padding-inline-start: 1.25em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-key-takeaways li::marker {
	color: var(--gsre-link);
	font-weight: 800;
}

/* FAQ uses native details/summary; no script is needed for disclosure input. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq {
	margin-block: 2.4em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item {
	margin-block: 0 0.75em;
	border: 1px solid var(--gsre-border);
	border-radius: 10px;
	background: var(--gsre-surface);
	overflow: clip;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__question {
	min-height: var(--gsf-touch-target-min-height, 44px);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 0.85em 1em;
	cursor: pointer;
	color: var(--gsre-heading);
	font-weight: 750;
	line-height: 1.4;
	list-style: none;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__question::-webkit-details-marker {
	display: none;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__question::after {
	content: "+";
	min-width: 1.25em;
	color: var(--gsre-link);
	font-size: 1.35em;
	font-weight: 500;
	line-height: 1;
	text-align: center;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item[open] {
	border-color: var(--gsre-accent);
	background: var(--gsre-surface-alt);
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item[open] > .mh-faq__question::after {
	content: "−";
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__question:focus-visible {
	outline: 3px solid var(--gsre-link);
	outline-offset: -3px;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item > :not(summary) {
	margin-inline: 1em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item > :last-child {
	margin-block-end: 1em;
}

/* Legacy FAQ questions remain readable but are not converted or copied. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq > h3 {
	margin: 0;
	padding-block: 1.1em 0.45em;
	border-block-start: 1px solid var(--gsre-border);
	font-size: 1.15em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq > h3 + p {
	margin-block: 0;
	padding-block-end: 1.1em;
}

/* Official Sources separates first-party evidence from editorial prose. */
body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-official-sources {
	margin-block: 2.5em 1.5em;
	padding: 1.25em 1.4em;
	border-block-start: 4px solid var(--gsre-accent);
	background: var(--gsre-surface);
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-official-sources :where(ul, ol) {
	margin-block-end: 0;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-official-sources li + li {
	margin-block-start: 0.75em;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-official-sources a {
	overflow-wrap: anywhere;
	word-break: break-word;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-source-type {
	display: inline-block;
	margin-inline-end: 0.55em;
	padding: 0.18em 0.5em;
	border: 1px solid var(--gsre-border);
	border-radius: 999px;
	color: var(--gsre-muted);
	font-size: 0.72em;
	font-weight: 750;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-external-link::after {
	content: " ↗";
	font-size: 0.78em;
	text-decoration: none;
}

@media (max-width: 1023px) {
	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll--wide table {
		min-width: 760px;
	}
}

@media (min-width: 1024px) {
	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-toc {
		max-width: var(--gsre-content-width);
	}
}

@media (max-width: 600px) {
	body.game-site-reading-enhancer :where(.entry-header, .wp-block-post-title),
	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) {
		width: 100%;
		padding-inline: var(--gsre-mobile-gutter);
	}

	body.game-site-reading-enhancer :where(h1.entry-title, .wp-block-post-title) {
		font-size: clamp(2rem, 9vw, 36px);
	}

	/*
	 * Mobile tables keep native touch scrolling, but expose a larger and more
	 * visible horizontal scrollbar. The bottom padding separates the table from
	 * the drag surface without moving overflow to the document.
	 */
	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport {
		padding-block-end: 10px;
		scrollbar-color: #7fd7dd #26313c;
		scrollbar-width: auto;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport::-webkit-scrollbar {
		height: 14px;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport::-webkit-scrollbar-track {
		border: 1px solid #435260;
		border-radius: 999px;
		background: #26313c;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__viewport::-webkit-scrollbar-thumb {
		min-width: 48px;
		border: 2px solid #26313c;
		border-radius: 999px;
		background: #7fd7dd;
		background-clip: padding-box;
		box-shadow: inset 0 0 0 1px rgb(255 255 255 / 28%);
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__hint {
		justify-content: center;
		gap: 0.55em;
		padding: 0.65em 0.75em 0;
		color: var(--gsre-heading);
		font-size: 0.82rem;
		text-align: center;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__arrow {
		display: inline-grid;
		min-width: 2em;
		min-height: 1.5em;
		place-items: center;
		border: 1px solid var(--gsre-border);
		border-radius: 999px;
		background: var(--gsre-surface);
		color: var(--gsre-link);
		font-size: 1em;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) :where(.mh-quick-answer, .mh-key-takeaways, .mh-official-sources) {
		padding: 1em;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-map-frame :where(iframe, .wp-block-embed__wrapper) {
		min-height: 280px;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) iframe.mh-map-frame {
		min-height: 280px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html:has(body.game-site-reading-enhancer) {
		scroll-behavior: auto;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-table-scroll__hint {
		transition: none;
	}

	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-quick-answer,
	body.game-site-reading-enhancer :where(.entry-content, .wp-block-post-content) .mh-faq__item {
		transition: none;
	}
}
