/*
	Article and manual pages: left-aligned title, sidebar table of contents,
	share menu and author card. Loaded by templates/header.php for these pages only.
*/

/* ---------- Title header ---------- */

header.header--content {
	align-items: stretch;
}

header.header--content h1 {
	text-align: left;
	max-width: 960px;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

header.header--content .header-breadcrumbs {
	margin-top: 20px;
	font-size: 15px;
}

header.header--content .breadcrumb > li {
	display: inline;
}

/* ---------- Two-column layout ---------- */

.article-layout {
	--article-sticky-top: 24px;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
}

.article-layout-author,
.article-layout-sidebar,
.article-layout-main {
	min-width: 0;
}

.article-layout-sidebar {
	display: grid;
	gap: 16px;
	align-content: start;
}

/* Section anchors stay clear of the sticky site header. */
.article-layout .manual [id^="/"],
[id="/comments"] {
	scroll-margin-top: 100px;
}

/* A heading that opens the article needs no top gap; the author card already separates it. */
.article-layout [data-article-body] > div[id^="/"]:not(:is(p, div, blockquote, ul, ol, table) ~ *) h2,
.article-layout [data-article-body] > div[id^="/"]:not(:is(p, div, blockquote, ul, ol, table) ~ *) h3 {
	margin-top: 8px;
}

@media (min-width: 992px) {
	.article-layout--sidebar {
		grid-template-columns: 250px minmax(0, 1fr);
		grid-template-rows: auto 1fr;
		column-gap: 40px;
	}

	.article-layout--sidebar .article-layout-author {
		grid-column: 2;
		grid-row: 1;
	}

	.article-layout--sidebar .article-layout-sidebar {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-self: start;
		position: sticky;
		top: var(--article-sticky-top);
		transition: top 0.25s ease-out;
		z-index: 5;
	}

	.article-layout--sidebar .article-layout-main {
		grid-column: 2;
		grid-row: 2;
	}

	.article-toc-list {
		/* Keeps the sidebar bottom clear of the floating "Top" button (templates/gototop.php). */
		max-height: calc(100vh - var(--article-sticky-top) - 300px);
		min-height: 160px;
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}
}

@media (min-width: 1200px) {
	.article-layout--sidebar {
		grid-template-columns: 280px minmax(0, 1fr);
		column-gap: 48px;
	}
}

/* ---------- Table of contents ---------- */

.article-toc {
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
	padding: 18px 12px 12px;
}

.article-toc-head {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 0 10px;
	border: 0;
	background: none;
	text-align: left;
	font-size: 13px;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #8a8a8a;
	cursor: default;
}

.article-toc-head strong {
	flex: 1 1 auto;
	font-weight: 700;
}

.article-toc-count,
.article-toc-chevron {
	display: none;
}

.article-toc-progress {
	height: 3px;
	margin: 12px 10px 10px;
	border-radius: 3px;
	background: #f0f0f0;
	overflow: hidden;
}

.article-toc-progress span {
	display: block;
	width: 100%;
	height: 100%;
	background: #DE4523;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.1s linear;
}

.article-toc-list {
	position: relative;
	display: grid;
	gap: 2px;
}

.article-toc-list a {
	display: block;
	padding: 7px 10px;
	border-radius: 10px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	color: #4a4a4a;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s;
}

.article-toc-list a:hover,
.article-toc-list a:focus-visible {
	background: #f5f5f5;
	color: #DE4523;
	text-decoration: none;
}

.article-toc-list a.article-toc-nested {
	margin-left: 14px;
	font-size: 14px;
	color: #6b6b6b;
}

.article-toc-list a[aria-current="location"] {
	background: rgba(222, 69, 35, 0.08);
	color: #DE4523;
	font-weight: 600;
}

.article-toc-list a.article-toc-extra {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	padding-top: 10px;
	border-top: 1px solid #f0f0f0;
	border-radius: 0 0 10px 10px;
	font-size: 14px;
	color: #7a7a7a;
}

.article-toc-extra .icon-svg {
	width: 14px;
	height: 14px;
}

/* Mobile and tablet: collapsible block before the article text. */
@media (max-width: 991px) {
	.article-toc {
		padding: 0;
	}

	.article-toc-head {
		padding: 16px 18px;
		cursor: pointer;
	}

	.article-toc-count {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 24px;
		height: 22px;
		padding: 0 7px;
		border-radius: 11px;
		background: #f3f3f3;
		font-size: 12px;
		font-weight: 600;
		line-height: 1;
		letter-spacing: 0;
		font-variant-numeric: tabular-nums;
		color: #6b6b6b;
	}

	.article-toc-chevron {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 20px;
		height: 20px;
		font-size: 16px;
		transition: transform 0.2s;
	}

	.article-toc.is-open .article-toc-chevron {
		transform: rotate(180deg);
	}

	.article-toc-progress {
		display: none;
	}

	.article-toc-list {
		padding: 0 10px 12px;
	}

	.article-toc:not(.is-open) .article-toc-list {
		display: none;
	}

	/* The author card already carries a share button on small screens. */
	.article-sidebar-share {
		display: none;
	}

	.article-sidebar-share--always {
		display: block;
	}
}

/* ---------- Share menu ---------- */

.share-menu {
	position: relative;
}

.share-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 7px 14px;
	border: 1px solid #e4e4e4;
	border-radius: 999px;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	color: #303030;
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.share-trigger:hover,
.share-trigger:focus-visible,
.share-trigger[aria-expanded="true"] {
	border-color: #DE4523;
	color: #DE4523;
}

/* Icons inside flex rows render as blocks so baseline offsets never shift them off-center. */
.share-icon,
.article-layout .author-card .icon-svg,
.article-toc .icon-svg {
	display: block;
	flex: 0 0 auto;
	vertical-align: initial;
}

.share-icon {
	width: 16px;
	height: 16px;
}

.share-menu--full .share-trigger {
	width: 100%;
	padding: 13px 18px;
	border-color: transparent;
	border-radius: 16px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
	font-size: 15px;
}

.share-menu--full .share-trigger:hover,
.share-menu--full .share-trigger[aria-expanded="true"] {
	border-color: rgba(222, 69, 35, 0.35);
}

.share-trigger-chevron {
	display: inline-flex;
	margin-left: auto;
	transition: transform 0.2s;
}

.share-trigger[aria-expanded="true"] .share-trigger-chevron {
	transform: rotate(180deg);
}

.share-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 30;
	display: grid;
	gap: 2px;
	min-width: 220px;
	padding: 6px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
}

.share-panel[hidden] {
	display: none;
}

.share-menu--full .share-panel {
	width: 100%;
}

.share-menu--compact .share-panel {
	left: auto;
	right: 0;
	max-width: calc(100vw - 32px);
}

.share-menu--up .share-panel {
	top: auto;
	bottom: calc(100% + 8px);
}

.share-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 10px;
	background: none;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-align: left;
	color: #303030;
	cursor: pointer;
	text-decoration: none;
}

.share-item[hidden] {
	display: none;
}

.share-item .share-icon {
	color: #8a8a8a;
	transition: color 0.15s;
}

.share-item:hover,
.share-item:focus-visible {
	background: #f5f5f5;
	color: #DE4523;
	text-decoration: none;
}

.share-item:hover .share-icon,
.share-item:focus-visible .share-icon {
	color: #DE4523;
}

.share-item.is-copied,
.share-item.is-copied .share-icon {
	color: #2e8b57;
}

.share-status {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Author card ---------- */

.author-card {
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
	padding: 20px 24px;
}

.author-card--top {
	display: grid;
	gap: 16px;
}

.author-card-head,
.author-card-title {
	display: flex;
	align-items: center;
	gap: 14px;
}

.author-card-avatar {
	flex: 0 0 auto;
	border-radius: 50%;
}

.author-card-avatar img {
	display: block;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
}

.author-card-identity {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.author-card-name {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.25;
	color: #202020;
	text-decoration: none;
}

.author-card-name:hover {
	color: #DE4523;
	text-decoration: none;
}

.author-card-position {
	font-size: 14px;
	line-height: 1.35;
	color: #7a7a7a;
}

.author-card-socials {
	display: flex;
	flex: 0 1 auto;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
	max-width: 60%;
	margin-left: auto;
}

/* Author page: icons follow the bio, aligned to the left. */
.author-card-socials.author-page-socials {
	justify-content: flex-start;
	max-width: none;
	margin-left: 0;
}

.author-social {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #f4f4f4;
	color: #7a7a7a;
	transition: background-color 0.15s, color 0.15s;
}

.author-social:hover,
.author-social:focus-visible {
	background: #DE4523;
	color: #fff;
}

.author-social .share-icon {
	width: 15px;
	height: 15px;
}

.author-card-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	padding-top: 14px;
	border-top: 1px solid #f0f0f0;
	font-size: 14px;
	line-height: 1.3;
	color: #7a7a7a;
}

/* Stats wrap onto extra lines on the left; the share button keeps its own column on the right. */
.author-card-stats {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 20px;
	min-width: 0;
}

.author-card-stats > span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.author-card-meta .icon-svg {
	width: 15px;
	height: 15px;
	margin: 0;
}

.author-card-share {
	flex: 0 0 auto;
	margin-left: auto;
}

.author-card--bottom {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	margin-top: 48px;
	padding: 28px;
}

.author-card--bottom .author-card-avatar img {
	width: 72px;
	height: 72px;
}

.author-card-body {
	display: grid;
	flex: 1 1 auto;
	gap: 10px;
	min-width: 0;
}

.author-card-eyebrow {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #9a9a9a;
}

.author-card-bio {
	margin: 0;
	font-size: 16px;
	line-height: 1.6;
	color: #555;
}

.author-card-more {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	justify-self: start;
	font-size: 15px;
	font-weight: 600;
	color: #DE4523;
}

.author-card-more .icon-svg {
	width: 16px;
	height: 16px;
	transition: transform 0.15s;
}

.author-card-more:hover .icon-svg {
	transform: translateX(3px);
}

@media (max-width: 600px) {
	.author-card {
		padding: 16px;
	}

	.author-card-meta {
		gap: 12px;
	}

	.author-card-stats {
		gap: 6px 14px;
	}

	.author-card--bottom {
		flex-direction: column;
		gap: 14px;
		padding: 20px;
	}

	.author-card-title {
		flex-wrap: wrap;
	}

	/* Socials stay beside the name and wrap below it only when they do not fit. */
	.author-card-head {
		flex-wrap: wrap;
	}

	.author-card-head .author-card-identity {
		flex: 1 1 150px;
	}

	.author-card-head .author-card-socials {
		max-width: none;
	}
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
	.article-layout-sidebar,
	.article-toc-progress span,
	.share-trigger-chevron,
	.article-toc-chevron {
		transition: none;
	}
}

@media print {
	.article-layout-sidebar,
	.author-card-share,
	.author-card-socials {
		display: none !important;
	}

	.article-layout--sidebar {
		grid-template-columns: minmax(0, 1fr);
	}

	.article-layout--sidebar .article-layout-author,
	.article-layout--sidebar .article-layout-main {
		grid-column: 1;
		grid-row: auto;
	}
}
