/* ============================================
   Blog Styles (Neon Theme)
   ============================================ */

.blog-page { padding-top: calc(var(--nav-height) + 2rem); }

/* ---- Filter Pills ---- */
.filter-pills {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
}
.pill {
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--border-glow);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font-mono);
}
.pill:hover, .pill.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.08);
  box-shadow: 0 0 10px var(--glow-cyan);
}

/* ---- Search ---- */
.search-bar {
  position: relative;
  margin: 0 auto 2.5rem;
  max-width: 400px;
}
.search-bar i, .search-bar .icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: color 0.3s;
}
.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.3s;
  font-family: var(--font-body);
}
.search-bar input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 20px var(--glow-cyan);
}
.search-bar:focus-within i, .search-bar:focus-within .icon { color: var(--cyan); }

/* ---- Blog Grid V2 (with cover images) ---- */
.blog-grid-v2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.blog-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s;
  color: var(--text) !important;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}
.blog-card-v2:hover {
  border-color: var(--cyan);
  transform: translateY(-6px);
  box-shadow: 0 12px 40px var(--glow-cyan);
}
.blog-card-cover {
  width: 100%;
  height: 180px;
  overflow: hidden;
  position: relative;
}
.blog-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.blog-card-v2:hover .blog-card-cover img {
  transform: scale(1.05);
}
.blog-card-cover-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 50%, var(--bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.blog-card-cover-placeholder::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--magenta-rgb), 0.08), transparent 70%);
  top: -50px; right: -50px;
}
.blog-card-cover-placeholder::after {
  content: '';
  position: absolute;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--cyan-rgb), 0.06), transparent 70%);
  bottom: -40px; left: -30px;
}
.blog-card-cover-placeholder i, .blog-card-cover-placeholder .icon {
  font-size: 2.5rem;
  color: var(--magenta);
  opacity: 0.2;
  z-index: 1;
}
.blog-card-content {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.blog-card-v2 .blog-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.blog-card-v2 .blog-meta i, .blog-card-v2 .blog-meta .icon {
  margin-right: 0.25rem;
  color: var(--cyan);
}
.blog-card-title-v2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  flex: 1;
  transition: color 0.3s;
}
.blog-card-v2:hover .blog-card-title-v2 { color: var(--cyan); }
.blog-tags-v2 {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.blog-tag-cat {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  background: rgba(var(--cyan-rgb), 0.12);
  color: var(--cyan);
  border: 1px solid rgba(var(--cyan-rgb), 0.3);
  font-weight: 600;
}
.blog-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  color: var(--text-muted);
  border: 1px solid var(--border-glow);
}

.no-posts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.no-posts i, .no-posts .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; display: block; }

@media (max-width: 900px) {
  .blog-grid-v2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .blog-grid-v2 { grid-template-columns: 1fr; }
}

/* ---- Single Post ---- */
.post-container { max-width: 800px; }
.post-header {
  margin-bottom: 3rem;
  padding-top: calc(var(--nav-height) + 2rem);
}
.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 1rem 0;
  color: var(--text);
}
.post-layout {
  display: block;
}

/* TOC */
.toc-sidebar {
  display: none;
}
.toc-sidebar h4 {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}
.toc-sidebar a {
  display: block;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted) !important;
  padding: 0.42rem 0;
  border-left: 2px solid var(--border);
  padding-left: 0.9rem;
  transition: all 0.3s;
}
.toc-sidebar a:hover {
  color: var(--cyan) !important;
  border-left-color: var(--cyan);
}
.toc-h3 { padding-left: 1.5rem !important; }

/* Post Content */
.post-content {
  font-size: 1.12rem;
  line-height: 1.85;
  max-width: 100%;
}
.post-content h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}
.post-content h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}
.post-content p { margin-bottom: 1rem; color: var(--text-muted); }
.post-content a { color: var(--cyan); text-decoration: underline; }
.post-content code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--cyan);
}
.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  position: relative;
  max-width: 100%;
}
.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text);
}
.post-content img {
  border-radius: 8px;
  margin: 1.5rem 0;
}
.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.post-content li {
  margin-bottom: 0.5rem;
  list-style: disc;
  color: var(--text-muted);
}
.post-content blockquote {
  border-left: 3px solid var(--magenta);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
}
.post-content th {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
}
.post-content td { color: var(--text-muted); }
.post-content strong { color: var(--text); }

/* Copy button */
.copy-btn {
  position: absolute;
  top: 0.5rem; right: 0.5rem;
  background: var(--border-glow);
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.8rem;
}
.copy-btn:hover { background: var(--cyan); color: var(--bg); }

/* Share */
.post-share {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 3rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.post-share span { color: var(--text-muted); font-weight: 600; }
.share-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted) !important;
  transition: all 0.3s;
}
.share-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan) !important;
}

/* Post Navigation */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}
.post-nav-link {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text) !important;
  transition: all 0.3s;
}
.post-nav-link:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--glow-cyan);
}
.post-nav-link.next { text-align: right; }
.post-nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}
.post-nav-title { font-weight: 600; font-size: 0.95rem; }

/* Responsive */
@media (max-width: 768px) {
  .post-title { font-size: 1.5rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .post-content { font-size: 0.95rem; }
  .post-nav { grid-template-columns: 1fr; }
}

/* ============================================================
   Modern writeup styling — framed images, code, quotes, headings
   ============================================================ */
.post-content .post-figure { margin: 2rem auto; max-width: 720px; text-align: center; }
.post-content .post-figure img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--border-glow); box-shadow: 0 14px 40px rgba(var(--shadow-rgb), 0.55), 0 0 0 1px rgba(var(--sky-rgb), 0.06); }
.post-content .post-figure figcaption { margin-top: 0.7rem; font-size: 0.82rem; color: var(--text-muted); font-style: italic; line-height: 1.5; }
.post-content img { border-radius: 12px; }
.post-content h2 { position: relative; padding-left: 1rem; margin-top: 2.5rem; }
.post-content h2::before { content: ""; position: absolute; left: 0; top: 0.12em; bottom: 0.12em; width: 4px; border-radius: 4px; background: linear-gradient(180deg,var(--blue),var(--sky)); }
.post-content h3 { position: relative; padding-left: 0.85rem; margin-top: 1.9rem; }
.post-content h3::before { content: ""; position: absolute; left: 0; top: 0.15em; bottom: 0.15em; width: 3px; border-radius: 3px; background: rgba(var(--sky-rgb), 0.55); }
.post-content pre { border: 1px solid var(--border); border-radius: 12px; position: relative; padding-top: 2.7rem !important; box-shadow: 0 10px 30px rgba(var(--shadow-rgb), 0.45); }
.post-content pre::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.2rem; background: linear-gradient(180deg,rgba(var(--blue-rgb), 0.10),transparent); border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.post-content pre::after { content: ""; position: absolute; top: 0.9rem; left: 1rem; width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; box-shadow: 18px 0 0 #febc2e, 36px 0 0 #28c840; }
.post-content :not(pre) > code { border: 1px solid var(--border-glow); background: rgba(var(--blue-rgb), 0.08); color: var(--accent-strong); border-radius: 6px; padding: 0.12em 0.45em; }
.post-content blockquote { border-left: 3px solid var(--blue); background: rgba(var(--blue-rgb), 0.06); border-radius: 0 10px 10px 0; padding: 0.9rem 1.2rem; }
.post-content ul li::marker { color: var(--sky); }
.post-content ol li::marker { color: var(--sky); font-weight: 700; }
.post-content hr { border: 0; height: 1px; margin: 2.5rem 0; background: linear-gradient(90deg, transparent, var(--border-glow), transparent); }
.post-content > p:first-of-type { font-size: 1.2rem; color: var(--text); line-height: 1.7; }
.post-content a:hover { color: var(--accent-strong); }
/* post-figure img width auto — show screenshots at native size, never upscaled */
.post-content .post-figure img { width: auto; max-width: 100%; margin: 0 auto; }
/* blog-meta spacing fix — separate date and read-time */
.blog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6rem; margin-bottom: 1.1rem; }
.blog-meta > span { display: inline-flex; align-items: center; gap: 0.5rem; }


/* =========================================================================
   Pass 4 — post page (moved from redesign.css: blog.css loads later and won)
   ========================================================================= */

/* ---- Post page ------------------------------------------------------- */
.post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.25s, gap 0.25s;
}
.post-back:hover { color: var(--cyan); gap: 0.85rem; }

.post-cover {
  margin: 0 0 2.25rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-glow);
  box-shadow: 0 20px 55px -25px rgba(var(--shadow-rgb), 0.9);
  line-height: 0;
}
.post-cover img { width: 100%; height: auto; display: block; }

/* Screenshots are bright; sit them on a dark mat so they read as evidence
   pinned to the page rather than white holes punched through it. */
.post-content .post-figure {
  padding: 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.post-content .post-figure img {
  border-radius: 10px;
  border: 1px solid rgba(var(--tint-rgb), 0.08);
  box-shadow: 0 10px 30px -16px rgba(var(--shadow-rgb), 0.9);
}
.post-content .post-figure figcaption {
  margin-top: 0.85rem;
  padding: 0 0.4rem;
}

/* Everything above and below the reading column shares its width and centring,
   so the header, cover, share row and prev/next all sit on the same axis. */
.post-header,
.post-cover,
.post-share,
.post-nav {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.post-share { margin-top: 3rem; margin-bottom: 3rem; }
.post-nav { margin-top: 2rem; margin-bottom: 4rem; }

/* Table of contents: the markup and the JS that fills it already existed,
   the stylesheet just had it at display:none.
   Three tracks — sidebar, reading column, and an equal spacer on the right —
   so the text stays on the page centre instead of being shoved right by the
   sidebar. Needs 1320px of room, hence the breakpoint. */
@media (min-width: 1440px) {
  .post-container { max-width: 1480px; }
  .post-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 900px) 240px;
    column-gap: 2.5rem;
    justify-content: center;
    align-items: start;
  }
  .toc-sidebar {
    grid-column: 1;
    display: block;
    position: sticky;
    top: calc(var(--nav-height) + 2rem);
    max-height: calc(100vh - var(--nav-height) - 4rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
  }
  .toc-sidebar a.is-active {
    color: var(--cyan) !important;
    border-left-color: var(--cyan);
  }
  .post-content { grid-column: 2; }
}

/* `.section { overflow: hidden }` makes the article a scroll container, which
   silently disables `position: sticky` for the TOC inside it. `clip` gives the
   same visual clipping without creating a scrollport. */
.section.blog-post { overflow: clip; }

/* ============================================================
   Image lightbox — click a screenshot to view it full-window
   ============================================================ */
.post-content .post-figure img,
.post-content > p > img,
.post-cover img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3.5rem 1.5rem 2rem;
  background: rgba(var(--shadow-rgb), 0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox img {
  max-width: 94vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(var(--tint-rgb), 0.1);
  box-shadow: 0 30px 90px -30px rgba(var(--shadow-rgb), 0.95);
  transform: scale(0.97);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: zoom-out;
}
.lightbox.is-open img { transform: scale(1); }

.lightbox figcaption {
  max-width: min(900px, 92vw);
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-muted);
}

.lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  background: rgba(var(--tint-rgb), 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}
.lightbox-close:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.08);
}

body.lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox img { transition: none; }
  .lightbox img { transform: none; }
}


/* ---- Code blocks: keep dark in both themes + a richer syntax palette ---- */
.post-content pre { background: #0c1018 !important; }
.post-content pre code.hljs { background: transparent; color: #cdd6f4; }
.post-content .hljs-keyword,
.post-content .hljs-selector-tag,
.post-content .hljs-built_in,
.post-content .hljs-section,
.post-content .hljs-name,
.post-content .hljs-attribute { color: #f38ba8; }
.post-content .hljs-attr { color: #7fe0cf; font-style: italic; }
.post-content .hljs-string,
.post-content .hljs-meta .hljs-string,
.post-content .hljs-regexp { color: #e6c07b; }
.post-content .hljs-number,
.post-content .hljs-literal,
.post-content .hljs-boolean { color: #fab387; }
.post-content .hljs-title,
.post-content .hljs-title.function_,
.post-content .hljs-doctag { color: #89b4fa; }
.post-content .hljs-type,
.post-content .hljs-class .hljs-title { color: #94e2d5; }
.post-content .hljs-comment,
.post-content .hljs-quote { color: #6b7394; font-style: italic; }
.post-content .hljs-punctuation,
.post-content .hljs-operator,
.post-content .hljs-params { color: #9aa5ce; }
.post-content .hljs-variable,
.post-content .hljs-template-variable { color: #cdd6f4; }
.post-content .hljs-meta { color: #94e2d5; }
.post-content .hljs-deletion { color: #f38ba8; }
.post-content .hljs-addition { color: #a6e3a1; }


/* ---- Code block chrome: language label + Copy header (reference look) ---- */
.post-content pre { padding: 0 !important; overflow: visible !important; }
.post-content pre::after { display: none !important; }
.post-content pre::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #f38ba8, #cba6f7 45%, transparent) !important;
  border: 0 !important; border-radius: 8px 8px 0 0; z-index: 2;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 9px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.code-lang { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #8b99b0; }
.code-copy {
  display: inline-flex; align-items: center; gap: 7px; background: transparent;
  border: 0; color: #8b99b0; font-family: var(--font-mono); font-size: 13px; cursor: pointer; padding: 2px 2px;
}
.code-copy:hover { color: var(--cyan); }
.post-content pre code.hljs { display: block; overflow-x: auto; padding: 16px 18px; border-radius: 0 0 8px 8px; }
.post-content .hljs .hv { color: #e6c07b; }

/* JSON keys upright to match the request font */
.post-content pre code .hljs-attr { font-style: normal; }
