/* ============================================================
   TOOLYARD — BLOG
   Shared by the generated index and article pages
   (scripts/build-blog.js).
============================================================ */

body { padding-top: var(--header-h); }

/* ── header ── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h); z-index: 200;
  background: rgba(10,10,15,0.85); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .site-header { background: rgba(248,248,252,0.9); }
.site-header-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 24px;
}
.logo-text {
  font-family: var(--font-display); font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent2), var(--accent3));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hnav {
  padding: 7px 14px; border-radius: var(--r); font-size: 14px;
  font-weight: 500; color: var(--text2); transition: all var(--t);
}
.hnav:hover { background: var(--surface); color: var(--text); }
.theme-btn {
  width: 36px; height: 36px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer; transition: all var(--t);
}
.theme-btn:hover { border-color: var(--accent); }

/* ── reading progress ── */
.read-progress {
  position: fixed; top: var(--header-h); left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  z-index: 300; transition: width 0.1s linear;
}

/* ── breadcrumb ── */
.breadcrumb {
  padding: 22px 24px 0; font-size: 13px; color: var(--text3);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.breadcrumb a { color: var(--text3); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent2); text-decoration: underline; }

/* ── index hero ── */
.blog-hero { padding: 30px 24px 36px; }
.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 44px); font-weight: 800;
  line-height: 1.12; margin: 14px 0 14px;
}
.blog-hero p { font-size: 17px; color: var(--text2); line-height: 1.7; max-width: 640px; }
.blog-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.blog-cat-chip {
  font-size: 12.5px; font-weight: 600; color: var(--text2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 14px;
}

/* ── lead card ── */
.blog-lead {
  display: flex; gap: 26px; align-items: center;
  background: linear-gradient(135deg, rgba(124,108,255,0.1), rgba(56,189,248,0.05));
  border: 1px solid rgba(124,108,255,0.22);
  border-radius: var(--r-xl, 26px); padding: 32px;
  text-decoration: none; color: inherit; transition: all var(--t);
}
.blog-lead:hover { border-color: var(--accent); transform: translateY(-2px); }
.blog-lead-icon { font-size: 56px; line-height: 1; flex-shrink: 0; }
.blog-lead-body { min-width: 0; }
.blog-lead h2 {
  font-family: var(--font-display); font-size: clamp(21px, 3vw, 28px);
  font-weight: 800; line-height: 1.2; margin: 10px 0 10px;
}
.blog-lead p { font-size: 15.5px; color: var(--text2); line-height: 1.7; }
.blog-lead-meta { font-size: 12.5px; color: var(--text3); display: block; margin-top: 14px; }

/* ── grid ── */
.blog-grid-wrap { padding: 36px 24px 80px; }
.blog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.blog-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 20px); padding: 24px;
  text-decoration: none; color: inherit; transition: all var(--t);
}
.blog-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(124,108,255,0.14); }
.blog-card-icon { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.blog-card h3 { font-family: var(--font-display); font-size: 17.5px; font-weight: 800; line-height: 1.3; }
.blog-card p { font-size: 14px; color: var(--text2); line-height: 1.65; }
.blog-card-meta { font-size: 12px; color: var(--text3); margin-top: auto; padding-top: 10px; }

.post-cat {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent2);
}

/* ── article ── */
.post { padding: 0 24px; }
.post-head { padding: 26px 0 34px; max-width: 760px; }
.post-head h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.6vw, 42px); font-weight: 800;
  line-height: 1.14; margin: 12px 0 16px;
}
.post-excerpt { font-size: 18px; color: var(--text2); line-height: 1.65; }
.post-meta {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  font-size: 13px; color: var(--text3); margin-top: 20px;
}

.post-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px;
  gap: 52px; align-items: start; padding-bottom: 80px;
}
.post-body { min-width: 0; max-width: 760px; }

.post-toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 20px); padding: 20px 24px; margin-bottom: 34px;
}
.post-toc h2 {
  font-size: 12px !important; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text3); margin: 0 0 12px !important;
  font-family: var(--font-body) !important;
}
.post-toc ol { margin: 0 0 0 18px; }
.post-toc li { font-size: 14.5px; margin-bottom: 7px; color: var(--text2); }
.post-toc a { color: var(--text2); text-decoration: none; }
.post-toc a:hover { color: var(--accent2); text-decoration: underline; }

.post-body h2 {
  font-family: var(--font-display); font-size: 25px; font-weight: 800;
  line-height: 1.25; margin: 42px 0 16px; scroll-margin-top: 90px;
}
.post-body h3 {
  font-size: 18.5px; font-weight: 700; margin: 28px 0 10px;
}
.post-body p { font-size: 16.5px; line-height: 1.8; color: var(--text2); margin-bottom: 18px; }
.post-body ul, .post-body ol { margin: 0 0 20px 22px; }
.post-body li { font-size: 16.5px; line-height: 1.78; color: var(--text2); margin-bottom: 10px; }
.post-body strong { color: var(--text); font-weight: 650; }
.post-body a { color: var(--accent2); }
.post-body code {
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 14.5px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px;
}
.post-body pre {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md, 14px); padding: 18px;
  overflow-x: auto; margin-bottom: 20px;
}
.post-body pre code { background: none; border: none; padding: 0; font-size: 14px; line-height: 1.6; }
.post-body blockquote {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 20px;
  margin: 0 0 20px; color: var(--text2); font-style: italic;
}
/* Emitted around every table by scripts/build-blog.js. The table keeps a
   min-width so it scrolls inside this box instead of crushing its cells, and
   the box — not the page — is what scrolls. */
.post-table-scroll { overflow-x: auto; margin-bottom: 22px; -webkit-overflow-scrolling: touch; }
.post-body table { width: 100%; border-collapse: collapse; margin-bottom: 22px; font-size: 15px; }
.post-table-scroll table { margin-bottom: 0; }
.post-body th, .post-body td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.post-body th { color: var(--text3); font-size: 13px; font-weight: 600; }
.post-body td { color: var(--text2); }

.post-callout {
  background: var(--surface); border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md, 14px); padding: 18px 20px; margin-bottom: 22px;
}
.post-callout p:last-child { margin-bottom: 0; }

/* ── FAQ ── */
.post-faq details {
  border: 1px solid var(--border); border-radius: var(--r-md, 14px);
  margin-bottom: 10px; background: var(--surface); overflow: hidden;
}
.post-faq summary {
  padding: 15px 18px; cursor: pointer; font-weight: 650; font-size: 15.5px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.post-faq summary::-webkit-details-marker { display: none; }
.post-faq summary::after { content: '+'; color: var(--text3); font-size: 19px; flex-shrink: 0; }
.post-faq details[open] summary::after { content: '−'; }
.post-faq details[open] summary { border-bottom: 1px solid var(--border); }
.post-faq p { padding: 14px 18px 16px; margin: 0; font-size: 15.5px; line-height: 1.72; color: var(--text2); }

.post-end {
  margin-top: 44px; padding: 28px;
  background: linear-gradient(135deg, rgba(124,108,255,0.1), rgba(56,189,248,0.05));
  border: 1px solid rgba(124,108,255,0.22);
  border-radius: var(--r-lg, 20px); text-align: center;
}
.post-end p { font-size: 15.5px; color: var(--text2); margin-bottom: 18px; }

/* ── sidebar ── */
.post-aside { position: sticky; top: calc(var(--header-h) + 22px); display: flex; flex-direction: column; gap: 16px; }
.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg, 20px); padding: 20px;
}
.post-card h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text3); margin-bottom: 14px;
}
.post-tools, .post-more { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.post-tools a, .post-more a {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: var(--r, 10px);
  font-size: 14px; line-height: 1.45; color: var(--text2);
  text-decoration: none; transition: all var(--t);
}
.post-tools a:hover, .post-more a:hover { background: var(--surface2); color: var(--text); }

/* ── footer ── */
.post-footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 30px 0; text-align: center;
}
.post-footer p { font-size: 13px; color: var(--text3); }
.post-footer a { color: var(--accent2); text-decoration: none; }
.post-footer a:hover { text-decoration: underline; }

/* ── responsive ── */
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; gap: 36px; }
  .post-aside { position: static; }
  .blog-lead { flex-direction: column; align-items: flex-start; gap: 16px; }
}
@media (max-width: 640px) {
  .hide-mobile { display: none; }
  .blog-grid { grid-template-columns: 1fr; }
  .post-body p, .post-body li { font-size: 16px; }
  /* Scroll the table rather than wrap every cell onto four lines. */
  .post-table-scroll table { min-width: 460px; }
  .post-body th, .post-body td { padding: 9px 10px; white-space: nowrap; }
  /* Long URLs and code spans in prose are the other thing that pushes a
     phone into a horizontal scroll. */
  .post-body { overflow-wrap: break-word; }
  .post-body pre { overflow-x: auto; }
}
