/* ============================================================
   Extramarital Affair — design system
   Warm, editorial, calm. Not clinical, not tabloid.
   ============================================================ */

:root {
  --ink: #1c1614;
  --ink-2: #4a3f3a;
  --ink-3: #6f625b;
  --line: #e6ddd4;
  --line-2: #f0e9e1;
  --bg: #fbf8f4;
  --surface: #ffffff;
  --surface-2: #f6f0e8;

  --plum: #7c2d4a;
  --plum-dark: #5c1e35;
  --plum-soft: #fdf2f5;
  --gold: #b98b3f;
  --sage: #4a6b5a;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 22, 20, .05), 0 8px 24px -12px rgba(28, 22, 20, .18);
  --shadow-lg: 0 2px 4px rgba(28, 22, 20, .06), 0 20px 48px -20px rgba(28, 22, 20, .28);

  /* Fallbacks are metric-matched @font-face rules declared in the inlined
     critical CSS, so the webfont swap does not shift layout. */
  --fallback-sans: 'Manrope Fallback', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fallback-serif: 'Fraunces Fallback', ui-serif, Georgia, 'Times New Roman', serif;
  --font-display: 'Fraunces', var(--fallback-serif);
  --font-body: 'Manrope', var(--fallback-sans);

  --wrap: 1180px;
  --measure: 68ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--plum); text-underline-offset: 3px; }
a:hover { color: var(--plum-dark); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 .5em;
}

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--plum); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; border-radius: 3px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 248, 244, .88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 68px;
}

.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--plum) 0%, var(--plum-dark) 55%, var(--gold) 130%);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.04rem;
  color: var(--ink); letter-spacing: -.02em;
}
.brand-tag { font-size: .68rem; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }

.primary-nav { display: flex; gap: 1.35rem; margin-left: auto; }
.primary-nav a {
  font-size: .875rem; font-weight: 500; color: var(--ink-2);
  text-decoration: none; padding: .35rem 0; position: relative; white-space: nowrap;
}
.primary-nav a:hover, .primary-nav a.is-active { color: var(--plum); }
.primary-nav a.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--plum); border-radius: 2px;
}

.search-mini { display: flex; align-items: center; position: relative; flex-shrink: 0; }
.search-mini input {
  width: 148px; padding: .48rem .75rem; padding-right: 2.1rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font: inherit; font-size: .84rem; color: var(--ink);
  transition: width .2s ease, border-color .2s ease;
}
.search-mini input:focus { width: 200px; border-color: var(--plum); outline: none; }
.search-mini button {
  position: absolute; right: .3rem; display: grid; place-items: center;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-3); cursor: pointer;
}
.search-mini button:hover { color: var(--plum); }

.nav-toggle {
  display: none; margin-left: auto; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; padding: 10px 9px;
  flex-direction: column; justify-content: space-between;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }

/* ---------- Layout ---------- */
main { min-height: 60vh; padding-block: 2.5rem 4rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 3rem;
  align-items: start;
}
/* Grid items default to min-width:auto, so a wide child (a comparison table)
   would blow the column past the viewport. Pin them to 0. */
.layout > * { min-width: 0; }

.sidebar { position: sticky; top: 92px; display: grid; gap: 1.25rem; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h2 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-family: var(--font-body); font-weight: 700;
  margin-bottom: .85rem;
}

.cat-list { display: grid; gap: .1rem; }
.cat-list a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .5rem .6rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); font-size: .9rem; font-weight: 500;
}
.cat-list a:hover { background: var(--plum-soft); color: var(--plum); }
.cat-list .count {
  font-size: .72rem; color: var(--ink-3); background: var(--surface-2);
  padding: .1rem .45rem; border-radius: 999px; font-variant-numeric: tabular-nums;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-chip {
  font-size: .78rem; padding: .28rem .68rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); text-decoration: none;
  border: 1px solid transparent;
}
.tag-chip:hover { background: var(--plum-soft); color: var(--plum); border-color: var(--plum); }

/* ---------- Hero / featured ---------- */
.page-head { margin-bottom: 2rem; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .35rem; }
.page-head p { color: var(--ink-3); margin: 0; max-width: var(--measure); }

.featured {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
}
/* Side-by-side: the image is absolutely positioned so it contributes no
   intrinsic height. The row is sized by the text column, and the image fills
   it — otherwise a long headline overflows and gets clipped. */
.featured-media {
  position: relative; background: var(--surface-2);
  min-height: 260px; overflow: hidden;
}
/* <picture> wraps the responsive images; make it transparent so the existing
   sizing rules keep applying to the <img> as a direct child. */
.featured-media picture,
.post-card-media picture,
.post-hero picture { display: contents; }

.featured-media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.featured-body { padding: 2rem; display: flex; flex-direction: column; justify-content: center; }
.featured-body h2 {
  font-size: clamp(1.35rem, 1.9vw, 1.85rem); margin-bottom: .6rem;
  overflow-wrap: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden;
}
.featured-body h2 a { color: inherit; text-decoration: none; }
.featured-body h2 a:hover { color: var(--plum); }
.featured-body p { color: var(--ink-2); margin: 0 0 1.1rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--plum); text-decoration: none; margin-bottom: .7rem;
}

/* ---------- Post grid ---------- */
.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d9cec2; }
.post-card-media { aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.post-card h3 { font-size: 1.14rem; line-height: 1.32; margin-bottom: .5rem; }
.post-card h3 a { color: inherit; text-decoration: none; }
.post-card h3 a:hover { color: var(--plum); }
.post-card p { font-size: .9rem; color: var(--ink-3); margin: 0 0 1rem; flex: 1; }

.post-meta {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .76rem; color: var(--ink-3); margin-top: auto;
}
.post-meta a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.post-meta a:hover { color: var(--plum); }
.dot { opacity: .45; }

/* ---------- Single post ---------- */
.post-header { margin-bottom: 1.75rem; }
.breadcrumbs { font-size: .78rem; color: var(--ink-3); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--ink-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--plum); }
.breadcrumbs span { margin: 0 .4rem; opacity: .5; }

.post-title { font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.12; margin-bottom: .75rem; }
.post-excerpt {
  font-size: 1.14rem; color: var(--ink-2); max-width: var(--measure);
  margin: 0 0 1.4rem; line-height: 1.62;
}

.byline {
  display: flex; align-items: center; gap: .85rem;
  padding: 1rem 0; border-block: 1px solid var(--line-2); margin-bottom: 1.75rem;
}
.byline-avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  background: linear-gradient(140deg, var(--plum) 0%, var(--gold) 130%);
  flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 1rem; font-family: var(--font-display);
}
.byline-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.byline-name { font-weight: 700; font-size: .94rem; }
.byline-name a { color: var(--ink); text-decoration: none; }
.byline-name a:hover { color: var(--plum); }
.byline-sub { font-size: .78rem; color: var(--ink-3); }

.post-hero {
  border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem;
  border: 1px solid var(--line); background: var(--surface-2);
}
.post-hero img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-hero figcaption {
  font-size: .76rem; color: var(--ink-3); padding: .6rem .9rem; background: var(--surface);
}

/* Direct-answer block for AI Overviews / AEO */
.post-answer-block {
  background: var(--plum-soft); border-left: 3px solid var(--plum);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.15rem 1.35rem; margin-bottom: 2rem;
}
.post-answer-block p { margin: 0; font-size: 1.02rem; color: var(--ink); }
.post-answer-block strong { color: var(--plum-dark); }

.toc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.35rem; margin-bottom: 2rem;
}
.toc h2 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  font-family: var(--font-body); font-weight: 700; color: var(--ink-3); margin-bottom: .7rem;
}
.toc ol { margin: 0; padding-left: 1.15rem; display: grid; gap: .35rem; }
.toc li { font-size: .88rem; }
.toc li.lvl-3 { padding-left: .9rem; font-size: .84rem; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--plum); text-decoration: underline; }

.post-body { max-width: var(--measure); font-size: 1.06rem; }
.post-body > * + * { margin-top: 1.3em; }
.post-body h2 {
  font-size: 1.65rem; margin-top: 2.4em; scroll-margin-top: 92px;
  padding-bottom: .3rem; border-bottom: 1px solid var(--line-2);
}
.post-body h3 { font-size: 1.28rem; margin-top: 1.9em; scroll-margin-top: 92px; }
.post-body p { margin-block: 0; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li + li { margin-top: .5em; }
.post-body li::marker { color: var(--plum); }
.post-body strong { color: var(--ink); font-weight: 700; }
.post-body blockquote {
  margin-inline: 0; padding: .35rem 0 .35rem 1.35rem;
  border-left: 3px solid var(--gold); color: var(--ink-2); font-style: italic;
}
.post-body img { border-radius: var(--radius-sm); border: 1px solid var(--line); }
/* Body images pasted without explicit dimensions still reserve space, so a
   late-loading image cannot push text down (CLS). */
.post-body img:not([width]) { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-body a.auto-link { text-decoration-style: dotted; }

.post-body table {
  width: 100%; border-collapse: collapse; font-size: .93rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.post-body thead { background: var(--surface-2); }
.post-body th, .post-body td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line-2); }
.post-body th { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.post-body tbody tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.faq-section { max-width: var(--measure); margin-top: 3rem; }
.faq-section > h2 { font-size: 1.65rem; margin-bottom: 1.1rem; }
.faq-item {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin-bottom: .7rem; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; font-size: 1rem;
  list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; color: var(--plum); font-size: 1.35rem; font-weight: 400; line-height: 1;
  transition: transform .2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer { padding: 0 1.25rem 1.15rem; color: var(--ink-2); }
.faq-item .faq-answer > :first-child { margin-top: 0; }

.post-tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 2.5rem; }

.author-box {
  display: flex; gap: 1.15rem; margin-top: 2.5rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.author-box .byline-avatar { width: 68px; height: 68px; font-size: 1.4rem; }
.author-box h2 { font-size: 1.1rem; margin-bottom: .15rem; }
.author-box .author-title { font-size: .82rem; color: var(--plum); font-weight: 600; margin: 0 0 .6rem; }
.author-box p { font-size: .92rem; color: var(--ink-2); margin: 0 0 .5rem; }
.author-box .credentials {
  font-size: .78rem; color: var(--ink-3); padding-top: .5rem;
  border-top: 1px dashed var(--line); margin-top: .6rem;
}

.related { margin-top: 3.5rem; }
.related h2 { font-size: 1.4rem; margin-bottom: 1.2rem; }

/* ---------- Web Stories ---------- */
.story-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.1rem;
}
.story-card {
  position: relative; aspect-ratio: 3/5; border-radius: var(--radius);
  overflow: hidden; text-decoration: none; background: var(--ink);
  box-shadow: var(--shadow);
}
.story-card img { width: 100%; height: 100%; object-fit: cover; opacity: .82; transition: transform .3s ease, opacity .3s ease; }
.story-card:hover img { transform: scale(1.05); opacity: .68; }
.story-card span {
  position: absolute; inset: auto 0 0 0; padding: 2.5rem .9rem .9rem;
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: .98rem; line-height: 1.25;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: .4rem;
  margin-top: 3rem; flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 40px; height: 40px; display: grid; place-items: center; padding-inline: .75rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); font-size: .88rem; font-weight: 600;
  background: var(--surface);
}
.pagination a:hover { border-color: var(--plum); color: var(--plum); }
.pagination .is-current { background: var(--plum); border-color: var(--plum); color: #fff; }
.pagination .is-disabled { opacity: .4; pointer-events: none; }

/* ---------- Prose pages (legal, about) ---------- */
.prose { max-width: var(--measure); }
.prose h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin-bottom: .4rem; }
.prose .updated { font-size: .82rem; color: var(--ink-3); margin-bottom: 2rem; }
.prose h2 { font-size: 1.4rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.12rem; margin-top: 1.7em; }
.prose > * + * { margin-top: 1.15em; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--plum); }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.prose th, .prose td { padding: .6rem .8rem; border: 1px solid var(--line); text-align: left; }
.prose thead { background: var(--surface-2); }

.notice {
  background: var(--surface-2); border-left: 3px solid var(--gold);
  padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .94rem; color: var(--ink-2);
}
.notice strong { color: var(--ink); }

/* ---------- Author archive ---------- */
.author-hero {
  display: flex; gap: 1.5rem; align-items: flex-start;
  padding: 1.75rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 2.5rem;
}
.author-hero .byline-avatar { width: 88px; height: 88px; font-size: 1.8rem; }
.author-hero h1 { font-size: 1.85rem; margin-bottom: .2rem; }
.author-hero .author-title { color: var(--plum); font-weight: 600; font-size: .92rem; margin: 0 0 .8rem; }
.author-hero p { color: var(--ink-2); margin: 0 0 .6rem; max-width: 62ch; }

/* ---------- Ad slots ----------
   Height is reserved up-front so an ad loading late cannot shift content (CLS). */
.ad-slot {
  margin-block: 2.5rem; padding: .5rem; text-align: center;
  background: var(--surface-2); border-radius: var(--radius-sm);
  display: grid; place-items: center;
  contain: layout size style;
}
.ad-slot::before {
  content: 'Advertisement'; font-size: .64rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}
.ad-slot[data-format="leaderboard"] { height: 106px; }
.ad-slot[data-format="rectangle"]  { height: 266px; }
.ad-slot[data-format="skyscraper"] { height: 616px; }
@media (max-width: 640px) {
  .ad-slot[data-format="leaderboard"] { height: 116px; }
  .ad-slot[data-format="skyscraper"]  { height: 266px; }
}

/* ---------- Rendering performance ----------
   Below-the-fold sections skip layout/paint until scrolled near, which cuts
   Speed Index and main-thread work on long article pages. contain-intrinsic-size
   supplies a placeholder height so scrollbar position stays stable. */
.related, .faq-section, .site-footer, .story-grid {
  content-visibility: auto;
}
.related { contain-intrinsic-size: auto 480px; }
.faq-section { contain-intrinsic-size: auto 420px; }
.site-footer { contain-intrinsic-size: auto 420px; }
.story-grid { contain-intrinsic-size: auto 320px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 4rem 1rem; color: var(--ink-3);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h2 { font-size: 1.25rem; color: var(--ink-2); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #d8cec6;
  padding-block: 3rem 1.75rem; margin-top: 4rem;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 2.5rem;
  padding-bottom: 2.25rem; border-bottom: 1px solid rgba(255,255,255,.1);
}
.site-footer .brand-name { color: #fff; font-size: 1.15rem; display: block; margin-bottom: .6rem; }
.footer-blurb { font-size: .86rem; line-height: 1.65; color: #a99e96; margin: 0; max-width: 38ch; }
.footer-col h2 {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
  color: #fff; font-family: var(--font-body); font-weight: 700; margin-bottom: .9rem;
}
.footer-col { display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { color: #a99e96; text-decoration: none; font-size: .86rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  padding-top: 1.5rem; display: flex; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: #8b807a;
}
.footer-bottom p { margin: 0; }
.footer-note { max-width: 55ch; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .sidebar { position: static; grid-template-columns: minmax(0,1fr) minmax(0,1fr); display: grid; }
  .featured { grid-template-columns: 1fr; }
  /* Stacked: back to normal flow so the image keeps its own height. */
  .featured-media { aspect-ratio: 16/9; min-height: 0; }
  .featured-media img { position: static; }
  .featured-body { padding: 1.5rem; }
  .featured-body h2 { -webkit-line-clamp: 4; }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .search-mini { display: none; }
  .primary-nav {
    position: fixed; inset: 68px 0 auto 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: .5rem 1.25rem 1.25rem;
    margin-left: 0; display: none;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav a { padding: .8rem 0; border-bottom: 1px solid var(--line-2); font-size: .98rem; }
  .primary-nav a.is-active::after { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .wrap { width: min(var(--wrap), 100% - 2rem); }
  main { padding-block: 1.75rem 3rem; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .post-grid { grid-template-columns: 1fr; gap: 1.15rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .author-hero, .author-box { flex-direction: column; }
  .story-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .post-body { font-size: 1.02rem; }
  .brand-tag { display: none; }
}

@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}
