/* ==========================================================================
   PROSE: typography for database-written article HTML       (.pg-prose)
   --------------------------------------------------------------------------
   Used by every page that prints text from the Manage editor (service pages
   today, blog posts next). PHP runs the text through pg_render_content()
   first (config/content-security.php), which strips every inline style,
   class and colour and fixes the heading outline. So this file is the ONLY
   thing that styles that text: fonts, colours, sizes and spacing live here.

   It owns: type scale and rhythm, headings, lists, links, quotes, rules,
   images, tables and video. It does not own the page around the column.

   Needs Jost 400 in the page's Google Fonts link (body copy is weight 400;
   without it the browser falls back to 500 and every paragraph looks bold).
   Uses the tokens from nav.css (--pg-ink, --pg-pink, --pg-line ...).
   ========================================================================== */

.pg-prose {
	counter-reset: pg-h2;
	font-family: var(--pg-font);
	font-size: clamp(16px, .3vw + 15px, 17.5px);
	font-weight: 400;
	line-height: 1.75;
	color: #3d3866;
	overflow-wrap: break-word;
}
.pg-prose > :first-child { margin-top: 0 !important; }
.pg-prose > :last-child { margin-bottom: 0 !important; }

/* Paragraphs */
.pg-prose p { margin: 0 0 1.05em; }
.pg-prose strong, .pg-prose b { font-weight: 600; color: var(--pg-ink); }
.pg-prose em, .pg-prose i { font-style: italic; }

/* Section headings (h2): numbered, with a hairline above */
.pg-prose h2 {
	counter-increment: pg-h2;
	position: relative;
	margin: 2.4em 0 .7em;
	padding-top: 1.1em;
	border-top: 1px solid var(--pg-line);
	font: 600 clamp(23px, 1.4vw + 16px, 30px)/1.25 var(--pg-font);
	letter-spacing: -.01em;
	color: var(--pg-ink);
	text-transform: none;
	scroll-margin-top: calc(var(--pg-bar-h) + 24px);
}
.pg-prose h2::before {
	content: counter(pg-h2, decimal-leading-zero);
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .14em;
	color: var(--pg-pink);
}
.pg-prose > h2:first-child { padding-top: 0; border-top: 0; }

.pg-prose h3 {
	margin: 1.8em 0 .55em;
	font: 600 clamp(19px, .6vw + 16px, 22px)/1.35 var(--pg-font);
	color: var(--pg-plum);
	text-transform: none;
	letter-spacing: 0;
	scroll-margin-top: calc(var(--pg-bar-h) + 24px);
}
.pg-prose h4, .pg-prose h5, .pg-prose h6 {
	margin: 1.5em 0 .5em;
	font: 600 17px/1.4 var(--pg-font);
	color: var(--pg-ink);
	text-transform: none;
	letter-spacing: 0;
}
.pg-prose h2 + h3 { margin-top: .9em; }

/* Links */
.pg-prose a {
	color: var(--pg-plum);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgba(230, 8, 127, .45);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
	transition: color .2s, text-decoration-color .2s;
}
.pg-prose a:hover { color: var(--pg-pink); text-decoration-color: var(--pg-pink); }

/* Lists: pink dots and numbers. A list item that starts with a bold label
   ("Hypothyroidism:" + line break) reads as a term with its explanation. */
.pg-prose ul, .pg-prose ol { margin: 0 0 1.3em; padding: 0; list-style: none; }
.pg-prose li { position: relative; margin: 0 0 .7em; padding-left: 1.6em; }
.pg-prose li > p { margin: 0; }
.pg-prose li > p + p { margin-top: .5em; }
.pg-prose ul > li::before {
	content: "";
	position: absolute;
	left: .3em;
	top: .68em;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pg-pink);
	box-shadow: 0 0 0 4px var(--pg-blush);
}
.pg-prose ol { counter-reset: pg-ol; }
.pg-prose ol > li { counter-increment: pg-ol; padding-left: 2.2em; }
.pg-prose ol > li::before {
	content: counter(pg-ol);
	position: absolute;
	left: 0;
	top: .2em;
	display: grid;
	place-items: center;
	width: 1.55em;
	height: 1.55em;
	border-radius: 50%;
	background: var(--pg-lilac);
	font-size: .78em;
	font-weight: 700;
	line-height: 1;
	color: var(--pg-plum);
}
.pg-prose li li { margin-top: .5em; }
.pg-prose li > p:first-child > strong:first-child,
.pg-prose li > strong:first-child { color: var(--pg-plum); }

/* Quotes */
.pg-prose blockquote {
	margin: 1.6em 0;
	padding: .2em 0 .2em 1.3em;
	border-left: 3px solid var(--pg-pink);
	font-size: 1.08em;
	color: var(--pg-ink);
}
.pg-prose blockquote p:last-child { margin-bottom: 0; }

/* Rules */
.pg-prose hr { height: 1px; margin: 2em 0; border: 0; background: var(--pg-line); opacity: 1; }

/* Images (lazy, sized by optimize_public_images(); placeholder from nav.js) */
.pg-prose img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 1.6em auto;
	border-radius: 18px;
}
.pg-prose p > img:only-child { margin: 0 auto; }
.pg-prose figure { margin: 1.8em 0; }
.pg-prose figcaption { margin-top: 8px; font-size: 14px; color: var(--pg-muted); text-align: center; }

/* Tables: scroll sideways inside their wrapper, hairline rows */
.pg-prose .pg-prose__table { margin: 1.6em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pg-prose table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: .94em; line-height: 1.55; }
.pg-prose th, .pg-prose td { padding: 12px 14px; border-bottom: 1px solid var(--pg-line); text-align: left; vertical-align: top; }
.pg-prose thead th, .pg-prose tr:first-child th {
	background: var(--pg-lilac);
	font-weight: 600;
	color: var(--pg-ink);
	border-bottom: 0;
}
.pg-prose thead th:first-child { border-radius: 12px 0 0 12px; }
.pg-prose thead th:last-child { border-radius: 0 12px 12px 0; }
.pg-prose td p { margin: 0; }

/* Video */
.pg-prose .pg-prose__video { position: relative; margin: 1.8em 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 18px; background: var(--pg-lilac); }
.pg-prose .pg-prose__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Code (rare in this content) */
.pg-prose code { padding: .1em .35em; border-radius: 6px; background: var(--pg-lilac); font-size: .9em; }
.pg-prose pre { margin: 1.4em 0; padding: 16px; overflow-x: auto; border-radius: 14px; background: var(--pg-lilac); }
.pg-prose sub, .pg-prose sup { font-size: .72em; }

@media (max-width: 767.98px) {
	.pg-prose h2 { margin-top: 2em; }
	.pg-prose img, .pg-prose .pg-prose__video { border-radius: 14px; }
}
