/* Forage blog — extends styles.css. Same tokens (Manrope headings, Nunito Sans body,
   Forage blue, #dedede greys); adds long-form reading, index cards and citation styling.
   No inline styles anywhere: the site CSP is style-src 'self'. */

:root {
  --prose: 62ch;
  --paper: #fbfbfc;
  --rule: #e6e6e9;
  --tint: #eef4ff;
  --radius-lg: 14px;
}

/* ------------------------------------------------------------------ shared */

.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: transparent; pointer-events: none;
}
.reading-progress span {
  display: block; height: 100%; width: 0; background: var(--blue);
  transform-origin: 0 50%; transition: width 0.08s linear;
}
@media (prefers-reduced-motion: reduce) { .reading-progress span { transition: none; } }

.eyebrow {
  font-family: var(--heading); font-weight: 800; font-size: 13px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue);
  margin: 0 0 14px;
}
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

.pill {
  display: inline-block; font-family: var(--heading); font-weight: 700;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; text-decoration: none;
  background: var(--tint); color: var(--blue-deep); border: 1px solid #d8e5fb;
  white-space: nowrap;
}
a.pill:hover { background: #e2ecfd; }
.pill.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }

.meta {
  font-family: var(--heading); font-weight: 600; font-size: 14px;
  color: var(--muted); margin: 0;
}
.meta > * + *::before { content: "·"; margin: 0 10px; color: var(--grey-2); }

/* Breadcrumb. Same Manrope 14px muted as .meta, so it sits with the rest of the
   page furniture whether or not the element also carries .meta. Kept here and
   never in a style attribute: _headers sets style-src 'self' with no
   'unsafe-inline', so an inline style would be silently dropped. styles.css
   carries an identical copy for the pages that do not load blog.css. */
.breadcrumb { font-family: var(--heading); font-weight: 600; font-size: 14px; color: var(--muted); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1rem; }
.breadcrumb li + li::before { content: "/"; margin-right: .5rem; }
.breadcrumb a { color: inherit; text-underline-offset: 3px; }
.breadcrumb [aria-current="page"] { color: var(--ink); }

/* ------------------------------------------------------------- blog index */

.blog-hero { padding: clamp(36px, 5vw, 76px) 0 clamp(24px, 3vw, 44px); }
.blog-hero h1 { font-size: clamp(38px, 5.4vw, 78px); margin-bottom: 0.3em; }
.blog-hero .lede { max-width: 30em; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 0 0 clamp(28px, 4vw, 52px); margin: 0; list-style: none;
  border-bottom: 1px solid var(--rule);
}

.featured { padding: clamp(32px, 4vw, 56px) 0; border-bottom: 1px solid var(--rule); }
.featured-grid {
  display: grid; grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 4vw, 64px); align-items: center;
}
.featured-body h2 { font-size: clamp(30px, 3.6vw, 50px); margin-bottom: 0.35em; }
.featured-body h2 a { text-decoration: none; }
.featured-body h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.featured-body .dek { font-size: clamp(18px, 1.5vw, 22px); max-width: 30em; color: var(--ink); }
/* Explicit height rather than aspect-ratio: a percentage height on the image only
   resolves reliably against a definite one, and the device shot is far taller than
   the card, so it would otherwise be cropped. */
.featured-art {
  border-radius: var(--radius-lg); overflow: hidden; background: var(--tint);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
  height: clamp(300px, 32vw, 440px); padding: clamp(20px, 2.5vw, 34px);
}
/* Flex, not grid: an auto-sized grid row ignores the container's fixed height, so a
   percentage max-height on the image resolves against the row and the shot gets cropped. */
.featured-art img { width: auto; height: auto; max-width: 100%; max-height: 100%; }

.post-grid {
  list-style: none; margin: 0; padding: clamp(36px, 5vw, 72px) 0 clamp(56px, 7vw, 110px);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 3.4vw, 48px);
}
.post-card {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 22px; border-top: 3px solid var(--black);
}
.post-card.is-hidden { display: none; }
.post-card h3 { font-size: clamp(21px, 1.9vw, 27px); margin: 0; line-height: 1.18; }
.post-card h3 a { text-decoration: none; }
.post-card h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-card p { margin: 0; font-size: 16.5px; color: var(--ink); }
.post-card .meta { margin-top: auto; padding-top: 6px; }
.post-card .pill { align-self: flex-start; }

.empty-state { grid-column: 1 / -1; padding: 40px 0; color: var(--muted); }

/* ------------------------------------------------------------ article page */

.article { padding: clamp(28px, 3.5vw, 56px) 0 0; }
/* em widths below resolve against each element's own font-size, so the display
   headline gets a display measure and the dek gets a reading measure. */
.article-head h1 { font-size: clamp(36px, 5vw, 72px); margin-bottom: 0.28em; max-width: 13em; }
.article-head .dek {
  font-family: var(--body); font-size: clamp(19px, 1.7vw, 25px);
  line-height: 1.45; color: var(--ink); max-width: 27em; margin-bottom: 22px;
}
.article-head .meta { padding-bottom: clamp(28px, 3.5vw, 48px); }

.article-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(32px, 5vw, 88px); align-items: start;
  padding-bottom: clamp(56px, 7vw, 110px);
  border-top: 1px solid var(--rule); padding-top: clamp(32px, 4vw, 60px);
}
.prose { max-width: var(--prose); font-size: 19px; line-height: 1.68; }

.toc { position: sticky; top: 104px; font-size: 15px; }
.toc h2 {
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 800; margin-bottom: 14px;
}
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.toc a {
  text-decoration: none; color: var(--muted); display: block;
  padding-left: 14px; border-left: 2px solid var(--rule); line-height: 1.35;
}
.toc a:hover { color: var(--black); }
.toc a.is-current { color: var(--black); font-weight: 700; border-left-color: var(--blue); }
.toc-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule); }
.toc-foot a { font-family: var(--heading); font-weight: 700; font-size: 14px; text-decoration: none; color: var(--blue-deep); }
.toc-foot a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ prose */

.prose > h2 {
  font-size: clamp(26px, 2.6vw, 36px);
  margin: 2em 0 0.55em; scroll-margin-top: 110px;
}
.prose > h2:first-child { margin-top: 0; }
.prose > h3 {
  font-size: clamp(20px, 1.8vw, 25px); margin: 1.9em 0 0.5em;
  scroll-margin-top: 110px;
}
.prose p { margin: 0 0 1.15em; }
.prose .standfirst { font-size: 21px; line-height: 1.6; }
.prose a { color: var(--blue-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.6em; }
.prose li > ul, .prose li > ol { margin-top: 0.6em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }
.prose figure { margin: 2em 0; }
.prose figcaption {
  font-size: 15px; color: var(--muted); margin-top: 12px; line-height: 1.5;
}
.prose img { border-radius: var(--radius); }
/* Diagrams are authored at a fixed viewBox and scale down to the measure. */
.prose figure svg { display: block; width: 100%; height: auto; max-width: 100%; }

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 5px; padding: 1px 6px;
}

blockquote.pull {
  margin: 2.2em 0; padding: 0 0 0 26px; border-left: 4px solid var(--blue);
  font-family: var(--heading); font-weight: 700; font-size: clamp(22px, 2.1vw, 29px);
  line-height: 1.3; letter-spacing: -0.015em; color: var(--black);
}
blockquote.pull p { margin: 0; }
blockquote.pull cite {
  display: block; margin-top: 14px; font-family: var(--body); font-style: normal;
  font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0;
}

/* Callouts */
.callout {
  margin: 2em 0; padding: 22px 26px; border-radius: var(--radius-lg);
  background: var(--paper); border: 1px solid var(--rule); font-size: 17.5px;
}
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title {
  font-family: var(--heading); font-weight: 800; font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 10px;
}
.callout.key { background: var(--tint); border-color: #d8e5fb; }
.callout.key .callout-title { color: var(--blue-deep); }
.callout.caveat { background: #fffaf0; border-color: #f2e3c4; }
.callout.caveat .callout-title { color: #8a6412; }

/* Stat strip */
.stat-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin: 2.2em 0; padding: 0; list-style: none;
}
.stat-strip li { margin: 0; padding: 20px 22px; border-radius: var(--radius-lg); background: var(--tint); }
.stat-strip b {
  display: block; font-family: var(--heading); font-weight: 800;
  font-size: clamp(30px, 3.2vw, 44px); line-height: 1; letter-spacing: -0.04em;
  color: var(--blue-deep); margin-bottom: 10px;
}
.stat-strip span { display: block; font-size: 15px; line-height: 1.4; color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 2em 0; -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 16.5px; }
.prose th, .prose td {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.prose thead th {
  font-family: var(--heading); font-weight: 800; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  border-bottom-width: 2px; border-bottom-color: var(--black);
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td strong { white-space: nowrap; }

/* Numbered steps */
.steps { list-style: none; counter-reset: step; margin: 2em 0; padding: 0; }
.steps > li {
  counter-increment: step; position: relative; padding-left: 52px; margin-bottom: 1.6em;
}
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff;
  font-family: var(--heading); font-weight: 800; font-size: 16px;
  display: grid; place-items: center;
}
.steps h3 { margin: 0 0 0.35em; font-size: 20px; }
.steps > li > :last-child { margin-bottom: 0; }

/* Citations */
.prose sup a {
  text-decoration: none; font-weight: 700; font-size: 0.72em;
  padding: 0 1px 0 2px; color: var(--blue-deep);
}
.prose sup a:hover { text-decoration: underline; }
.sources { margin-top: 3em; padding-top: 26px; border-top: 3px solid var(--black); }
.sources h2 { font-size: 22px; margin-bottom: 0.7em; }
.sources ol { font-size: 15.5px; line-height: 1.5; padding-left: 1.4em; }
.sources li { margin-bottom: 0.75em; }
.sources li:target { background: var(--tint); border-radius: 4px; }
.sources .tier {
  font-family: var(--heading); font-weight: 700; font-size: 11px;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
  margin-left: 6px; white-space: nowrap;
}

/* End-of-article CTA */
.article-cta {
  margin: 3em 0 0; padding: clamp(28px, 3.4vw, 44px);
  border-radius: var(--radius-lg); background: var(--blue); color: #fff;
}
.article-cta h2 { color: #fff; font-size: clamp(24px, 2.4vw, 34px); margin-bottom: 0.4em; }
.article-cta p { max-width: 34em; margin-bottom: 1.3em; }
.article-cta .btn-light { color: var(--black); }

/* Related */
.related { border-top: 1px solid var(--rule); padding: clamp(40px, 5vw, 72px) 0 clamp(56px, 7vw, 100px); }
.related h2 { font-size: clamp(22px, 2vw, 30px); margin-bottom: 1em; }
.related-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 3vw, 44px); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc {
    position: static; max-width: var(--prose); order: -1;
    padding: 20px 24px; background: var(--paper);
    border: 1px solid var(--rule); border-radius: var(--radius-lg);
    margin-bottom: 2.2em;
  }
  .toc ol { gap: 8px; }
  .toc a { border-left: 0; padding-left: 0; }
  .toc a.is-current { border-left: 0; }
  .toc-foot { display: none; }
  .post-grid, .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .featured-grid { grid-template-columns: 1fr; }
  .featured-art { order: -1; height: clamp(280px, 62vw, 340px); }
  .stat-strip { grid-template-columns: 1fr; }
  .article-head h1, .article-head .dek { max-width: none; }
}
@media (max-width: 620px) {
  .post-grid, .related-grid { grid-template-columns: 1fr; }
  .prose { font-size: 18px; }
  .steps > li { padding-left: 44px; }
  .steps > li::before { width: 30px; height: 30px; font-size: 15px; }
}

@media print {
  .site-header, .toc, .article-cta, .related, .reading-progress, .site-footer nav { display: none; }
  .article-layout { grid-template-columns: 1fr; border: 0; }
  .prose { max-width: none; font-size: 11pt; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
}
