/* Blog pages — loaded after app.css, reuses its tokens, header and footer. */

.blog { --soft: color-mix(in srgb, var(--brand) 7%, var(--bg)); --sunken: var(--surface-2); }
@supports not (background: color-mix(in srgb, red 50%, blue)) { .blog { --soft: var(--brand-tint); } }

/* Header language switch: two links, the current one filled. */
.blog-lang { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.blog-lang a { padding: 4px 10px; border-radius: 999px; color: var(--ink-3); font-size: 0.8rem; font-weight: 800; text-decoration: none; }
.blog-lang a:hover { color: var(--ink); }
.blog-lang a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

/* ---------- Index ---------- */
.blog-hero { padding: 64px 0; background: linear-gradient(to bottom right, var(--soft), var(--surface)); }
@media (min-width: 640px) { .blog-hero { padding: 80px 0; } }
.blog-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--ink-2); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.blog-back:hover { color: var(--brand); }
.blog-hero h1 { margin-bottom: 16px; font-size: 2.25rem; line-height: 2.5rem; font-weight: 800; }
@media (min-width: 640px) { .blog-hero h1 { font-size: 3rem; line-height: 1; } }
.blog-hero p { max-width: 42rem; color: var(--ink-2); font-size: 1.125rem; line-height: 1.75rem; }
.blog-list { padding: 48px 0; }
@media (min-width: 640px) { .blog-list { padding: 64px 0; } }

.card-grid { display: grid; gap: 32px; }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.post-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(12, 26, 21, 0.08), 0 2px 4px -2px rgba(12, 26, 21, 0.06);
  transition: box-shadow .3s ease;
}
.post-card:hover { box-shadow: 0 20px 25px -5px rgba(12, 26, 21, 0.1), 0 8px 10px -6px rgba(12, 26, 21, 0.08); }
.post-card-thumb {
  position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9;
  background: linear-gradient(to bottom right, var(--soft), var(--sunken)); text-decoration: none;
}
.post-card-thumb::after { content: ""; position: absolute; inset: 0; background: var(--brand); opacity: 0; transition: opacity .3s ease; }
.post-card:hover .post-card-thumb::after { opacity: 0.1; }
.post-card-thumb span { font-size: 3.75rem; line-height: 1; font-weight: 800; color: var(--brand); opacity: 0.2; }
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 24px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pills span { padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--brand); font-size: 0.75rem; font-weight: 600; }
.post-card-title { margin-bottom: 8px; font-size: 1.25rem; line-height: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.post-card-title a { color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color .15s ease; }
.post-card:hover .post-card-title a { color: var(--brand); }
.post-card-desc { margin-bottom: 16px; color: var(--ink-2); font-size: 0.875rem; line-height: 1.25rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-3); font-size: 0.875rem; }
.post-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.post-card-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.post-card-read { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; text-decoration: none; transition: gap .15s ease; }
.post-card-read:hover { gap: 8px; }

/* ---------- Article ---------- */
.post.container { max-width: 1152px; padding-block: 32px; }
.crumbs { margin-bottom: 24px; font-size: 0.875rem; color: var(--ink-2); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs li:last-child { flex: 1 1 0; min-width: 0; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--ink-3); }
.crumbs [aria-current] { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 1024px) { .post-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; } }
.post-main { min-width: 0; }

.post-head { margin-bottom: 32px; }
.post-head h1 { margin-bottom: 24px; color: var(--ink); font-size: 1.875rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.025em; }
@media (min-width: 640px) { .post-head h1 { font-size: 2.25rem; } }
@media (min-width: 1024px) { .post-head h1 { font-size: 3rem; } }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 24px; color: var(--ink-2); font-size: 0.875rem; }
.post-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.post-share { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.875rem; }
.post-share > span { margin-inline-end: 4px; }
.share-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: 1rem; transition: background-color .15s ease, color .15s ease; }
.share-btn:hover { background: var(--brand); color: var(--on-brand); }
.share-btn.copied { background: var(--brand); color: var(--on-brand); }
.i-fill { width: 1em; height: 1em; fill: currentColor; }

.post-hero { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; margin-bottom: 32px; border-radius: 12px; background: linear-gradient(to bottom right, var(--soft), var(--sunken)); }
.post-hero span { font-size: 6rem; line-height: 1; font-weight: 800; color: var(--brand); opacity: 0.2; }

/* Prose — sizes follow the reference article. */
.prose { color: var(--ink-2); font-size: 1rem; line-height: 1.625; font-weight: 500; }
.prose p { margin: 0 0 16px; }
.prose a { color: var(--brand); font-weight: 600; text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose h2 { margin: 40px 0 16px; color: var(--ink); font-size: 1.5rem; line-height: 2rem; font-weight: 800; letter-spacing: -0.02em; scroll-margin-top: 96px; }
.prose h3 { margin: 32px 0 12px; color: var(--ink); font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; letter-spacing: -0.01em; scroll-margin-top: 96px; }
.prose > h2:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 16px; padding-inline-start: 1.5em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 6px 0; padding-inline-start: 4px; }
.prose li::marker { color: var(--ink-3); }
.prose code { padding: 1px 6px; border-radius: 6px; background: var(--sunken); color: var(--ink); font: 600 0.875em/1.4 var(--mono); }
.prose pre { margin: 0 0 20px; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.prose pre code { padding: 0; background: none; font-weight: 500; white-space: pre; }
.table-wrap { margin: 28px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
/* app.css styles bare table/th/td for the schedule (nowrap, end-aligned, sticky caps
   header); reset all of that so article tables wrap and read left to right. */
.prose table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 0.875rem; line-height: 1.45; }
.prose th, .prose td { padding: 8px 16px; text-align: start; white-space: normal; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose thead th { position: static; background: var(--sunken); color: var(--ink); font-size: 0.875rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
.prose tbody tr:hover td { background: none; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--ink); font-weight: 600; }
@media (max-width: 639px) { .prose table { min-width: 520px; } }
.callout { margin: 24px 0; padding: 16px 18px; border-inline-start: 3px solid var(--brand); border-radius: 0 8px 8px 0; background: var(--soft); color: var(--ink-2); }
.callout p:last-child { margin-bottom: 0; }

.post-cta { margin-top: 48px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
@media (min-width: 640px) { .post-cta { padding: 32px; } }
.post-cta h2 { margin-bottom: 8px; color: var(--ink); font-size: 1.5rem; line-height: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.post-cta p { margin-bottom: 20px; color: var(--ink-2); line-height: 1.625; }
.post-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-tags span { padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--brand); font-size: 0.875rem; font-weight: 500; }

/* Sticky table of contents (desktop only, like the reference). */
.post-toc { display: none; }
@media (min-width: 1024px) { .post-toc { display: block; } }
.post-toc nav { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-h { margin-bottom: 16px; color: var(--brand); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.post-toc ul { margin: 0; padding: 0; list-style: none; font-size: 0.875rem; line-height: 1.35; }
.post-toc li + li { margin-top: 8px; }
.post-toc ul ul { margin-top: 8px; padding-inline-start: 12px; }
.post-toc a { display: block; padding-block: 4px; padding-inline: 12px 0; border-inline-start: 2px solid transparent; color: var(--ink-2); text-decoration: none; transition: color .15s ease, border-color .15s ease; }
.post-toc a:hover { color: var(--brand); }
.post-toc a.active { border-color: var(--brand); color: var(--brand); font-weight: 700; }

.related { padding-block: 24px 72px; }
.related.container { max-width: 1152px; }
.related > h2 { margin-bottom: 24px; padding-top: 40px; border-top: 1px solid var(--line); font-size: 1.5rem; font-weight: 800; }
