/* Shared reading layer for native post/page content (parent + Galaxy/Market/Zomorod landing templates).
 * Scoped by mtc-reading-auto, so commerce UI, widget areas, query-loop cards and provider forms
 * are not auto-reformatted. Low-specificity :where() respects explicit block/inline styles.
 */
.mtc-reading-auto {
	--mtc-reading-space: 1.4rem;
	--mtc-reading-radius: 14px;
	--mtc-reading-line: 1.95;
}
.mtc-reading-auto.mtc-reading-density-compact { --mtc-reading-space: 1rem; --mtc-reading-line: 1.8; }
.mtc-reading-auto.mtc-reading-density-relaxed { --mtc-reading-space: 1.9rem; --mtc-reading-line: 2.1; }
.mtc-reading-auto.mtc-reading-image-square { --mtc-reading-radius: 0px; }
.mtc-reading-auto.mtc-reading-image-round { --mtc-reading-radius: 24px; }

/* Keep layouts and explicit WordPress alignment unchanged. This is the sole content target list. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) {
	min-width: 0;
	max-width: 100%;
	line-height: var(--mtc-reading-line);
	text-wrap: pretty;
	overflow-wrap: break-word;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > :where(p, ul, ol, figure, blockquote, pre, table, .wp-block-list, .wp-block-image, .wp-block-gallery, .wp-block-media-text, .wp-block-table, .wp-block-video, .wp-block-embed) {
	margin-block-start: 0;
	margin-block-end: var(--mtc-reading-space);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > :where(h2, h3, h4, h5, h6) {
	margin-block: calc(var(--mtc-reading-space) * 1.5) calc(var(--mtc-reading-space) * .55);
	line-height: 1.5;
	text-wrap: balance;
	overflow-wrap: anywhere;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(ul, ol):not(.wp-block-post-template):not(.wp-block-navigation__container):not(.products):not(.wc-block-grid__products):not(.wc-block-product-template):not(.wp-block-woocommerce-product-template) {
	padding-inline-start: clamp(1.2em, 2.6vw, 1.75em);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(ul:not(.wp-block-post-template):not(.wp-block-navigation__container):not(.products):not(.wc-block-grid__products):not(.wc-block-product-template):not(.wp-block-woocommerce-product-template), ol:not(.products)) > li + li { margin-block-start: .35em; }

/* Images stay natural-size and never force a crop; explicit Gutenberg radius/styles prevail. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image img, .wp-caption img) {
	max-width: 100%;
	height: auto;
	border-radius: var(--mtc-reading-radius);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > img,
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > p > img,
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > p > a > img {
	max-width: 100%;
	height: auto;
	border-radius: var(--mtc-reading-radius);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image, .wp-caption, figure) {
	max-width: 100%;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image img, .wp-caption img) {
	vertical-align: middle;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(figcaption, .wp-caption-text, .wp-element-caption) {
	margin-block-start: .55em;
	color: var(--mtc-muted);
	font-size: .875rem;
	line-height: 1.7;
	text-align: center;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-gallery, .blocks-gallery-grid) {
	gap: clamp(10px, 2vw, 20px);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-gallery img) {
	max-width: 100%;
	border-radius: var(--mtc-reading-radius);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-media-text) {
	gap: clamp(14px, 2vw, 24px);
	min-width: 0;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-media-text__content) {
	min-width: 0;
}

/* Semantic reading elements; avoid touching nested WooCommerce/plugin UI. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > :where(blockquote, .wp-block-quote, .wp-block-pullquote) {
	margin-inline: 0;
	padding: clamp(14px, 2.5vw, 24px);
	border: 1px solid var(--mtc-line);
	border-inline-start: 4px solid var(--mtc-primary);
	border-radius: 12px;
	background: var(--mtc-bg);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(pre, .wp-block-code) {
	max-width: 100%;
	overflow-x: auto;
	padding: clamp(12px, 2vw, 18px);
	border: 1px solid var(--mtc-line);
	border-radius: 10px;
	background: var(--mtc-bg);
	direction: ltr;
	text-align: start;
	tab-size: 4;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-table) {
	max-width: 100%;
	overflow-x: auto;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-table table, table) {
	border-collapse: collapse;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > :where(.wp-block-table, table:not(.shop_table)) :where(th, td) {
	padding: .6em .85em;
	border: 1px solid var(--mtc-line);
	text-align: start;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-separator, hr) {
	border: 0;
	border-block-start: 1px solid var(--mtc-line);
	margin-block: calc(var(--mtc-reading-space) * 1.4);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-embed__wrapper, .wp-block-video, .wp-block-audio, .wp-block-file) {
	max-width: 100%;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(iframe, video, audio) {
	max-width: 100%;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-embed.is-type-video iframe) {
	width: 100%;
	aspect-ratio: 16 / 9;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(a:focus-visible) {
	outline: 2px solid var(--mtc-primary);
	outline-offset: 3px;
}
@media (max-width: 640px) {
	.mtc-reading-auto.mtc-reading-density-compact { --mtc-reading-line: 1.75; }
	.mtc-reading-auto.mtc-reading-density-comfortable { --mtc-reading-line: 1.85; }
	.mtc-reading-auto.mtc-reading-density-relaxed { --mtc-reading-line: 1.95; }
	.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.alignleft, .alignright) {
		float: none;
		max-width: 100%;
		margin-inline: auto;
	}
	.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-media-text:not(.is-stacked-on-mobile)) {
		gap: 12px;
	}
}

/* Parent standard posts/pages already specify paragraph line-height in editorial.css.
 * This scoped rule makes the reading density controls effective without styling forms or query cards. */
.mtc-reading-auto .mtc-editorial-entry > .mtc-entry-content > :is(p, ul, ol) {
	line-height: var(--mtc-reading-line);
	margin-block-end: var(--mtc-reading-space);
}

/* The legacy editorial sheet sets a 12px image radius on direct Gutenberg figures.
 * Override only its default, not an author-selected is-style-rounded/custom border. */
.mtc-reading-auto .mtc-editorial-entry > .mtc-entry-content > .wp-block-image:not(.is-style-rounded):not(.has-custom-border) img {
	border-radius: var(--mtc-reading-radius);
}

/* P04J: native WordPress text/layout. No modification to the saved content.
 * A paragraph containing inline media is not justified; author alignment wins. */
.mtc-reading-auto.mtc-reading-justify :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > p:not(.has-text-align-left):not(.has-text-align-right):not(.has-text-align-center):not([style*="text-align"]):not(:has(img)) {
  text-align: justify;
  text-align-last: auto;
  hyphens: manual;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > p:has(> img, > a > img):not(.has-text-align-left):not(.has-text-align-right):not(.has-text-align-center):not([style*="text-align"]) {
  text-align: center;
  text-align-last: center;
}
/* Images have intrinsic sizes unless author chooses alignleft/right/wide/full. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image:not(.alignleft):not(.alignright):not(.alignwide):not(.alignfull):not(.has-text-align-left):not(.has-text-align-right), .wp-caption:not(.alignleft):not(.alignright), figure.wp-block-table:not(.alignwide):not(.alignfull)) {
  margin-inline: auto;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image:not(.alignleft):not(.alignright):not(.alignwide):not(.alignfull), .wp-caption:not(.alignleft):not(.alignright)) {
  width: fit-content;
  max-width: 100%;
}
/* Bare Classic images are inline by default, so auto margins need block display. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > img:not(.alignleft):not(.alignright):not(.alignwide):not(.alignfull) {
  display: block;
  margin-inline: auto;
  width: auto;
  max-width: 100%;
}
/* Caption is distinct from alt text: style only visible WP-caption elements. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-image > figcaption, .wp-caption > .wp-caption-text, .wp-block-image > .wp-element-caption) {
  display: block;
  box-sizing: border-box;
  max-width: 100%;
  margin-block: 0;
  padding: .55em .85em;
  border: 1px solid var(--mtc-line);
  border-radius: 0 0 min(10px, var(--mtc-reading-radius)) min(10px, var(--mtc-reading-radius));
  background: var(--mtc-bg);
  color: var(--mtc-muted);
  font-size: .875rem;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}
/* Article/page native tables use palette variables. Woo and plugin tables are excluded. */
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table:not(.shop_table):not(.woocommerce-table),
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) figure.wp-block-table:not(.alignwide):not(.alignfull) {
  margin-inline: auto;
  max-width: 100%;
  width: fit-content;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table:not(.shop_table):not(.woocommerce-table),
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) figure.wp-block-table > table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--mtc-line);
  border-radius: 10px;
  background: var(--mtc-surface);
  color: var(--mtc-text);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--mtc-text) 5%, transparent);
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table:not(.shop_table):not(.woocommerce-table) :where(th,td):not([style*="text-align"]):not(.has-text-align-left):not(.has-text-align-right):not(.has-text-align-center),
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) figure.wp-block-table > table :where(th,td):not([style*="text-align"]):not(.has-text-align-left):not(.has-text-align-right):not(.has-text-align-center) {
  text-align: center;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table:not(.shop_table):not(.woocommerce-table) thead th,
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) figure.wp-block-table > table thead th {
  background: color-mix(in srgb, var(--mtc-primary) 12%, var(--mtc-surface));
  color: var(--mtc-text);
  font-weight: 750;
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) > table:not(.shop_table):not(.woocommerce-table) tbody tr:nth-child(even) > :where(th,td),
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) figure.wp-block-table > table tbody tr:nth-child(even) > :where(th,td) {
  background: color-mix(in srgb, var(--mtc-primary) 4%, var(--mtc-surface));
}
.mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(.wp-block-table) { box-sizing: border-box; overflow-x: auto; }
@media (max-width: 640px) {
  .mtc-reading-auto :where(.mtc-entry-content, .mtc-galaxy-landing-content, .mtc-market-landing-content, .mtc-zomorod-landing-content) :where(figure.wp-block-table, .wp-block-image, .wp-caption) { max-width: 100%; }
}
