/* Blog: listing and post pages. Extends ../style.css.
   Layout from the MotionSites "Blog Showcase" section: a full-width featured post over a grid of cards, photos that
   scale on hover under a dark veil with a centred circle and corner brackets. Ported to the site's own materials:
   light .card for the featured post and the article, glass for cards on the sky.
   The card, photo frame, pill and base grid live in ../style.css, because the home page shows them too. */

/* ---------- Heroes: shorter than the default, so the posts arrive sooner ---------- */
.page-hero--blog, .page-hero--post { min-height: 0; padding-bottom: calc(2 * var(--space-section, clamp(20px, 2.6vw, 36px))); }
.page-hero--post .page-hero__title { max-width: 15ch; font-size: clamp(2.3rem, 5.4vw, 4.5rem); line-height: 1; letter-spacing: var(--track-display); }

.blog-list { padding-top: 0; padding-bottom: var(--space-section-lg, clamp(32px, 4vw, 56px)); }

/* ---------- Featured post ---------- */
.blog-card--feature { background: var(--card); color: var(--card-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 40px 80px -48px rgba(var(--tint-rgb), 0.95); }
.blog-feature__body { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 16px; padding: clamp(20px, 4vw, 48px) clamp(12px, 3.4vw, 44px); }
.blog-feature__title { margin: 0; font-size: clamp(2rem, 3.9vw, 3rem); font-weight: 500; line-height: 1.02; letter-spacing: var(--track-display); text-wrap: balance; }
.blog-feature__text { margin: 0; max-width: 40ch; font-family: var(--font-body); font-size: clamp(1rem, 1.3vw, 1.0625rem); line-height: 1.6; color: var(--item-ink); text-wrap: pretty; }
.blog-feature__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: auto; padding-top: 12px; }
.blog-feature__foot .blog-card__meta { color: var(--item-ink); }
.blog-feature__tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
/* The feature is an article, not one big link (the author and tag are links too, and an anchor cannot hold an anchor):
   the title link stretches over the whole card with ::after, the author and tag links sit above it. */
.blog-card--feature { position: relative; }
.blog-feature__title a { color: inherit; }
.blog-feature__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-card); }
.blog-feature__title a:focus-visible { outline: none; }
.blog-feature__title a:focus-visible::after { outline: 2px solid var(--card-ink); outline-offset: -6px; }
.blog-feature__foot a { position: relative; z-index: 2; }
.blog-feature__foot .blog-card__meta a { text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }
.blog-card--feature :focus-visible { outline-color: var(--card-ink); }
@media (min-width: 900px) {
  .blog-card--feature { display: grid; grid-template-columns: 1fr 1fr; min-height: 520px; }
  .blog-card--feature .blog-media { aspect-ratio: auto; height: 100%; }
}

/* ---------- Grid: wide and narrow cards swap sides on the second row ---------- */
@media (min-width: 960px) {
  .blog-grid--mixed { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .blog-grid--mixed .blog-item { grid-column: span 5; }
  .blog-grid--mixed .blog-item:nth-child(4n + 1), .blog-grid--mixed .blog-item:nth-child(4n) { grid-column: span 7; }
  .blog-grid--mixed .blog-item:nth-child(4n + 1) .blog-media, .blog-grid--mixed .blog-item:nth-child(4n) .blog-media { flex: 1; aspect-ratio: auto; min-height: 260px; }
}

/* ---------- Post: back link and byline in the hero ---------- */
.post-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 18px; padding: 0 16px; border-radius: 12px; font-family: var(--font-body); font-size: 13px; letter-spacing: var(--track-small);
  background: var(--glass); box-shadow: var(--edge-top), var(--edge-ring); transition: background-color var(--dur-hover) var(--ease); }
.post-back svg { transition: transform var(--dur-spring) var(--ease-spring); }
@media (hover: hover) { .post-back:hover svg { transform: translateX(-3px); } }
.post-byline { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px; margin: 24px 0 0; font-family: var(--font-body); font-size: 14px; color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 14px rgba(var(--tint-rgb), 0.6); }
.post-byline .pill { text-shadow: none; }
.post-byline a:not(.pill) { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Post: one light sheet, photo inset at the top, a narrow reading column below ---------- */
.post { padding: 0 var(--gutter); }
.card.post__sheet { display: block; min-height: 0; max-width: 56rem; padding: 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 40px 80px -48px rgba(var(--tint-rgb), 0.95); }
.post__cover { position: relative; margin: 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: calc(var(--radius-card) - 8px); background: var(--bg-deep); }
.post__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, center); }
.post__body { max-width: 40rem; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(12px, 3vw, 20px) clamp(24px, 4vw, 40px); }
.post__sample { margin: 0 0 clamp(24px, 4vw, 36px); padding: 10px 14px; border-radius: 12px; background: rgba(var(--tint-rgb), 0.07); font-family: var(--font-body); font-size: 13px; line-height: 1.5; color: var(--item-ink); }
.post__prose { max-width: none; font-size: clamp(1.0625rem, 1.2vw, 1.125rem); }
.post__prose .post__lede { margin-bottom: 1.3em; font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 1.5rem); font-weight: 500; line-height: 1.35; letter-spacing: -0.015em; color: var(--card-ink); text-wrap: pretty; }
.post__prose h2 { margin-top: 1.8em; }
.post__prose strong { color: inherit; }
.post__prose a { color: var(--ink-soft); }
.post__prose blockquote { margin: 1.8em 0; padding: clamp(20px, 3vw, 28px); border-radius: 18px; background: rgba(var(--tint-rgb), 0.07); }
.post__prose blockquote p { margin: 0; font-family: var(--font-display); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 500; line-height: 1.25; letter-spacing: var(--track-title); color: var(--card-ink); text-wrap: pretty; }
.post__prose blockquote cite { display: block; margin-top: 12px; font-family: var(--font-body); font-size: 14px; font-style: normal; color: var(--item-ink); }
.post__prose h3 { margin-top: 1.6em; }
.post__prose ol { padding-left: 1.4em; }
.post__table { margin: 1.8em 0; overflow-x: auto; border-radius: 14px; border: 1px solid rgba(var(--tint-rgb), 0.14); -webkit-overflow-scrolling: touch; }
.post__table:focus-visible { outline: 2px solid var(--card-ink); outline-offset: 2px; }
.post__table table { width: 100%; border-collapse: collapse; font-family: var(--font-body); font-size: 15px; line-height: 1.5; text-align: left; }
.post__table th, .post__table td { padding: 12px 14px; vertical-align: top; border-bottom: 1px solid rgba(var(--tint-rgb), 0.12); }
.post__table thead th { background: rgba(var(--tint-rgb), 0.07); font-weight: 600; color: var(--item-ink); }
.post__table tbody th { font-weight: 600; color: var(--card-ink); }
.post__table tbody tr:last-child > * { border-bottom: 0; }
@media (max-width: 700px) { .post__table table { min-width: 34rem; } }
.post__end { display: grid; gap: 16px; margin-top: clamp(24px, 4vw, 36px); padding-top: 20px; border-top: 1px solid rgba(var(--tint-rgb), 0.14); font-family: var(--font-body); font-size: 14px; color: var(--item-ink); }
.post__end p { margin: 0; }
.post__end a { text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }
.post__backlink { display: inline-flex; align-items: center; min-height: 44px; justify-self: start; }
.card.post__sheet :focus-visible { outline-color: var(--card-ink); }

.post-more { padding-block: var(--space-section-lg, clamp(32px, 4vw, 56px)); }
.post-more .section__head { margin-bottom: clamp(20px, 3vw, 32px); }

/* Reading progress: one transformed bar, driven by page.js. */
.post-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { .post-back svg { transition: none; } }


/* ==========================================================================
   Tags: neutral pill for any tag without its own tint in ../style.css (links on glass and on the light card).
   ========================================================================== */
.pill--tag { background: #ece6f7; color: #3b1478; }
a.pill { text-decoration: none; transition: filter var(--dur-hover) var(--ease); }
@media (hover: hover) { a.pill:hover { filter: brightness(0.93); } }

/* ---------- Category chips (shown only when there are two or more tags) ---------- */
.tag-chips { margin: 0 0 clamp(20px, 3vw, 32px); }
.tag-chips ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tag-chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font-family: var(--font-body); font-size: 14px; line-height: 1.2; letter-spacing: var(--track-small); color: var(--white);
  background: var(--glass); box-shadow: var(--edge-top), var(--edge-ring); transition: background-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease); }
.tag-chip[aria-current] { background: var(--white); color: var(--card-ink); box-shadow: none; font-weight: 500; }
@media (hover: hover) { .tag-chip:not([aria-current]):hover { background: rgba(255, 255, 255, 0.24); } }
.tag-chip[aria-current]:focus-visible { outline-color: var(--white); }

/* ---------- Post list: text rows, no photos. The title link is stretched over the row; author and tag links sit above it. ---------- */
.post-list { margin-top: clamp(28px, 4vw, 48px); }
.tag-chips + .post-list, .section__inner > .post-list:first-child { margin-top: 0; }
.post-list__title { margin: 0 0 clamp(14px, 2vw, 22px); font-size: clamp(1.5rem, 2.8vw, 2.25rem); font-weight: 500; line-height: 1.05; letter-spacing: var(--track-title); text-shadow: 0 2px 30px rgba(var(--tint-rgb), 0.45); }
.post-list__empty { margin: 0; padding: clamp(18px, 2.4vw, 26px) clamp(18px, 2.8vw, 32px); border-radius: 20px; background: var(--glass); box-shadow: var(--edge-top), var(--edge-ring); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.post-rows { display: grid; gap: clamp(10px, 1.4vw, 14px); margin: 0; padding: 0; list-style: none; }
.post-row { --row-radius: clamp(20px, 2.4vw, 26px); position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 16px;
  padding: clamp(18px, 2.4vw, 26px) clamp(18px, 2.8vw, 32px); border-radius: var(--row-radius); background: var(--glass);
  box-shadow: var(--edge-top), var(--edge-ring), 0 28px 60px -44px rgba(var(--tint-rgb), 0.95);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  transition: transform var(--dur-spring) var(--ease-spring); }
.post-row__main { display: grid; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.post-row__title { margin: 0; font-size: clamp(1.3rem, 2.2vw, 1.75rem); font-weight: 500; line-height: 1.12; letter-spacing: var(--track-title); text-wrap: balance; }
.post-row__link::after { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: var(--row-radius); }
.post-row__link:focus-visible { outline: none; }
.post-row__link:focus-visible::after { outline: 2px solid var(--white); outline-offset: 3px; }
.post-row__text { margin: 0; max-width: 62ch; font-family: var(--font-body); font-size: 15px; line-height: 1.55; color: rgba(255, 255, 255, 0.94); text-wrap: pretty; }
.post-row__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 4px; }
.post-row__meta { margin: 0; font-family: var(--font-body); font-size: 13px; line-height: 1.4; letter-spacing: var(--track-small); color: rgba(255, 255, 255, 0.92); }
.post-row__meta a { text-decoration: underline; text-underline-offset: 3px; }
.post-row__tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.post-row__meta a, .post-row__tags a { position: relative; z-index: 1; }
.post-row__go { display: none; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  transition: transform var(--dur-spring) var(--ease-spring), background-color var(--dur-hover) var(--ease); }
.post-row__go svg { width: 20px; height: 20px; }
@media (min-width: 640px) {
  .post-row { grid-template-columns: minmax(0, 1fr) auto; gap: 24px; }
  .post-row__go { display: grid; }
}
@media (hover: hover) {
  .post-row:hover { transform: translateY(var(--lift-s)); }
  .post-row:hover .post-row__go { transform: translate(2px, -2px); background: rgba(255, 255, 255, 0.24); }
}

/* ---------- Pagination ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 12px; margin-top: clamp(28px, 4vw, 44px); font-family: var(--font-body); font-size: 14px; }
.pager__list { grid-column: 1 / -1; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pager__link { grid-row: 2; justify-self: start; }
.pager__link--next { justify-self: end; }
.pager__link, .pager__num { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 16px; border-radius: 14px; line-height: 1; letter-spacing: var(--track-small); color: var(--white);
  background: var(--glass); box-shadow: var(--edge-top), var(--edge-ring); transition: background-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease); }
.pager__num { padding: 0 8px; }
.pager__num[aria-current] { background: var(--white); color: var(--card-ink); box-shadow: none; font-weight: 500; }
.pager__num[aria-current]:focus-visible { outline-color: var(--white); }
.pager__link[aria-disabled] { opacity: 0.5; box-shadow: var(--edge-ring); }
.pager__gap { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 44px; color: rgba(255, 255, 255, 0.9); }
@media (hover: hover) {
  a.pager__link:hover, a.pager__num:not([aria-current]):hover { background: rgba(255, 255, 255, 0.24); }
}
@media (min-width: 640px) {
  .pager { grid-template-columns: auto 1fr auto; }
  .pager__list { grid-column: 2; grid-row: 1; }
  .pager__link { grid-row: 1; }
  .pager__link--prev { grid-column: 1; }
  .pager__link--next { grid-column: 3; }
}

/* ---------- Authors: hero, profile card (author page) and compact card (end of a post) ---------- */
.author-hero .page-hero__lead { max-width: 36rem; }
.author-profile { padding-top: 0; padding-bottom: 0; }
.author-profile + .blog-list { padding-top: var(--space-section-lg, clamp(32px, 4vw, 56px)); }
.author-card { color: var(--card-ink); }
.author-card--profile { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(18px, 3vw, 32px); max-width: 56rem; margin: 0 auto; padding: clamp(20px, 3.4vw, 40px); border-radius: var(--radius-card); background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 40px 80px -48px rgba(var(--tint-rgb), 0.95); }
.author-portrait { margin: 0; width: min(100%, 15rem); border-radius: calc(var(--radius-card) - 8px); overflow: hidden; background: rgba(var(--tint-rgb), 0.5); box-shadow: var(--edge-ring); }
.author-portrait img { display: block; width: 100%; height: auto; }
@media (min-width: 720px) {
  .author-card--profile.has-portrait { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
}
.author-card__text { min-width: 0; }
.author-card--profile .author-card__role { margin: 0 0 14px; font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 500; line-height: 1.2; letter-spacing: var(--track-title); text-wrap: balance; }
.author-card__bio { margin: 0 0 8px; max-width: 62ch; font-family: var(--font-body); font-size: clamp(1rem, 1.1vw, 1.0625rem); line-height: 1.7; color: var(--item-ink); text-wrap: pretty; }
.author-card__bio strong { color: var(--card-ink); font-weight: 600; }
.author-card__more { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-family: var(--font-body); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }
.author-card__more svg { flex: none; }
.author-card :focus-visible { outline-color: var(--card-ink); }

.author-card--compact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; padding: 16px 20px; border-radius: 18px; background: rgba(var(--tint-rgb), 0.07); }
.author-card__label { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--item-ink); }
.post__end .author-card__name { margin-top: 2px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; line-height: 1.15; letter-spacing: var(--track-title); color: var(--card-ink); }
.post__end .author-card__line { margin-top: 4px; max-width: 36ch; font-size: 14px; line-height: 1.5; color: var(--item-ink); }
.author-card__all { display: inline-flex; align-items: center; min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .post-row, .post-row__go, .tag-chip, .pager__link, .pager__num, a.pill { transition: none; }
  .post-row:hover, .post-row:hover .post-row__go { transform: none; }
}

.tag-chip__n { margin-left: 8px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.72; }
.tag-chip[aria-current] .tag-chip__n { opacity: 0.6; }

/* Author filter row sits above the topic chips: keep the two rows close together */
.tag-chips--author { margin-bottom: 12px; }
.tag-chips--author + .tag-chips { margin-top: 0; }

/* Views and likes (blog/counts.js). Hidden until the numbers arrive, so a visitor never sees a made-up 0. */
html:not(.js) [data-blog-stats], html:not(.js) [data-post-stats],
[data-blog-stats].is-failed, [data-post-stats].is-failed { display: none; }
.js [data-blog-stats]:not(.is-ready), .js [data-post-stats]:not(.is-ready) { visibility: hidden; }
[data-blog-stats], [data-post-stats] { transition: opacity var(--dur-hover) var(--ease); }

/* Read-only counts on cards and rows: same voice as the byline next to them. */
.blog-stats { display: flex; align-items: center; gap: 14px; margin: 0; font-family: var(--font-body); font-size: 13px; line-height: 1.4; letter-spacing: var(--track-small); font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.92); }
.blog-stats__i { display: inline-flex; align-items: center; gap: 5px; }
.blog-stats svg { flex: none; width: 16px; height: 16px; }
.blog-feature__foot .blog-stats { color: var(--item-ink); }

/* End of a post: views on the left, the like button on the right. */
.post-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--item-ink); }
.post__end .post-stats p { display: inline-flex; align-items: center; gap: 8px; }
.like-btn { --like: #a81f4c; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid rgba(var(--tint-rgb), 0.18); border-radius: 999px; background: transparent; font: inherit; font-size: 15px; color: var(--card-ink); cursor: pointer; transition: background-color var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease); -webkit-tap-highlight-color: transparent; }
.like-btn .heart { width: 20px; height: 20px; transition: fill var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease); }
.like-btn.is-on { border-color: color-mix(in srgb, var(--like) 45%, transparent); background: color-mix(in srgb, var(--like) 9%, transparent); color: var(--like); }
.like-btn.is-on .heart { fill: currentColor; }
.like-btn:focus-visible { outline: 2px solid var(--card-ink); outline-offset: 2px; }
@media (hover: hover) { .like-btn:not(.is-on):hover { background: rgba(var(--tint-rgb), 0.07); } }
@media (prefers-reduced-motion: no-preference) {
  .like-btn.is-on .heart { animation: like-pop 0.42s var(--ease-spring); }
  .like-btn:active .heart { transform: scale(0.88); }
}
@keyframes like-pop { 0% { transform: scale(0.7); } 55% { transform: scale(1.22); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .like-btn, .like-btn .heart, [data-blog-stats], [data-post-stats] { transition: none; } }
