/* Riverforge v4 version B: the blog. Post pages and the /insights/ index, both built by tools/build_blog.py.
   Sits on top of ../styles.css and ../services/services.css.
   Each post carries its own colour, taken from its cover: --tone (dark, for panels) and --tint (light).
   Posts set them on <main>, cards set them on the card. */

:root { --tone: var(--ink); --tint: var(--paper); --measure: 44rem; }

/* Reading progress, under the header */
.post-progress { position: fixed; z-index: 99; top: var(--header); left: 0; right: 0; height: 3px; pointer-events: none; }
.post-progress span { display: block; height: 100%; background: var(--copper); transform: scaleX(0); transform-origin: 0 50%; }

/* Post hero: centred */
.post-hero { display: grid; justify-items: center; gap: 22px; padding: calc(var(--header) + 9vh) var(--gutter) 8vh; background: var(--paper); text-align: center; }
.post-hero.no-cover { padding-bottom: 10vh; }
.post-crumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; font-size: 15px; color: var(--muted); }
.post-crumbs a { color: var(--ink); font-weight: 650; text-decoration: none; }
.post-crumbs a:hover { color: var(--copper); }
.post-hero h1 { max-width: 15em; font-size: clamp(34px, 4.7vw, 80px); text-wrap: balance; }
.post-lede { max-width: 34em; font-size: clamp(18px, 1.45vw, 22px); line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.post-byline { display: flex; align-items: center; gap: 14px; margin-top: 8px; text-align: left; font-size: 15px; line-height: 1.35; color: var(--muted); }
.post-byline img { width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; }
.post-byline b { display: block; color: var(--ink); font-weight: 650; }

/* Cover: straddles the hero and the article */
.post-cover { padding: 0 var(--gutter); background: linear-gradient(var(--paper) 50%, var(--white) 50%); }
.post-cover > img, .post-shot { width: 100%; max-width: 1180px; margin: 0 auto; aspect-ratio: 2 / 1; border-radius: 14px; box-shadow: 0 1px 2px rgba(14, 17, 22, .06), 0 34px 70px -34px rgba(14, 17, 22, .4); }
.post-cover > img { object-fit: cover; }
.post-shot { position: relative; overflow: hidden; background: var(--tone); }
.post-shot img { position: absolute; left: 50%; top: 10%; width: min(58%, 810px); border-radius: 10px; transform: translateX(-50%) rotate(-1.5deg); box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 40px 80px -30px rgba(0, 0, 0, .6); }
.post-cover figcaption { max-width: 1180px; margin: 14px auto 0; font-size: 14px; line-height: 1.45; color: var(--muted); text-align: center; }

/* Body: contents and share on the left, the article in the middle of the page */
.post-body { padding: 10vh var(--gutter) 12vh; background: var(--white); }
.post-layout { display: grid; gap: 32px; max-width: var(--measure); margin: 0 auto; }
.post-side { display: grid; gap: 22px; align-content: start; min-width: 0; }
.post-main { min-width: 0; }

.post-toc { border-radius: 10px; background: var(--paper); }
.post-toc summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; list-style: none; cursor: pointer; font-weight: 650; font-size: 16px; }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc summary::after { content: ""; width: 9px; height: 9px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.post-toc[open] summary::after { margin-top: 4px; transform: rotate(225deg); }
.post-toc nav { display: grid; padding: 0 20px 18px; }
.post-toc nav a { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); font-size: 15px; line-height: 1.35; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s; }
.post-toc nav a:hover, .post-toc nav a.is-active { color: var(--ink); border-left-color: var(--copper); }
.post-toc nav a.is-active { font-weight: 600; }

.post-share { display: none; gap: 10px; }
.post-share a, .post-share button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px; border: 0; border-radius: 3px; background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-size: 14.5px; font-weight: 650; cursor: pointer; text-decoration: none; transition: box-shadow .2s, color .2s; }
.post-share a { width: 40px; padding: 0; }
.post-share a:hover, .post-share button:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.post-share a:hover { color: #0a66c2; }

/* Article */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 22px; }
.prose p, .prose li { font-size: 18px; line-height: 1.72; color: var(--ink-2); }
.prose > p:first-child { font-size: clamp(19px, 1.4vw, 21px); line-height: 1.65; color: var(--ink); }
.prose h2 { margin-top: 72px; font-size: clamp(27px, 2.7vw, 42px); line-height: 1.04; text-wrap: balance; scroll-margin-top: calc(var(--header) + 28px); }
.prose h3 { margin-top: 40px; font-size: clamp(20px, 1.7vw, 25px); line-height: 1.15; scroll-margin-top: calc(var(--header) + 28px); }
.prose h2 + p, .prose h3 + p { margin-top: 16px; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--copper); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { color: var(--copper); }
.prose strong { font-weight: 680; color: var(--ink); }
.prose ul, .prose ol { display: grid; gap: 12px; }
.prose ul li { position: relative; padding-left: 26px; }
.prose ul li::before { content: ""; position: absolute; left: 3px; top: .72em; width: 8px; height: 8px; border-radius: 50%; background: var(--copper); }
.prose ol { counter-reset: n; }
.prose ol li { position: relative; padding-left: 34px; counter-increment: n; }
.prose ol li::before { content: counter(n); position: absolute; left: 0; top: .1em; font-stretch: 112%; font-weight: 700; color: var(--copper); }
.prose blockquote p { font-size: inherit; line-height: inherit; color: inherit; }
.prose blockquote cite { display: block; margin-top: 12px; font-size: 15px; font-style: normal; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.prose blockquote { padding-left: 24px; border-left: 3px solid var(--copper); font-stretch: 112%; font-weight: 600; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.3; letter-spacing: -.015em; }
.prose .rf-fig, .prose .wp-block-image { margin-top: 40px; margin-bottom: 18px; }
.prose .rf-fig img, .prose .wp-block-image img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line), 0 24px 50px -30px rgba(14, 17, 22, .35); }
.prose .rf-fig figcaption, .prose .wp-block-image figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); }
.prose .table-wrap, .prose .wp-block-table { overflow-x: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.prose table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 15.5px; }
.prose th { text-align: left; padding: 14px 16px; background: var(--tone); color: #fff; font-weight: 650; font-size: 14px; }
.prose td { padding: 13px 16px; border-top: 1px solid var(--line); line-height: 1.5; vertical-align: top; color: var(--ink-2); }
.prose tbody tr:nth-child(even) td { background: var(--paper); }

/* Key takeaways: the post's colour */
.prose .post-takeaways { padding: clamp(28px, 3.4vw, 44px); border-radius: 14px; background: var(--tone); color: #fff; }
.prose .post-takeaways > * + * { margin-top: 16px; }
.prose .post-takeaways h2 { margin-top: 0; font-size: clamp(24px, 2.2vw, 32px); color: #fff; }
.prose .post-takeaways p, .prose .post-takeaways li { color: rgba(255, 255, 255, .84); font-size: 17px; line-height: 1.6; }
.prose .post-takeaways ul { gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .16); }
.prose .post-takeaways ul li::before { background: #e69466; }

/* FAQ: open-and-close questions */
.prose .post-faq { margin-top: 28px; border-bottom: 1px solid var(--line); }
.post-faq details { border-top: 1px solid var(--line); }
.post-faq summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 22px 0; list-style: none; cursor: pointer; }
.post-faq summary::-webkit-details-marker { display: none; }
.post-faq summary::after { content: ""; flex: none; width: 14px; height: 14px; margin-top: 6px; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; transition: transform .25s; }
.post-faq details[open] summary::after { transform: rotate(45deg); color: var(--copper); }
.prose .post-faq h3, .prose .post-faq summary { margin: 0; font-size: clamp(19px, 1.5vw, 22px); line-height: 1.25; transition: color .2s; }
.post-faq summary:hover h3, .post-faq summary:hover { color: var(--copper); }
.prose .post-faq summary { font-stretch: 112%; font-weight: 660; letter-spacing: -.02em; }
.post-faq summary::after { color: var(--ink); }
.post-faq details > p { max-width: 38em; padding-bottom: 24px; }

/* Author */
.post-author { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; max-width: var(--measure); margin-top: 72px; padding: 30px; border-radius: 14px; background: var(--tint); }
.post-author img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.post-author p { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.post-author p + p { margin-top: 6px; }
.post-author .post-author-name { font-stretch: 112%; font-weight: 680; font-size: 20px; letter-spacing: -.015em; color: var(--ink); }
.post-author-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px !important; }
.post-author-links a { font-weight: 650; font-size: 15px; text-decoration-color: var(--copper); text-underline-offset: 3px; }
.post-author-links a:hover { color: var(--copper); }

/* Keep reading */
.post-next { padding: 14vh var(--gutter); background: var(--paper); }
.post-next h2 { font-size: clamp(32px, 4vw, 68px); }
.post-all { display: inline-block; margin-top: 44px; padding-bottom: 2px; border-bottom: 1.5px solid var(--copper); font-weight: 650; text-decoration: none; }
.post-all:hover { color: var(--copper); }
.post-page .related { background: var(--white); }

/* Post cards, on the index and under each post */
.post-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 56px clamp(24px, 3vw, 44px); margin-top: 44px; }
.post-card { display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none; }
.post-card-media { position: relative; display: block; aspect-ratio: 3 / 2; margin-bottom: 10px; overflow: hidden; border-radius: 12px; background: var(--tone); }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.post-card-media.is-shot img { position: absolute; left: 50%; top: 13%; width: 76%; height: auto; border-radius: 8px; transform: translateX(-50%) rotate(-2deg); box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 30px 60px -24px rgba(0, 0, 0, .6); }
.post-card-media.is-empty { display: grid; place-items: center; }
.post-card-media.is-empty img { width: 48px; height: 48px; }
.post-card h3 { max-width: 20em; font-size: clamp(22px, 1.8vw, 28px); line-height: 1.08; text-wrap: balance; transition: color .2s; }
.post-card p { max-width: 34em; font-size: 16px; line-height: 1.55; color: var(--muted); }
.post-card small { margin-top: auto; padding-top: 4px; font-size: 14.5px; color: var(--muted); }
.post-card:hover h3 { color: var(--copper); }
.post-card:hover .post-card-media img { transform: scale(1.04); }
.post-card:hover .post-card-media.is-shot img { transform: translateX(-50%) translateY(-8px) rotate(-1deg); }

/* Index (/insights/) */
.blog-hero { display: grid; gap: 24px; padding: calc(var(--header) + 11vh) var(--gutter) 7vh; background: var(--paper); }
.blog-hero h1 { max-width: 12em; font-size: clamp(40px, 6.2vw, 112px); }
.blog-hero .svc-lede { margin-top: 0; }
.blog-lead { padding: 0 var(--gutter) 14vh; background: var(--paper); }
.blog-feature { display: grid; overflow: hidden; border-radius: 16px; background: var(--tone); color: #f5f6f8; text-decoration: none; box-shadow: 0 1px 2px rgba(14, 17, 22, .08), 0 40px 80px -48px rgba(14, 17, 22, .55); }
.blog-feature .post-card-media { aspect-ratio: 16 / 10; margin: 0; border-radius: 0; }
.blog-feature-text { display: grid; align-content: center; justify-items: start; gap: 20px; padding: clamp(28px, 4.4vw, 72px); }
.blog-feature h2 { max-width: 14em; font-size: clamp(30px, 3.3vw, 56px); line-height: 1.02; text-wrap: balance; color: #fff; }
.blog-feature p { max-width: 30em; font-size: clamp(17px, 1.3vw, 20px); line-height: 1.55; color: rgba(255, 255, 255, .76); }
.blog-feature .post-byline { margin: 0; color: rgba(255, 255, 255, .7); }
.blog-feature .post-byline b { color: #fff; }
.blog-read { display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; padding: 14px 20px; border-radius: 3px; background: #fff; color: var(--ink); font-weight: 650; font-size: 16px; transition: background .2s, color .2s; }
.blog-read i { font-style: normal; transition: transform .2s; }
.blog-feature:hover .blog-read { background: var(--copper); color: #fff; }
.blog-feature:hover .blog-read i { transform: translateX(4px); }
.blog-feature:hover .post-card-media img { transform: scale(1.03); }

.blog-more { padding: 14vh var(--gutter); background: var(--white); }
.blog-more > h2 { font-size: clamp(32px, 4vw, 68px); }
/* The last card asks for questions: an email being written, on a plain panel */
.post-card.is-ask .post-card-media { display: grid; place-items: center; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.ask-mail { display: grid; width: 78%; padding: 6px 0 0; border-radius: 10px; background: var(--white); font-size: 14px; line-height: 1.4; color: var(--ink-2); transform: rotate(-2deg); box-shadow: 0 1px 2px rgba(14, 17, 22, .08), 0 30px 60px -28px rgba(14, 17, 22, .35); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.ask-mail > span { display: flex; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.ask-mail b { width: 4.2em; flex: none; font-weight: 500; color: var(--muted); }
.ask-mail .ask-text { display: block; min-height: 6.5em; padding: 14px 18px; border: 0; font-size: 15px; color: var(--ink); }
.ask-text i { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: var(--copper); animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.post-card.is-ask small { font-weight: 650; color: var(--ink); }
.post-card.is-ask:hover .ask-mail { transform: rotate(-1deg) translateY(-8px); }

@media (min-width: 700px) {
  .post-share { display: flex; }
}
@media (min-width: 1000px) {
  .blog-feature { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .blog-feature .post-card-media { aspect-ratio: auto; min-height: 540px; }
}
/* Wide screens: contents beside the article */
@media (min-width: 1100px) {
  .post-layout { grid-template-columns: 15rem minmax(0, var(--measure)); justify-content: center; gap: 0 clamp(48px, 5vw, 80px); max-width: none; }
  .post-side { position: sticky; top: calc(var(--header) + 40px); align-self: start; }
  .post-toc { border-radius: 0; background: none; }
  .post-toc summary { padding: 0 0 14px; font-size: 15px; pointer-events: none; }
  .post-toc summary::after { display: none; }
  .post-toc nav { max-height: calc(100vh - var(--header) - 230px); padding: 0; overflow: auto; }
  .post-share { padding-top: 22px; border-top: 1px solid var(--line); }
}
/* Wider still: a matching empty column on the right, so the article sits under the title */
@media (min-width: 1360px) {
  .post-layout { grid-template-columns: 15rem minmax(0, var(--measure)) 15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card-media img, .blog-read i, .ask-mail { transition: none; }
  .ask-text i { animation: none; }
}
