/* Blog index and posts (generated by scripts/build-pages.mjs). Builds on style.css and page.css. */

/* ---------- Blog index ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.post-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: #fff; border: 2px solid rgba(11,16,48,.07); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.post-card:hover { transform: translateY(-6px); box-shadow: 0 34px 60px -30px rgba(11,16,48,.45); }
.post-card:has(a:focus-visible) { outline: 3px solid var(--blue); outline-offset: 3px; }
.post-card-img img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; }
.post-card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 26px; }
.post-card-meta { opacity: .6; }
.post-card h3 { font-family: var(--display); font-stretch: 110%; font-weight: 900; text-transform: uppercase; font-size: 22px; line-height: 1.02; }
.post-card h3 a { text-decoration: none; }
.post-card h3 a:focus-visible { outline: none; }
/* the whole card is the link */
.post-card h3 a::after { content: ""; position: absolute; inset: 0; }
.post-card p { font-size: 16px; opacity: .85; }
.post-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; }
.post-card.featured .post-card-body { padding: 32px 40px; }
.post-card.featured h3 { font-size: clamp(26px, 2.6vw, 38px); }
.post-card.featured p { font-size: 17px; }

/* ---------- Post header ---------- */
.post-hero { padding-bottom: clamp(50px, 6vw, 80px); }
.post-kicker { opacity: .8; margin-bottom: 18px; }
.post-h1 { font-family: var(--display); font-stretch: 120%; font-weight: 900; text-transform: uppercase; font-size: clamp(28px, 4.4vw, 66px); line-height: .95; max-width: 1150px; }
.post-dek { max-width: 760px; margin-top: 24px; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 28px; opacity: .85; }
.post-meta a { text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- Post body ---------- */
/* --gutter: distance from the viewport edge to the content (paper margin + wrap padding). */
.post-body { --gutter: calc(var(--pad) + clamp(8px, 1.2vw, 18px)); padding-top: clamp(24px, 3vw, 40px); }
.post-cover { max-width: 1100px; margin: 0 auto clamp(40px, 5vw, 64px); }
.post-cover img { width: 100%; height: auto; border-radius: clamp(18px, 2vw, 28px); box-shadow: 0 30px 60px -36px rgba(11,16,48,.55); }
.post-layout { max-width: 760px; margin: 0 auto; }

.toc { margin-bottom: 48px; padding: 22px 26px; border-radius: 22px; background: #fff; border: 2px solid rgba(11,16,48,.07); }
.toc p { opacity: .55; margin-bottom: 10px; }
.toc ol { margin: 0; padding-left: 1.5em; columns: 2 240px; column-gap: 36px; font-size: 15.5px; line-height: 1.4; }
.toc li { break-inside: avoid; padding: 4px 0; }
.toc li::marker { color: var(--orange); font-weight: 800; }
.toc a { text-decoration: none; }
.toc a:hover { color: var(--blue); text-decoration: underline; }

.prose { font-size: 18px; line-height: 1.7; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-family: var(--display); font-stretch: 115%; font-weight: 900; text-transform: uppercase; font-size: clamp(26px, 2.8vw, 38px); line-height: 1; color: var(--blue); margin-top: 2.2em; scroll-margin-top: 100px; }
.prose h3 { font-family: var(--display); font-stretch: 105%; font-weight: 800; font-size: 21px; line-height: 1.25; margin-top: 1.8em; scroll-margin-top: 100px; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { color: var(--orange); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--orange); font-weight: 800; }
.prose strong { font-weight: 800; }
.prose :not(pre) > code { font-family: var(--mono); font-size: .86em; padding: .12em .38em; border-radius: 6px; background: rgba(31,63,216,.09); color: var(--blue-d); overflow-wrap: break-word; }

/* figures and code break out of the text column, up to the page gutter */
.prose .post-fig { margin-inline: calc(50% - min(550px, 50vw - var(--gutter))); margin-block: 2em; }
.post-fig-link { display: block; cursor: zoom-in; }
.post-fig img { width: 100%; height: auto; border-radius: 20px; }
.post-fig figcaption { max-width: 760px; margin: 12px auto 0; font-size: 14.5px; line-height: 1.5; opacity: .7; }

.prose .code { margin-inline: calc(50% - min(440px, 50vw - var(--gutter))); border-radius: 18px; overflow: hidden; background: var(--ink); color: #e6e9ff; box-shadow: 0 24px 50px -34px rgba(11,16,48,.7); }
.code-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px 6px 18px; background: #161c45; font-family: var(--mono); font-size: 12.5px; line-height: 1.4; }
.code-file { color: var(--cream); opacity: .85; overflow-wrap: anywhere; }
.code-lang { color: var(--cream); opacity: .6; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.code-copy { flex: none; padding: 6px 12px; border: 0; border-radius: 99px; cursor: pointer; background: rgba(255,233,189,.12); color: var(--cream); font: 600 12px/1 var(--mono); transition: background .2s, color .2s; }
.code-copy:hover { background: var(--cream); color: var(--ink); }
.code pre { margin: 0; padding: 18px 20px 20px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.65; tab-size: 2; }
.code code { font-family: inherit; }
/* ligatures would show => and != as single arrow glyphs, which misleads anyone copying by eye */
.code pre, .prose code { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
.tok-com { color: #8f98d6; font-style: italic; }
.tok-str { color: var(--lime); }
.tok-kw { color: #ff8a63; }
.tok-type { color: var(--sky); }
.tok-num, .tok-attr { color: #ffd27f; }
.tok-fn { color: var(--cream); }
.tok-meta { color: #ff9ad5; }
.tok-key { color: var(--sky); }

.note { padding: 18px 22px; border-radius: 18px; background: #fff; border: 2px solid rgba(11,16,48,.08); border-left: 6px solid var(--orange); }
.note p { font-size: 16.5px; line-height: 1.6; }
.note p + p { margin-top: .6em; }

.table { overflow-x: auto; border-radius: 16px; background: #fff; border: 2px solid rgba(11,16,48,.1); }
.table table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 15.5px; line-height: 1.45; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; }
.table th { background: rgba(31,63,216,.07); color: var(--blue); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.table tr + tr td { border-top: 1px solid rgba(11,16,48,.08); }
.table td:first-child { font-weight: 700; }

.prose .post-author { margin-top: 3em; padding: 24px 26px; border-radius: 22px; background: var(--blue); color: var(--cream-2); }
.post-author .small-caps { opacity: .7; }
.post-author-name { margin: 6px 0 10px; font-family: var(--display); font-stretch: 120%; font-weight: 900; text-transform: uppercase; font-size: 26px; line-height: 1; }
.prose .post-author a { color: inherit; }
.post-author p:last-child { font-size: 16px; line-height: 1.55; }

/* end-of-post links */
.sp-related-stack { grid-template-columns: 1fr 1fr; margin-top: 14px; }

@media (max-width: 1000px) {
  .post-grid { grid-template-columns: 1fr 1fr; }
  .post-card.featured { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .post-grid, .sp-related-stack { grid-template-columns: 1fr; }
  .post-card.featured .post-card-body { padding: 22px 24px 26px; }
  .prose { font-size: 17px; }
  .code pre { font-size: 13px; padding: 16px; }
  .toc { padding: 18px 20px; }
}
