/*
 * The article under the table, the "All 118 elements" table and the footer.
 *
 * Colours come from the theme tokens in css/ipt.css, so the article follows the
 * Light / Dark switch.
 *
 * Mediavine rule (CONTRACT.md): `article.ipt-article.entry-content` inside
 * `body.single-post` is Mediavine's content container, and it inserts units
 * between the TOP-LEVEL children. So:
 *  - the 720px measure lives on the article's own padding, never on the children,
 *    so injected ad containers get the same column;
 *  - children are styled by enumerated tags, `> :is(p, h2, h3, ul, ol, table,
 *    figure)`, never `> :not(...)`, which would also narrow the injected divs.
 * #ipt-all is a sibling of the article, outside `.entry-content`, so no ad lands in it.
 */

body.ipt-body .ipt-article {
	--ipt-measure: 720px;
	position: relative;
	z-index: 1;
	display: flow-root;
	margin: 0;
	padding: 56px max(20px, calc((100% - var(--ipt-measure)) / 2)) 40px;
	color: var(--ipt-ink);
	font: 1.0625rem / 1.72 var(--ipt-sans);
	background: var(--ipt-bg);
	border-top: 1px solid var(--ipt-line);
}

body.ipt-body .ipt-article > :is(p, ul, ol, table, figure) {
	margin-top: 0;
	margin-bottom: 1.15em;
}

/* Lead paragraph: the first element is p.ipt-answer. */
body.ipt-body .ipt-article > p.ipt-answer {
	padding: 4px 0 4px 18px;
	font: 600 1.28rem / 1.5 var(--ipt-serif);
	letter-spacing: -0.005em;
	border-left: 4px solid var(--ipt-accent);
}

body.ipt-body .ipt-article > h2 {
	margin: 2.5em 0 0.55em;
	color: var(--ipt-ink);
	font: 700 clamp(1.5rem, 3.4vw, 1.95rem) / 1.2 var(--ipt-serif);
	letter-spacing: -0.012em;
	text-wrap: balance;
	scroll-margin-top: 24px;
}

body.ipt-body .ipt-article > h2:first-child {
	margin-top: 0;
}

body.ipt-body .ipt-article > h2::before {
	content: '';
	display: block;
	width: 40px;
	height: 3px;
	margin-bottom: 14px;
	background: var(--ipt-accent);
	border-radius: 2px;
}

body.ipt-body .ipt-article > h3 {
	margin: 1.7em 0 0.35em;
	color: var(--ipt-ink);
	font: 700 1.18rem / 1.3 var(--ipt-serif);
}

body.ipt-body .ipt-article a {
	color: var(--ipt-link);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

body.ipt-body .ipt-article a:hover {
	text-decoration-thickness: 2px;
}

body.ipt-body .ipt-article strong,
body.ipt-body .ipt-article b {
	color: var(--ipt-ink);
}

body.ipt-body .ipt-article code {
	padding: 1px 6px;
	color: var(--ipt-ink);
	font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	background: var(--ipt-surface2);
	border-radius: 5px;
}

body.ipt-body .ipt-article > :is(ul, ol) {
	padding-left: 1.4em;
}

body.ipt-body .ipt-article :is(ul, ol) > li {
	margin-bottom: 0.55em;
	padding-left: 0.2em;
}

body.ipt-body .ipt-article ul > li::marker {
	color: var(--ipt-accent);
}

body.ipt-body .ipt-article ol > li::marker {
	color: var(--ipt-dim);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* ---- tables ---- */

body.ipt-body .ipt-article > table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	font-size: 0.96rem;
	line-height: 1.45;
	font-variant-numeric: tabular-nums;
	background: var(--ipt-surface);
	border: 1px solid var(--ipt-line);
	border-radius: 14px;
}

body.ipt-body .ipt-article table :is(th, td) {
	padding: 11px 14px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--ipt-line);
}

body.ipt-body .ipt-article table thead th {
	color: #e8eefc;
	font-size: 0.74rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	background: #0d1a3d;
	border-bottom: 0;
}

body.ipt-body .ipt-article table tbody tr:last-child :is(th, td) {
	border-bottom: 0;
}

body.ipt-body .ipt-article table tbody td:first-child {
	font-weight: 700;
}

body.ipt-body .ipt-article table tbody tr:nth-child(even) {
	background: var(--ipt-surface2);
}

body.ipt-body .ipt-article :is(sup, sub) {
	line-height: 0;
}

@media (max-width: 640px) {
	/* Wide data tables scroll inside themselves instead of widening the page. */
	body.ipt-body .ipt-article > table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	body.ipt-body .ipt-article table :is(th, td) {
		padding: 9px 11px;
	}
}

/* The credits carry full dataset URLs: they must wrap instead of widening the page. */
body.ipt-body .ipt-article .ipt-credits li {
	overflow-wrap: anywhere;
}

/* ---- figures ---- */

body.ipt-body .ipt-article > figure {
	margin-left: 0;
	margin-right: 0;
}

body.ipt-body .ipt-article figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 14px;
}

body.ipt-body .ipt-article figcaption {
	margin-top: 8px;
	color: var(--ipt-dim);
	font-size: 0.86rem;
	line-height: 1.45;
}

/* ---- FAQ: every h3 after the #faq heading is a question ---- */

body.ipt-body .ipt-article > h2#faq ~ h3 {
	margin: 0;
	padding: 20px 0 4px;
	font-size: 1.08rem;
	border-top: 1px solid var(--ipt-line);
}

body.ipt-body .ipt-article > h2#faq ~ h3 + p {
	margin-bottom: 0.6em;
}

body.ipt-body .ipt-article > h2#faq ~ h2 {
	margin-top: 3em;
}

/* ---- credits: the last list, smaller and quieter ---- */

body.ipt-body .ipt-article > h2#credits ~ :is(ul, p) {
	color: var(--ipt-dim);
	font-size: 0.9rem;
	line-height: 1.6;
}

/* ---- Mediavine units: a minimum height so a unit arriving above the reader does not move the text ---- */

body.ipt-body .ipt-article .mv-ads,
body.ipt-body .ipt-article .mv-ad-box {
	display: block;
	clear: both;
	min-height: 90px;
}

/* ------------------------------------------------------ All 118 elements */

body.ipt-body .ipt-all {
	max-width: 1100px;
	margin: 0 auto;
	padding: 40px 16px 48px;
	color: var(--ipt-ink);
	background: var(--ipt-bg);
}

body.ipt-body .ipt-all h2 {
	margin: 0 0 8px;
	color: var(--ipt-ink);
	font: 700 clamp(1.4rem, 3vw, 1.8rem) / 1.2 var(--ipt-serif);
}

body.ipt-body .ipt-all p {
	max-width: 70ch;
	margin: 0 0 14px;
	color: var(--ipt-dim);
	font-size: 0.92rem;
	line-height: 1.55;
}

body.ipt-body .ipt-all .ipt-all-note {
	margin: 12px 0 0;
	font-size: 0.82rem;
}

body.ipt-body .ipt-all-scroll {
	overflow-x: auto;
	border: 1px solid var(--ipt-line);
	border-radius: 12px;
	-webkit-overflow-scrolling: touch;
}

body.ipt-body .ipt-all-table {
	width: 100%;
	min-width: 760px;
	border-collapse: collapse;
	font-size: 0.88rem;
	font-variant-numeric: tabular-nums;
	background: var(--ipt-surface);
}

body.ipt-body .ipt-all-table :is(th, td) {
	padding: 8px 12px;
	text-align: left;
	white-space: nowrap;
	border-bottom: 1px solid var(--ipt-line);
}

body.ipt-body .ipt-all-table thead th {
	position: sticky;
	top: 0;
	color: #e8eefc;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: normal;
	background: #0d1a3d;
}

body.ipt-body .ipt-all-table tbody tr:nth-child(even) {
	background: var(--ipt-surface2);
}

body.ipt-body .ipt-all-table tbody tr:last-child td {
	border-bottom: 0;
}

body.ipt-body .ipt-all-table a {
	color: var(--ipt-link);
	font-weight: 700;
}

/* ------------------------------------------------------------------ footer */

.ipt-foot {
	position: relative;
	z-index: 1;
	color: #a9b8d6;
	background: #0b1530;
	border-top: 1px solid #263558;
}

.ipt-foot-in {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 28px;
	max-width: 1100px;
	margin: 0 auto;
	padding: 28px 20px 34px;
}

.ipt-foot-logo {
	color: #fff;
	font: 700 1.4rem var(--ipt-serif);
	text-decoration: none;
}

.ipt-foot-logo span {
	color: #3de0c4;
}

.ipt-foot-nav {
	display: flex;
	gap: 22px;
}

body.ipt-body .ipt-foot a {
	color: #dce6fb;
	font-size: 0.92rem;
	font-weight: 600;
	text-decoration: none;
}

body.ipt-body .ipt-foot a:hover {
	color: #3de0c4;
}

.ipt-foot-c {
	flex-basis: 100%;
	margin: 0;
	color: #a9b8d6;
	font-size: 0.8rem;
}

@media (max-width: 600px) {
	body.ipt-body .ipt-article {
		padding-top: 44px;
		font-size: 1rem;
	}

	body.ipt-body .ipt-article > p.ipt-answer {
		font-size: 1.14rem;
	}

	body.ipt-body .ipt-article table :is(th, td) {
		padding: 9px 10px;
	}

	body.ipt-body .ipt-article > table {
		font-size: 0.88rem;
	}
}
