/* Article pages (posts + Writing) - builds on styles.css tokens */
.nav.scrolled { background: rgba(246, 245, 241, 0.85); }
.back { font: 500 .8rem 'JetBrains Mono', monospace; text-decoration: none; color: var(--teal); }
.back:hover { color: var(--amber); }
.meta { margin: 0 0 14px; color: var(--muted); font-size: .95rem; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.prose > :first-child { margin-top: 0; }
.prose p, .prose li { color: #2a3138; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 2.2em 0 .6em; max-width: none; }
.prose h1 { font-size: 1.9rem; } .prose h2 { font-size: 1.5rem; } .prose h3 { font-size: 1.2rem; } .prose h4 { font-size: 1.05rem; }
.prose a { color: var(--teal); text-decoration: underline; text-decoration-color: rgba(15, 143, 134, .35); text-underline-offset: 3px; }
.prose a:hover { color: var(--amber); }
.prose img, .prose video { max-width: 100%; height: auto; border-radius: 10px; }
.prose figure, .prose .quarto-figure { margin: 2em 0; text-align: center; }
.prose figcaption { color: var(--muted); font-size: .88rem; margin-top: 10px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--teal); color: var(--muted); }
.prose code { font: 400 .88em 'JetBrains Mono', monospace; background: #ecebe5; padding: 2px 6px; border-radius: 6px; }
.prose pre { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-size: .85rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose div.sourceCode { margin: 1.4em 0; }
.prose div.sourceCode pre { margin: 0; }
.copy { position: absolute; top: 8px; right: 8px; font: 500 .7rem 'Inter', sans-serif; border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 3px 10px; cursor: pointer; opacity: 0; transition: opacity .2s; }
.prose pre:hover .copy, .copy:focus { opacity: 1; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.8em 0; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font-weight: 600; background: rgba(20, 24, 28, .04); }
.prose iframe, .prose .quarto-video { width: 100%; border: 0; border-radius: 12px; }
.prose iframe { aspect-ratio: 16/9; height: auto; }
.prose .quarto-video { aspect-ratio: 16/9; }
.prose .quarto-video iframe { width: 100%; height: 100%; }
.prose .callout { border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 12px; background: #fff; padding: 12px 18px; margin: 1.6em 0; }
.prose .footnotes { font-size: .88rem; color: var(--muted); }
.prose .footnote-ref { text-decoration: none; }
.prose .csl-entry { margin-bottom: .7em; }
.prose .anchorjs-link { display: none; }


.listing { max-width: 1320px; margin: 0 auto; padding: 56px clamp(20px, 6vw, 96px) 100px; }
.listing .filters { margin-top: 0; }
/* Plain header (Writing page) - same background as the homepage */
.article-head { padding: 130px clamp(20px, 6vw, 96px) 24px; }
.article-head-inner { max-width: 1320px; margin: 0 auto; animation: rise .9s var(--ease) both; }
.article-head h1 { font-size: clamp(2.6rem, 7vw, 5rem); letter-spacing: -.035em; margin: 14px 0 12px; }

/* Post layout: sticky visual column + editorial reading column */
.post-page { padding-top: 96px; }
.post-layout { display: grid; grid-template-columns: minmax(280px, 430px) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); max-width: 1560px; margin: 0 auto; padding: 40px clamp(16px, 3vw, 40px) 40px; align-items: start; }
.post-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 22px; animation: rise .9s var(--ease) both; }
/* No frame: the image sits directly on the page background */
.visual { margin: 0; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
.visual img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; object-position: left top; border-radius: 14px; display: block; }
.visual.logo img { border-radius: 0; }
.visual figcaption { padding: 12px 0 0; font: 500 .72rem/1.4 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.facts { margin: 0; display: grid; gap: 14px; }
.facts dt { font: 500 .7rem 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--teal); margin-bottom: 3px; }
.facts dd { margin: 0; font-size: .95rem; color: var(--ink); }
.facts .tags { padding-top: 4px; margin: 0; }
.post-main { min-width: 0; animation: rise 1s .08s var(--ease) both; }
.post-title { font-size: clamp(2.2rem, 5.2vw, 4rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.04; margin: 0 auto 44px; max-width: 800px; text-align: center; text-wrap: balance; }
.post-main .prose { max-width: 800px; margin-left: auto !important; margin-right: auto !important; padding: 0; margin: 0; }
.post-main .prose > p:first-of-type { font-size: 1.3rem; line-height: 1.55; color: var(--ink); font-weight: 400; letter-spacing: -.01em; }

.related { border-top: 1px solid var(--line); margin-top: 60px; padding: 72px clamp(16px, 3vw, 40px) 110px; }
.related-inner { max-width: 1560px; margin: 0 auto; }
.related .kicker { margin-bottom: 28px; }

@media (max-width: 860px) {
  .post-layout { grid-template-columns: 1fr; gap: 28px; }
  .post-aside { position: static; }
  .visual { max-width: 420px; }
  .post-title { max-width: none; }
}

/* Links: coloured, with a link icon, always clickable */
.prose a { color: var(--teal); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1.5px; text-decoration-color: rgba(15, 143, 134, .4); text-underline-offset: 3px; cursor: pointer; position: relative; z-index: 1; pointer-events: auto; transition: color .2s, text-decoration-color .2s; }
.prose a:hover { color: var(--amber); text-decoration-color: currentColor; }
.prose a:not([href^="#"]):not(:has(img)):not(.dl)::after {
  content: ''; display: inline-block; width: .75em; height: .75em; margin-left: .25em; vertical-align: -.02em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14L21 3M21 3h-7M21 3v7M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14L21 3M21 3h-7M21 3v7M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .8;
}
.prose a[aria-hidden="true"] { pointer-events: none; text-decoration: none; }
.prose a[aria-hidden="true"]::after { display: none; }

/* Downloads: always directly below the image */
.downloads { display: grid; gap: 8px; }
.dl-title { margin: 0; font: 500 .7rem 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--teal); }
.dl { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; transition: transform .25s var(--ease), border-color .2s, color .2s, box-shadow .25s; }
.dl svg { color: var(--teal); flex: none; }
.dl:hover { transform: translateY(-2px); border-color: var(--teal); color: var(--teal); box-shadow: 0 12px 24px -16px rgba(20, 24, 28, .4); }

/* Larger reading size on desktop */
@media (min-width: 1024px) {
  .post-main .prose { font-size: 1.25rem; line-height: 1.75; max-width: 860px; }
  .post-title { max-width: 860px; }
  .post-main .prose > p:first-of-type { font-size: 1.6rem; line-height: 1.5; }
  .prose h1 { font-size: 2.3rem; } .prose h2 { font-size: 1.9rem; } .prose h3 { font-size: 1.45rem; } .prose h4 { font-size: 1.2rem; }
  .prose pre { font-size: .95rem; } .prose table { font-size: 1.05rem; } .prose .footnotes { font-size: 1rem; }
  .facts dd { font-size: 1.02rem; } .dl { font-size: 1rem; }
}

/* Slides: embedded deck in the left column, under the image */
.slides { display: grid; gap: 10px; }
.slides-frame { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.slides-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Animations in the left-column figure (replace the stock image) */
.visual canvas { display: block; width: 100%; height: auto; }
.visual canvas.city-canvas { aspect-ratio: 5 / 4; }
.visual canvas.book-canvas { aspect-ratio: 640 / 440; }
.visual canvas.signal-canvas { aspect-ratio: 640 / 440; }
