/* Blog (server-rendered pages from app/blog.py). Loaded after style.css and uses its tokens.
   Editorial reading layout: one calm column (~68ch), hairline rules, crisp corners, no web fonts. */

body.blog {
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
.blog-main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 72px;
  outline: none;
}

/* ───── header & footer ───── */
.blog-topbar {
  gap: 12px;
}
.blog-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.blog-nav a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  text-decoration: none;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.blog-nav a:hover {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--line-strong);
}
.blog-nav a[aria-current] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.blog-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-3);
  font-size: 13.5px;
}
.blog-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
}
.blog-footer-brand {
  margin: 0;
  color: var(--text-2);
}
.blog-footer-brand strong {
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-right: 6px;
}
.blog-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.blog-footer a {
  color: var(--text-2);
  text-decoration: none;
}
.blog-footer a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.blog-footer-note {
  margin: 0 0 0 auto;
}

/* ───── shared bits ───── */
.breadcrumb ol {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--text-3);
}
.breadcrumb li {
  display: flex;
  align-items: center;
  min-width: 0;
}
.breadcrumb li + li::before {
  content: "/";
  margin-right: 4px;
  opacity: 0.55;
}
.breadcrumb a {
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.breadcrumb [aria-current] {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46ch;
}
.eyebrow {
  margin: 0 0 10px;
  font: 600 12px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede {
  margin: 14px 0 0;
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}
.post-meta .dot {
  opacity: 0.6;
}
.post-tag {
  font: 600 11.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  text-decoration: none;
  padding: 4px 7px;
  border: 1px solid var(--accent-2-line);
  border-radius: var(--radius-sm);
  background: var(--accent-2-soft);
}
.post-tag:hover {
  border-color: var(--accent-2);
}

/* ───── index ───── */
.blog-hero {
  max-width: 760px;
  padding-bottom: 28px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.blog-hero h1,
.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.blog-hero .btn {
  margin-top: 22px;
}
.tag-list ul {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-list a {
  display: inline-block;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.tag-list a:hover {
  color: var(--text);
  border-color: var(--text-3);
}
.tag-list a[aria-current] {
  color: var(--on-accent-2);
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 760px;
}
.post-list .post-card {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.post-card-title {
  margin: 10px 0 0;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.post-card-title a {
  text-decoration: none;
}
.post-card-title a:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.post-card-desc {
  margin: 8px 0 0;
  color: var(--text-2);
  max-width: 68ch;
}

/* ───── post ───── */
.post {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 740px;
}
.post-header {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.post-header h1 {
  margin-top: 14px;
}
.post-updated {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-3);
}
.toc {
  margin: 28px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
}
.toc-title {
  margin: 0 0 8px;
  font: 600 11.5px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.toc ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-3);
}
.toc li {
  padding: 3px 0;
}
.toc a {
  color: var(--text-2);
  text-decoration: none;
}
.toc a:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 1100px) {
  .post {
    max-width: none;
    grid-template-columns: minmax(0, 720px) 260px;
    column-gap: 64px;
  }
  .post > * {
    grid-column: 1;
  }
  .post > .toc {
    grid-column: 2;
    grid-row: 1 / span 5;
    align-self: start;
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
    margin: 4px 0 0;
    padding: 0 0 0 18px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: none;
    font-size: 13.5px;
  }
  .post > .toc ol {
    list-style: none;
    padding: 0;
  }
}

/* ───── prose ───── */
.prose {
  font-size: 18px;
  line-height: 1.72;
  color: var(--text);
  max-width: 68ch;
  overflow-wrap: break-word;
  padding-top: 8px;
}
.prose > * {
  margin: 0;
}
.prose > * + * {
  margin-top: 1.1em;
}
.prose h2 {
  margin-top: 2em;
  font-size: 1.5em;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.prose h3 {
  margin-top: 1.7em;
  font-size: 1.17em;
  line-height: 1.35;
  font-weight: 680;
  letter-spacing: -0.01em;
}
.prose h4 {
  margin-top: 1.5em;
  font-size: 1em;
}
.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.6em;
}
.prose :is(h2, h3, h4) {
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.prose a {
  color: var(--accent-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover {
  color: var(--accent-2-hover);
  text-decoration-thickness: 2px;
}
.prose strong {
  font-weight: 680;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li + li {
  margin-top: 0.4em;
}
.prose li > ul,
.prose li > ol {
  margin-top: 0.4em;
}
.prose li::marker {
  color: var(--text-3);
}
.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}
.prose blockquote > * {
  margin: 0;
}
.prose blockquote > * + * {
  margin-top: 0.8em;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em 0;
}
.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}
.prose p > img:only-child {
  margin: 0.6em auto;
}
.prose code {
  font: 0.86em/1.5 var(--font-mono);
  padding: 0.12em 0.38em;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
  line-height: 1.6;
}
.prose pre code {
  font-size: inherit;
  padding: 0;
  border: 0;
  background: none;
}
.prose .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}
.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.prose th {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-2);
  background: var(--surface-2);
  white-space: nowrap;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.prose tbody tr:hover td {
  background: var(--tone);
}
.prose .align-center {
  text-align: center;
}
.prose .align-right {
  text-align: right;
}

/* ───── end of post ───── */
.post-cta {
  margin-top: 56px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.post-cta h2 {
  font-size: 22px;
  letter-spacing: -0.015em;
}
.post-cta p {
  margin: 8px 0 0;
  color: var(--text-2);
  max-width: 56ch;
}
.post-cta .post-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 18px;
}
.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
}
.cta-link:hover {
  color: var(--accent-2);
}
.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}
.post-pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.post-pager a:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}
.pager-next {
  text-align: right;
  align-items: flex-end;
}
.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-3);
}
.pager-title {
  font-weight: 620;
  line-height: 1.35;
}
.related {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.related h2 {
  font-size: 20px;
  letter-spacing: -0.015em;
}
.related-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.related-list .post-card {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.related-list .post-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.related-list .post-card-title {
  font-size: 17px;
}
.related-list .post-card-desc {
  font-size: 14.5px;
}

/* ───── phones ───── */
@media (max-width: 640px) {
  .blog-main {
    padding: 20px 16px 56px;
  }
  .blog-topbar {
    gap: 6px;
  }
  .blog-nav a {
    padding: 7px 8px;
  }
  .blog-footer-inner {
    padding: 24px 16px 32px;
  }
  .blog-footer-note {
    margin-left: 0;
  }
  .breadcrumb [aria-current] {
    max-width: 22ch;
  }
  .lede {
    font-size: 17.5px;
  }
  .prose {
    font-size: 17.5px;
    line-height: 1.68;
  }
  .prose th,
  .prose td {
    padding: 9px 11px;
  }
  .post-cta {
    padding: 22px 18px;
  }
  .post-pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .pager-next {
    text-align: left;
    align-items: flex-start;
  }
}
@media (max-width: 380px) {
  .blog-topbar .brand-name {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .blog-nav a,
  .tag-list a,
  .post-pager a,
  .related-list .post-card {
    transition: none;
  }
}
@media print {
  .blog-topbar,
  .blog-footer,
  .toc,
  .post-cta,
  .post-pager,
  .related {
    display: none;
  }
}
