/* Prose (ahan-prose) — typography for rendered post content (article, price pages, services, pages...). Logical properties only. */

.ahan-prose {
	font-size: var(--fs-base);
	line-height: 2;
	overflow-wrap: anywhere;
}

.ahan-prose > * + * {
	margin-top: 1rem;
}

.ahan-prose h2,
.ahan-prose h3,
.ahan-prose h4 {
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
	scroll-margin-top: calc(var(--ahan-sticky-top, 0px) + 120px);
}

.ahan-prose h2 {
	margin-top: 2rem;
	font-size: var(--t-h2-size);
}

.ahan-prose h3 {
	margin-top: 1.5rem;
	font-size: var(--t-h3-size);
}

.ahan-prose h4 {
	font-size: var(--fs-base);
}

.ahan-prose a {
	color: var(--c-primary);
	text-decoration: underline;
}

.ahan-prose ul,
.ahan-prose ol {
	padding-inline-start: 1.5rem;
	list-style: revert;
}

.ahan-prose li + li {
	margin-top: 4px;
}

.ahan-prose img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius-sm);
}

.ahan-prose figure {
	max-width: 100%;
}

/* Standalone media between the text fills the column: an image alone in its paragraph (or link), captioned figures, video and
   embeds. Everything else keeps its own size: icons inside a sentence, several images in one paragraph, thumbnails, images in
   lists/tables, floated images (alignleft / alignright / style="float"). */
.ahan-prose > img:not(.alignleft, .alignright, .size-thumbnail, [style*="float"]),
.ahan-prose > p > img:only-child:not(.alignleft, .alignright, .size-thumbnail, [style*="float"]),
.ahan-prose > p > a:only-child > img:only-child:not(.alignleft, .alignright, .size-thumbnail, [style*="float"]),
.ahan-prose > figure:not(.alignleft, .alignright) img,
.ahan-prose > .wp-caption:not(.alignleft, .alignright) img {
	display: block;
	width: 100%;
	height: auto;
}

/* The lazy loader prints a noscript element right after each image, so an image followed only by that is alone too. Its own rule:
   a browser without :has() would drop the whole rule above if the selector were part of it. */
.ahan-prose > p > img:first-child:has(+ noscript:last-child):not(.alignleft, .alignright, .size-thumbnail, [style*="float"]),
.ahan-prose > p > a:only-child > img:first-child:has(+ noscript:last-child):not(.alignleft, .alignright, .size-thumbnail, [style*="float"]) {
	display: block;
	width: 100%;
	height: auto;
}

/* The classic editor writes a fixed width on captions (inline style), hence !important. */
.ahan-prose > figure:not(.alignleft, .alignright),
.ahan-prose > .wp-caption:not(.alignleft, .alignright) {
	width: 100% !important;
}

.ahan-prose > video,
.ahan-prose > p > video:only-child {
	display: block;
	width: 100%;
	height: auto;
}

.ahan-prose > iframe,
.ahan-prose > p > iframe:only-child {
	display: block;
	width: 100%;
	max-width: 100%;
}

.ahan-prose iframe:is([src*="youtube"], [data-src*="youtube"], [src*="youtu.be"], [src*="aparat"], [data-src*="aparat"], [src*="vimeo"]) {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

.ahan-prose figcaption {
	margin-top: 6px;
	color: var(--c-text-muted);
	font-size: var(--fs-xs);
	text-align: center;
}

.ahan-prose .aligncenter {
	margin-inline: auto;
}

.ahan-prose .alignleft {
	float: left;
	margin-inline-end: 1rem;
}

.ahan-prose .alignright {
	float: right;
	margin-inline-start: 1rem;
}

.ahan-prose table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
}

.ahan-prose th,
.ahan-prose td {
	padding: 8px 12px;
	border: 1px solid var(--c-border);
	text-align: start;
}

/* Content tables fill the column (!important: editors write a fixed width on them); the tables of the price-table plugin
   (.apt-table) keep their own layout. Narrow screens: the table scrolls sideways. */
.ahan-prose table:not(.apt-table) {
	display: table;
	width: 100% !important;
}

.ahan-prose table:not(.apt-table) :is(th, td) {
	overflow-wrap: normal; /* break between words only (the prose-wide "anywhere" split cells mid-letter) */
}

/* Alternate rows and a row under the pointer, in every text table: the colours the site CSS box already gives to the tables of
   articles. */
.ahan-prose table:not(.apt-table) tr:nth-child(2n) {
	background: #f9fafb;
}

.ahan-prose table:not(.apt-table) tr:hover {
	background: #eef2f7;
}

@media (max-width: 767px) {
	.ahan-prose table:not(.apt-table) {
		display: block;
		overflow-x: auto;
	}
}

.ahan-prose blockquote {
	padding-inline-start: var(--gap);
	border-inline-start: 4px solid var(--c-primary);
	color: var(--c-text-muted);
}

