/*
 * Article — Figma "Article desktop" (216:2631).
 *
 * Three columns of 245 / 740 / 245 with 55px gutters make the 1340px
 * container. The head spans all three; both rails span the figure and the body
 * rows so they can stick while the article scrolls past.
 */

.article {
	padding: 40px var(--gutter-mobile) 60px;
}

.article__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 40px;
	max-width: var(--container);
	margin: 0 auto;
}

/*
 * Stacked, the rails read as asides to the text, so the article body comes
 * before the details/author/promo column rather than after it in source order.
 */
.article__head { order: 1; }
.article__figure { order: 2; }
.article__rail--left { order: 3; }
.article__body { order: 4; }
.article__rail--right { order: 5; }

/* Head */

.article__head {
	display: flex;
	flex-direction: column;
	gap: 40px;
}

.article__headline {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.article__title {
	margin: 0;
	color: var(--color-primary);
	font-family: var(--font-heading);
	font-size: 32px;
	font-weight: var(--h2-weight);
	line-height: var(--h2-lh);
}

.article__lede {
	color: var(--color-neutral-1);
	font-size: var(--body-main-size);
	font-weight: var(--body-main-weight);
	line-height: var(--body-main-lh);
}

/* Lead image */

.article__figure {
	margin: 0;
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.article__figure img {
	display: block;
	width: 100%;
	aspect-ratio: 740 / 416;
	object-fit: cover;
}

/* Rails */

.article__rail {
	display: flex;
	flex-direction: column;
	gap: 25px;
}

.side-card {
	display: flex;
	flex-direction: column;
	gap: 30px;
	padding: 24px 15px;
	border-radius: 14px;
	background: var(--color-white);
}

.side-card--author { gap: 26px; padding-bottom: 15px; }

.side-card__top {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

/* The rule under the heading is drawn as a border, not a 1px image. */
.side-card__top::after {
	content: "";
	height: 1px;
	background: var(--color-neutral-4);
}

.side-card__title {
	color: var(--color-primary);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	text-transform: uppercase;
}

.side-card__list {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Table of contents */

.toc__link {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	color: var(--color-primary);
	font-size: 15px;
	line-height: 1.2;
	letter-spacing: -0.3px;
}

.toc__link:hover { color: var(--color-accent); }

/* The chevron is an 8x10.67 export carrying preserveAspectRatio="none". */
.toc__link img {
	width: 8px;
	height: auto;
	flex: 0 0 8px;
	margin-top: 3px;
}

.toc__link.is-current { color: var(--color-accent); }

/* Details list */

.detail {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
}

.detail__label {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--color-neutral-1);
	font-size: 15px;
	line-height: 1.2;
	letter-spacing: -0.3px;
}

.detail__label img { width: 13px; height: 13px; flex: 0 0 13px; }

/* The folder glyph is 13x11.8 and carries preserveAspectRatio="none". */
.detail__icon-folder { height: auto !important; }

.detail__value {
	color: var(--color-primary);
	font-size: 15px;
	line-height: 1.2;
	letter-spacing: -0.3px;
	text-align: right;
}

/* Author card */

.side-author {
	display: flex;
	align-items: center;
	gap: 14px;
}

.side-author__avatar {
	width: 46px;
	height: 46px;
	flex: 0 0 46px;
	border-radius: 50%;
	object-fit: cover;
}

.side-author__name {
	color: var(--color-primary);
	font-size: 15px;
	line-height: 1.2;
	letter-spacing: -0.3px;
}

/* Small pill link, used by the author card and the promo card. */

.chip-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 18px;
	border-radius: var(--radius-pill);
	background: var(--color-neutral-7);
	color: var(--color-neutral-1);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.24px;
	text-align: center;
}

.chip-link img {
	width: 6px;
	height: auto;
	flex: 0 0 6px;
}

.chip-link:hover { background: var(--color-neutral-4); }

.chip-link--accent {
	background: var(--color-accent);
	color: var(--color-white);
}

.chip-link--accent:hover { background: var(--color-accent-light); }

/* Promo card */

.promo-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-height: 251px;
	padding: 24px 15px 15px;
	border-radius: 14px;
	background: var(--color-primary);
	overflow: hidden;
}

.promo-card__text {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	max-width: 149px;
}

.promo-card__title {
	color: var(--color-white);
	font-size: var(--body-main-size);
	font-weight: 500;
	line-height: var(--body-main-lh);
}

.promo-card__desc {
	color: var(--color-neutral-3);
	font-size: 13px;
	line-height: 1.4;
	letter-spacing: -0.13px;
}

/*
 * Figma 259:2165 draws the cut-out mirrored (scaleY(-1) plus rotate(180deg),
 * which composes to a horizontal flip) so the doctor faces into the card. The
 * frame is 201px wide starting 109px in, i.e. 65px past the 245px card, and
 * the card clips the overflow.
 */
.promo-card__photo {
	position: absolute;
	right: -65px;
	top: 35px;
	z-index: 0;
	width: 201px;
	height: auto;
	transform: scaleX(-1);
	pointer-events: none;
}

.promo-card .chip-link {
	position: relative;
	z-index: 1;
	margin-top: auto;
}

.promo-card__text { position: relative; z-index: 1; }

/* White chevron on the accent chip. */
.chip-link--accent img { filter: brightness(0) invert(1); }

/* Body */

.article__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	color: var(--color-primary);
	font-size: var(--body-secondary-size);
	line-height: var(--body-lh);
}

.article__body > h2,
.article__body > h3 {
	margin: 18px 0 16px;
	color: var(--color-primary);
	font-family: var(--font-heading);
	font-size: 26px;
	font-weight: var(--h2-weight);
	line-height: var(--h2-lh);
	scroll-margin-top: 104px;
}

/* h3 carries the FAQ questions — kept clearly below the h2 above them. */
.article__body > h3 {
	margin: 12px 0 0;
	font-size: var(--h6-size);
	font-weight: var(--h6-weight);
	line-height: var(--h6-lh);
	letter-spacing: var(--h6-ls);
}

.article__body > h2:first-child,
.article__body > h3:first-child { margin-top: 0; }

.article__body > h4 {
	margin: 12px 0 0;
	font-size: var(--h5-size);
}

.article__body a {
	color: var(--color-accent);
	text-decoration: underline;
}

.article__body ul,
.article__body ol {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	padding-left: 24px;
	list-style: disc outside;
}

.article__body ol { list-style: decimal outside; }

.article__body img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
}

.article__body blockquote {
	margin: 12px 0;
	padding: 24px;
	border-radius: var(--radius-lg);
	background: var(--color-white);
	font-size: var(--body-main-size);
	font-weight: 500;
}

@media (min-width: 768px) {
	.article__title { font-size: 38px; }
	.article__body > h2 { font-size: 32px; }
	.article__body > h3 { font-size: 22px; }
}

@media (min-width: 1024px) {
	.article { padding: 40px var(--gutter) 60px; }

	.article__grid {
		grid-template-columns: 245px minmax(0, 740px) 245px;
		column-gap: 55px;
		row-gap: 60px;
		justify-content: center;
	}

	.article__head {
		grid-column: 1 / -1;
		align-items: center;
		gap: 60px;
	}

	/* Figma centres the headline over 740px, the width of the image below it. */
	.article__headline {
		align-items: center;
		max-width: 740px;
		text-align: center;
		gap: 16px;
	}

	.article__title { font-size: var(--h2-size); }

	.breadcrumbs { align-self: stretch; }

	.article__figure { grid-column: 2; grid-row: 2; }
	.article__body { grid-column: 2; grid-row: 3; gap: 12px; }

	/*
	 * Both rails run alongside the figure and the body, and stick clear of the
	 * sticky header while the article scrolls.
	 */
	.article__rail--left { grid-column: 1; grid-row: 2 / span 2; }
	.article__rail--right { grid-column: 3; grid-row: 2 / span 2; }

	.article__rail {
		position: sticky;
		top: 104px;
		align-self: start;
	}

	.article__body > h2 { margin-top: 30px; }
	.article__body > h3 { margin-top: 20px; }
}
