/* ── Blog: article and index layouts ── */

/* base.css smooths scrolling site-wide; articles use the browser default */
html { scroll-behavior: auto }

.draft-flag {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--navy);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  padding: .5rem 1rem;
}

.draft-flag span { color: var(--blue-400) }

/* ── Hero ── */
.page-hero { padding: 8rem 2rem 3rem; text-align: left }
.page-hero-inner { max-width: 720px }
.page-hero h1 { font-size: 2.75rem; margin-bottom: 1rem }
.page-hero-sub { margin: 0; max-width: 620px }

.hero-meta {
  margin-top: 1.5rem;
  font-size: .8rem;
  color: var(--gray-500);
}

.hero-meta span { color: var(--gray-300); padding: 0 .25rem }

.page-hero-index { text-align: center }
.page-hero-index .page-hero-inner { margin: 0 auto }
.page-hero-index .page-hero-sub { margin: 0 auto }
.page-hero-index h1 svg { display: inline; vertical-align: middle; color: var(--blue-500); position: relative; top: -4px }

.hero-crumb {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: 1.25rem;
}

.hero-crumb:hover { color: var(--blue-700) }

/* ── Contents rail ──
   The rail is an absolutely positioned column spanning the whole article, so the
   sticky nav inside it starts below the hero and pins as the reader scrolls. */
.article-main { position: relative; padding-bottom: 6rem }

.toc-rail {
  position: absolute;
  top: 3.5rem;
  bottom: 0;
  right: calc(50% + 400px);
  width: 230px;
  display: none;
}

/* Only shown once there is clear margin beside the content column */
@media (min-width: 1400px) {
  .toc-rail { display: block }
}

.toc {
  position: sticky;
  top: 6rem;
}

.toc-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: .75rem;
  padding-left: .8rem;
}

.toc ul { list-style: none }

.toc a {
  display: block;
  font-size: .88rem;
  line-height: 1.4;
  color: var(--gray-600);
  padding: .35rem 0 .35rem .8rem;
  border-left: 2px solid var(--gray-200);
  transition: color .15s, border-color .15s;
}

.toc a:hover { color: var(--gray-900); border-color: var(--gray-400) }
.toc a.on { color: var(--blue-500); border-color: var(--blue-500); font-weight: 600 }

.toc li.sub a {
  font-size: .8rem;
  padding-left: 1.5rem;
  color: var(--gray-400);
}

.toc li.sub a:hover { color: var(--gray-700) }

/* ── Prose ── */
.article { padding: 3.5rem 2rem 1rem }
.prose { max-width: 720px; margin: 0 auto; font-size: 1.02rem; color: var(--gray-700) }

.prose > * + * { margin-top: 1.15rem }

.prose h2 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
}

.prose h2, .prose h3, .prose h4 { scroll-margin-top: 4.5rem }

.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 1.5rem;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 1.25 rem;
}

.prose p { line-height: 1.75 }

.prose a { color: var(--blue-500); text-decoration: underline; text-underline-offset: 2px }
.prose a:hover { color: var(--blue-700) }

.prose ul, .prose ol { padding-left: 1.4rem }
.prose li { line-height: 1.75 }
.prose li + li { margin-top: .35rem }
.prose strong { color: var(--gray-900) }

.prose code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--gray-100);
  border-radius: 4px;
  padding: .1em .35em;
}

.prose pre {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.6;
}

.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit }

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: .9rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.prose th, .prose td {
  text-align: left;
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--gray-200);
}

.prose th {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-600);
  background: var(--gray-50);
}

.prose tr:last-child td { border-bottom: 0 }

.prose blockquote {
  border-left: 3px solid var(--blue-100);
  background: var(--gray-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  font-size: .95rem;
  color: var(--gray-600);
}

.prose blockquote + blockquote { margin-top: .5rem }
.prose blockquote p + p { margin-top: .75rem }

.prose blockquote cite {
  display: block;
  margin-top: .6rem;
  font-style: normal;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gray-400);
}

.callout {
  border: 1px solid var(--blue-100);
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  font-size: .92rem;
  color: var(--gray-700);
}

.callout b { color: var(--navy) }

/* ── Figure shell (full width, escapes the prose column) ── */
.figure { padding: 1.75rem 2rem 2.25rem }
.figure-inner { max-width: var(--max-w); margin: 0 auto; --viz-w: 780px }
.figure + .article { padding-top: 2rem }

.figure-head { margin: 0 auto 1.5rem; max-width: 720px }

.figure-label {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: .5rem;
}

.figure-head h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: .6rem;
}

.figure-head p { font-size: .95rem; color: var(--gray-600); line-height: 1.65 }

/* ── Index listing ── */
.post-list { padding: 3rem 2rem 7rem }
.post-list-inner { max-width: 760px; margin: 0 auto }

.post-item {
  display: block;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--gray-200);
  color: inherit;
}

.post-item:first-child { padding-top: 0 }

.post-item-meta {
  display: flex;
  gap: 1rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: .6rem;
}

.post-item h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  line-height: 1.25;
  margin-bottom: .5rem;
  transition: color .15s;
}

.post-item h2 em { font-style: normal; color: var(--blue-500) }
.post-item:hover h2 { color: var(--blue-500) }

.post-item p { font-size: .95rem; color: var(--gray-600); line-height: 1.65 }

@media (max-width: 700px) {
  .page-hero h1 { font-size: 2rem }
  .article, .figure { padding-left: 1.25rem; padding-right: 1.25rem }
}
