/**
 * Single-post typography and article furniture.
 *
 * Structure and components follow "Template libary":
 *   buying-guide-template/best_keyword_Post.html   (best)
 *   comparison-post-template/comparison-page.html  (comparison)
 *   how-to-template/how-to-install.html            (how-to)
 *   table-templates/vivid-tables-buyer-reports-v1.html (spec tables)
 *
 * Rendered in Stitch tokens rather than the templates' own sand/amber palette,
 * so posts sit in the same design system as the rest of the site.
 *
 * FIXES the left-oriented post container: the site wrappers are 100% wide by
 * design (full-bleed bands), so the ARTICLE has to supply its own centred
 * measure. Without this, prose ran the full viewport - 3430px on a 3440px
 * screen.
 */

/* ============================================================
   MEASURE — the container fix
   ============================================================ */
.aa-article__measure {
	width: 100%;
	max-width: 760px;          /* ~75 characters of Libre Franklin at 18px */
	margin-inline: auto;
	padding-inline: var(--margin-mobile);
}

.aa-article__measure--wide { max-width: 1160px; }

@media (min-width: 768px) {
	.aa-article__measure { padding-inline: var(--margin-desktop); }
}

.aa-article { background: var(--surface-bright); }

/* ============================================================
   MASTHEAD
   ============================================================ */
.aa-article__head {
	padding-block: clamp(28px, 5vw, 56px) 24px;
	border-bottom: 2px solid var(--asphalt-black);
	margin-bottom: 32px;
}

.aa-crumbs {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	font-family: var(--font-util);
	font-size: var(--caption);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--rim-gray);
}

.aa-crumbs a { color: var(--rim-gray); }
.aa-crumbs a:hover { color: var(--race-red); }

.aa-article__kicker {
	display: inline-block;
	background: var(--race-red);
	color: var(--paper-white);
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	padding: 4px 12px;
	margin-bottom: 16px;
	box-shadow: var(--pop-black);
}

.aa-article__title {
	font-family: var(--font-display);
	font-size: clamp(32px, 5vw, var(--headline-lg));
	line-height: 1.02;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin: 0 0 16px;
}

.aa-article__standfirst {
	font-family: var(--font-body);
	font-size: var(--body-lg);
	line-height: var(--body-lg-lh);
	color: var(--on-surface-variant);
	margin: 0 0 24px;
	max-width: 62ch;
}

/* --- byline ------------------------------------------------------- */
.aa-byline {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.aa-byline__avatar {
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	border: 2px solid var(--asphalt-black);
	flex: 0 0 auto;
}

.aa-byline__name {
	display: block;
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--asphalt-black);
}

.aa-byline__role {
	display: block;
	font-family: var(--font-util);
	font-size: var(--caption);
	color: var(--rim-gray);
}

/* --- trust bar ---------------------------------------------------- */
.aa-trustbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	padding-top: 16px;
	border-top: 1px solid var(--surface-dim);
}

.aa-trustbar__item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-util);
	font-size: var(--caption);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rim-gray);
}

.aa-trustbar__dot {
	width: 6px;
	height: 6px;
	background: var(--race-red);
	flex: 0 0 auto;
}

/* --- lede image --------------------------------------------------- */
.aa-article__lede { margin: 0 0 40px; }

.aa-article__lede img {
	display: block;
	width: 100%;
	height: auto;
	border-top: 4px solid var(--race-red);
}

/* ============================================================
   TL;DR + CONTENTS
   ============================================================ */
.aa-tldr {
	background: var(--surface-container-low);
	border-left: 4px solid var(--race-red);
	padding: 20px 24px;
	margin-bottom: 32px;
}

.aa-tldr__label,
.aa-toc__label,
.aa-verdict__label,
.aa-toolcta__label {
	display: block;
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--caption);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--race-red);
	margin-bottom: 8px;
}

.aa-tldr p {
	font-family: var(--font-body);
	font-size: var(--body-lg);
	line-height: var(--body-lg-lh);
	margin: 0;
}

.aa-toc {
	border: 1px solid var(--surface-dim);
	background: var(--paper-white);
	padding: 20px 24px;
	margin-bottom: 40px;
}

.aa-toc ol {
	margin: 0;
	padding-left: 20px;
	columns: 1;
}

@media (min-width: 640px) {
	.aa-toc ol { columns: 2; column-gap: 32px; }
}

.aa-toc li {
	margin-bottom: 6px;
	break-inside: avoid;
	font-family: var(--font-body);
	font-size: var(--body-md);
}

.aa-toc a { color: var(--asphalt-black); }
.aa-toc a:hover { color: var(--race-red); text-decoration: underline; }

/* ============================================================
   PROSE
   ============================================================ */
.aa-prose {
	font-family: var(--font-body);
	font-size: var(--body-lg);
	line-height: var(--body-lg-lh);
	color: var(--on-surface);
}

.aa-prose > * + * { margin-top: 1.25em; }

.aa-prose h2 {
	font-family: var(--font-headline);
	font-size: clamp(26px, 3.4vw, var(--headline-md));
	line-height: 1.1;
	text-transform: uppercase;
	letter-spacing: -0.01em;
	color: var(--asphalt-black);
	margin-top: 2em;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--asphalt-black);
	scroll-margin-top: 140px;   /* clears the fixed topbar on anchor jumps */
}

.aa-prose h3 {
	font-family: var(--font-headline);
	font-size: 24px;
	line-height: 1.15;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin-top: 1.75em;
	scroll-margin-top: 140px;
}

.aa-prose h4 {
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--subheading);
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin-top: 1.5em;
}

.aa-prose p { margin-bottom: 0; }

.aa-prose a {
	color: var(--race-red);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.aa-prose a:hover { color: var(--surface-tint); }

.aa-prose ul,
.aa-prose ol { padding-left: 24px; }

.aa-prose li { margin-bottom: 8px; }

.aa-prose li::marker { color: var(--race-red); font-weight: 700; }

.aa-prose img,
.aa-prose figure img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--surface-dim);
}

.aa-prose figcaption {
	font-family: var(--font-util);
	font-size: var(--caption);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--rim-gray);
	margin-top: 8px;
}

.aa-prose blockquote {
	margin: 2em 0;
	padding: 4px 0 4px 20px;
	border-left: 4px solid var(--race-red);
	font-family: var(--font-body);
	font-size: var(--body-lg);
	color: var(--on-surface);
}

.aa-prose blockquote p { margin: 0; }

.aa-prose code {
	font-family: var(--font-util);
	background: var(--surface-container);
	border: 1px solid var(--surface-dim);
	padding: 1px 6px;
	font-size: 0.92em;
}

.aa-prose hr {
	border: 0;
	border-top: 2px solid var(--asphalt-black);
	margin: 2.5em 0;
}

/* --- spec tables, per table-templates ----------------------------- */
.aa-prose table {
	width: 100%;
	border-collapse: collapse;
	margin: 2em 0;
	font-family: var(--font-body);
	font-size: var(--body-md);
}

.aa-prose thead th {
	background: var(--asphalt-black);
	color: var(--paper-white);
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-align: left;
	padding: 12px 14px;
	border: 0;
}

.aa-prose tbody td,
.aa-prose tbody th {
	padding: 11px 14px;
	border: 0;
	border-bottom: 1px solid var(--surface-dim);
	vertical-align: top;
}

.aa-prose tbody th {
	font-family: var(--font-util);
	font-weight: 700;
	text-align: left;
	color: var(--asphalt-black);
}

.aa-prose tbody tr:nth-child(even) td,
.aa-prose tbody tr:nth-child(even) th { background: var(--surface-container-low); }

/* wide tables scroll rather than break the measure */
.aa-prose table { display: block; overflow-x: auto; white-space: nowrap; }

@media (min-width: 900px) {
	.aa-prose table { display: table; white-space: normal; }
}

/* ============================================================
   CALLOUTS — how-to + comparison
   ============================================================ */
.aa-callout {
	display: flex;
	gap: 14px;
	background: var(--surface-container-low);
	border: 1px solid var(--surface-dim);
	border-left: 4px solid var(--race-red);
	padding: 18px 20px;
	margin-bottom: 32px;
	font-family: var(--font-body);
	font-size: var(--body-md);
	line-height: var(--body-md-lh);
}

.aa-callout--warn {
	background: var(--primary-fixed, var(--surface-container-low));
	border-left-color: var(--error);
}

.aa-callout__mark {
	width: 8px;
	height: 8px;
	margin-top: 7px;
	flex: 0 0 auto;
	background: var(--race-red);
}

.aa-callout--warn .aa-callout__mark { background: var(--error); }
.aa-callout a { color: var(--race-red); text-decoration: underline; }

/* ============================================================
   STEPS — how-to
   ============================================================ */
.aa-article--how-to .aa-prose > ol {
	list-style: none;
	padding-left: 0;
	counter-reset: aa-step;
}

.aa-article--how-to .aa-prose > ol > li {
	position: relative;
	counter-increment: aa-step;
	padding: 0 0 20px 56px;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--surface-dim);
}

.aa-article--how-to .aa-prose > ol > li::before {
	content: counter(aa-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	background: var(--asphalt-black);
	color: var(--paper-white);
	font-family: var(--font-display);
	font-size: 20px;
	line-height: 1;
}

.aa-article--how-to .aa-prose > ol > li:last-child { border-bottom: 0; }

/* ============================================================
   VERDICT + TOOL CTA
   ============================================================ */
.aa-verdict {
	background: var(--asphalt-black);
	color: var(--paper-white);
	border-top: 4px solid var(--race-red);
	padding: 24px 28px;
	margin: 40px 0 32px;
}

.aa-verdict p {
	color: var(--inverse-on-surface);
	font-family: var(--font-body);
	font-size: var(--body-lg);
	line-height: var(--body-lg-lh);
	margin: 0;
}

.aa-toolcta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 20px;
	border: 2px solid var(--asphalt-black);
	background: var(--paper-white);
	box-shadow: var(--pop-red);
	padding: 24px 28px;
	margin: 40px 0;
}

@media (min-width: 640px) {
	.aa-toolcta { flex-direction: row; align-items: center; justify-content: space-between; }
}

.aa-toolcta__title {
	font-family: var(--font-headline);
	font-size: 26px;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin: 0 0 6px;
}

.aa-toolcta p {
	font-family: var(--font-body);
	font-size: var(--body-md);
	color: var(--rim-gray);
	margin: 0;
}

.aa-toolcta .stitch-btn { flex: 0 0 auto; }

/* ============================================================
   METHOD + DATELINE
   ============================================================ */
.aa-method {
	border-top: 2px solid var(--asphalt-black);
	padding-top: 24px;
	margin-top: 48px;
}

.aa-method h2 {
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--subheading);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin: 0 0 12px;
}

.aa-method p {
	font-family: var(--font-body);
	font-size: var(--body-md);
	line-height: var(--body-md-lh);
	color: var(--rim-gray);
	margin: 0 0 12px;
}

.aa-method__links { display: flex; gap: 20px; flex-wrap: wrap; }

.aa-method__links a {
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--caption);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--race-red);
}

.aa-dateline {
	font-family: var(--font-util);
	font-size: var(--caption);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rim-gray);
	margin-bottom: 24px;
}

/* ============================================================
   RELATED
   ============================================================ */
.aa-article__related {
	margin-top: 64px;
	padding-block: 48px;
	border-top: 2px solid var(--asphalt-black);
	background: var(--surface-container-low);
}

/* ============================================================
   ARCHIVE / CATEGORY — same measure discipline
   ============================================================ */
body.archive .site-main,
body.search .site-main,
body.blog .site-main {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--margin-mobile);
	padding-block: 40px;
}

@media (min-width: 768px) {
	body.archive .site-main,
	body.search .site-main,
	body.blog .site-main { padding-inline: var(--margin-desktop); }
}

/* ============================================================
   ARCHIVE / SEARCH
   ============================================================
   The site wrappers are pinned to max-width:100% !important in two places so
   full-bleed bands work, which is why a `body.archive .site-main` rule could
   never centre anything. The archive supplies its own measure instead — same
   approach as .aa-article__measure.
   ------------------------------------------------------------ */
.aa-archive { background: var(--surface-bright); }

.aa-archive__measure {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--margin-mobile);
}

@media (min-width: 768px) {
	.aa-archive__measure { padding-inline: var(--margin-desktop); }
}

.aa-archive__head {
	padding-block: clamp(28px, 5vw, 56px) 24px;
	border-bottom: 2px solid var(--asphalt-black);
	margin-bottom: 40px;
}

.aa-archive__kicker {
	display: inline-block;
	background: var(--race-red);
	color: var(--paper-white);
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	padding: 4px 12px;
	margin-bottom: 16px;
	box-shadow: var(--pop-black);
}

.aa-archive__title {
	font-family: var(--font-display);
	font-size: clamp(32px, 5vw, var(--headline-lg));
	line-height: 1.02;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin: 0 0 16px;
}

.aa-archive__standfirst {
	font-family: var(--font-body);
	font-size: var(--body-lg);
	line-height: var(--body-lg-lh);
	color: var(--on-surface-variant);
	margin: 0 0 24px;
	max-width: 70ch;
}

/* child-topic chips */
.aa-subnav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 20px;
}

.aa-subnav a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 14px;
	border: 1px solid var(--asphalt-black);
	background: var(--paper-white);
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}

.aa-subnav a:hover { background: var(--race-red); border-color: var(--race-red); color: var(--paper-white); }
.aa-subnav a span { color: var(--rim-gray); font-variant-numeric: tabular-nums; }
.aa-subnav a:hover span { color: var(--paper-white); }

.aa-archive__body { padding-bottom: 56px; }

/* pagination */
.aa-pagination {
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 48px;
}

.aa-pagination .page-numbers {
	display: inline-block;
	padding: 9px 16px;
	border: 1px solid var(--asphalt-black);
	background: var(--paper-white);
	font-family: var(--font-util);
	font-weight: 700;
	font-size: var(--label-bold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--asphalt-black);
}

.aa-pagination .page-numbers:hover,
.aa-pagination .page-numbers.current {
	background: var(--race-red);
	border-color: var(--race-red);
	color: var(--paper-white);
}

.aa-pagination .dots { border-color: transparent; background: transparent; }

/* empty state */
.aa-empty {
	border: 2px solid var(--asphalt-black);
	background: var(--paper-white);
	padding: 40px 32px;
	text-align: center;
}

.aa-empty h2 {
	font-family: var(--font-headline);
	font-size: 28px;
	text-transform: uppercase;
	color: var(--asphalt-black);
	margin: 0 0 10px;
}

.aa-empty p {
	font-family: var(--font-body);
	color: var(--rim-gray);
	margin: 0 0 8px;
}

.aa-empty .aa-subnav { justify-content: center; }

/* tools strip */
.aa-archive__tools {
	padding-block: 48px;
	border-top: 2px solid var(--asphalt-black);
	background: var(--surface-container-low);
}

/* ============================================================
   AUTHOR PROFILE — closes every article
   ============================================================
   E-E-A-T furniture: the specialist who owns the topic, their
   credential, and a route to the rest of their work. Stitch shape:
   0px radius, 2px rule, hard offset shadow.
   ------------------------------------------------------------ */
.aa-authorbox {
	margin: 48px 0 0;
	padding: 24px;
	border: 2px solid var(--asphalt-black);
	background: var(--paper-white);
	box-shadow: 6px 6px 0 var(--asphalt-black);
}

.aa-authorbox__head {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}

.aa-authorbox__avatar {
	flex: 0 0 auto;
	width: 72px;
	height: 72px;
	border: 2px solid var(--asphalt-black);
	display: block;
}

.aa-authorbox__label {
	display: block;
	font-family: var(--font-sans);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--race-red);
	margin-bottom: 4px;
}

.aa-authorbox__name {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.2;
}

.aa-authorbox__name a {
	color: var(--asphalt-black);
	text-decoration: none;
}

.aa-authorbox__name a:hover,
.aa-authorbox__name a:focus { color: var(--race-red); }

.aa-authorbox__role {
	display: block;
	margin-top: 4px;
	font-family: var(--font-sans);
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--rim-gray);
}

.aa-authorbox__bio {
	margin: 16px 0 0;
	font-family: var(--font-sans);
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--asphalt-black);
}

.aa-authorbox__more {
	display: inline-block;
	margin-top: 16px;
	font-family: var(--font-sans);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--asphalt-black);
	text-decoration: none;
	border-bottom: 2px solid var(--race-red);
	padding-bottom: 2px;
}

.aa-authorbox__more:hover,
.aa-authorbox__more:focus { color: var(--race-red); }

@media (max-width: 600px) {
	.aa-authorbox { padding: 20px 16px; box-shadow: 4px 4px 0 var(--asphalt-black); }
	.aa-authorbox__avatar { width: 56px; height: 56px; }
	.aa-authorbox__name { font-size: 1.25rem; }
}

/* --- author archive masthead ---------------------------------------- */
.aa-authorhead {
	display: flex;
	gap: 20px;
	align-items: center;
}

.aa-authorhead__avatar {
	flex: 0 0 auto;
	width: 88px;
	height: 88px;
	border: 2px solid var(--asphalt-black);
	display: block;
}

.aa-authorhead__role {
	display: block;
	margin-top: 6px;
	font-family: var(--font-sans);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--race-red);
}

@media (max-width: 600px) {
	.aa-authorhead { gap: 14px; }
	.aa-authorhead__avatar { width: 64px; height: 64px; }
}
