/* Blog (/blog and /blog/:slug) in the landing's design: rendered in layouts/home inside
   the framed column (.vx-frame in home.css), dark and black-and-white, Geist for prose,
   Geist Mono for meta and code, Instrument Serif for titles. Every component reads the
   tokens on main.blog, which point at the landing's --vx-* palette.

   Loaded after home.css and chrome.css (via yield :head), so equal-specificity rules here
   win. */

main.blog{
  --ink:var(--vx-ink);
  --text:#b4b6bd;
  --muted:var(--vx-muted);
  --faint:var(--vx-dim);
  --rule:var(--vx-line);
  --wash:#17181d;
  --bg:var(--vx-bg);
  --radius:10px;
  --mono:var(--vx-mono);
  --serif:'Instrument Serif',Georgia,'Times New Roman',serif;

  display:block; font-family:var(--vx-sans); color:var(--ink); background:var(--bg);
  font-size:16.5px; line-height:1.7; -webkit-font-smoothing:antialiased;
}

/* Every link is ink with a rule underline that sharpens to ink on hover; components that
   want no underline (cards, the contents menu) opt out below. */
.blog a,
.blog a:visited{ color:var(--ink); text-decoration:none; background:none; border-bottom:1px solid #4a4b52; }
.blog a:hover{ color:var(--ink); background:none; border-bottom-color:var(--ink); }

.blog ::selection{ background:#f2f3f5; color:#0b0c10; }

.blog-title{
  font-family:var(--serif); font-weight:400; letter-spacing:-.015em; line-height:1.08;
  padding-bottom:.08em;
  background:linear-gradient(to right bottom,#fff 30%,rgba(255,255,255,.55));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}

/* ---------- index ---------- */
.blog-head{ padding:112px 40px 88px; border-bottom:1px solid var(--rule); text-align:center; }
.blog-head h1{ font-size:clamp(48px,6vw,84px); margin:0; }
.blog-head p{ color:var(--muted); margin:14px auto 0; max-width:34em; font-size:17px; }

/* A post is a row of the frame: a mono date column, then the title, excerpt and link. */
.blog .blog-card,
.blog .blog-card:visited{
  display:grid; grid-template-columns:220px minmax(0,1fr); gap:0;
  border-bottom:1px solid var(--rule); transition:background-color .15s ease;
}
.blog .blog-card:hover{ border-bottom-color:var(--rule); background:rgba(255,255,255,.02); }
.blog-card-meta{ padding:44px 24px 44px 40px; border-right:1px solid var(--rule); }
.blog-card-body{ padding:40px 40px 44px; }
.blog-card h2{ font-size:28px; font-weight:600; line-height:1.2; letter-spacing:-.035em; margin:0; text-wrap:pretty; color:var(--ink); }
.blog-card-excerpt{ color:var(--muted); font-size:15.5px; margin:12px 0 0; max-width:44em; text-wrap:pretty; }
.blog-card-more{ display:inline-block; margin-top:18px; font-family:var(--mono); font-size:12.5px; color:var(--faint); }
.blog .blog-card:hover .blog-card-more{ color:var(--ink); }

.blog-meta{ display:flex; flex-wrap:wrap; align-items:baseline; gap:.5rem; color:var(--muted); font-family:var(--mono); font-size:12.5px; }
.blog-card-meta .blog-meta{ flex-direction:column; gap:4px; }
.blog-card-meta .blog-dot{ display:none; }
.blog-dot{ color:var(--faint); }
.blog-author{ color:var(--muted); }

.blog-empty{ margin:0; padding:72px 40px; text-align:center; color:var(--muted); font-size:15px; border-bottom:1px solid var(--rule); }

@media(max-width:720px){
  .blog-head{ padding:64px 20px 56px; }
  .blog .blog-card, .blog .blog-card:visited{ grid-template-columns:1fr; }
  .blog-card-meta{ padding:28px 20px 0; border-right:0; }
  .blog-card-meta .blog-meta{ flex-direction:row; }
  .blog-card-meta .blog-dot{ display:inline; }
  .blog-card-body{ padding:10px 20px 32px; }
  .blog-card h2{ font-size:22px; }
}

/* ---------- post ---------- */
/* The article is one cell; on desktop the contents menu and promo ride a sticky second
   cell to its right, sharing the frame's rule. */
.blog-post{ border-bottom:1px solid var(--rule); }
.blog-post .post-wrap{ display:flex; flex-direction:column; }
.blog-post .post-col{ min-width:0; padding:72px 64px 96px; }
.blog-post .post-col > *{ max-width:760px; }

.blog .post-back,
.blog .post-back:visited{ display:inline-block; font-family:var(--mono); font-size:12.5px; color:var(--muted); border-bottom:none; }
.blog .post-back:hover{ color:var(--ink); }

.post-head{ margin:0 0 48px; }
.post-head h1{ font-size:clamp(40px,4.6vw,64px); margin:28px 0 18px; text-wrap:pretty; }

.post-foot{ margin-top:56px; padding-top:24px; border-top:1px solid var(--rule); }

@media(max-width:720px){
  main.blog{ font-size:15.5px; }
  .blog-post .post-col{ padding:48px 20px 64px; }
}

/* ---------- post body ---------- */
.post-body{ color:var(--text); }
.post-body > *:first-child{ margin-top:0; }
.post-body p{ margin:0 0 1.1rem; text-wrap:pretty; }

.post-body h1,
.post-body h2{
  font-size:26px; font-weight:600; letter-spacing:-.03em; line-height:1.3; color:var(--ink);
  margin:3rem 0 1rem; scroll-margin-top:96px; position:relative; text-wrap:pretty;
}
.post-body h3{ font-size:18px; font-weight:600; letter-spacing:-.01em; color:var(--ink); margin:2.25rem 0 .5rem; scroll-margin-top:96px; position:relative; }
@media(max-width:720px){
  .post-body h1, .post-body h2{ font-size:21px; }
}

.post-body .anchor{ position:absolute; left:-.9em; width:.9em; border-bottom:none; opacity:0; }
.post-body .anchor::before{ content:"#"; color:var(--faint); font-weight:400; }
.post-body .anchor:hover::before{ color:var(--ink); }
.post-body h1:hover .anchor,
.post-body h2:hover .anchor,
.post-body h3:hover .anchor{ opacity:1; }
@media(max-width:900px){ .post-body .anchor{ display:none; } }

.post-body strong{ font-weight:600; color:var(--ink); }
.post-body ul,
.post-body ol{ margin:0 0 1.1rem; padding-left:1.25rem; }
.post-body li{ margin:.4rem 0; text-wrap:pretty; }
.post-body hr{ border:none; border-top:1px solid var(--rule); margin:2.75rem 0; }
.post-body img{ display:block; max-width:100%; height:auto; border:1px solid var(--rule); border-radius:var(--radius); }
.post-body blockquote{ margin:0 0 1.1rem; padding:.25rem 0 .25rem 1.25rem; border-left:2px solid var(--vx-blue); color:var(--muted); }
.post-body blockquote p:last-child{ margin-bottom:0; }

.post-body table{ width:100%; border-collapse:collapse; font-size:14px; margin:1rem 0 1.5rem; display:block; overflow-x:auto; }
.post-body thead th,
.post-body th{
  text-align:left; font-weight:500; color:var(--faint); font-family:var(--mono);
  text-transform:uppercase; letter-spacing:.08em; font-size:11px;
  padding:0 1rem .6rem 0; border-bottom:1px solid #4a4b52;
}
.post-body td{ padding:.6rem 1rem .6rem 0; border-bottom:1px solid var(--rule); vertical-align:top; }
.post-body td:first-child{ color:var(--ink); }

/* inline code + fenced blocks */
.post-body code{
  font-family:var(--mono); background:var(--wash); border:1px solid var(--rule); border-radius:5px;
  padding:1px 5px; font-size:.84em; color:#e6e7ea;
}
.post-body pre.highlight{
  background:#0e0f12; border:1px solid var(--rule); border-radius:var(--radius);
  padding:16px 20px; overflow-x:auto; margin:0 0 1.4rem;
}
.post-body pre.highlight code{ background:none; border:none; padding:0; font-size:13.5px; line-height:1.7; color:#d6d7db; }

/* Rouge tokens: monochrome structure, with the landing's two accents for strings and
   numbers. */
.post-body .highlight .c,.post-body .highlight .c1,.post-body .highlight .cm,.post-body .highlight .cs{ color:var(--faint); font-style:italic; }
.post-body .highlight .k,.post-body .highlight .kd,.post-body .highlight .kn,.post-body .highlight .kr,.post-body .highlight .kc,.post-body .highlight .kp,.post-body .highlight .kt,.post-body .highlight .nt{ color:#fff; font-weight:600; }
.post-body .highlight .s,.post-body .highlight .s1,.post-body .highlight .s2,.post-body .highlight .sb,.post-body .highlight .sc,.post-body .highlight .sd,.post-body .highlight .se,.post-body .highlight .sh,.post-body .highlight .si,.post-body .highlight .sx,.post-body .highlight .sr{ color:var(--vx-blue); }
.post-body .highlight .m,.post-body .highlight .mi,.post-body .highlight .mf,.post-body .highlight .mh,.post-body .highlight .mo,.post-body .highlight .il{ color:var(--vx-amber); }

/* inline animation + tweet embed */
.post-body .post-video{ margin:0 0 1.5rem; }
.post-body .post-video video{
  display:block; width:100%; height:auto; aspect-ratio:16/9;
  border:1px solid var(--rule); border-radius:var(--radius); background:var(--wash);
}
.tweet-embed{ margin:0 0 1.5rem; min-height:260px; }
.tweet-embed .twitter-tweet{ margin:0 !important; }
.tweet-embed blockquote:not(.twitter-tweet-rendered){ border-left:2px solid var(--rule); padding:.75rem 0 .75rem 1.25rem; margin:0; color:var(--muted); }
.tweet-embed blockquote:not(.twitter-tweet-rendered) a{ font-size:.8rem; word-break:break-all; }

/* ---------- sidebar: contents + promo ---------- */
@media(min-width:1100px){
  .blog-post .post-wrap{
    display:grid; grid-template-columns:minmax(0,1fr) 300px; align-items:stretch;
  }
  .post-side{ border-left:1px solid var(--rule); }
  .post-side-in{
    position:sticky; top:73px; padding:72px 28px 40px;
    max-height:calc(100vh - 73px); overflow-y:auto; scrollbar-width:thin; scrollbar-color:#2a2b31 transparent;
  }
}

.post-toc summary{
  display:flex; align-items:center; gap:.45rem; cursor:pointer; list-style:none;
  font-family:var(--mono); font-size:11px; text-transform:uppercase; letter-spacing:.1em; font-weight:600; color:var(--vx-blue);
  padding-bottom:.9rem;
}
.post-toc summary::-webkit-details-marker{ display:none; }
.post-toc summary:hover{ color:var(--ink); }
.post-toc summary::before{
  content:""; width:0; height:0; border-left:4px solid currentColor;
  border-top:3.5px solid transparent; border-bottom:3.5px solid transparent; transition:transform .2s;
}
.post-toc details[open] > summary::before{ transform:rotate(90deg); }
@media (prefers-reduced-motion: reduce){ .post-toc summary::before{ transition:none; } }

.post-toc ol{ list-style:none; margin:0; padding:0; border-left:1px solid var(--rule); }
.post-toc li{ margin:0; }
.blog .post-toc li a,
.blog .post-toc li a:visited{
  display:block; padding:.3rem 0 .3rem .9rem; margin-left:-1px; border-bottom:none; border-left:1px solid transparent;
  font-size:13px; line-height:1.45; color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.blog .post-toc li a:hover{ color:var(--ink); border-bottom:none; }
.blog .post-toc li.is-active > a{ color:var(--ink); border-left-color:var(--ink); }
.post-toc li.toc-h3 a{ padding-left:1.8rem; }

.post-promo{
  margin-top:2rem; padding:18px 18px 20px;
  border:1px solid var(--rule); border-radius:var(--radius); background:#0e0f12;
}
.post-promo-text{ margin:0; color:var(--muted); font-size:14px; line-height:1.6; }
.post-promo-text strong{ color:var(--ink); font-weight:600; }
.blog .post-promo-cta,
.blog .post-promo-cta:visited{
  display:inline-flex; margin-top:14px; padding:8px 14px; border-radius:7px; border:0;
  background:#f2f3f5; color:#0b0c10; font-size:13.5px; font-weight:600;
}
.blog .post-promo-cta:hover{ background:#fff; color:#0b0c10; }

/* Below the sidebar's breakpoint the menu moves above the article as a collapsible panel
   and the promo drops below the post. */
@media(max-width:1099px){
  .post-side, .post-side-in{ display:contents; }
  .post-toc{
    order:-1; margin:40px 64px 0; padding:16px 20px;
    border:1px solid var(--rule); border-radius:var(--radius); background:#0e0f12;
  }
  .blog-post .post-col{ padding-top:48px; }
  .post-toc summary{ padding-bottom:0; }
  .post-toc details[open] > summary{ padding-bottom:.9rem; }
  .blog .post-toc li a{ white-space:normal; }
  .post-promo{ order:1; margin:0 64px 64px; }
}
@media(max-width:720px){
  .post-toc{ margin:32px 20px 0; }
  .post-promo{ margin:0 20px 48px; }
}
