/* ============================================================
   Blog - listing extras + single-article reading view.
   Listing cards reuse .post-grid/.post-card from landing.css.
   ============================================================ */

:root {
  --acc: #008CCF;
  --acc-strong: #015E8F;
  --ink: #333639;
  --ink-soft: #5B5E69;
  --ink-muted: #8E909B;
  --line: #E2E4EB;
}

/* ---------- category chips ---------- */
.blog-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 auto 8px;
  padding-top: 4px;
}

.blog-cat {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 7px 16px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  transition: all .15s;
}

.blog-cat:hover {
  border-color: var(--acc);
  color: var(--acc-strong);
}

.blog-cat.is-active {
  background: var(--acc);
  color: #fff;
  border-color: var(--acc);
}

/* ---------- listing extras ---------- */
.post-date {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-muted);
}

.post-thumb-fallback {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(135deg, #008CCF 0%, #31A0D9 55%, #6FC3E8 100%);
}

.blog-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
  font-size: 16px;
}

.blog-empty a {
  color: var(--acc);
  font-weight: 600;
}

/* ---------- pagination ---------- */
.blog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 44px;
}

.blog-pager-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--acc-strong);
  text-decoration: none;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s;
}

.blog-pager-btn:hover {
  border-color: var(--acc);
}

.blog-pager-info {
  font-size: 14px;
  color: var(--ink-muted);
}

/* ============================================================
   Single article
   ============================================================ */
.blog-article {
  position: relative;
  padding-bottom: 40px;
}

.blog-article .page-aura {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blog-article-head {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding-top: 100px;
  text-align: center;
}

.blog-crumbs {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.blog-crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}

.blog-crumbs a:hover {
  color: var(--acc);
}

.blog-article-title {
  font-family: "Montserrat Alternates", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}

.blog-article-meta {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
}

.blog-article-hero {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 36px auto 0;
}

.blog-article-hero img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  display: block;
  box-shadow: 0 30px 70px -34px rgba(20, 30, 50, 0.4);
}

/* ---------- prose ---------- */
.blog-prose {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 40px auto 0;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.blog-prose h2 {
  font-family: "Montserrat Alternates", ui-sans-serif, system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin: 40px 0 14px;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.blog-prose h3 {
  font-family: "Montserrat Alternates", ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 30px 0 10px;
}

.blog-prose p {
  margin: 0 0 20px;
}

.blog-prose ul,
.blog-prose ol {
  /* margin: 0 0 20px; */
  padding-left: 40px;
}

.blog-prose ul {
  list-style: disc;
}

.blog-prose ol {
  list-style: decimal;
}

.blog-prose li {
  margin-bottom: 8px;
}

.blog-prose a {
  color: var(--acc);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.blog-prose a:hover {
  color: var(--acc-strong);
}

.blog-prose strong {
  color: var(--ink);
  font-weight: 700;
}

.blog-prose em {
  font-style: italic;
}

/* ---------- comparison tables ----------
   Styles any <table> inside a blog post. Works whether or not the table uses
   <thead>; the first row and any row <th> are treated as headers. */
.blog-prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 30px 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 40, 70, 0.04);
}

.blog-prose th,
.blog-prose td {
  padding: 12px 15px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.blog-prose th:last-child,
.blog-prose td:last-child {
  border-right: 0;
}

.blog-prose tr:last-child th,
.blog-prose tr:last-child td {
  border-bottom: 0;
}

/* Column headers: explicit <thead>, or the first row when there is no thead. */
.blog-prose thead th,
.blog-prose tr:first-child th {
  background: rgba(0, 140, 207, 0.08);
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.005em;
}

/* Row labels: a leading <th scope="row"> or the first cell of body rows. */
.blog-prose tbody th[scope="row"],
.blog-prose tbody td:first-child {
  font-weight: 600;
  color: var(--ink);
}

.blog-prose tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.022);
}

.blog-prose tbody tr:hover td {
  background: rgba(0, 140, 207, 0.05);
}

.blog-prose caption {
  caption-side: bottom;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
}

/* Scroll horizontally on small screens instead of squashing the columns. */
@media (max-width: 640px) {
  .blog-prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* Dark theme: keep header tint, zebra and hover visible. */
[data-theme="dark"] .blog-prose thead th,
[data-theme="dark"] .blog-prose tr:first-child th {
  background: rgba(0, 140, 207, 0.16);
}

[data-theme="dark"] .blog-prose tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .blog-prose tbody tr:hover td {
  background: rgba(0, 140, 207, 0.12);
}

/* ---------- tags ---------- */
.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 34px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.blog-tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 140, 207, 0.07);
}

/* ---------- related ---------- */
.blog-related {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 64px auto 0;
}

.blog-related-title {
  font-family: "Montserrat Alternates", ui-sans-serif, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 22px;
  text-align: center;
}

@media (max-width: 640px) {
  .blog-prose {
    font-size: 16px;
  }

  .blog-article-head {
    padding-top: 84px;
  }
}

/* ============================================================
   Blog post - floating table of contents
   Shown only at ≥ 1440 px where there is clear space to the
   right of the 920 px prose column without overlap.
   ============================================================ */
.blog-toc {
  display: none;
}

@media (min-width: 1440px) {
  .blog-toc {
    display: block;
    position: fixed;
    top: 90px;
    right: 24px;
    width: 210px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 16px;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: 0 4px 24px rgba(20, 40, 70, 0.08);
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    z-index: 100;
  }
}

.blog-toc-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 10px;
  padding: 0 8px;
}

.blog-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.blog-toc-item--sub {
  padding-left: 10px;
}

.blog-toc-link {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.blog-toc-link:hover {
  color: var(--acc-strong);
  background: rgba(0, 140, 207, 0.06);
}

.blog-toc-link.is-active {
  color: var(--acc-strong);
  font-weight: 600;
  border-left-color: var(--acc);
  background: rgba(0, 140, 207, 0.08);
}

[data-theme="dark"] .blog-toc {
  background: rgba(28, 30, 36, 0.88);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .blog-toc-link:hover {
  background: rgba(0, 140, 207, 0.1);
}

[data-theme="dark"] .blog-toc-link.is-active {
  background: rgba(0, 140, 207, 0.15);
}

/* ============================================================
   Branded podcast player - replaces native <audio> in .blog-prose
   (built by setupAudioPlayers in landing.js)
   ============================================================ */
.ls-audio {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 8px 28px rgba(16, 42, 67, 0.07);
}

.ls-audio-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(0, 140, 207, 0.4);
  transition: background 0.18s, transform 0.18s;
}

.ls-audio-btn:hover {
  background: var(--acc-strong);
  transform: scale(1.05);
}

.ls-audio-main {
  flex: 1;
  min-width: 0;
}

.ls-audio-track {
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

/* the visible rail */
.ls-audio-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 140, 207, 0.14);
}

.ls-audio-fill {
  position: absolute;
  left: 0;
  width: 0;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--acc), #31A0D9);
  pointer-events: none;
}

.ls-audio-thumb {
  position: absolute;
  left: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--acc);
  box-shadow: 0 1px 5px rgba(16, 42, 67, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.ls-audio-track:hover .ls-audio-thumb,
.ls-audio-track:focus-visible .ls-audio-thumb,
.ls-audio.is-playing .ls-audio-thumb {
  opacity: 1;
}

.ls-audio-times {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.ls-audio-speed {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ls-audio-speed:hover {
  border-color: var(--acc);
  color: var(--acc-strong);
}

@media (max-width: 520px) {
  .ls-audio {
    gap: 12px;
    padding: 12px 14px;
  }

  .ls-audio-btn {
    width: 46px;
    height: 46px;
  }
}

/* ============================================================
   Dark mode (must come after :root block above to win cascade)
   ============================================================ */
[data-theme="dark"] {
  --ink: #F4F4F6;
  --ink-soft: #B8BBC8;
  --ink-muted: #848592;
  --acc: #008CCF;
  --acc-strong: #31A0D9;
  --line: rgba(255, 255, 255, 0.09);
}

[data-theme="dark"] .blog-cat {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink-soft);
}

[data-theme="dark"] .blog-cat.is-active {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}

[data-theme="dark"] .blog-pager-btn {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink-soft);
}

[data-theme="dark"] .ls-audio {
  background: rgba(39, 39, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.09);
}

[data-theme="dark"] .ls-audio-speed {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
}