/*
 * chabad.info v2: the article page. Loaded after shell.css, on single posts only.
 * Mobile first. Class prefix: chb-.
 */

/* ---------- Article ---------- */
.chb-article {
	--chb-hover: var(--chb-cat);
	/*
	 * The tallest a picture gets: the window, less the bar that stays at the top of the page and
	 * some air, so that a portrait picture shows whole without scrolling. Never under 360px, for
	 * a phone held sideways. Clicking the picture still opens it full size in the gallery.
	 */
	--chb-picture-max: max(360px, calc(100vh - 130px));
	margin-bottom: var(--chb-gap);
	padding: 18px 16px 20px;
	border-radius: var(--chb-radius);
	background: var(--chb-surface);
	box-shadow: var(--chb-shadow);
}
.chb-article__head {
	margin-bottom: 12px;
}
.chb-article__head .chb-tag {
	margin-bottom: 10px;
}
.chb-article__title {
	font-size: clamp(26px, 4.4vw, 38px);
	font-weight: 800;
	line-height: 1.22;
	letter-spacing: -0.3px;
	text-wrap: balance;
}
.chb-article__lead {
	color: #2b323c;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.6;
}
.chb-article__lead p + p {
	margin-top: 8px;
}
.chb-article__lead a,
.chb-article__body a {
	color: var(--chb-cat);
	transition: filter 0.15s ease;
}
.chb-article__lead a:hover,
.chb-article__body a:hover {
	filter: brightness(0.7);
}
.chb-article__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-block: 10px 16px;
	color: var(--chb-muted);
	font-size: 14px;
}
.chb-article__author {
	color: var(--chb-text);
	font-weight: 700;
}
.chb-article__author + time::before {
	content: "·";
	margin-inline-end: 10px;
}
.chb-article__meta .chb-share {
	margin-inline-start: auto;
}

/* The main picture or the lead video runs from edge to edge of the card. */
.chb-article__media {
	position: relative;
	margin: 0 -16px 18px;
	background: #e9ecf1;
}
.chb-article__media > a {
	display: block;
	cursor: zoom-in;
}
.chb-article__media img {
	display: block;
	width: 100%;
}
/* A square or portrait main picture is fitted into the window; an ordinary wide one always fills the card. */
.chb-article__media--tall img {
	max-height: var(--chb-picture-max);
	object-fit: contain;
}
.chb-article__caption {
	padding: 6px 16px;
	background: var(--chb-surface);
	color: var(--chb-muted);
	font-size: 13px;
}
.chb-article__player {
	background: #000;
}
.chb-article__player video {
	display: block;
	width: 100%;
	max-height: 75vh;
	background: #000;
}

/* ---------- The text ---------- */
.chb-article__body {
	font-size: 18px;
	line-height: 1.75;
	overflow-wrap: anywhere;
}
.chb-article__body p,
.chb-article__body ul,
.chb-article__body ol {
	margin: 0 0 1em;
}
.chb-article__body > :last-child {
	margin-bottom: 0;
}
.chb-article__body ul,
.chb-article__body ol {
	padding-inline-start: 1.4em;
}
.chb-article__body li + li {
	margin-top: 0.3em;
}
.chb-article__body h2,
.chb-article__body h3,
.chb-article__body h4 {
	margin: 1.4em 0 0.5em;
	font-weight: 800;
	line-height: 1.3;
}
.chb-article__body h2 {
	font-size: 24px;
}
.chb-article__body h3 {
	font-size: 21px;
}
.chb-article__body h4 {
	font-size: 18px;
}
.chb-article__body blockquote {
	margin: 1.2em 0;
	padding: 14px 18px;
	border-radius: 8px;
	background: var(--chb-bg);
	color: #2b323c;
}
.chb-article__body blockquote > :last-child {
	margin-bottom: 0;
}

/* Pictures follow one another down the page, in the order the editor placed them. */
.chb-article__body img {
	display: block;
	width: auto;
	max-height: var(--chb-picture-max);
	margin: 14px auto;
	border-radius: 8px;
}
.chb-article__body img.emoji {
	display: inline;
	max-height: none;
	margin: 0;
	border-radius: 0;
}
.chb-article__body [data-gallery-item],
.chb-article__body [data-gallery-item] img {
	cursor: zoom-in;
}
.chb-article__body .wp-caption {
	max-width: 100%;
	margin: 14px auto;
}
.chb-article__body .wp-caption img {
	margin-block: 0;
}
.chb-article__body .wp-caption-text {
	margin: 6px 0 0;
	color: var(--chb-muted);
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
}

/* Players and embeds take the width of the text. */
.chb-article__body iframe {
	display: block;
	margin: 14px auto;
	border: 0;
}
.chb-article__body iframe[src*="youtube"],
.chb-article__body iframe[src*="youtu.be"],
.chb-article__body iframe[src*="vimeo"],
.chb-article__body iframe[src*="c-live"],
.chb-article__body iframe[src*="livestream"],
.chb-article__body .video-container iframe {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}
.chb-article__body video {
	display: block;
	width: 100%;
	max-height: 75vh;
	background: #000;
}
.chb-article__body .plyr,
.chb-article__body .video-container,
.chb-article__body .wp-video {
	margin-block: 14px;
	border-radius: 8px;
	overflow: hidden;
}
.chb-article__body audio,
.chb-article__body .wp-audio-shortcode {
	display: block;
	width: 100%;
	margin-block: 14px;
}
/*
 * A table keeps its words whole and scrolls sideways when it is wider than the screen.
 * The "break anywhere" rule of the text would let the browser squeeze every column
 * down to a letter or two, cutting words in the middle.
 */
.chb-article__body table {
	display: block;
	width: 100%;
	margin: 0 0 1em;
	border-collapse: collapse;
	overflow-x: auto;
	overflow-wrap: normal;
	font-size: 15px;
	line-height: 1.5;
}
.chb-article__body th,
.chb-article__body td {
	padding: 6px 8px;
	border: 1px solid var(--chb-border);
	text-align: start;
	vertical-align: top;
}
.chb-article__body th {
	background: var(--chb-bg);
}

/* ---------- Under the text: tags and the WhatsApp invitation ---------- */
.chb-article__foot {
	display: grid;
	gap: 16px;
	margin-top: 22px;
	padding-top: 16px;
	border-top: 1px solid var(--chb-border);
}
.chb-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.chb-tags a {
	display: block;
	padding: 4px 14px;
	border-radius: 999px;
	background: var(--chb-bg);
	color: #2b323c;
	font-size: 14px;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.chb-tags a:hover {
	background: var(--chb-cat);
	color: #fff;
}
.chb-whatsapp {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: var(--chb-radius);
	background: #e7f8ec;
	color: #0b5c2a;
	font-weight: 700;
	transition: background-color 0.15s ease;
}
.chb-whatsapp:hover {
	background: #d3f1dc;
}
.chb-whatsapp img {
	flex: none;
}

/* ---------- Rail ---------- */
.chb-rail .chb-charidy {
	margin-bottom: var(--chb-gap);
}
.chb-rail .chb-charidy iframe {
	display: block;
	width: 100%;
	border: 0;
	border-radius: var(--chb-radius);
}

/* ---------- Wider screens ---------- */
@media (min-width: 600px) {
	.chb-article {
		padding: 24px 28px 26px;
	}
	.chb-article__media {
		margin-inline: -28px;
	}
	.chb-article__caption {
		padding-inline: 28px;
	}
	.chb-article__lead {
		font-size: 19px;
	}
	.chb-article__body table {
		font-size: 17px;
	}
	.chb-article__body th,
	.chb-article__body td {
		padding: 8px 12px;
	}
}
