/* ==========================================================================
   Perit AI — front-end stylesheet
   Design tokens matched to perit.ai's live palette (signal-blue #1e74ff,
   ink-black #131315, ash-mist #e9e7e3, sharp 0-radius editorial style).
   DM Sans (perit.ai's own font) carries every heading/body/button; IBM Plex
   Mono is a small supporting accent for eyebrows, dates, category pills and
   TOC labels.
   ========================================================================== */

:root {
	--ink: #131315;
	--graphite: #3a3a3d;
	--smoke: #6b6b6f;
	--white: #ffffff;
	--mist: #e9e7e3;
	--rule: #c9c6c2;
	--blue: #1e74ff;
	--blue-dark: #0f56d1;
	--canvas: #f7f6f4;
	--surface: #ffffff;
	--radius: 3px;
	--container: 1380px;
	--reading: 700px;
	--font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--font-mono: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
/* Browsers don't inherit font-family into form controls by default (a
   long-standing UA-stylesheet quirk) — without this, every <button>,
   <input>, <select> and <textarea> silently falls back to the OS's UI font
   instead of DM Sans, regardless of what body{font-family} is set to. */
button, input, select, textarea, optgroup {
	font-family: inherit;
	font-size: 100%;
}
/* overflow-x lives on html only, never body — setting it on body too would
   force body's overflow-y to compute as auto (per spec, when one axis is
   hidden and the other visible), turning body into its own nested
   scrolling container and breaking position:sticky for everything inside
   it (the TOC/AI sidebar, share rail, admin publish box, etc). */
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
	margin: 0;
	font-family: var(--font-body);
	color: var(--ink);
	background: var(--white);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
.eyebrow {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--blue);
	margin-bottom: 14px;
}

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 14px;
	padding: 11px 22px;
	border-radius: var(--radius);
	border: 1px solid var(--ink);
	background: transparent;
	color: var(--ink);
	transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
	cursor: pointer;
	white-space: nowrap;
}
.btn--dark { background: var(--ink); color: var(--white); }
.btn--dark:hover { background: transparent; color: var(--ink); }
.btn--sm { padding: 8px 16px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }

/* ---------- Layout helpers ---------- */
.blog-wrap, .single-post, .related-posts, .archive-head, .error-404, .post-nav, .post-rating-wrap {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 24px;
}
@media (min-width: 640px) { .blog-wrap, .single-post, .related-posts, .archive-head, .error-404, .post-nav, .post-rating-wrap { padding: 0 40px; } }
@media (min-width: 1024px) { .blog-wrap, .single-post, .related-posts, .archive-head, .error-404, .post-nav, .post-rating-wrap { padding: 0 56px; } }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 200;
	background: #eeeeec;
	border-bottom: 1px solid transparent;
	transition: background-color .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--rule); background: #eeeeec; box-shadow: 0 1px 0 rgba(19,19,21,.04); }

.site-nav-inner {
	max-width: var(--container);
	margin: 0 auto;
	padding: 14px 24px;
	display: flex;
	align-items: center;
	gap: 28px;
}
@media (min-width: 640px) { .site-nav-inner { padding: 14px 40px; } }
@media (min-width: 1024px) { .site-nav-inner { padding: 14px 56px; } }

.site-header__logo { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-header__logo-img { height: 26px; width: auto; }
.site-header__mark {
	display: inline-block;
	width: 15px;
	height: 26px;
	background-color: var(--ink);
	-webkit-mask-image: url(../images/logo-mark.svg);
	mask-image: url(../images/logo-mark.svg);
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}
.site-header__wordmark { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }

.site-header__menu { display: none; align-items: center; gap: 2px; flex: 1; }
@media (min-width: 1100px) { .site-header__menu { display: flex; } }

.nav-item { position: relative; }
.nav-item__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	font-size: 15.5px;
	font-weight: 400;
	border-radius: var(--radius);
	transition: background .18s ease;
}
.nav-item__link:hover, .nav-item__link:focus-visible { background: var(--mist); }
.nav-item__link--plain { font-weight: 400; }
.nav-item__caret { width: 11px; height: 11px; flex-shrink: 0; transition: transform .2s var(--ease); opacity: .6; }
.nav-item:hover .nav-item__caret { transform: rotate(180deg); }

/* Anchored to the sticky header (its nearest positioned ancestor via the
   .nav-item wrapper) with position:absolute rather than fixed — a fixed
   dropdown with top:auto stops tracking correctly once the page has
   actually scrolled under a position:sticky ancestor. */
.mega-panel {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 8px;
	background: var(--surface);
	border: 1px solid var(--rule);
	box-shadow: 0 16px 40px rgba(19,19,21,.12);
	padding: 10px;
	display: grid;
	grid-template-columns: repeat(3, 220px);
	gap: 4px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
	z-index: 50;
}
.mega-panel--sm { grid-template-columns: repeat(2, 240px); }
/* The rightmost nav items sit close to the viewport edge — anchoring their
   panel to the trigger's right edge instead of its left keeps it from
   overflowing off-screen and forcing horizontal scroll. */
.mega-panel--right { left: auto; right: 0; }
.nav-item:hover .mega-panel,
.nav-item:focus-within .mega-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.mega-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--radius); }
.mega-item:hover { background: var(--mist); }
.mega-item__title { font-size: 13.5px; font-weight: 500; }
.mega-item__desc { font-size: 12px; color: var(--smoke); line-height: 1.4; }
.mega-item.is-current .mega-item__title { color: var(--blue); }

.site-header__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }

/* ---------- Header search ---------- */
.header-search { position: relative; }
.header-search__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
	transition: background .15s ease;
}
.header-search__toggle:hover { background: var(--mist); }
.header-search.is-open .header-search__toggle { background: var(--mist); }
.header-search__form {
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 12px;
	width: 300px;
	max-width: calc(100vw - 48px);
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--white);
	border: 1px solid var(--rule);
	box-shadow: 0 16px 40px rgba(19,19,21,.12);
	padding: 6px 6px 6px 14px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.header-search.is-open .header-search__form { opacity: 1; visibility: visible; transform: translateY(0); }
.header-search__input { flex: 1; border: none; outline: none; font-family: var(--font-body); font-size: 14px; padding: 8px 0; background: transparent; }
.header-search__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: var(--ink);
	color: var(--white);
	cursor: pointer;
	flex-shrink: 0;
	transition: background .15s ease;
}
.header-search__submit:hover { background: var(--blue); }

.nav-burger {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 34px;
	height: 34px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
}
@media (min-width: 1100px) { .nav-burger { display: none; } }
.nav-burger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
	display: none;
	flex-direction: column;
	gap: 4px;
	padding: 8px 24px 28px;
	border-top: 1px solid var(--rule);
	background: var(--white);
}
.mobile-menu.is-open { display: flex; }
@media (min-width: 1100px) { .mobile-menu { display: none !important; } }
.mobile-menu__link { padding: 12px 4px; font-weight: 500; border-bottom: 1px solid var(--mist); }
.mobile-menu__link--main { font-weight: 700; font-size: 17px; }
.mobile-menu__group { padding: 10px 4px 4px; border-bottom: 1px solid var(--mist); }
.mobile-menu__label { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--smoke); margin-bottom: 6px; }
.mobile-menu__group a { display: block; padding: 7px 0; font-size: 14.5px; }
.mobile-menu .btn { margin-top: 16px; }

/* ==========================================================================
   Hero-embedded recent-posts carousel: hero__inner splits into copy (left)
   + a rounded image card (right) whose text sits overlaid on the photo via
   a bottom gradient scrim, cycling through the 4 latest posts.
   ========================================================================== */
.hero__inner--split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero__inner--split { grid-template-columns: 1fr; gap: 32px; } }
.hero__copy { min-width: 0; }

.hero-carousel { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 4/3; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
@media (max-width: 900px) { .hero-carousel { aspect-ratio: 16/10; } }

.hero-carousel__track { display: flex; flex-wrap: nowrap; width: 100%; height: 100%; transition: transform .5s var(--ease); }
.hero-carousel__slide { position: relative; flex: 0 0 100%; min-width: 0; height: 100%; display: block; }
.hero-carousel__img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--mist); }

.hero-carousel__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 8px;
	padding: 24px 26px;
	background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.82) 100%);
}
.hero-carousel__tag {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #fff;
	border: 1px solid rgba(255,255,255,.55);
	padding: 3px 10px;
	border-radius: 999px;
}
.hero-carousel__title { color: #fff; font-weight: 700; font-size: clamp(18px, 2.2vw, 22px); line-height: 1.3; }
.hero-carousel__meta { font-family: var(--font-mono); font-size: 11.5px; color: rgba(255,255,255,.75); }

.hero-carousel__controls { position: absolute; bottom: 20px; right: 20px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.hero-carousel__dots { display: flex; align-items: center; gap: 6px; }
.hero-carousel__dot { width: 6px; height: 6px; border-radius: 50%; border: none; background: rgba(255,255,255,.4); cursor: pointer; padding: 0; transition: background .15s ease, width .15s ease; }
.hero-carousel__dot.is-active { background: #fff; width: 16px; border-radius: 3px; }
.hero-carousel__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid rgba(255,255,255,.4);
	background: rgba(255,255,255,.12);
	color: #fff;
	cursor: pointer;
	backdrop-filter: blur(4px);
	transition: background .15s ease;
}
.hero-carousel__arrow:hover { background: rgba(255,255,255,.25); }

/* ==========================================================================
   Hero (blog homepage + inner-page archive header) — dark, with a layered
   abstract background: blue glow gradients, a fine grid, and a large
   translucent watermark of the brand mark (.hero__decor, masked like the
   header logo).
   ========================================================================== */
.hero {
	position: relative;
	background: #0b0b0d;
	color: #fff;
	padding: 64px 24px 32px;
}
/* Decorative background lives in its own absolutely-positioned, clipped
   wrapper — NOT on .hero itself — so things that legitimately need to
   escape the hero's box (the category dropdown panel) aren't clipped
   along with it. */
.hero__bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
@media (min-width: 640px) { .hero { padding: 84px 40px 40px; } }
.hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(640px circle at 12% 15%, rgba(30,116,255,.32), transparent 60%),
		radial-gradient(520px circle at 88% 85%, rgba(30,116,255,.16), transparent 60%),
		repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 1px, transparent 1px 88px),
		repeating-linear-gradient(0deg, rgba(255,255,255,.045) 0 1px, transparent 1px 88px);
	-webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
	mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
	pointer-events: none;
}
.hero__decor {
	position: absolute;
	top: 50%;
	right: -30px;
	transform: translateY(-50%);
	width: 220px;
	height: 420px;
	background-color: rgba(255,255,255,.05);
	-webkit-mask-image: url(../images/logo-mark.svg);
	mask-image: url(../images/logo-mark.svg);
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	pointer-events: none;
}
@media (max-width: 900px) { .hero__decor { display: none; } }
.hero__inner { position: relative; z-index: 1; max-width: var(--container); margin: 0 auto; }
.hero__title {
	font-size: clamp(32px, 5vw, 56px);
	max-width: 820px;
	font-weight: 700;
	color: #fff;
}
.hero__lead { max-width: 560px; color: rgba(255,255,255,.68); font-size: 17px; margin-bottom: 28px; }
/* ---------- Category dropdown (replaces the old pill row) ---------- */
.cat-dropdown { position: relative; display: inline-block; }
.cat-dropdown__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: rgba(255,255,255,.08);
	border: 1px solid rgba(255,255,255,.25);
	border-radius: 999px;
	cursor: pointer;
	transition: background .18s ease, border-color .18s ease;
}
.cat-dropdown__toggle:hover,
.cat-dropdown.is-open .cat-dropdown__toggle { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.5); }
.cat-dropdown__count { font-family: var(--font-mono); font-size: 11.5px; color: rgba(255,255,255,.6); }
.cat-dropdown__chevron { transition: transform .18s var(--ease); opacity: .8; }
.cat-dropdown.is-open .cat-dropdown__chevron { transform: rotate(180deg); }

.cat-dropdown__panel {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 8px;
	min-width: 240px;
	background: var(--white);
	border: 1px solid var(--rule);
	border-radius: 10px;
	box-shadow: 0 20px 48px rgba(0,0,0,.35);
	padding: 6px;
	z-index: 20;
}
.cat-dropdown__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 12px;
	border-radius: 6px;
	font-size: 14px;
	color: var(--ink);
	transition: background .15s ease;
}
.cat-dropdown__item:hover { background: var(--canvas); }
.cat-dropdown__item.is-active { color: var(--blue); font-weight: 600; }
.cat-dropdown__item-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--smoke); }

.hero--compact { padding: 40px 24px 32px; }
@media (min-width: 640px) { .hero--compact { padding: 48px 40px 36px; } }
.hero__title--sm { font-size: clamp(26px, 3.6vw, 40px); max-width: 720px; }
.archive-head__title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.archive-head__title-row .hero__title--sm { margin: 0; }
.archive-head__count {
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: rgba(255,255,255,.6);
	white-space: nowrap;
	padding: 4px 12px;
	border: 1px solid rgba(255,255,255,.2);
	border-radius: 999px;
}
.hero--compact .breadcrumbs { color: rgba(255,255,255,.55); }
.hero--compact .breadcrumbs a { color: rgba(255,255,255,.7); }
.hero--compact .breadcrumbs a:hover { color: #fff; }
.hero--compact .breadcrumbs span[aria-current] { color: rgba(255,255,255,.85); }

/* ---------- Archive / search head ---------- */
.archive-head { padding: 40px 24px 8px; }
.archive-head__title { font-size: clamp(28px, 4vw, 40px); }
.archive-head__desc { color: var(--smoke); max-width: 640px; }
.breadcrumbs { font-family: var(--font-mono); font-size: 12px; color: var(--smoke); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--smoke); transition: color .15s ease; }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs__sep { opacity: .5; }
.breadcrumbs span[aria-current] { color: var(--graphite); }

/* ==========================================================================
   Post grid + cards
   ========================================================================== */
.blog-wrap { padding-top: 40px; padding-bottom: 24px; }
.featured-post-wrap { margin-bottom: 40px; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 28px; }
@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--rule);
	border-radius: 14px;
	overflow: hidden;
	background: var(--white);
	transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.post-card:hover { box-shadow: 0 12px 28px rgba(19,19,21,.09); border-color: #b9b6b1; transform: translateY(-2px); }
.post-card__media { display: block; width: 100%; height: 250px; overflow: hidden; background: var(--mist); }
.post-card__media img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s var(--ease); }
.post-card:hover .post-card__media img { transform: scale(1.04); }
.post-card__placeholder { display: block; width: 100%; height: 100%; }
.post-card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.post-card__tag {
	display: inline-block;
	align-self: flex-start;
	font-family: var(--font-mono);
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--blue);
	border: 1px solid var(--blue);
	padding: 3px 9px;
	border-radius: 999px;
	margin-bottom: 10px;
}
.post-card__title { font-size: 19px; margin-bottom: 8px; }
.post-card__title a:hover { color: var(--blue); }
.post-card__excerpt { color: var(--smoke); font-size: 14.5px; margin-bottom: 10px; }
.post-card__meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--smoke); display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

.post-card--featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; align-items: stretch; border-radius: 16px; }
.post-card--featured .post-card__media { height: auto; }
.post-card--featured .post-card__media img { object-fit: cover; }
.post-card--featured .post-card__body { justify-content: center; padding: 28px 36px; }
.post-card--featured .post-card__title { font-size: clamp(24px, 3vw, 32px); }
@media (max-width: 780px) { .post-card--featured { grid-template-columns: 1fr; } .post-card--featured .post-card__media { height: 250px; } }

.pagination { display: flex; justify-content: center; gap: 8px; padding: 20px 24px 72px; flex-wrap: wrap; }
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	font-size: 13.5px;
	font-weight: 500;
}
.pagination .page-numbers.current { background: var(--ink); color: var(--white); border-color: var(--ink); }
.pagination .page-numbers:hover:not(.current) { border-color: var(--ink); }
.pagination .dots { border: none; }

.empty-state { max-width: var(--container); margin: 0 auto; padding: 60px 24px 100px; color: var(--smoke); }

/* ---------- Infinite-scroll load-more sentinel ---------- */
.load-more { display: flex; align-items: center; justify-content: center; padding: 20px 24px 72px; min-height: 40px; }
.load-more__spinner[hidden] { display: none; }
.load-more__spinner { display: flex; gap: 6px; }
.load-more__spinner span { width: 8px; height: 8px; border-radius: 50%; background: var(--rule); animation: pa-bounce 1s infinite ease-in-out; }
.load-more__spinner span:nth-child(2) { animation-delay: .15s; }
.load-more__spinner span:nth-child(3) { animation-delay: .3s; }
@keyframes pa-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; background: var(--blue); } }
.load-more__done { font-family: var(--font-mono); font-size: 12.5px; color: var(--smoke); text-align: center; }

/* ==========================================================================
   Single post
   ========================================================================== */
/* .single-post__head is also .hero.hero--compact (see single.php) for the
   same full-bleed dark background as the homepage/archive hero — it sits
   outside <article class="single-post"> specifically so that max-width
   constraint can't clip its background. Its own content is narrowed to the
   article's reading width here so title/byline line up with the body copy
   beneath it. */
.single-post__head-inner { max-width: var(--reading); }
/* With a featured image, the header goes full-width 2-column (image right)
   like the homepage hero — the narrow reading-width cap above only applies
   to the no-image, text-only case. */
.single-post__head-inner.hero__inner--split { max-width: var(--container); }
.single-post__meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-family: var(--font-mono); }
.post-tag {
	font-family: var(--font-mono);
	font-size: 11.5px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--blue);
	border: 1px solid var(--blue);
	padding: 4px 10px;
	border-radius: 999px;
}
.single-post__date, .single-post__readtime { font-size: 12px; color: var(--smoke); letter-spacing: .03em; }
.single-post__dot { color: var(--rule); }
.single-post__title { font-size: clamp(28px, 4.5vw, 44px); margin-bottom: 24px; }

.post-meta-bar { display: flex; align-items: center; gap: 12px; }
.post-meta-bar__avatar { border-radius: 50%; }
.post-meta-bar__text { display: flex; flex-direction: column; line-height: 1.35; }
.post-meta-bar__author { font-weight: 600; font-size: 14.5px; }
.post-meta-bar__sub { font-size: 12.5px; color: var(--smoke); }

/* Featured image lives in the hero header now (right side, next to the
   title) — see .single-post__hero-media below. */
.single-post__hero-media {
	border-radius: 18px;
	overflow: hidden;
	aspect-ratio: 4/3;
	box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.single-post__hero-media-img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) { .single-post__hero-media { aspect-ratio: 16/10; } }

.single-post__layout {
	display: grid;
	grid-template-columns: 56px minmax(0, var(--reading)) 280px;
	gap: 40px;
	justify-content: center;
	padding-top: 40px;
	align-items: start;
}
@media (max-width: 1180px) {
	.single-post__layout { grid-template-columns: 56px minmax(0, 1fr); }
	.post-sidebar { grid-column: 2; grid-row: 1; margin-bottom: 8px; }
}
@media (max-width: 760px) {
	.single-post__layout { grid-template-columns: 1fr; }
	/* .post-sidebar still carries grid-column:2/grid-row:1 from the 1180px
	   block above — with only one explicit column now, that stray
	   grid-column:2 makes the browser silently create an implicit second
	   column just to hold it, breaking the single-column mobile stack.
	   Reset it back into normal document flow (column 1, after the share
	   row) and drop sticky here too — a long table of contents pinned to
	   the screen leaves almost no room to actually read on a phone. */
	.post-sidebar {
		grid-column: 1;
		grid-row: 3;
		position: static !important;
		margin-top: 24px;
	}
	.share-rail {
		grid-column: 1;
		grid-row: 2;
		flex-direction: row !important;
		flex-wrap: wrap;
		position: sticky !important;
		top: 62px;
		z-index: 40;
		width: auto !important;
		margin: 24px 0 0;
		padding: 10px 14px;
		background: rgba(255,255,255,.92);
		backdrop-filter: blur(6px);
		border-bottom: 1px solid var(--mist);
	}
	.share-rail__label { display: none; }
	.post-content { grid-row: 1; }
}

/* ---------- Share rail ---------- */
.share-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; position: sticky; top: 110px; }
.share-rail__label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--smoke); writing-mode: vertical-rl; margin-bottom: 4px; }
@media (max-width: 760px) { .share-rail__label { display: none; } }
.share-rail__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid var(--rule);
	background: var(--white);
	color: var(--graphite);
	cursor: pointer;
	transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
	flex-shrink: 0;
}
.share-rail__btn:hover { background: var(--ink); border-color: var(--ink); color: var(--white); transform: translateY(-2px); }

/* ---------- Article body typography ---------- */
.post-content { font-size: 17px; line-height: 1.85; color: var(--graphite); max-width: 100%; }
.post-content h2 { font-size: 27px; color: var(--ink); margin: 2.2em 0 .7em; scroll-margin-top: 110px; }
.post-content h3 { font-size: 20px; color: var(--ink); margin: 1.8em 0 .6em; scroll-margin-top: 110px; }
.post-content h2:first-child, .post-content h3:first-child { margin-top: 0; }
.post-content p { margin: 0 0 1.5em; }
.post-content a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.post-content ul, .post-content ol { margin-bottom: 1.5em; padding-left: 1.4em; }
.post-content li { margin-bottom: .6em; }
.post-content li:last-child { margin-bottom: 0; }
.post-content img { border-radius: var(--radius); margin: 1.4em 0; }
.post-content blockquote {
	position: relative;
	margin: 1.8em 0;
	padding: 20px 24px 20px 56px;
	background: var(--canvas);
	border-left: 3px solid var(--blue);
	border-radius: 0 var(--radius) var(--radius) 0;
	color: var(--ink);
	font-style: italic;
	font-size: 19px;
	line-height: 1.55;
}
.post-content blockquote::before {
	content: "“";
	position: absolute;
	left: 16px;
	top: 6px;
	font-family: Georgia, serif;
	font-style: normal;
	font-size: 46px;
	line-height: 1;
	color: var(--blue);
	opacity: .55;
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content blockquote cite,
.post-content .wp-block-quote__citation {
	display: block;
	margin-top: 10px;
	font-style: normal;
	font-family: var(--font-mono);
	font-size: 12.5px;
	letter-spacing: .03em;
	color: var(--smoke);
}
.post-content pre { background: var(--ink); color: #f0f0f0; padding: 18px 20px; border-radius: var(--radius); overflow-x: auto; font-family: var(--font-mono); font-size: 13.5px; }
.post-content code { font-family: var(--font-mono); font-size: .9em; background: var(--mist); padding: 2px 6px; border-radius: 3px; }
.post-content pre code { background: none; padding: 0; }
.post-content__embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 1.6em 0; }
.post-content__embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

.post-content table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	margin: 1.8em 0;
	font-size: 14.5px;
	border: 1px solid var(--rule);
	border-radius: 8px;
	overflow: hidden;
}
/* A wide table (many columns) has nowhere to go on a phone otherwise — it
   would force the entire page to scroll sideways instead of just the table. */
@media (max-width: 640px) {
	.post-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.post-content th, .post-content td { padding: 12px 16px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.post-content th:not(:last-child), .post-content td:not(:last-child) { border-right: 1px solid var(--mist); }
.post-content thead th { background: var(--ink); color: #fff; font-weight: 600; border-bottom: none; }
.post-content thead th:not(:last-child) { border-right: 1px solid rgba(255,255,255,.12); }
.post-content tbody tr:last-child td { border-bottom: none; }
.post-content tbody tr:nth-child(even) { background: var(--canvas); }
.post-content tbody tr:hover { background: var(--mist); }

.post-content figure { margin: 1.8em 0; }
.post-content figure img { margin: 0; }
.post-content figcaption { font-size: 13px; color: var(--smoke); text-align: center; margin-top: 8px; line-height: 1.5; }
.post-content hr { border: none; border-top: 1px solid var(--mist); margin: 2.4em 0; }

/* ---------- Flowchart / step-diagram blocks — Group and Columns blocks
   editors use to build box-and-arrow diagrams by hand read these classes
   automatically, no extra markup needed beyond WordPress's own block editor. ---------- */
.post-content .wp-block-group {
	padding: 20px 22px;
	margin: 1.6em 0;
	background: var(--canvas);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
}
.post-content .wp-block-group.has-background { border-color: transparent; }
.post-content .wp-block-group h2,
.post-content .wp-block-group h3,
.post-content .wp-block-group h4 { margin-top: 0; }
.post-content .wp-block-group p:last-child { margin-bottom: 0; }

.post-content .wp-block-columns { display: flex; flex-wrap: wrap; gap: 20px; margin: 1.8em 0; align-items: stretch; }
.post-content .wp-block-column {
	flex: 1 1 200px;
	min-width: 0;
	padding: 16px 18px;
	background: var(--white);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	font-size: 14.5px;
}
.post-content .wp-block-column p:last-child { margin-bottom: 0; }
.post-content .wp-block-column strong:first-child { display: block; margin-bottom: 4px; color: var(--blue); font-size: 12px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }

/* A right-pointing arrow between step boxes — add class="flow-arrow" to any
   empty paragraph/element between two .wp-block-column steps. */
.post-content .flow-arrow { text-align: center; color: var(--rule); font-size: 22px; margin: -6px 0; }
@media (max-width: 620px) { .post-content .wp-block-columns { flex-direction: column; } }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--mist); }
.post-tags__item { font-family: var(--font-mono); font-size: 12px; color: var(--smoke); border: 1px solid var(--rule); padding: 5px 11px; border-radius: 999px; }
.post-tags__item:hover { color: var(--blue); border-color: var(--blue); }

/* ---------- Sidebar: Open-in-AI + Table of contents ---------- */
.post-sidebar { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 16px; }

.sidebar-media-card { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--white); }
.sidebar-media-card__video { position: relative; line-height: 0; }
.sidebar-media-card__video iframe,
.sidebar-media-card__video embed,
.sidebar-media-card__video video,
.sidebar-media-card__video .mejs-container { width: 100% !important; aspect-ratio: 16/9; height: auto !important; display: block; }
.sidebar-media-card__image { width: 100%; height: auto; display: block; }
.sidebar-media-card__image--sm { aspect-ratio: 4/3; object-fit: cover; }

.ai-open { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--white); }
.ai-open__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--white);
	border: none;
	cursor: pointer;
	font-family: var(--font-body);
	font-size: 13.5px;
	font-weight: 600;
	color: var(--ink);
	text-align: left;
}
.ai-open__toggle-icon { display: inline-flex; color: var(--blue); }
.ai-open__toggle span:nth-child(2) { flex: 1; }
.ai-open__chevron { transition: transform .18s ease; flex-shrink: 0; }
.ai-open__toggle[aria-expanded="true"] .ai-open__chevron { transform: rotate(180deg); }
.ai-open__panel[hidden] { display: none; }
.ai-open__panel { border-top: 1px solid var(--mist); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.ai-open__item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 5px; transition: background .15s ease; }
.ai-open__item:hover { background: var(--canvas); }
.ai-open__item-icon { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--mist); }
.ai-open__item-icon--chatgpt { background-color: #10a37f22; color: #10a37f; }
.ai-open__item-icon--claude { background-color: #d97a5722; color: #d97a57; }
.ai-open__item-icon--gemini { background-color: #4285f422; color: #4285f4; }
.ai-open__item-icon--perplexity { background-color: #13131522; color: var(--ink); }
.ai-open__item-text { display: flex; flex-direction: column; gap: 1px; }
.ai-open__item-text strong { font-size: 13px; font-weight: 600; }
.ai-open__item-text span { font-size: 11.5px; color: var(--smoke); }

.toc-card { border: 1px solid var(--rule); border-radius: 6px; padding: 16px 16px 14px; background: var(--white); }
.toc-card__label { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--smoke); margin-bottom: 12px; }
.toc-card__nav { display: flex; flex-direction: column; }
.toc-card__link {
	display: block;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--graphite);
	padding: 6px 0 6px 12px;
	border-left: 2px solid var(--mist);
	transition: color .15s ease, border-color .15s ease;
}
.toc-card__link--h3 { padding-left: 22px; font-size: 13px; color: var(--smoke); }
.toc-card__link:hover { color: var(--blue); }
.toc-card__link.is-active { color: var(--blue); border-left-color: var(--blue); font-weight: 500; }

/* ---------- Prev/next + related ---------- */
.post-nav { margin-top: 56px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--mist); padding-top: 28px; }
.post-nav__item { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--rule); border-radius: 6px; transition: border-color .15s ease; }
.post-nav__item:hover { border-color: var(--ink); }
.post-nav__item--next { text-align: right; align-items: flex-end; grid-column: 2; }
.post-nav__label { font-family: var(--font-mono); font-size: 11px; color: var(--smoke); text-transform: uppercase; letter-spacing: .05em; }
.post-nav__title { font-weight: 600; font-size: 14.5px; }
@media (max-width: 560px) { .post-nav { grid-template-columns: 1fr; } .post-nav__item--next { grid-column: 1; text-align: left; align-items: flex-start; } }

/* ---------- End-of-post rating widget ---------- */
.post-rating-wrap { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--mist); }
.post-rating { max-width: 460px; margin: 0 auto; text-align: center; }
.post-rating__head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.post-rating__title { font-weight: 600; font-size: 16px; color: var(--ink); }
.post-rating__summary { font-family: var(--font-mono); font-size: 12px; color: var(--smoke); }
.post-rating__faces { display: flex; justify-content: center; gap: 10px; }
.post-rating__face {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1.5px solid var(--rule);
	background: var(--white);
	color: var(--smoke);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	transition: border-color .15s ease, color .15s ease, transform .15s ease, background .15s ease;
}
.post-rating__face:hover,
.post-rating__face.is-hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.post-rating__face.is-selected { border-color: var(--blue); background: var(--blue); color: #fff; }
.post-rating[data-rating-rated="1"] .post-rating__face { cursor: default; pointer-events: none; opacity: .55; }
.post-rating[data-rating-rated="1"] .post-rating__face.is-selected { opacity: 1; }
.post-rating__thanks { margin-top: 14px; font-size: 13px; color: var(--blue); font-weight: 600; }

.related-posts { padding: 64px 24px 96px; border-top: 1px solid var(--mist); margin-top: 56px; }
.related-posts__title { font-size: 24px; margin-bottom: 28px; }

/* ---------- Generic page template ---------- */
.page-content { max-width: var(--reading); margin: 0 auto; padding: 48px 24px 96px; }
.page-content__title { font-size: clamp(28px, 4vw, 40px); margin-bottom: 28px; }

/* ---------- 404 ---------- */
.error-404 { text-align: center; padding: 100px 24px; }
.error-404 h1 { font-size: clamp(26px, 4vw, 36px); }
.error-404 p { color: var(--smoke); max-width: 440px; margin: 0 auto 28px; }
.error-404__search { max-width: 360px; margin: 28px auto 0; }
.search-form { display: flex; gap: 8px; }
.search-form label { flex: 1; }
.search-field { width: 100%; padding: 11px 14px; border: 1px solid var(--rule); border-radius: var(--radius); font-family: var(--font-body); }
.search-submit { padding: 11px 18px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); border-radius: var(--radius); cursor: pointer; font-weight: 600; }

/* ---------- Toast (copy-link feedback) ---------- */
.pa-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translate(-50%, 12px);
	background: var(--ink);
	color: var(--white);
	padding: 12px 20px;
	border-radius: 6px;
	font-size: 13.5px;
	z-index: 999;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
	max-width: calc(100vw - 48px);
	text-align: center;
}
.pa-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { display: block; width: 100%; background: var(--ink); color: rgba(255,255,255,.85); margin-top: 40px; }
.site-footer__top {
	max-width: var(--container);
	margin: 0 auto;
	padding: 72px 24px 48px;
	display: flex;
	flex-direction: column;
	gap: 48px;
}
@media (min-width: 640px) { .site-footer__top { padding: 80px 40px 56px; } }
@media (min-width: 1024px) { .site-footer__top { padding: 90px 56px 64px; flex-direction: row; justify-content: space-between; } }

.footer-brand { display: flex; flex-direction: column; gap: 18px; max-width: 320px; }
.footer-brand__logo { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand__logo .site-header__mark { background-color: var(--white); }
.footer-brand__logo .site-header__wordmark { color: var(--white); }
.footer-brand__tagline { font-size: 14px; color: rgba(255,255,255,.6); }
.footer-brand__links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-brand__icon-link { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; color: rgba(255,255,255,.75); transition: color .15s ease; }
.footer-brand__icon-link:hover { color: var(--white); }
.footer-brand__yc { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255,255,255,.65); }
.footer-brand__yc-mark { display: grid; place-items: center; width: 18px; height: 18px; background: #ff6600; color: #fff; font-size: 11px; font-weight: 700; }
.footer-brand__yc strong { color: #fff; font-weight: 600; }

.footer-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 24px; }
@media (min-width: 560px) { .footer-cols { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .footer-cols { gap: 32px 40px; } }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col__label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.45); margin-bottom: 4px; }
.footer-col a { font-size: 13.5px; color: rgba(255,255,255,.8); transition: color .15s ease; }
.footer-col a:hover { color: var(--white); }

.site-footer__badges { max-width: var(--container); margin: 0 auto; padding: 0 24px 48px; display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 640px) { .site-footer__badges { padding: 0 40px 48px; } }
@media (min-width: 1024px) { .site-footer__badges { padding: 0 56px 56px; } }
.footer-badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: .03em; color: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.18); padding: 6px 12px; border-radius: 999px; }

.site-footer__bottom {
	max-width: var(--container);
	margin: 0 auto;
	padding: 22px 24px;
	border-top: 1px solid rgba(255,255,255,.12);
	display: flex;
	flex-direction: column;
	gap: 12px;
}
@media (min-width: 640px) { .site-footer__bottom { padding: 22px 40px; flex-direction: row; align-items: center; justify-content: space-between; } }
@media (min-width: 1024px) { .site-footer__bottom { padding: 22px 56px; } }
.footer-copyright { font-family: var(--font-mono); font-size: 11.5px; color: rgba(255,255,255,.5); }
.footer-legal { display: flex; gap: 18px; }
.footer-legal a { font-family: var(--font-mono); font-size: 11.5px; color: rgba(255,255,255,.5); }
.footer-legal a:hover { color: var(--white); }

/* ---------- Skip-to-content (a11y) ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 12px 18px; z-index: 999; }
.skip-link:focus { left: 12px; top: 12px; }