/* =========================================================
   Buzzlect Red — blog additions (listing + single post).
   Loaded ONLY on blog listing pages and single posts. Kept as a
   separate file so css/style.css and css/pages.css stay 1:1 with
   the original static site.
   ========================================================= */

/* ---------------------------------------------------------
   SINGLE POST
   --------------------------------------------------------- */

/* .post-hero already has 10rem top padding; drop the extra
   .section top padding so the banner sits under the title. */
.post-section { padding-top: 1.5rem; }

/* Featured image inside the existing .post-banner shell. */
.post-banner-img {
  background-size: cover;
  background-position: center;
}

/* ---- Gutenberg blocks -------------------------------------------------
   functions.php dequeues wp-block-library to protect the design, so the
   blocks that actually need styling are handled here. */

.post-content figure { margin: 0 0 2rem; }

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.post-content figcaption {
  font-size: 0.85rem;
  color: var(--grey-dim);
  text-align: center;
  margin-top: 0.6rem;
}

.post-content .wp-block-table { overflow-x: auto; }

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 2rem;
  font-size: 0.95rem;
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.post-content th,
.post-content td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: var(--black-3);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.post-content tr:last-child td { border-bottom: none; }
.post-content tbody tr:hover { background: rgba(229, 9, 20, 0.05); }

.post-content .wp-block-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.post-content .wp-block-code,
.post-content pre {
  background: var(--black-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-size: 0.9rem;
  margin-bottom: 1.6rem;
}

.post-content h4 { font-size: 1.1rem; margin: 1.8rem 0 0.7rem; }

.post-content .alignleft   { float: left;  margin: 0 1.5rem 1rem 0; }
.post-content .alignright  { float: right; margin: 0 0 1rem 1.5rem; }
.post-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }

.post-pagination { color: var(--grey); }
.post-pagination a { color: var(--red); }

/* ---- Previous / next post ---- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.2rem 1.4rem;
  background: var(--black-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.post-nav-link:hover { border-color: var(--red); transform: translateY(-3px); }
.post-nav-link span { color: var(--grey-dim); font-size: 0.8rem; letter-spacing: 0.05em; }
.post-nav-link strong { color: var(--white); font-family: var(--font-display); font-size: 1rem; line-height: 1.35; }
.post-nav-next { text-align: right; align-items: flex-end; }

/* ---------------------------------------------------------
   BLOG LISTING
   --------------------------------------------------------- */

/* The featured post is a link wrapper — kill default underline/colour. */
.featured-post { text-decoration: none; color: var(--white); margin-top: 2.5rem; }
.featured-body h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; }
.featured-cta { color: var(--red); font-weight: 600; font-size: 0.92rem; margin-top: 0.4rem; }
.featured-post:hover .featured-cta .arrow { transform: translateX(5px); }
.featured-cta .arrow { display: inline-block; transition: transform 0.3s var(--ease); }

/* Featured image with a real thumbnail behind the FEATURED badge. */
.featured-img-thumb { background-size: cover; background-position: center; }
.featured-img-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(10,10,10,0.75), rgba(69,4,10,0.45));
}

/* Card thumbnail variant. */
.blog-card-img-thumb { background-size: cover; background-position: center; }
.blog-card-img-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(10,10,10,0.55), rgba(69,4,10,0.35));
  z-index: 1;
}

/* .blog-tag is absolutely positioned, so the image needs to be its context. */
.blog-card-img { position: relative; }

/* ---- Pagination ---- */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 3.5rem;
}

.blog-pagination .page-numbers {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--grey);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s var(--ease);
}

.blog-pagination .page-numbers:hover {
  border-color: var(--red);
  color: var(--white);
  transform: translateY(-2px);
}

.blog-pagination .page-numbers.current {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 5px 20px var(--red-glow);
}

.blog-pagination .page-numbers.dots { border-color: transparent; }

/* ---- Empty state ---- */
.blog-empty {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 3rem 0;
}
.blog-empty p { color: var(--grey); margin-bottom: 1.6rem; }

@media (max-width: 700px) {
  .post-hero { padding: 8rem 0 2rem; }
  .post-banner { height: 200px; margin-bottom: 2.5rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; align-items: flex-start; }
}

/* ---------------------------------------------------------
   LEGAL / GENERIC PAGES
   Privacy Policy, Disclaimer, Terms — these reuse .post-content,
   so they only need the hero meta line and a little breathing room.
   --------------------------------------------------------- */

.page-hero .blog-meta {
  display: block;
  margin-top: 0.7rem;
}

/* First heading shouldn't push the page open with its usual big top margin. */
.post-content > h2:first-child,
.post-content > h3:first-child { margin-top: 0; }

.post-content > *:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------
   BUTTONS INSIDE PROSE
   .post-content a paints every link red with an underline, which is right
   for body links but wrong for buttons — it was repainting the CTA label
   red-on-red. Buttons keep their own colours.
   --------------------------------------------------------- */

.post-content a.btn,
.post-content a.btn:hover {
  border-bottom: none;
}

.post-content a.btn-primary,
.post-content a.btn-primary:hover {
  color: #fff;
}

.post-content a.btn-ghost,
.post-content a.btn-ghost:hover {
  color: var(--white);
}

/* ---------------------------------------------------------
   POST TABLE OF CONTENTS
   Sidebar of headings beside the article on wide screens,
   collapsing to a tappable panel on small ones.
   --------------------------------------------------------- */

.post-layout.has-toc {
  display: grid;
  grid-template-columns: 236px minmax(0, 760px);
  gap: 3.5rem;
  justify-content: center;
  align-items: start;
}

.post-layout.has-toc .post-content { max-width: none; margin: 0; }

.post-toc {
  position: sticky;
  top: 110px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-right: 0.5rem;
  border-left: 1px solid var(--border);
}

.post-toc-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey-dim);
  margin: 0 0 0.9rem 1.1rem;
}

.post-toc-toggle { display: none; }

.post-toc-list { list-style: none; margin: 0; padding: 0; }

.post-toc-item a {
  display: block;
  padding: 0.38rem 0 0.38rem 1.1rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--grey);
  font-size: 0.86rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.25s, border-color 0.25s;
}

.post-toc-item a:hover { color: var(--white); border-left-color: var(--red-deep); }

.post-toc-h3 a { padding-left: 2rem; font-size: 0.8rem; color: var(--grey-dim); }

/* Sub-headings live inside their parent section and stay tucked away until
   that section is the one being read, or the reader opens it themselves. */
.post-toc-sub { list-style: none; margin: 0; padding: 0; display: none; }
.post-toc-item.is-expanded > .post-toc-sub { display: block; }

.post-toc-item.has-children { position: relative; }
.post-toc-item.has-children > a { padding-right: 1.7rem; }

.post-toc-sub-toggle {
  position: absolute;
  top: 0.2rem;
  right: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: 0;
  color: var(--grey-dim);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s;
}

.post-toc-sub-toggle:hover { color: var(--red-bright); }
.post-toc-item.is-expanded > .post-toc-sub-toggle { color: var(--red); }

/* Own visually-hidden helper: core's .screen-reader-text is dequeued here. */
.post-toc-sub-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.post-toc-item.is-active > a {
  color: var(--red-bright);
  border-left-color: var(--red);
  font-weight: 600;
}

/* Anchor targets clear the fixed header when jumped to. */
.post-content h2[id],
.post-content h3[id] { scroll-margin-top: 110px; }

/* Thin scrollbar inside the nav only. */
.post-toc::-webkit-scrollbar { width: 4px; }
.post-toc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

@media (max-width: 1080px) {
  .post-layout.has-toc { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 760px; margin: 0 auto; }

  .post-toc {
    position: static;
    max-height: none;
    overflow: visible;
    border-left: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--black-2);
    margin-bottom: 2.2rem;
    padding: 0;
  }

  .post-toc-title { display: none; }

  .post-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.95rem 1.2rem;
    background: none;
    border: none;
    color: var(--white);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
  }

  .post-toc-chevron { color: var(--red); font-size: 1.1rem; line-height: 1; }

  .post-toc-list { max-height: 0; overflow: hidden; transition: max-height 0.35s var(--ease); }
  .post-toc.is-open .post-toc-list { max-height: 60vh; overflow-y: auto; padding: 0 0.6rem 0.9rem; }

  .post-toc-item a { border-left: none; padding-left: 0.7rem; }
  .post-toc-item.is-active > a { border-left: none; }
}
