/* ==========================================================
   CartPinger Blog — Styles
   Extends /styles.css (load both)
   ========================================================== */

/* ── Nav active state ─────────────────────────────────────── */
.nav-links .nav-active,
.drawer-links .nav-active {
  color: var(--text-1);
  font-weight: 500;
}

/* ── Blog listing hero ────────────────────────────────────── */
.blog-hero {
  padding: 80px 0 56px;
  border-bottom: 1px solid var(--border);
}
.blog-hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 14px;
  color: var(--text-1);
}
.blog-hero .lede { max-width: 520px; margin: 0; }

/* ── Tag filter ───────────────────────────────────────────── */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.tag-filter-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 150ms, color 150ms, background 150ms;
  font-family: inherit;
}
.tag-filter-btn:hover,
.tag-filter-btn.active {
  border-color: var(--wa);
  color: var(--wa);
  background: var(--wa-soft);
}

/* ── RSS link ─────────────────────────────────────────────── */
.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  margin-top: 20px;
  transition: color 150ms;
}
.rss-link:hover { color: var(--wa); }

/* ── Blog grid ────────────────────────────────────────────── */
.blog-section { padding: 64px 0 96px; }
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 600px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Post card ────────────────────────────────────────────── */
.post-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 200ms, transform 200ms;
  text-decoration: none;
  color: inherit;
}
.post-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.post-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.post-card-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--surface-2) 0%, #1a2a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  opacity: 0.5;
}
.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--wa-soft);
  color: var(--wa);
  border: 1px solid var(--wa-border);
}
.post-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0;
}
.post-card-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}
.post-meta-sep { color: var(--border-strong); }

/* ── Pagination ───────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 56px;
}
.blog-pagination a,
.blog-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-btn);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-2);
  text-decoration: none;
  transition: border-color 150ms, color 150ms;
}
.blog-pagination a:hover { border-color: var(--border-strong); color: var(--text-1); }
.blog-pagination span.active { background: var(--wa); color: #000; border-color: var(--wa); }

/* ── Post hero ────────────────────────────────────────────── */
.post-hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
}
.post-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 28px;
}
.post-breadcrumb a { color: var(--text-3); text-decoration: none; transition: color 150ms; }
.post-breadcrumb a:hover { color: var(--text-2); }
.post-title {
  font-size: clamp(26px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0 0 20px;
  color: var(--text-1);
  max-width: 820px;
}
.post-description {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 680px;
}
.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 32px;
}
.post-cover-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
}

/* ── Post layout ──────────────────────────────────────────── */
.post-layout {
  display: block;
  padding: 64px 0 32px;
}
@media (min-width: 1140px) {
  .post-layout {
    display: grid;
    grid-template-columns: minmax(0, 720px) 260px;
    gap: 64px;
    align-items: start;
  }
}

/* ── TOC ──────────────────────────────────────────────────── */
.toc-mobile-toggle {
  max-width: 720px;
  margin: 0 0 32px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px 20px;
}
.toc-mobile-toggle summary {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.toc-mobile-toggle summary::-webkit-details-marker { display: none; }
.toc-mobile-toggle summary::after { content: " ▾"; }
.toc-mobile-toggle[open] summary::after { content: " ▴"; }
@media (min-width: 1140px) {
  .toc-mobile-toggle { display: none; }
}

.toc-desktop {
  display: none;
}
@media (min-width: 1140px) {
  .toc-desktop {
    display: block;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px;
  }
}
.toc-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 12px;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-mobile-toggle .toc-list { margin-top: 14px; }
.toc-item a {
  display: block;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 5px;
  line-height: 1.4;
  transition: background 150ms, color 150ms;
}
.toc-item a:hover,
.toc-item a.active {
  background: var(--surface-2);
  color: var(--text-1);
}
.toc-h3 > a { padding-left: 20px; font-size: 12px; }

/* ── Post body typography ─────────────────────────────────── */
.post-body {
  min-width: 0;
  max-width: 720px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-2);
}
.post-body h2 {
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-1);
  margin: 56px 0 16px;
  padding-top: 4px;
}
.post-body h3 {
  font-size: clamp(17px, 2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text-1);
  margin: 40px 0 12px;
}
.post-body h4 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 32px 0 10px;
}
.post-body p { margin: 0 0 20px; }
.post-body a { color: var(--wa); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { color: var(--mint); }
.post-body strong { color: var(--text-1); font-weight: 600; }
.post-body ul,
.post-body ol { padding-left: 24px; margin: 0 0 20px; }
.post-body li { margin-bottom: 8px; line-height: 1.65; }
.post-body blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--wa);
  background: var(--wa-soft);
  border-radius: 0 var(--r-badge) var(--r-badge) 0;
  font-size: 18px;
  font-style: italic;
  color: var(--text-1);
}
.post-body img {
  width: 100%;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  margin: 24px 0;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ── Tables ───────────────────────────────────────────────── */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 15px;
  overflow-x: auto;
  display: block;
}
.post-body th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-2);
  white-space: nowrap;
}
.post-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}
.post-body tr:last-child td { border-bottom: none; }

/* ── Code ─────────────────────────────────────────────────── */
.post-body code {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--mint);
  border: 1px solid var(--border);
}
.post-body pre {
  margin: 28px 0;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  overflow-x: auto;
  background: #111 !important;
}
.post-body pre code {
  display: block;
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.65;
  background: transparent !important;
  color: inherit;
  border: none;
  border-radius: 0;
}

/* ── Callouts ─────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r-card);
  margin: 28px 0;
  font-size: 15px;
  line-height: 1.65;
  border: 1px solid;
}
.callout::before { font-size: 18px; flex-shrink: 0; line-height: 1.65; }
.callout-info    { background: rgba(6,182,212,0.08); border-color: rgba(6,182,212,0.25); color: var(--text-2); }
.callout-info::before { content: "ℹ️"; }
.callout-warning { background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.25); color: var(--text-2); }
.callout-warning::before { content: "⚠️"; }
.callout-danger  { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); color: var(--text-2); }
.callout-danger::before { content: "🚨"; }
.callout-tip     { background: var(--wa-soft); border-color: var(--wa-border); color: var(--text-2); }
.callout-tip::before { content: "💡"; }

/* ── YouTube embed ────────────────────────────────────────── */
.embed-youtube {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  margin: 28px 0;
}
.embed-youtube iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* ── Author bio ───────────────────────────────────────────── */
.post-author {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  margin: 0 0 48px;
  max-width: 720px;
}
.author-avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wa-soft), var(--surface-3));
  border: 2px solid var(--wa-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--wa);
  flex-shrink: 0;
}
.author-info { flex: 1; }
.author-name { font-size: 15px; font-weight: 600; color: var(--text-1); margin: 0 0 3px; }
.author-role { font-size: 13px; color: var(--text-3); margin: 0 0 10px; }
.author-links { display: flex; gap: 14px; }
.author-links a { font-size: 13px; color: var(--wa); text-decoration: none; transition: color 150ms; }
.author-links a:hover { color: var(--mint); }

/* ── Related posts ────────────────────────────────────────── */
.post-related { margin-bottom: 56px; }
.post-related-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0 0 20px;
}
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 600px) {
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}
.related-grid .post-card-title { font-size: 14px; }

/* ── CTA banner ───────────────────────────────────────────── */
.post-cta {
  padding: 40px;
  background: linear-gradient(135deg, var(--wa-soft) 0%, rgba(6,182,212,0.07) 100%);
  border: 1px solid var(--wa-border);
  border-radius: var(--r-card);
  text-align: center;
  margin-bottom: 80px;
}
.post-cta h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-1);
  margin: 0 0 10px;
}
.post-cta p { font-size: 15px; color: var(--text-2); margin: 0 0 24px; line-height: 1.6; }

/* ── Blog footer ──────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}
.blog-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}
.blog-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.blog-footer-links a {
  font-size: 14px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 150ms;
}
.blog-footer-links a:hover { color: var(--text-2); }
