/* ============================================================================
   FreeSoftwareX Blog — listing page + article template
   Original layout (hero/featured/grid/newsletter for the index; banner/TOC/
   content/callouts/FAQ/related for posts) — a common, generic blog pattern
   used across many sites, built fresh for this site's own colours, type and
   spacing tokens (reuses fsx.css variables). No third-party content or
   imagery — banner art is original inline SVG. (Rohit, 18-Sep)
   ========================================================================== */

/* ── shared page chrome ───────────────────────────────────────────────── */
.blog-crumb { font-size: 13px; color: var(--ink-3); margin: 0 0 var(--s3); }
.blog-crumb a { color: var(--ink-3); }
.blog-crumb a:hover { color: var(--brand-ink); }

/* ── listing: page head ───────────────────────────────────────────────── */
.blog-head { position: relative; max-width: none; margin: 0 0 var(--s5); padding: var(--s5) 0 0; }
.blog-head::before {
  content: ''; position: absolute; top: -40px; left: 0; width: 900px; height: 420px;
  background: radial-gradient(420px 220px at 10% 0%, rgba(79,70,229,.14), transparent 65%),
              radial-gradient(360px 200px at 55% 10%, rgba(34,211,238,.12), transparent 65%);
  pointer-events: none; z-index: -1;
}
.blog-head-row { display: flex; align-items: center; gap: clamp(20px, 4vw, 48px); }
.blog-head-copy { flex: 1 1 56%; min-width: 0; }
.blog-head-visual { flex: 1 1 36%; min-width: 0; max-width: 360px; }
.blog-head-visual img { display: block; width: 100%; height: auto; }
@media (max-width: 860px) { .blog-head-row { flex-direction: column; } .blog-head-visual { max-width: 260px; order: -1; margin: 0 auto; } .blog-head-copy { text-align: center; } }
.blog-head span.badge { margin-bottom: 14px; }
.blog-head h1 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.025em; line-height: 1.1; }
.blog-head h1 em { font-style: normal; background: linear-gradient(90deg, var(--brand-ink), #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.blog-head p { margin: 0 0 20px; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; max-width: 52em; }
.blog-head-stats { display: flex; align-items: center; justify-content: flex-start; gap: 22px; flex-wrap: wrap; }
@media (max-width: 860px) { .blog-head-stats { justify-content: center; } }
.blog-head-stat { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.blog-head-stat b { color: var(--ink); font-weight: 800; }
.blog-head-stats .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-2); }

/* ── shared: avatar + category colour system ──────────────────────────── */
.blog-avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink);
  display: inline-grid; place-items: center; font-weight: 800; font-size: 9.5px; flex: 0 0 auto; letter-spacing: -.02em;
}
[data-cat="safety"] .blog-tag  { color: #b45309; background: #fef3c7; }
[data-cat="guides"] .blog-tag  { color: #2563eb; background: #dbeafe; }
[data-cat="picks"]  .blog-tag  { color: #16a34a; background: #dcfce7; }
[data-cat="trust"]  .blog-tag  { color: #9333ea; background: #f3e8ff; }

/* ── listing: featured + recent ───────────────────────────────────────── */
.blog-featured { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s4); margin-bottom: var(--s6); }
.blog-featured-main {
  display: block; border-radius: var(--r-card); overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--sh-2); transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.blog-featured-main:hover { transform: translateY(-4px); box-shadow: var(--sh-3); text-decoration: none; }
.blog-featured-banner { position: relative; aspect-ratio: 16/8; display: block; overflow: hidden; }
.blog-featured-banner img, .blog-featured-banner svg { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s var(--ease); }
.blog-featured-main:hover .blog-featured-banner img,
.blog-featured-main:hover .blog-featured-banner svg { transform: scale(1.06); }
.blog-featured-banner .blog-tag { position: absolute; top: 16px; left: 16px; z-index: 1; background: #fff; box-shadow: var(--sh-1); }
.blog-featured-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(10,19,48,.25)); pointer-events: none; }
.blog-featured-body { padding: 22px 26px 26px; }
.blog-tag {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--brand-ink); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px;
}
.blog-featured-body h2 { margin: 12px 0 8px; font-size: 25px; line-height: 1.22; letter-spacing: -.01em; color: var(--ink); }
.blog-featured-body p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.blog-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.blog-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }

.blog-recent { display: flex; flex-direction: column; gap: 14px; }
.blog-recent-h { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 2px; }
.blog-recent-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px;
  transition: background .15s var(--ease), transform .15s var(--ease);
}
.blog-recent-item:hover { background: var(--surface-2); transform: translateX(2px); text-decoration: none; }
.blog-recent-thumb { position: relative; flex: 0 0 64px; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; }
.blog-recent-thumb img, .blog-recent-thumb svg { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .3s var(--ease); }
.blog-recent-item:hover .blog-recent-thumb img,
.blog-recent-item:hover .blog-recent-thumb svg { transform: scale(1.08); }
.blog-recent-item h3 { margin: 0 0 4px; font-size: 14px; line-height: 1.35; color: var(--ink); }
.blog-recent-item .blog-meta { font-size: 11.5px; }

/* ── listing: category filter pills ───────────────────────────────────── */
.blog-filters { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 var(--s4); }
.blog-filter {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--ink-2);
  font: 600 13px/1 var(--font); padding: 10px 18px; border-radius: 999px; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.blog-filter:hover { border-color: var(--brand-line); color: var(--brand-ink); transform: translateY(-1px); }
.blog-filter.is-active { background: linear-gradient(145deg, var(--brand), var(--brand-ink)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -5px rgba(79,70,229,.5); }

/* ── listing: card grid ───────────────────────────────────────────────── */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-bottom: var(--s6); }
.blog-card {
  display: flex; flex-direction: column; border-radius: var(--r-card); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-1);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.blog-card:hover { transform: translateY(-5px); box-shadow: var(--sh-3); border-color: var(--brand-line); text-decoration: none; }
.blog-card-banner { position: relative; aspect-ratio: 16/9; display: block; overflow: hidden; }
.blog-card-banner img, .blog-card-banner svg { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s var(--ease); }
.blog-card:hover .blog-card-banner img,
.blog-card:hover .blog-card-banner svg { transform: scale(1.08); }
.blog-card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.blog-card-body h3 { margin: 10px 0 8px; font-size: 16.5px; line-height: 1.35; color: var(--ink); transition: color .15s var(--ease); }
.blog-card:hover .blog-card-body h3 { color: var(--brand-ink); }
.blog-card-body p { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; flex: 1; }

/* ── listing: newsletter CTA banner ───────────────────────────────────── */
.blog-news {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; padding: 32px 38px; border-radius: var(--r-card);
  background: linear-gradient(120deg, #2563eb, #4f46e5 70%); border: 0; color: #fff;
}
.blog-news::after { content: ''; position: absolute; inset: 0; background: radial-gradient(420px 220px at 100% 100%, rgba(255,255,255,.14), transparent 70%); pointer-events: none; }
.blog-news > div { position: relative; z-index: 1; }
.blog-news h2 { margin: 0 0 6px; font-size: 21px; color: #fff; }
.blog-news p { margin: 0; color: rgba(255,255,255,.82); font-size: 14px; max-width: 42ch; }
.blog-news form { position: relative; z-index: 1; display: flex; gap: 8px; flex: 0 0 auto; }
.blog-news .input { min-width: 240px; background: #fff; border-color: transparent; }
.blog-news .btn { background: #fff; color: var(--brand-ink); border-color: #fff; font-weight: 700; }
.blog-news .btn:hover { background: #eef0ff; border-color: #eef0ff; }
@media (max-width: 560px) {
  .blog-news form { width: 100%; flex-direction: column; }
  .blog-news .input { min-width: 0; width: 100%; }
  .blog-news .btn { width: 100%; }
}

@media (max-width: 900px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .blog-grid { grid-template-columns: 1fr; }
}

/* ── post: banner + meta ──────────────────────────────────────────────── */
.post-banner { aspect-ratio: 21/8; border-radius: var(--r-card); overflow: hidden; margin-bottom: var(--s4); }
.post-banner img, .post-banner svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.post-head { max-width: 78ch; margin: 0 auto var(--s2); }
.post-head h1 { margin: 10px 0 12px; font-size: clamp(26px, 3.4vw, 38px); line-height: 1.2; letter-spacing: -.01em; }
.post-byline { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-3); }
.post-byline .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: 0 0 auto; }
.post-byline b { color: var(--ink-2); font-weight: 650; }
.post-byline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }

/* ── post: two-column layout with sticky TOC ──────────────────────────── */
.post-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--s5); align-items: start; margin-top: var(--s4); }
.post-toc { position: sticky; top: 90px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; }
.post-toc-h { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.post-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; border-left: 2px solid var(--border); }
.post-toc a {
  display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 13px; color: var(--ink-2); line-height: 1.4;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.post-toc a:hover, .post-toc a.is-active { color: var(--brand-ink); border-left-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
@media (max-width: 900px) { .post-layout { grid-template-columns: 1fr; } .post-toc { position: static; margin-bottom: var(--s3); } .post-toc ol { display: grid; grid-template-columns: repeat(2, 1fr); border-left: 0; gap: 4px 12px; } .post-toc a { border-left: 0; border-radius: var(--r-sm); padding: 3px 6px; margin-left: -6px; } }

/* ── post: article typography ─────────────────────────────────────────── */
.post-content { max-width: 78ch; font-size: 16px; line-height: 1.75; color: var(--ink-2); }
.post-content h2 { margin: 2.1em 0 .6em; font-size: 23px; color: var(--ink); scroll-margin-top: 90px; }
.post-content h2:first-child { margin-top: 0; }
.post-content h3 { margin: 1.6em 0 .5em; font-size: 18px; color: var(--ink); scroll-margin-top: 90px; }
.post-content p { margin: 0 0 1.1em; }
.post-content ul, .post-content ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.post-content li { margin-bottom: .45em; }
.post-content strong { color: var(--ink); }
.post-content a { text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 2px; }

.post-callout {
  display: flex; gap: 12px; padding: 16px 18px; margin: 1.6em 0; border-radius: 12px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
}
.post-callout .ico { flex: 0 0 auto; width: 20px; height: 20px; color: var(--brand-ink); margin-top: 1px; }
.post-callout b { display: block; color: var(--ink); margin-bottom: 2px; }
.post-callout p { margin: 0; font-size: 14.5px; }

.post-cta {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin: 2.2em 0; padding: 24px 26px; border-radius: var(--r-card);
  background: linear-gradient(120deg, #2563eb, #4f46e5 70%); color: #fff;
}
.post-cta::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 160px at 88% 0%, rgba(255,255,255,.16), transparent 70%);
}
.post-cta > * { position: relative; }
.post-cta h3 { margin: 0 0 4px; font-size: 18px; color: #fff; }
.post-cta p { margin: 0; font-size: 13.5px; color: rgba(255,255,255,.78); }
.post-cta .btn { flex: 0 0 auto; background: #fff; color: var(--brand-ink); border-color: #fff; }
.post-cta .btn:hover { background: #e5e8ef; border-color: #e5e8ef; color: var(--brand-ink); }

/* ── post: FAQ ─────────────────────────────────────────────────────────── */
.post-faq { max-width: 78ch; margin: var(--s5) 0; }
.post-faq h2 { font-size: 23px; margin: 0 0 14px; color: var(--ink); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  padding: 16px 2px; background: none; border: 0; text-align: left; font: 650 15.5px/1.4 var(--font);
  color: var(--ink); cursor: pointer;
}
.faq-q .ico { flex: 0 0 auto; width: 18px; height: 18px; color: var(--ink-3); transition: transform .18s var(--ease); }
.faq-item.is-open .faq-q .ico { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .22s var(--ease); }
.faq-a p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); max-width: 72ch; }

/* ── post: related ─────────────────────────────────────────────────────── */
.post-related { margin: var(--s6) 0 0; }
.post-related h2 { font-size: 20px; margin: 0 0 16px; }
.post-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .post-related-grid { grid-template-columns: 1fr; } }
