/*
 * Softliro — blog, archives and long-form reading.
 * Loaded on the blog index, archives, search and single posts.
 */

/* ------------------------------------------------------- Page header */

.sl-page-header {
	padding-block: calc(var(--sl-section) * 0.7) 0;
}

.sl-page-header__eyebrow {
	margin-bottom: 14px;
}

.sl-page-header__title {
	margin: 0;
	font-size: var(--sl-h1);
	max-width: 20ch;
}

/*
 * A section that follows the page header carries the header's own bottom
 * space as well as its own top padding, which reads as a hole between the
 * title and the first thing under it. Half is enough to separate them.
 */
.sl-section--after-header {
	padding-top: calc(var(--sl-section) * 0.5);
}

.sl-page-header__description {
	margin-top: 20px;
	max-width: 58ch;
	color: var(--sl-text-soft);
}

.sl-author-card {
	display: flex;
	gap: 20px;
	align-items: center;
	margin-top: 28px;
	padding-top: 28px;
	border-top: var(--sl-border-w) solid var(--sl-hairline);
	max-width: 60ch;
}

.sl-author-card__avatar {
	border-radius: var(--sl-radius);
	flex: none;
}

.sl-author-card__bio {
	margin: 0;
	color: var(--sl-text-soft);
	font-size: 16px;
}

/* -------------------------------------------------------------- Cards */

.sl-card {
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-width: 0;
}

.sl-card__media {
	display: block;
	border-radius: var(--sl-radius);
	overflow: hidden;
	background: var(--sl-surface);
	aspect-ratio: 4 / 3;
}

.sl-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 600ms var(--sl-ease);
}

.sl-card:hover .sl-card__image {
	transform: scale(1.02);
}

.sl-card__body {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.sl-card__title {
	margin: 0;
	font-size: 21px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.sl-card__link {
	color: var(--sl-text);
}

.sl-card__link:hover {
	color: var(--sl-link);
}

/* Make the whole card clickable without nesting interactive elements. */
.sl-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.sl-card {
	position: relative;
}

.sl-card__excerpt {
	margin: 0;
	color: var(--sl-text-soft);
	font-size: 16px;
}

.sl-card--post.sl-entry--no-media .sl-card__body {
	padding-top: 20px;
	border-top: 2px solid var(--sl-hairline-strong);
}

/* ----------------------------------------------------------- Featured */

.sl-featured {
	position: relative;
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 0;
	border: var(--sl-border-w) solid var(--sl-hairline);
	border-radius: var(--sl-radius);
	overflow: hidden;
	margin-bottom: calc(var(--sl-gap) * 1.5);
}

.sl-featured__media {
	display: block;
	background: var(--sl-surface);
	min-height: 100%;
}

.sl-featured__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sl-featured__body {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 44px 40px;
	justify-content: center;
}

.sl-featured__title {
	margin: 0;
	font-size: clamp(28px, 3vw, 38px);
	line-height: 1.08;
}

.sl-featured__excerpt {
	margin: 0;
	color: var(--sl-text-soft);
	max-width: 46ch;
}

.sl-featured__flag {
	color: var(--sl-signal);
}

/* ------------------------------------------------------ Category grid */

/*
 * Term cards. Each card is one link to a term archive, so the grid is
 * navigation a crawler can follow rather than a filter that only exists in
 * memory. Column count rides on a custom property so an Elementor responsive
 * control can override it per breakpoint without a specificity fight.
 */

.sl-topics-band {
	margin-top: calc(var(--sl-section) * 0.55);
}

.sl-topics-band__title {
	margin: 0 0 18px;
	color: var(--sl-muted);
}

.sl-topics {
	display: grid;
	grid-template-columns: repeat(var(--sl-topics-columns, 3), minmax(0, 1fr));
	gap: var(--sl-gap);
}

.sl-topics--1 {
	--sl-topics-columns: 1;
}

.sl-topics--2 {
	--sl-topics-columns: 2;
}

.sl-topics--3 {
	--sl-topics-columns: 3;
}

.sl-topics--4 {
	--sl-topics-columns: 4;
}

.sl-topic {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	color: var(--sl-text);
	background: var(--sl-surface);
	border: var(--sl-border-w) solid var(--sl-hairline);
	border-radius: var(--sl-radius);
	overflow: hidden;
	transition: border-color var(--sl-duration) var(--sl-ease);
}

.sl-topic:hover,
.sl-topic:focus-visible {
	border-color: var(--sl-hairline-strong);
	color: var(--sl-text);
}

.sl-topic.is-current {
	border-color: var(--sl-primary);
}

.sl-topic--lead {
	grid-column: 1 / -1;
	flex-direction: row;
	align-items: stretch;
}

.sl-topic__media {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	background: var(--sl-bg);
	aspect-ratio: 16 / 9;
}

.sl-topic--lead .sl-topic__media {
	flex: 1 1 52%;
	aspect-ratio: auto;
	min-height: 320px;
}

.sl-topic__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 600ms var(--sl-ease);
}

.sl-topic:hover .sl-topic__image {
	transform: scale(1.02);
}

/* No post in the term carries an image — show the name on the hatch. */
.sl-topic__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 24px;
	text-align: center;
	color: var(--sl-muted);
	background-image: repeating-linear-gradient(
		135deg,
		var(--sl-wash) 0 1px,
		transparent 1px 11px
	);
}

.sl-topic__body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 24px;
}

.sl-topic--lead .sl-topic__body {
	flex: 1 1 48%;
	justify-content: center;
	padding: 44px 40px;
}

.sl-topic__flag {
	color: var(--sl-signal);
}

.sl-topic__name {
	margin: 0;
	font-family: var(--sl-font-display);
	font-size: 21px;
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.2;
}

.sl-topic--lead .sl-topic__name {
	font-size: clamp(28px, 3vw, 38px);
	font-weight: 300;
	letter-spacing: -0.035em;
	line-height: 1.08;
}

.sl-topic__count {
	color: var(--sl-text-faint);
}

.sl-topic.is-current .sl-topic__count {
	color: var(--sl-primary);
}

.sl-topic__description {
	margin: 0;
	font-size: 16px;
	color: var(--sl-text-soft);
	max-width: 46ch;
}

.sl-topic__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
	color: var(--sl-link);
}

/* -------------------------------------------------------- Index rows */

.sl-row {
	display: grid;
	grid-template-columns: 140px minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 24px;
	padding: 22px 0;
	border-bottom: var(--sl-border-w) solid var(--sl-hairline);
}

.sl-row:first-child {
	border-top: var(--sl-border-w) solid var(--sl-hairline);
}

.sl-row__date {
	font-family: var(--sl-font-mono);
	font-size: 11px;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
}

.sl-row__title {
	margin: 0;
	font-family: var(--sl-font-display);
	font-size: 22px;
	font-weight: 300;
	letter-spacing: -0.025em;
}

.sl-row__link {
	color: var(--sl-text);
}

.sl-row:hover .sl-row__link {
	color: var(--sl-link);
}

/* ------------------------------------------------------ Single post */

.sl-single__header {
	padding-block: calc(var(--sl-section) * 0.7) 0;
}

.sl-single__term {
	margin-bottom: 16px;
}

/*
 * Full width. The 18ch cap held a post title to roughly three words a line,
 * which suits a project name and starves a sentence — "Why your business still
 * needs a marketing website in 2026" ran to four lines in a column half the
 * page wide, with the other half empty beside it.
 */
.sl-single__title {
	margin: 0;
	font-size: var(--sl-h1);
	max-width: none;
	text-wrap: balance;
}

.sl-single__lead {
	margin: 24px 0 0;
	max-width: 58ch;
	font-size: 21px;
	line-height: 1.45;
	color: var(--sl-text-soft);
}

.sl-single__header .sl-meta {
	margin-top: 28px;
	padding-top: 20px;
	border-top: var(--sl-border-w) solid var(--sl-hairline);
}

.sl-single__media {
	margin-top: 44px;
}

.sl-single__image {
	width: 100%;
	border-radius: var(--sl-radius);
}

.sl-single__caption {
	margin-top: 12px;
	font-family: var(--sl-font-mono);
	font-size: 11px;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
}

.sl-single .sl-layout {
	padding-block: var(--sl-section);
}

/*
 * Long-form content
 *
 * These are prose rules — they exist to set a rhythm for headings an author
 * typed into the editor. The :not() guard keeps them off anything carrying a
 * component class, because .sl-entry-content is also an ancestor of Elementor
 * page content, and a descendant selector (0-1-1) outranks a component's own
 * class (0-1-0). Without the guard, .sl-grid-item__title and .sl-tier__title
 * silently render at prose sizes on any page that happens to load this file.
 */

.sl-entry-content > * + * {
	margin-top: 1.3em;
}

.sl-entry-content h2:not([class*="sl-"]):not(.elementor-heading-title) {
	margin-top: 2em;
	font-size: clamp(26px, 3vw, 34px);
}

.sl-entry-content h3:not([class*="sl-"]):not(.elementor-heading-title) {
	margin-top: 1.8em;
	font-size: clamp(21px, 2.2vw, 25px);
}

.sl-entry-content ul,
.sl-entry-content ol {
	padding-left: 1.3em;
}

.sl-entry-content li + li {
	margin-top: 0.5em;
}

.sl-entry-content img,
.sl-entry-content figure {
	border-radius: var(--sl-radius);
}

.sl-entry-content figcaption {
	margin-top: 10px;
	font-family: var(--sl-font-mono);
	font-size: 11px;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
}

.sl-entry-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 16px;
}

.sl-entry-content th,
.sl-entry-content td {
	text-align: left;
	padding: 12px 14px;
	border-bottom: var(--sl-border-w) solid var(--sl-hairline);
}

.sl-entry-content th {
	font-family: var(--sl-font-mono);
	font-size: 11px;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
	font-weight: 500;
}

/* Tables scroll rather than forcing the page to. */
.sl-entry-content > table {
	display: block;
	overflow-x: auto;
}

/* Attribution under a pull quote. The quote itself is styled globally. */
.sl-entry-content blockquote cite {
	display: block;
	margin-top: 14px;
	font-family: var(--sl-font-mono);
	font-size: 11px;
	font-style: normal;
	font-weight: 500;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
}

/*
 * A mono marker above a heading, for numbered sections in long-form content.
 *
 * The marker belongs to the heading below it, not to the paragraph above, so
 * the space goes on top. Without it the label sat tight under the previous
 * section's last line and read as a footnote to the wrong section.
 */
.sl-entry-content .sl-label {
	display: block;
	/* 4.8em against the label's own 11px is ~53px — about fifteen more than
	   before, which is what separates the sections rather than just spacing
	   the paragraphs. */
	margin-top: 4.8em;
	color: var(--sl-muted);
}

.sl-entry-content > .sl-label:first-child {
	margin-top: 0;
}

/*
 * Written to outrank `.sl-entry-content h2:not([class*="sl-"]):not(...)`, which
 * is 0-3-1 and sets 2em. The old rule here was 0-2-1, so it silently lost and
 * every heading sat two ems below the label introducing it — the label looked
 * detached from its own section at both ends.
 */
.sl-entry-content .sl-label + h2:not([class*="sl-"]):not(.elementor-heading-title) {
	margin-top: 0.3em;
}

.sl-single__footer {
	margin-top: 2.5em;
	padding-top: 1.5em;
	border-top: var(--sl-border-w) solid var(--sl-hairline);
}

/* ------------------------------------------- Post navigation, related */

.sl-post-nav {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sl-border-w);
	background: var(--sl-hairline);
	border: var(--sl-border-w) solid var(--sl-hairline);
	border-radius: var(--sl-radius);
	overflow: hidden;
}

.sl-post-nav__link {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 28px;
	background: var(--sl-bg);
	color: var(--sl-text);
	transition: background-color var(--sl-duration) var(--sl-ease);
}

.sl-post-nav__link:hover {
	background: var(--sl-surface);
	color: var(--sl-text);
}

.sl-post-nav__link--next {
	text-align: right;
	align-items: flex-end;
}

.sl-post-nav__title {
	font-family: var(--sl-font-display);
	font-size: 19px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.sl-related {
	margin-top: var(--sl-section);
}

/*
 * Related reading straight after a post. The article already ends on a full
 * section of padding, so the wrapper's own top padding and the related
 * block's top margin would stack two more on top of it (312px in all). One
 * section gap is the rhythm used everywhere else.
 */
.sl-single + .sl-section {
	padding-top: 0;
}

.sl-single + .sl-section > .sl-related:first-child {
	margin-top: 0;
}

.sl-related__title {
	font-size: var(--sl-h3);
	margin-bottom: calc(var(--sl-gap) * 1.2);
}

/* ------------------------------------------------------------- Empty */

.sl-empty,
.sl-404 {
	max-width: 56ch;
	padding-block: calc(var(--sl-section) * 0.6);
}

.sl-empty__title,
.sl-404__title {
	font-size: var(--sl-h2);
	margin: 20px 0 16px;
}

.sl-empty__text,
.sl-404__text {
	color: var(--sl-text-soft);
	margin-bottom: 28px;
}

.sl-empty__form,
.sl-404__form {
	max-width: 420px;
	margin-bottom: 28px;
}

.sl-empty__stroke,
.sl-404__stroke {
	width: 200px;
	margin-top: 56px;
	color: var(--sl-hairline-strong);
}

.sl-search-again {
	max-width: 480px;
	margin-bottom: calc(var(--sl-gap) * 2);
}

/* -------------------------------------------------------- Breakpoints */

@media (max-width: 1024px) {
	.sl-topics {
		--sl-topics-columns: 2;
	}
}

@media (max-width: 860px) {
	.sl-featured {
		grid-template-columns: minmax(0, 1fr);
	}

	.sl-featured__body {
		padding: 32px 28px;
	}

	.sl-topic--lead {
		flex-direction: column;
	}

	.sl-topic--lead .sl-topic__media {
		aspect-ratio: 16 / 9;
		min-height: 0;
	}

	.sl-topic--lead .sl-topic__body {
		padding: 28px;
	}

	.sl-row {
		grid-template-columns: minmax(0, 1fr);
		gap: 8px;
	}

	.sl-post-nav {
		grid-template-columns: minmax(0, 1fr);
	}

	.sl-post-nav__link--next {
		text-align: left;
		align-items: flex-start;
	}
}

@media (max-width: 640px) {
	.sl-topics {
		--sl-topics-columns: 1;
	}
}

/* ------------------------------------------------------- Author box */

/*
 * Sits under the post, inside the reading measure, in the same hairline box
 * language as the rest of the site. Deliberately quiet: it closes the article
 * rather than competing with it.
 */
.sl-author-box {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	margin-top: 40px;
	padding: 28px 30px;
	border: var(--sl-border-w) solid var(--sl-hairline-strong);
	border-radius: var(--sl-radius);
	background: var(--sl-surface);
}

.sl-author-box__media {
	flex: none;
}

.sl-author-box__avatar {
	display: block;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	border: var(--sl-border-w) solid var(--sl-hairline-strong);
}

.sl-author-box__body {
	min-width: 0;
}

.sl-author-box__label {
	display: block;
	margin-bottom: 10px;
	color: var(--sl-muted);
}

.sl-author-box__name {
	margin: 0;
	font-family: var(--sl-font-display);
	font-weight: 700;
	font-size: 21px;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.sl-author-box__role {
	margin: 4px 0 0;
	font-family: var(--sl-font-mono);
	font-size: 12px;
	letter-spacing: var(--sl-label-tracking);
	text-transform: uppercase;
	color: var(--sl-muted);
}

.sl-author-box__bio {
	margin: 12px 0 0;
	color: var(--sl-text-soft);
	max-width: 58ch;
}

.sl-author-box__links {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	margin-top: 18px;
}

@media (max-width: 640px) {
	.sl-author-box {
		flex-direction: column;
		gap: 18px;
		padding: 24px 22px;
	}

	.sl-author-box__avatar {
		width: 56px;
		height: 56px;
	}
}

/* The studio's name inside the bio: brighter than the sentence around it. */
.sl-author-box__brand {
	font-weight: 700;
	color: var(--sl-text);
}

/* ------------------------------------------------- Single post — contents rail */

/*
 * The rail sits to the left of the prose and holds the post's own h2s. It only
 * renders when the post has headings with ids, so a short post with none gets
 * the plain single-column body it had before.
 */
.sl-single__grid--railed {
	display: grid;
	grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
	gap: 64px;
	align-items: start;
}

.sl-single__rail {
	position: sticky;
	/* --sl-header-h, so it tracks the responsive header rather than a fixed guess. */
	top: calc(var(--sl-header-h, 76px) + 34px);
	min-width: 0;
}

.sl-single__rail-title {
	display: block;
	padding-bottom: 12px;
	border-bottom: var(--sl-border-w) solid var(--sl-hairline-strong);
	color: var(--sl-muted);
}

.sl-single__toc {
	display: flex;
	flex-direction: column;
}

.sl-single__toc-link {
	display: flex;
	gap: 10px;
	padding: 11px 0;
	border-bottom: var(--sl-border-w) solid var(--sl-wash);
	color: var(--sl-text);
	font-size: 15px;
	line-height: 1.35;
	transition: color var(--sl-duration) var(--sl-ease);
}

.sl-single__toc-link:hover,
.sl-single__toc-link:focus-visible {
	color: var(--sl-link);
}

.sl-single__toc-index {
	flex: none;
	padding-top: 3px;
	font-family: var(--sl-font-mono);
	font-size: 11px;
	letter-spacing: var(--sl-label-tracking);
	color: var(--sl-muted);
}

/* The prose keeps its own measure; the rail is what the extra column is for. */
.sl-single__grid--railed .sl-reading {
	margin-inline: 0;
}

@media (max-width: 1024px) {
	/* Below this the rail would squeeze the prose; it goes above it instead. */
	.sl-single__grid--railed {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.sl-single__rail {
		position: static;
	}
}
