/* Public Blog — isolated stylesheet (new file, style.css untouched).
   Uses the site's own design tokens (--bg, --text, --accent, etc. from
   style.css's :root) so it matches the rest of the site's light theme
   instead of fighting it with a hardcoded dark palette. */

/* style.css sets body { overflow-x: hidden }, which per spec forces
   overflow-y to compute as "auto" too — making body its own scroll
   container and breaking position:sticky (it starts sticking relative
   to body instead of the viewport). Scoped to blog/page routes only
   (this file isn't loaded elsewhere): restore body's default overflow.
   Deliberately NOT re-adding overflow-x:hidden on any ancestor of the
   sticky TOC sidebar (not even .blog-container) — any such ancestor,
   even one that never actually scrolls, can become sticky's reference
   scroll container instead of the viewport in some browsers. Blog pages
   have no off-screen decorative elements that need horizontal clipping,
   so there's nothing here that actually needs it. */
body { overflow-x: visible; }
.blog-container { max-width: 1200px; margin: 0 auto; padding: 150px 24px 60px; color: var(--text-2); }

.blog-breadcrumbs { font-size: .82rem; color: var(--text-3); margin-bottom: 20px; }
.blog-breadcrumbs a { color: var(--accent); text-decoration: none; }
.blog-breadcrumbs span { color: var(--text-3); }

.blog-hero { text-align: center; margin-bottom: 48px; }
.blog-hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 18px;
  padding: 7px 16px; border-radius: 999px; background: var(--accent-light);
  color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}
.blog-hero-dot { width: 7px; height: 7px; border-radius: 50%; background: #39ff14; box-shadow: 0 0 6px rgba(57,255,20,.6); flex-shrink: 0; }
.blog-hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; color: var(--text); margin-bottom: 24px; letter-spacing: -.01em; }
.blog-search {
  position: relative; display: flex; align-items: center; max-width: 520px; margin: 0 auto;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s;
}
.blog-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5,150,105,.12), var(--shadow-sm); }
.blog-search-icon { position: absolute; left: 20px; color: var(--text-4); font-size: .95rem; pointer-events: none; }
.blog-search input { flex: 1; border: none; background: transparent; padding: 15px 16px 15px 46px; color: var(--text); font-size: .92rem; border-radius: 999px; outline: none; }
.blog-search button {
  flex-shrink: 0; width: 42px; height: 42px; margin-right: 4px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.blog-search button:hover { background: var(--accent-dark); }

.blog-layout { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }
.blog-sidebar { position: sticky; top: 100px; }
.blog-widget { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.blog-widget h4 { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--text); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }
.blog-widget h4 i { color: var(--accent); font-size: .9rem; }
.blog-widget ul { list-style: none; padding: 0; margin: 0; }
.blog-widget li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.blog-widget li:last-child { border-bottom: none; }
.blog-widget a { color: var(--text-2); text-decoration: none; transition: color .15s; }
.blog-widget a:hover { color: var(--accent); }
.blog-popular-list li { display: flex; align-items: flex-start; gap: 10px; }
.blog-popular-list a { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.blog-popular-rank {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-light);
  color: var(--accent); font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.blog-popular-views { color: var(--text-4); font-size: .72rem; }

.blog-section-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin: 36px 0 18px; letter-spacing: -.01em; }

.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.blog-grid-featured { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.blog-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: block; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s, border-color .2s; }
.blog-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.blog-card-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-muted); }
.blog-card-img img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.blog-card-body { padding: 18px; }
.blog-card-cat { display: inline-block; background: var(--accent-light); color: var(--accent); font-size: .68rem; text-transform: uppercase; padding: 3px 9px; border-radius: 12px; margin-bottom: 8px; }
.blog-card-cat:empty { display: none; }
.blog-card-body h3 { font-size: 1rem; color: var(--text); margin: 0 0 6px; line-height: 1.4; }
.blog-card-body p { font-size: .82rem; color: var(--text-3); margin: 0 0 8px; line-height: 1.6; }
.blog-card-body p:empty { display: none; margin: 0; }
.blog-card-meta { font-size: .72rem; color: var(--text-4); }

.blog-pagination { display: flex; gap: 8px; margin-top: 30px; }
.blog-pagination a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: .85rem; }
.blog-pagination a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.blog-empty, .blog-empty-inline { text-align: center; color: var(--text-3); padding: 60px 20px; }
.blog-empty h1 { color: var(--text); margin-bottom: 10px; }
.blog-empty a { color: var(--accent); }

.blog-no-results {
  text-align: center; padding: 48px 24px; background: var(--bg-soft);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.blog-no-results i { font-size: 2rem; color: var(--text-4); }
.blog-no-results h3 { color: var(--text); font-size: 1.05rem; margin: 12px 0 6px; }
.blog-no-results p { color: var(--text-3); font-size: .88rem; margin: 0; }

/* Single article */
.blog-article { display: grid; grid-template-columns: 1fr 220px; gap: 40px; align-items: start; }
.blog-article-main h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 800; color: var(--text); line-height: 1.3; margin-bottom: 14px; }
.blog-article-meta { color: var(--text-3); font-size: .85rem; margin-bottom: 20px; }
.blog-article-cover { width: 100%; border-radius: var(--radius); margin-bottom: 24px; }
.blog-article-content { font-size: 1.05rem; line-height: 1.85; color: var(--text-2); }
.blog-article-content h2, .blog-article-content h3 { color: var(--text); margin: 32px 0 14px; scroll-margin-top: 100px; }
.blog-article-content p { margin: 0 0 18px; }
.blog-article-content img { max-width: 100%; border-radius: 10px; margin: 16px 0; }
.blog-article-content pre { background: var(--bg-muted); border: 1px solid var(--border); padding: 16px; border-radius: 10px; overflow-x: auto; }
.blog-article-content blockquote { border-left: 3px solid var(--accent); padding-left: 18px; color: var(--text-3); margin: 20px 0; }
.blog-article-content a { color: var(--accent); }
.blog-article-content ul, .blog-article-content ol { padding-left: 24px; margin-bottom: 18px; }

/* Sticky is on the grid ITEM (the aside), not an inner div. The grid's
   align-items:start keeps the aside content-height while its grid AREA
   spans the full row — that gap is the travel room sticky needs. (The
   previous version put sticky on a div inside the aside, whose parent
   was only content-tall, so it had zero room to move and never stuck.) */
.blog-toc-sidebar { position: sticky; top: 110px; align-self: start; max-height: calc(100vh - 130px); overflow-y: auto; }
.blog-toc-sidebar .toc-sticky { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.blog-toc-sidebar h4 { font-size: .8rem; color: var(--text); margin-bottom: 10px; text-transform: uppercase; }
.blog-toc-sidebar ul, .blog-toc-drawer ul { list-style: none; padding: 0; margin: 0; }
.blog-toc-sidebar li, .blog-toc-drawer li { font-size: .8rem; padding: 4px 0; }
.blog-toc-sidebar a, .blog-toc-drawer a { color: var(--text-3); text-decoration: none; }
.blog-toc-sidebar a:hover, .blog-toc-drawer a:hover { color: var(--accent); }
.toc-level-3 { padding-left: 14px; }

/* Mobile TOC — floating icon pinned to the right edge; tapping it slides
   in a drawer with the same "On this page" links. Hidden on desktop. */
.blog-toc-fab {
  display: none; position: fixed; right: 0; top: 45%; z-index: 1060;
  width: 44px; height: 44px; border: 1px solid var(--border); border-right: none;
  border-radius: 12px 0 0 12px; background: var(--bg); color: var(--accent);
  box-shadow: var(--shadow-md); align-items: center; justify-content: center;
  font-size: 1.15rem; cursor: pointer;
}
.blog-toc-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1061; }
.blog-toc-backdrop.open { display: block; }
.blog-toc-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(300px, 85vw); z-index: 1062;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  padding: 20px; overflow-y: auto; transform: translateX(105%); transition: transform .25s ease;
}
.blog-toc-drawer.open { transform: none; }
.blog-toc-drawer h4 { font-size: .8rem; color: var(--text); margin-bottom: 12px; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.blog-toc-drawer h4 button { border: none; background: none; color: var(--text-3); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.blog-toc-drawer li { padding: 7px 0; border-bottom: 1px solid var(--border-light); font-size: .85rem; }
.blog-toc-drawer li:last-child { border-bottom: none; }

.blog-author-box { display: flex; align-items: center; gap: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 30px 0; }
.blog-author-box .avatar { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, #04331b, #021a0d); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.blog-author-box .name { color: var(--text); font-weight: 600; font-size: .9rem; }
.blog-author-box .bio { color: var(--text-3); font-size: .8rem; }

.blog-share { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; color: var(--text-3); font-size: .85rem; }
.blog-share a { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.blog-share a:hover { border-color: var(--accent); color: var(--accent); }

.blog-related h2 { font-size: 1rem; color: var(--text); margin-bottom: 16px; }

.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: transparent; z-index: 1050; }
.reading-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #04331b, #021a0d); transition: width .1s linear; }

@media (max-width: 1024px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-sidebar { position: static; }
  .blog-article { grid-template-columns: 1fr; }
  .blog-toc-sidebar { display: none; }
  .blog-toc-fab { display: flex; }
}

@media (max-width: 640px) {
  .blog-container { padding: 110px 16px 40px; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-hero-badge { font-size: .72rem; padding: 6px 12px; }
  .blog-search input { font-size: .85rem; padding: 13px 14px 13px 42px; }
  .blog-search-icon { left: 16px; }
}
