/* article: UX pass 26 Nov (parallel agents). Loaded after style.css.
   Blog index cards and article pages: comfortable measure, big photos, small motions. */

/* ----- Article: reading column ----- */
.post { overflow-x: clip; }
.post-col { max-width: calc(31em + 2 * var(--gutter)); font-size: 1.0625rem; } /* Barlow is narrow: 31em gives about 68 to 72 characters a line */
@media (min-width: 768px) { .post-col { font-size: 1.1875rem; } }

.post-hero { padding-bottom: clamp(28px, 4vw, 44px); }
.post-hero h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); line-height: 1.06; text-wrap: balance; }
.post-hero .tag-list { gap: 8px; margin-top: 16px; }
.post-hero .tag-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; line-height: 1.2; transition: border-color .2s, color .2s; }
.post-hero .tag-list a:hover { border-color: var(--cyan); }

/* Reading progress bar: CSS scroll timeline where supported, nothing otherwise */
.read-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .read-progress { display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 4px; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; animation: sjf-read-progress linear both; animation-timeline: scroll(root block); }
  @keyframes sjf-read-progress { to { transform: scaleX(1); } }
}
@media (prefers-reduced-motion: reduce) { .read-progress { display: none; } }

/* Large cover: wider than the text, full bleed on phones */
.post-cover-wrap { margin-top: clamp(20px, 3vw, 32px); }
.post-cover-frame { overflow: hidden; border-radius: 10px; aspect-ratio: 21 / 9; background: var(--surface); box-shadow: 0 18px 50px rgba(24, 32, 44, .14); }
.post-cover-frame picture { display: contents; }
.post-cover-frame .post-cover { margin: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
@media (prefers-reduced-motion: no-preference) {
  .post-cover-frame .post-cover { animation: sjf-cover-in 1.4s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes sjf-cover-in { from { transform: scale(1.06); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (max-width: 860px) { .post-cover-frame { aspect-ratio: 16 / 9; } }
@media (max-width: 699px) {
  .post-cover-wrap { padding: 0; }
  .post-cover-frame { border-radius: 0; box-shadow: none; }
}

/* ----- Article: body text ----- */
.post-body { padding-top: clamp(28px, 4vw, 44px); padding-bottom: clamp(48px, 7vw, 80px); line-height: 1.72; }
.post-body p { margin-bottom: 1.15em; }
.post-body > p:first-of-type { font-size: 1.1em; color: var(--ink); }
.post-body h2 { font-size: clamp(1.75rem, 3.4vw, 2.3rem); line-height: 1.12; margin: 2.1em 0 .6em; scroll-margin-top: 96px; text-wrap: balance; }
.post-body h3 { font-size: clamp(1.25rem, 2.2vw, 1.4rem); margin: 1.7em 0 .45em; scroll-margin-top: 96px; }
.post-body h2 + h3 { margin-top: .8em; }
.post-body strong { color: var(--ink); }

/* Lists: brand markers, a little air between items */
.post-body ul, .post-body ol { padding-left: 1.4em; margin: 0 0 1.3em; }
.post-body li { margin-bottom: .5em; padding-left: .2em; }
.post-body li::marker { color: var(--cyan-dark); font-weight: 700; }
.post-body ol > li::marker { color: var(--violet); font-family: var(--font-head); }
.post-body li > ul, .post-body li > ol { margin: .5em 0 0; }
.post-body li.task::marker { content: ""; }

/* Tables: scroll sideways inside their own box on phones, with an edge shadow as a hint */
.table-scroll { margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch;
  background: linear-gradient(90deg, #fff 30%, rgba(255, 255, 255, 0)) left / 40px 100% no-repeat local, linear-gradient(270deg, #fff 30%, rgba(255, 255, 255, 0)) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(24, 32, 44, .16), transparent) left / 14px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, rgba(24, 32, 44, .16), transparent) right / 14px 100% no-repeat scroll; }
.table-scroll:focus-visible { outline-offset: 0; }
.post-body .table-scroll table { display: table; width: 100%; min-width: 520px; margin: 0; font-size: .92em; line-height: 1.5; background: transparent; }
.post-body .table-scroll th, .post-body .table-scroll td { padding: 11px 14px; }
.post-body .table-scroll tr:last-child td { border-bottom: 0; }
.post-body .table-scroll th { background: rgba(243, 245, 248, .92); }
.post-body .table-scroll tbody tr:nth-child(even) td { background: rgba(243, 245, 248, .5); }
/* Desktop: tables get a little more room than the text, centred on the column */
@media (min-width: 1000px) {
  .post-body .table-scroll { width: min(840px, calc(100vw - 2 * var(--gutter))); margin-left: calc(50% - min(420px, 50vw - var(--gutter))); }
}

.post-body blockquote { margin: 1.6em 0; padding: 14px 20px; border-left: 4px solid var(--cyan); background: var(--surface); border-radius: 0 8px 8px 0; color: var(--ink-2); }
.post-body blockquote p:last-child { margin-bottom: 0; }

/* "In this article" jump list (closed by default: one line until opened) */
.post-toc { margin: 0 0 2em; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.post-toc summary { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 18px; cursor: pointer; list-style: none; font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2.5px solid var(--violet); border-bottom: 2.5px solid var(--violet); transform: rotate(45deg) translate(-2px, -2px); transition: transform .25s; }
.post-toc[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.post-toc-count { font-family: var(--font); font-weight: 500; font-size: .85rem; color: var(--muted); }
.post-toc ol { margin: 0; padding: 0 18px 16px 2.4em; font-size: .95em; line-height: 1.45; }
.post-toc li { margin-bottom: .2em; }
.post-toc a { display: inline-block; padding: 6px 0; color: var(--ink-2); text-decoration: none; }
.post-toc a:hover { color: var(--violet); text-decoration: underline; }

/* The company's own section, boxed so it reads as our note rather than more body text */
.post-approach { margin: 2.4em 0 0; padding: clamp(20px, 3.5vw, 32px); border-radius: 12px; background: linear-gradient(135deg, rgba(81, 63, 138, .07), rgba(41, 169, 201, .08)); border: 1px solid rgba(81, 63, 138, .14); }
.post-approach h2 { margin-top: 0; }
.post-approach > :last-child { margin-bottom: 0; }

/* ----- Article: photos between sections ----- */
.post-body .post-figure { margin: 2.2em 0 2.4em; }
.post-body .post-figure picture { overflow: hidden; border-radius: 10px; }
.post-body .post-figure img { aspect-ratio: 16 / 9; border-radius: 0; }
.post-body .post-figure figcaption { margin-top: 10px; font-size: .86rem; line-height: 1.45; }
/* Tablet and desktop: wider than the text column, centred on it */
@media (min-width: 700px) {
  .post-body .post-figure { width: min(1040px, calc(100vw - 2 * var(--gutter))); margin-left: calc(50% - min(520px, 50vw - var(--gutter))); }
}
/* Phone: edge to edge, a taller 3:2 frame */
@media (max-width: 699px) {
  .post-body .post-figure { margin-inline: calc(-1 * var(--gutter)); }
  .post-body .post-figure picture { border-radius: 0; }
  .post-body .post-figure img { aspect-ratio: 3 / 2; }
  .post-body .post-figure figcaption { padding: 0 var(--gutter); }
}
/* Subtle reveal: a short rise, and the photo settles from a slight zoom */
.reveal-ready .post-body .post-figure.reveal { transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.reveal-ready .post-body .post-figure.reveal.is-visible { transform: none; }
.reveal-ready .post-body .post-figure img { transform: scale(1.04); transition: transform 1.1s cubic-bezier(.2, .7, .2, 1); }
.reveal-ready .post-body .post-figure.is-visible img { transform: none; }

/* ----- Blog index ----- */
.blog-hero { padding: clamp(24px, 4vw, 44px) 0 clamp(24px, 4vw, 40px); }
.blog-hero .lead { margin-bottom: 0; }
.blog-hero + .section { padding-top: clamp(28px, 5vw, 56px); }
.blog-grid { gap: clamp(18px, 2.4vw, 28px); }

/* ----- Post cards (blog index, home, related) ----- */
.post-card { padding: 0; overflow: hidden; border-radius: 10px; transition: border-color .25s, box-shadow .25s; }
.post-card:hover, .post-card:focus-within { border-color: rgba(41, 169, 201, .6); box-shadow: 0 14px 36px rgba(24, 32, 44, .12); }
.post-card-media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface); }
.post-card-media picture { display: contents; }
.post-card-media .post-card-img { margin: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; object-fit: cover; border-radius: 0; transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.post-card:hover .post-card-img, .post-card:focus-within .post-card-img { transform: scale(1.05); }
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 22px 20px; }
.post-card-body .tag { margin-bottom: .4em; font-size: .76rem; }
.post-card h3 { font-size: 1.32rem; line-height: 1.18; margin-bottom: .35em; }
.post-card-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; color: var(--muted); font-size: .97rem; line-height: 1.5; }
.post-card .card-link { padding-top: 10px; font-size: .95rem; }
.post-card .card-link .icon { transition: transform .25s; }
.post-card:hover .card-link .icon { transform: translateX(4px); }

/* Featured first card: big photo beside the title on tablet and desktop */
.blog-grid .post-card-featured { grid-column: 1 / -1; }
.post-card-featured h3 { font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.08; }
.post-card-featured .post-card-desc { -webkit-line-clamp: 3; line-clamp: 3; font-size: 1.05rem; }
@media (min-width: 760px) {
  .blog-grid .post-card-featured { display: grid; grid-template-columns: 1.45fr 1fr; }
  .post-card-featured .post-card-media { aspect-ratio: auto; min-height: 340px; }
  .post-card-featured .post-card-body { justify-content: center; padding: clamp(24px, 3.5vw, 44px); }
}

/* Stagger the grid's reveal a little so the cards arrive in reading order */
.reveal-ready .blog-grid .post-card.reveal { transition: opacity .5s ease, transform .5s ease, border-color .25s, box-shadow .25s; }
.reveal-ready .blog-grid .post-card:nth-child(3n + 3) { transition-delay: .08s; }
.reveal-ready .blog-grid .post-card:nth-child(3n + 1):not(:first-child) { transition-delay: .16s; }

@media (prefers-reduced-motion: reduce) {
  .post-card-media .post-card-img, .post-card .card-link .icon, .post-body .post-figure img { transition: none; transform: none; }
}

/* Two column grid (tablet): a card left alone on the last row spans it, photo beside text */
@media (min-width: 621px) and (max-width: 1020px) {
  .blog-grid > .post-card:not(.post-card-featured):last-child:nth-child(even) { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .blog-grid > .post-card:not(.post-card-featured):last-child:nth-child(even) .post-card-media { aspect-ratio: auto; min-height: 240px; }
  .blog-grid > .post-card:not(.post-card-featured):last-child:nth-child(even) .post-card-body { justify-content: center; }
}

/* Byline (26 Nov SEO pass) */
.post-byline { margin: 6px 0 0; font-size: .95rem; color: var(--muted); }
.post-byline a { color: inherit; font-weight: 600; }
