/* Blog index and post pages. Light surfaces use the paper tokens only (no hard-coded paper colours). */

/* ------------------------------------------------------------------ index hero + featured post */
.blog-hero { padding-bottom: clamp(56px, 7vw, 96px); }
.blog-hero h1 { font-size: clamp(2.6rem, 5.4vw, 4.8rem); }
.blog-hero .lede { margin-top: 24px; }
.feature-post { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(24px, 3.5vw, 48px); align-items: center;
  margin-top: clamp(40px, 5vw, 64px); padding: clamp(14px, 1.6vw, 20px); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(23, 38, 61, 0.88), rgba(15, 27, 45, 0.88)); box-shadow: inset 0 0 0 1px var(--night-line);
  transition: box-shadow 0.4s ease, transform 0.6s var(--ease-out); }
.feature-post:hover { box-shadow: inset 0 0 0 1px var(--night-line-strong), 0 30px 70px -40px rgba(0, 0, 0, 0.8); transform: translateY(-3px); }
.feature-post-img { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--night-3); }
.feature-post-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease-out); }
.feature-post:hover .feature-post-img img { transform: scale(1.03); }
.feature-post-body { padding: 8px clamp(4px, 1.5vw, 20px) 8px 0; }
.feature-post h2 { margin-top: 12px; font-size: clamp(1.6rem, 2.4vw, 2.2rem); line-height: 1.12; }
.feature-post .post-excerpt { margin-top: 14px; color: var(--mist); }
.feature-post .link-arrow { margin-top: 22px; }
@media (max-width: 860px) { .feature-post { grid-template-columns: 1fr; } .feature-post-body { padding: 4px 6px 10px; } }

/* shared post meta */
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--fog); }
.post-topic { font-weight: 600; color: var(--sky); }
:is(.paper, .paper-2) .post-meta { color: var(--paper-muted); }
:is(.paper, .paper-2) .post-topic { color: var(--blue); }

/* ------------------------------------------------------------------ index list */
.blog-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; margin-bottom: clamp(28px, 3.5vw, 44px); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
  color: var(--paper-body); box-shadow: inset 0 0 0 1px var(--paper-line); transition: color 0.2s, background-color 0.2s, box-shadow 0.2s; }
.filter-chip:hover { box-shadow: inset 0 0 0 1px var(--paper-muted); }
.filter-chip[aria-pressed='true'] { background: var(--paper-ink); color: var(--paper); box-shadow: none; }
.filter-n { font-size: 0.78rem; color: var(--paper-muted); font-variant-numeric: tabular-nums; }
.filter-chip[aria-pressed='true'] .filter-n { color: inherit; opacity: 0.7; }

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 32px); }
@media (max-width: 1000px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }
.post-card { display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; background: var(--paper);
  box-shadow: 0 0 0 1px var(--paper-line); transition: transform 0.5s var(--ease-out), box-shadow 0.4s ease, opacity 0.3s ease; }
.post-card:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--paper-line), 0 24px 50px -30px rgba(15, 23, 42, 0.35); }
.post-card-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-line); }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease-out); }
.post-card:hover .post-card-img img { transform: scale(1.04); }
.post-card-body { padding: 20px 22px 24px; }
.post-card h3 { margin-top: 10px; font-size: 1.4rem; line-height: 1.2; color: var(--paper-ink); }
.post-card .post-excerpt { margin-top: 10px; font-size: 0.95rem; line-height: 1.55; color: var(--paper-body);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* filter motion: leaving cards fade and drop; arriving cards rise in (transform/opacity only) */
.post-card[hidden] { display: none; }
.post-card.leaving { opacity: 0; transform: translateY(8px) scale(0.98); pointer-events: none; }
.post-card.entering { opacity: 0; transform: translateY(12px); }
.post-empty { color: var(--paper-muted); }
.blog-more { margin-top: clamp(36px, 4vw, 56px); display: flex; justify-content: center; }

/* ------------------------------------------------------------------ post page */
.read-progress { position: fixed; left: 0; right: 0; top: 0; z-index: 120; height: 3px; pointer-events: none; }
.read-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--aqua), var(--blue)); transform-origin: left center; transform: scaleX(0); will-change: transform; }

.post-hero { padding-bottom: clamp(140px, 16vw, 220px); }
.crumbs { display: flex; gap: 10px; font-size: 0.9rem; color: var(--fog); margin-bottom: 22px; }
.crumbs a { color: var(--mist); }
.crumbs a:hover { color: var(--cream); }
.post-hero h1 { font-size: clamp(2.3rem, 4.6vw, 4.1rem); max-width: 18em; }
.post-hero h1 .split-line > span { white-space: normal; }
.byline { display: flex; align-items: center; gap: 14px; margin-top: 30px; }
.byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(142, 219, 255, 0.25); }
.byline b { display: block; color: var(--cream); font-weight: 600; }
.byline span { display: block; color: var(--fog); font-size: 0.9rem; }

.post-surface { position: relative; padding-bottom: clamp(72px, 9vw, 120px); }
.post-hero-img { margin: calc(-1 * clamp(110px, 13vw, 180px)) auto 0; max-width: 1080px; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--paper-line); box-shadow: 0 40px 80px -40px rgba(15, 23, 42, 0.45); position: relative; z-index: 3; }
.post-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.post-layout { display: grid; grid-template-columns: minmax(0, 68ch) minmax(220px, 280px); justify-content: center; gap: clamp(40px, 6vw, 96px); margin-top: clamp(48px, 6vw, 80px); }
@media (max-width: 1100px) { .post-layout { grid-template-columns: minmax(0, 68ch); } .post-aside { display: none; } }

/* long-form typography */
.prose { font-size: 1.125rem; line-height: 1.7; color: var(--paper-body); }
.prose > * + * { margin-top: 1.15em; }
.prose > p:first-child { font-size: 1.32rem; line-height: 1.55; color: var(--paper-ink); }
.prose h2 { margin-top: 2.1em; font-size: clamp(1.75rem, 2.6vw, 2.15rem); line-height: 1.15; color: var(--paper-ink); scroll-margin-top: calc(var(--nav-h) + 24px); }
.prose h2 + * { margin-top: 0.7em; }
.prose h3 { margin-top: 1.8em; font-size: 1.45rem; color: var(--paper-ink); }
.prose a { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose blockquote { margin: 2em 0; padding: 4px 0 4px 26px; border-left: 3px solid var(--blue); }
.prose blockquote p { font-family: var(--title); font-style: italic; font-size: clamp(1.45rem, 2.2vw, 1.75rem); line-height: 1.32; color: var(--paper-ink); }
.prose hr { border: 0; height: 1px; background: var(--paper-line); margin: 2.4em 0; }
.prose-sign-off { color: var(--paper-muted); }
.prose-figure { margin: 2.2em 0; }
.prose-figure img { width: 100%; height: auto; border-radius: 14px; box-shadow: 0 0 0 1px var(--paper-line), 0 26px 50px -34px rgba(15, 23, 42, 0.4); }
.prose-figure figcaption { margin-top: 12px; font-size: 0.92rem; line-height: 1.5; color: var(--paper-muted); }
.cite { display: inline-flex; align-items: center; margin-left: 6px; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; color: var(--blue); background: rgba(0, 149, 237, 0.08); white-space: nowrap; }

/* sticky aside: table of contents + product tie-in */
.post-aside { position: relative; }
.toc { position: sticky; top: calc(var(--nav-offset, var(--nav-h)) + 32px); transition: top 0.45s var(--ease-out); }
.toc-title { font-size: 0.86rem; font-weight: 600; color: var(--paper-ink); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--paper-line); }
.toc a { position: relative; display: block; padding: 7px 0 7px 16px; font-size: 0.92rem; line-height: 1.4; color: var(--paper-muted); transition: color 0.25s ease; }
.toc a::before { content: ''; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--blue); transform: scaleY(0); transform-origin: top; transition: transform 0.35s var(--ease-out); }
.toc a:hover { color: var(--paper-ink); }
.toc a.active { color: var(--paper-ink); font-weight: 500; }
.toc a.active::before { transform: scaleY(1); }
.tie-in { position: relative; display: grid; gap: 6px; margin-top: 40px; padding: 22px 20px 20px; border-radius: 16px; overflow: hidden; color: var(--cream);
  background: linear-gradient(180deg, #13223A, #0C1626); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2); transition: transform 0.5s var(--ease-out); }
.tie-in:hover { transform: translateY(-3px); }
.tie-in img { width: 96px; height: auto; margin-bottom: 6px; }
.tie-in-kicker { font-size: 0.8rem; color: var(--sky-strong); font-weight: 600; }
.tie-in b { font: 400 1.35rem/1.15 var(--title); }
.tie-in span:not(.tie-in-kicker):not(.link-arrow):not(.arrow) { font-size: 0.9rem; color: var(--mist); }
.tie-in .link-arrow { margin-top: 8px; font-size: 0.92rem; }

.related { margin-top: clamp(72px, 9vw, 120px); padding-top: clamp(48px, 6vw, 72px); border-top: 1px solid var(--paper-line); }
.related h2 { margin-bottom: clamp(24px, 3vw, 36px); color: var(--paper-ink); }

/* markdown from the CMS: inline images, footnotes, tables, code */
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose h4 { margin-top: 1.6em; font: 600 1.1rem/1.3 var(--sans); color: var(--paper-ink); }
.prose strong { color: var(--paper-ink); font-weight: 600; }
.prose sup { line-height: 0; }
.prose sup a, .prose a[data-footnote-backref] { font-size: 0.75em; font-weight: 600; text-decoration: none; padding: 0 1px; }
.prose .footnotes { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--paper-line); font-size: 0.95rem; line-height: 1.55; color: var(--paper-muted); }
.prose .footnotes ol { padding-left: 1.3em; }
.prose .footnotes li + li { margin-top: 0.5em; }
.prose .footnotes p { margin: 0; }
.prose .footnotes a { overflow-wrap: anywhere; }
.prose li[id^='user-content-fn-'] { scroll-margin-top: calc(var(--nav-h) + 24px); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.98rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--paper-line); text-align: left; vertical-align: top; }
.prose th { color: var(--paper-ink); font-weight: 600; }
.prose code { font-family: var(--mono, ui-monospace, monospace); font-size: 0.9em; padding: 2px 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.06); }
.prose pre { overflow-x: auto; padding: 16px 18px; border-radius: 12px; background: rgba(15, 23, 42, 0.05); }
.prose pre code { padding: 0; background: none; }
.byline b a { color: inherit; }
.byline b a:hover { color: var(--sky); }
