/*
 * Themor's blog module: the featured posts slider, "Load more", the reading progress bar, the
 * table of contents and share buttons. A theme restyles it through the custom properties below.
 */

:root {
	--themor-blog-bg: #fff;
	--themor-blog-text: #1f2937;
	--themor-blog-heading: #111827;
	--themor-blog-muted: #6b7280;
	--themor-blog-border: #e5e7eb;
	--themor-blog-surface: #f8fafc;
	--themor-blog-accent: #2563eb;
	--themor-blog-on-accent: #fff;
	--themor-blog-radius: 12px;
	--themor-blog-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* The featured posts slider: slides side by side, scrolled one at a time. */
.themor-featured {
	position: relative;
	margin-block-end: clamp(2rem, 4vw, 3rem);
}

.themor-featured__track {
	display: grid;
	grid-auto-columns: 100%;
	grid-auto-flow: column;
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	border-radius: var(--themor-blog-radius);
}

.themor-featured__track::-webkit-scrollbar {
	display: none;
}

.themor-featured__track:focus-visible {
	outline: 2px solid var(--themor-blog-accent);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.themor-featured__track {
		scroll-behavior: auto;
	}
}

.themor-featured__slide {
	position: relative;
	scroll-snap-align: start;
	overflow: hidden;
	border-radius: var(--themor-blog-radius);
	background: var(--themor-blog-surface);
}

.themor-featured__link {
	display: block;
	color: #fff;
	text-decoration: none;
}

.themor-featured__image {
	display: block;
	width: 100%;
	height: clamp(260px, 42vw, 480px);
	object-fit: cover;
	transition: transform 0.8s var(--themor-blog-ease);
}

.themor-featured__link:hover .themor-featured__image {
	transform: scale(1.03);
}

.themor-featured__text {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
	padding: clamp(1.25rem, 4vw, 2.5rem);
	padding-inline-end: clamp(5rem, 12vw, 8rem);
	background: linear-gradient(to top, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0));
}

.themor-featured__category {
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	background: var(--themor-blog-accent);
	color: var(--themor-blog-on-accent);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.themor-featured__title {
	max-width: 32ch;
	font-size: clamp(1.4rem, 3vw, 2.2rem);
	font-weight: 700;
	line-height: 1.15;
	text-wrap: balance;
}

.themor-featured__date {
	opacity: 0.85;
	font-size: 0.875rem;
}

.themor-featured__nav {
	position: absolute;
	inset-block-end: clamp(1.25rem, 4vw, 2.5rem);
	inset-inline-end: clamp(1.25rem, 4vw, 2.5rem);
	display: flex;
	gap: 0.5rem;
}

.themor-featured__button {
	display: inline-grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	color: #0f172a;
	cursor: pointer;
	box-shadow: 0 6px 18px -6px rgba(15, 23, 42, 0.45);
}

.themor-featured__button:hover {
	background: #fff;
}

.themor-featured__button:disabled {
	opacity: 0.45;
	cursor: default;
}

[dir="rtl"] .themor-featured__button svg {
	transform: scaleX(-1);
}

/* "Load more". */
.themor-blog-more {
	display: flex;
	justify-content: center;
	margin-block: 2.5rem 0.5rem;
}

.themor-blog-more .button[aria-busy="true"],
.themor-blog-more button[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

/* The reading progress bar. */
.themor-progress {
	position: fixed;
	z-index: 9990;
	inset-block-start: var(--wp-admin--admin-bar--height, 0px);
	inset-inline: 0;
	height: 3px;
	pointer-events: none;
}

.themor-progress__bar {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--themor-blog-accent);
	transform: scaleX(var(--themor-progress, 0));
	transform-origin: left center;
}

[dir="rtl"] .themor-progress__bar {
	transform-origin: right center;
}

/* The table of contents. */
.themor-toc {
	margin-block: 0 2rem;
	padding: 1.1rem 1.35rem;
	border: 1px solid var(--themor-blog-border);
	border-radius: var(--themor-blog-radius);
	background: var(--themor-blog-surface);
}

.themor-toc__title {
	color: var(--themor-blog-heading);
	font-weight: 700;
	cursor: pointer;
}

.themor-toc__list {
	margin: 0.75rem 0 0;
	padding-inline-start: 1.25rem;
}

.themor-toc__item {
	margin-block: 0.3rem;
}

.themor-toc__item--h3 {
	margin-inline-start: 1rem;
}

.themor-toc__item--h4 {
	margin-inline-start: 2rem;
}

.themor-toc__item a {
	color: inherit;
	text-decoration: none;
}

.themor-toc__item a:hover,
.themor-toc__item a:focus-visible {
	color: var(--themor-blog-accent);
	text-decoration: underline;
}

:where(h2, h3, h4)[id] {
	scroll-margin-block-start: calc(var(--wp-admin--admin-bar--height, 0px) + 6rem);
}

/* Share buttons. */
.themor-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin-block-start: 2.5rem;
	padding-block-start: 1.5rem;
	border-block-start: 1px solid var(--themor-blog-border);
}

.themor-share__title {
	margin: 0;
	color: var(--themor-blog-heading);
	font-weight: 700;
}

.themor-share__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.themor-share__list li {
	margin: 0;
}

.themor-share__button {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	margin: 0;
	padding: 0;
	border: 1px solid var(--themor-blog-border);
	border-radius: 999px;
	background: var(--themor-blog-bg);
	color: var(--themor-blog-heading);
	font-size: 1rem;
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.themor-share__button:hover,
.themor-share__button:focus-visible {
	border-color: var(--themor-share-brand, var(--themor-blog-accent));
	background: var(--themor-share-brand, var(--themor-blog-accent));
	color: #fff;
}

.themor-share__button.is-copied {
	border-color: #16a34a;
	background: #16a34a;
	color: #fff;
}

/* Related posts: a row of cards after the post, as many to a row as fit. */
.themor-related {
	margin-block-start: 2.5rem;
	padding-block-start: 1.5rem;
	border-block-start: 1px solid var(--themor-blog-border);
}

.themor-related__title {
	margin: 0 0 1.25rem;
	color: var(--themor-blog-heading);
	font-size: 1.25rem;
}

.themor-related__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.themor-related__item {
	margin: 0;
}

.themor-related__link {
	display: grid;
	gap: 0.75rem;
	color: var(--themor-blog-heading);
	text-decoration: none !important;
}

.themor-related__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	border-radius: var(--themor-blog-radius);
	background: var(--themor-blog-surface);
	object-fit: cover;
	transition: opacity 0.2s;
}

.themor-related__name {
	font-weight: 600;
	line-height: 1.35;
}

.themor-related__link:hover .themor-related__name,
.themor-related__link:focus-visible .themor-related__name {
	color: var(--themor-blog-accent);
}

.themor-related__link:hover .themor-related__image {
	opacity: 0.88;
}

.themor-related__date {
	display: block;
	margin-block-start: 0.35rem;
	color: var(--themor-blog-muted);
	font-size: 0.875rem;
}

/* The share buttons beside the post: a column, fixed, faded in while the post is read. */
.themor-share-float {
	position: fixed;
	z-index: 50;
	inset-block-start: 50%;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity 0.2s;
}

.themor-share-float.is-shown {
	opacity: 1;
	pointer-events: auto;
}

.themor-share-float .themor-share__list {
	flex-direction: column;
}

@media (max-width: 1199px) {
	.themor-share-float {
		display: none;
	}
}

/* The Most read list. */
.themor-popular {
	display: grid;
	gap: 0.85rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.themor-popular__item {
	margin: 0;
}

.themor-popular__link {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	color: var(--themor-blog-heading);
	text-decoration: none !important;
}

.themor-popular__image,
.themor-popular__rank {
	flex: none;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: calc(var(--themor-blog-radius) * 0.6);
	object-fit: cover;
}

.themor-popular__rank {
	display: grid;
	place-items: center;
	background: var(--themor-blog-surface);
	color: var(--themor-blog-muted);
	font-weight: 700;
}

.themor-popular__title {
	display: block;
	font-weight: 600;
	line-height: 1.35;
}

.themor-popular__link:hover .themor-popular__title {
	color: var(--themor-blog-accent);
}

.themor-popular__views {
	display: block;
	margin-block-start: 0.15rem;
	color: var(--themor-blog-muted);
	font-size: 0.8125rem;
}

/* The author page header. */
.themor-author {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.25rem 1.5rem;
	margin-block-end: 2.5rem;
	padding: clamp(1.25rem, 3vw, 2rem);
	border-radius: var(--themor-blog-radius);
	background: var(--themor-blog-surface);
}

.themor-author__picture {
	flex: none;
	width: 112px;
	height: 112px;
	border-radius: 50%;
}

.themor-author__text {
	flex: 1 1 18rem;
	min-width: 0;
}

.themor-author__name {
	margin: 0;
	color: var(--themor-blog-heading);
	font-size: 1.5rem;
}

.themor-author__count {
	margin: 0.2rem 0 0;
	color: var(--themor-blog-muted);
	font-size: 0.9rem;
}

.themor-author__bio {
	margin-block-start: 0.85rem;
}

.themor-author__bio > :last-child {
	margin-block-end: 0;
}

.themor-author__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.themor-author__links a {
	display: inline-grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--themor-blog-border);
	border-radius: 999px;
	background: var(--themor-blog-bg);
	color: var(--themor-blog-heading);
	text-decoration: none !important;
}

.themor-author__links a:hover,
.themor-author__links a:focus-visible {
	border-color: var(--themor-blog-accent);
	color: var(--themor-blog-accent);
}

/* Post series: the box above or below a post in a series. */
.themor-series {
	display: grid;
	gap: 0.6rem;
	margin-block: 0 2rem;
	padding: 1rem 1.25rem;
	border: 1px solid var(--themor-blog-border);
	border-radius: 10px;
	font-size: 0.95rem;
}

.themor-series:last-child {
	margin-block: 2rem 0;
}

.themor-series p {
	margin: 0;
}

.themor-series__where {
	font-weight: 600;
	color: var(--themor-blog-heading);
}

.themor-series__parts summary {
	cursor: pointer;
	color: var(--themor-blog-muted);
}

.themor-series__parts ol {
	margin: 0.5rem 0 0;
	padding-inline-start: 1.5rem;
}

.themor-series__parts li {
	margin: 0.25rem 0;
}

.themor-series__parts [aria-current] span {
	font-weight: 600;
}

.themor-series__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 1rem;
}

.themor-series__links a {
	text-decoration: none;
}

.themor-series__links span {
	color: var(--themor-blog-muted);
}

.themor-series__next {
	margin-inline-start: auto;
	text-align: end;
}

