/* ═══════════════════════════════════════════════════════════════
   PORTFOLIO v1.0 — blog.css
   Covers: blog.html (listing) + post.html (single article)
   Must be loaded AFTER style.css (inherits all CSS variables)
═══════════════════════════════════════════════════════════════ */

/* ── Blog nav ─────────────────────────────────────────────── */
#blog-nav {
  max-width: var(--max-w, 1160px);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--nav-h, 68px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.blog-nav-right { display: flex; align-items: center; gap: 1.5rem; }

.nav-back {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2, #8b96a8);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.nav-back:hover {
  color: var(--accent, #2f81f7);
  border-color: rgba(47,129,247,0.4);
  background: rgba(47,129,247,0.06);
}

/* ── Blog hero ─────────────────────────────────────────────── */
.blog-hero {
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  padding: 4rem 2rem 3.5rem;
}
.blog-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.blog-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent, #2f81f7);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.blog-hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text, #e8edf5);
  margin-bottom: 1rem;
  line-height: 1.15;
}
.blog-hero-sub {
  font-size: 1rem;
  color: var(--text-2, #8b96a8);
  line-height: 1.75;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Blog listing ─────────────────────────────────────────── */
.blog-content-section {
  max-width: var(--max-w, 1160px);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
  width: 100%;
}
.blog-list-wrap { max-width: 760px; margin: 0 auto; }

/* Filter bar */
.blog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}
.blog-search-input {
  flex: 1;
  min-width: 200px;
  background: var(--surface, #13181f);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--text, #e8edf5);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.blog-search-input::placeholder { color: var(--text-3, #545f6e); }
.blog-search-input:focus {
  border-color: var(--accent, #2f81f7);
  box-shadow: 0 0 0 3px rgba(47,129,247,0.12);
}

.blog-filter-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: transparent;
  color: var(--text-2, #8b96a8);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-tag:hover { color: var(--text); border-color: var(--border-2, rgba(255,255,255,0.14)); }
.filter-tag.active {
  background: var(--accent-dim, rgba(47,129,247,0.12));
  color: var(--accent, #2f81f7);
  border-color: rgba(47,129,247,0.3);
}

/* Article cards */
.blog-list { display: flex; flex-direction: column; gap: 1px; }

.blog-card {
  display: block;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.blog-card:first-child { border-top: 1px solid var(--border, rgba(255,255,255,0.08)); }
.blog-card:hover { padding-left: 0.5rem; }

.blog-card .category-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent, #2f81f7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.blog-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text, #e8edf5);
  margin-bottom: 0.5rem;
  letter-spacing: -0.015em;
  line-height: 1.4;
  transition: color 0.15s ease;
}
.blog-card:hover .blog-card-title { color: var(--accent, #2f81f7); }
.blog-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-2, #8b96a8);
  line-height: 1.7;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 2;
}
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3, #545f6e);
}
.blog-card-meta .sep { opacity: 0.4; }
.blog-card-read {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent, #2f81f7);
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.blog-card:hover .blog-card-read { opacity: 1; }

/* Skeleton loading */
.skeleton-card {
  height: 100px;
  background: linear-gradient(90deg,
    var(--surface, #13181f) 25%,
    var(--surface-2, #1a2130) 50%,
    var(--surface, #13181f) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 1px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty / load more */
.blog-empty {
  text-align: center;
  padding: 4rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3, #545f6e);
}
.load-more-wrap { text-align: center; margin-top: 2.5rem; }

/* ── Single post ──────────────────────────────────────────── */
.post-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
  width: 100%;
}

/* Breadcrumb */
.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin-bottom: 2.5rem;
}
.breadcrumb li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3, #545f6e);
}
.breadcrumb a {
  color: var(--accent, #2f81f7);
  transition: opacity 0.15s;
}
.breadcrumb a:hover { opacity: 0.75; }
.breadcrumb li[aria-current="page"] { color: var(--text-2, #8b96a8); }

/* Post header */
.post-header { margin-bottom: 2rem; }
.post-header .category-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent, #2f81f7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.post-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text, #e8edf5);
  margin-bottom: 1.25rem;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3, #545f6e);
}
.post-meta-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-2, #8b96a8);
}
.post-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.post-meta-sep { opacity: 0.4; }

/* Divider */
.post-divider {
  height: 1px;
  background: var(--border, rgba(255,255,255,0.08));
  margin: 2rem 0;
}

/* Post content — the actual article body */
.post-content {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-2, #8b96a8);
}
.post-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text, #e8edf5);
  margin: 2.5rem 0 0.75rem;
  letter-spacing: -0.02em;
}
.post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, #e8edf5);
  margin: 2rem 0 0.5rem;
}
.post-content p  { margin-bottom: 1.4rem; }
.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.4rem;
}
.post-content li { margin-bottom: 0.5rem; }
.post-content a {
  color: var(--accent, #2f81f7);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-content a:hover { opacity: 0.8; }
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2, #1a2130);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.45em;
  color: var(--text, #e8edf5);
}
.post-content pre {
  background: var(--surface, #13181f);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.7;
}
.post-content blockquote {
  border-left: 3px solid var(--accent, #2f81f7);
  padding: 0.75rem 1.25rem;
  background: var(--accent-dim, rgba(47,129,247,0.06));
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.4rem;
  color: var(--text-2);
  font-style: italic;
}
.post-content strong { color: var(--text, #e8edf5); font-weight: 600; }
.post-content em     { color: var(--text, #e8edf5); }
.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Prev / Next */
.post-navigation {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin: 2.5rem 0;
}

/*
 * FIX — post nav overflow (advanced):
 *
 * post.js wraps each link in div.nav-prev / div.nav-next.
 * In flexbox, the default min-width:auto means items cannot
 * shrink below their content width — a long title forces the
 * div wider than 50%, overflowing the container.
 *
 * Solution:
 *   1. Give each wrapper exactly half the container minus half gap
 *   2. min-width:0 — overrides the auto, allows shrinking
 *   3. Link fills wrapper (width:100%) and truncates with ellipsis
 *
 * This is the correct CSS algorithm for constrained flex text.
 */
.nav-prev,
.nav-next {
  flex: 0 1 calc(50% - 0.5rem);
  min-width: 0;            /* KEY: allows item to shrink below content width */
}
.nav-next { text-align: right; }

.post-nav-link {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2, #8b96a8);
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  transition: all 0.15s ease;
  /* Truncate with ellipsis — correct for nav links */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.post-nav-link:hover {
  color: var(--accent, #2f81f7);
  border-color: rgba(47,129,247,0.4);
  background: var(--accent-dim, rgba(47,129,247,0.06));
}

/* Author box */
.author-box {
  background: var(--surface, #13181f);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #2f81f7);
  border-radius: 0 10px 10px 0;
  padding: 1.5rem;
  margin-top: 2rem;
}
.author-box-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.author-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-2, rgba(255,255,255,0.14));
  flex-shrink: 0;
}
.author-name {
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text, #e8edf5);
  margin-bottom: 0.35rem;
}
.author-bio {
  font-size: 0.88rem;
  color: var(--text-2, #8b96a8);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.author-bio a { color: var(--accent); }
.author-links {
  display: flex;
  gap: 1rem;
}
.author-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent, #2f81f7);
  transition: opacity 0.15s;
}
.author-links a:hover { opacity: 0.7; }

/* ── Blog footer ──────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  padding: 2rem;
}
.blog-footer-inner {
  max-width: var(--max-w, 1160px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.blog-footer ul {
  display: flex;
  gap: 1.5rem;
}
.blog-footer a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3, #545f6e);
  transition: color 0.15s;
}
.blog-footer a:hover { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────────── */
@media screen and (max-width: 640px) {
  .blog-hero    { padding: 3rem 1.25rem 2.5rem; }
  .blog-content-section { padding: 2rem 1.25rem 4rem; }
  .post-wrap    { padding: 2rem 1.25rem 4rem; }

  .blog-filter-bar  { flex-direction: column; align-items: stretch; }
  .blog-search-input { min-width: unset; }

  .post-navigation  { flex-direction: column; align-items: stretch; }
  .nav-prev,
  .nav-next         { flex: 0 0 100%; min-width: 0; text-align: left; }
  .post-nav-link    { width: 100%; }

  .author-box-inner { flex-direction: column; }

  .blog-footer-inner { flex-direction: column; align-items: center; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════
   SECTION BLEED FIX
   style.css defines global section { padding: 5rem 2rem }.
   On blog/post pages (body.single-post-page, body.blog-list-page)
   the portfolio section rules must not apply.
   Scope ALL portfolio-specific section ids to NOT match here.
═══════════════════════════════════════════════════════════ */
body.single-post-page section,
body.blog-list-page   section {
  /* Reset the huge 5rem vertical padding from style.css */
  padding: 0;
  /* Prevent the portfolio hero/about/skills background rules leaking */
  background: transparent;
}

/* The blog hero is the one section on blog-list-page that
   needs its own padding — already defined above, just ensure
   it wins the cascade */
body.blog-list-page .blog-hero {
  padding: 2rem 2rem 2.5rem;
}
body.blog-list-page .blog-content-section {
  padding: 3rem 2rem 5rem;
}

/* post-wrap is not a section but ensure no accidental padding */
body.single-post-page .post-wrap {
  padding: 2.5rem 2rem 5rem;
}

/* ═══════════════════════════════════════════════════════════
   SHARE BAR — Mobile-first
   Mobile  : icon + label, full-width row, wraps
   Tablet+ : compact pill row
   Desktop : same, slightly larger
═══════════════════════════════════════════════════════════ */

/* Container */
.share-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}

.share-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3, #545f6e);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 0.25rem;
  /* On very small screens the label alone gets its own row */
  flex-shrink: 0;
}

/* Each platform button */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: transparent;
  color: var(--text-2, #8b96a8);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.15s ease,
              border-color 0.15s ease,
              color 0.15s ease,
              transform 0.15s ease;
  /* Minimum tap target: 44px height for mobile accessibility */
  min-height: 36px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* SVG inside button */
.share-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Per-platform hover colours */
.share-btn--x:hover {
  background: rgba(0,0,0,0.4);
  border-color: rgba(0,0,0,0.6);
  color: #fff;
}
.share-btn--linkedin:hover {
  background: rgba(10,102,194,0.15);
  border-color: rgba(10,102,194,0.5);
  color: #0a66c2;
}
.share-btn--whatsapp:hover {
  background: rgba(37,211,102,0.12);
  border-color: rgba(37,211,102,0.5);
  color: #25d366;
}
.share-btn--email:hover {
  background: rgba(107,114,128,0.15);
  border-color: rgba(107,114,128,0.5);
  color: var(--text, #e8edf5);
}

.share-btn:hover { transform: translateY(-1px); }
.share-btn:active { transform: translateY(0); }

/* ── Mobile (< 480px): hide text labels, show icons only ── */
@media screen and (max-width: 480px) {
  .share-btn-label { display: none; }
  .share-btn {
    padding: 0.45rem 0.7rem;
    min-height: 40px;
    min-width: 40px;
    justify-content: center;
  }
  .share-btn svg { width: 17px; height: 17px; }
  /* Larger gap between icon-only buttons */
  .share-bar { gap: 0.6rem; }
}

/* ── Tablet 768px+: show labels ──────────────────────────── */
@media screen and (min-width: 481px) {
  .share-btn-label { display: inline; }
}

/* ── Desktop 1024px+: slightly more breathing room ──────── */
@media screen and (min-width: 1024px) {
  .share-btn { font-size: 0.78rem; padding: 0.45rem 0.9rem; }
  .share-btn svg { width: 16px; height: 16px; }
}