/* ===============================
   Blog custom styles - cleaned
   =============================== */

/* ---------- Container ---------- */
.container.blog-wrap {
  margin: 40px auto;
  padding: 5rem 18px 0;
  box-sizing: border-box;
}

/* ================== HERO (single) ================== */
.blog-hero-min {
  display: flex;
  gap: 30px;
  align-items: center;
  margin-bottom: 34px;
}
.blog-hero-min .hero-left { flex: 1; }
.blog-hero-min .hero-right { width: 480px; flex: 0 0 480px; }

.blog-hero-min .eyebrow {
  font-size: 13px;
  color: #2a7dd5;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.blog-hero-min .hero-title {
  font-size: 34px;
  margin: 6px 0 8px;
  color: #072042;
  font-weight: 700;
  line-height: 1.12;
}
.blog-hero-min .meta-line { color: #6f7a86; font-size: 13px; margin-bottom: 12px; }
.blog-hero-min .hero-desc { color: #4f5b6a; font-size: 15px; margin-bottom: 14px; }

/* hide hero CTA if still present */
.blog-hero-min .hero-cta { display: none !important; }

/* hero image */
.blog-hero-min .hero-right img { width: 100%; height: auto; border-radius: 10px; display: block; }

/* ================== Cards grid (4 posts) ================== */
.cards-grid-min {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  margin-top: 12px;
}

.card-min {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(11,33,60,0.04);
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}
.card-min .thumb img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.card-body { padding: 12px 14px; }
.card-min .title { font-size: 16px; margin: 4px 0 8px; color: #072042; font-weight: 600; }
.card-min .meta { color: #7b8793; font-size: 13px; }

/* ================== Grid + Sidebar layout ================== */

/* The wrapper that contains main column + sidebar */
.grid-with-sidebar {
  display: flex !important;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: nowrap;
  margin-top: 18px;
  box-sizing: border-box;
}

/* main column (cards) ~75% */
.grid-with-sidebar .main-cards-column {
  flex: 0 0 75%;
  max-width: 75%;
  box-sizing: border-box;
}

/* internal cards grid should fill the main column */
.grid-with-sidebar .main-cards-column .cards-grid-min {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  box-sizing: border-box;
}

/* sidebar column ~25% */
.grid-with-sidebar .blog-side-column {
  flex: 0 0 25%;
  max-width: 25%;
  box-sizing: border-box;
  padding-left: 18px;
}

/* Sidebar card + content */
.sidebar-card {
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(11,33,60,0.05);
  text-align: center;
}
.sidebar-banner-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  margin-bottom: 14px;
}
.sidebar-help { text-align: left; }
.sidebar-help h4 { font-size: 16px; margin: 0 0 8px; color: #0b2a47; }
.help-list { list-style: none; padding: 0; margin: 0; }
.help-list li { margin-bottom: 8px; }
.help-list a { color: #0b5aa3; text-decoration: none; font-size: 14px; }
.help-list a:hover { text-decoration: underline; }

/* ================== Responsive: stack on smaller screens ================== */
@media (max-width: 992px) {
  .blog-hero-min { flex-direction: column; }
  .blog-hero-min .hero-right { width: 100%; }

  /* make the wrapper stack instead of flexing */
  .grid-with-sidebar {
    display: block !important;
  }

  .grid-with-sidebar .main-cards-column,
  .grid-with-sidebar .blog-side-column {
    flex: 0 0 auto;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    box-sizing: border-box;
  }

  .grid-with-sidebar .main-cards-column .cards-grid-min {
    grid-template-columns: 1fr;
  }

  .blog-side-column { margin-top: 18px; }
}

/* ================== Small screens (extra small) ================== */
@media (max-width: 576px) {
  .container.blog-wrap { padding-left: 12px; padding-right: 12px; }
  .card-min .thumb img { height: 160px; } /* slightly smaller images on very small screens */
}

/* ---------- All Articles box (boxed list of links) ---------- */
.all-articles-box {
  background:#fff;
  border-radius:12px;
  padding:28px;
  box-shadow: 0 14px 30px rgba(11,33,60,0.06);
  margin: 36px 0;
}

.all-articles-box h3 {
  margin: 0 0 18px;
  font-size:22px;
  color:#0b2a47;
  font-weight:700;
}

/* 3-column list */
.all-articles-box .list-columns {
  columns: 3;
  column-gap: 44px;
  -webkit-columns: 3;
  -moz-columns: 3;
}

.all-articles-box a.article-link {
  display: block;
  font-size: 14px;
  color: #2e3a45;
  margin-bottom: 14px;
  text-decoration: none;
}

.all-articles-box a.article-link:hover {
  color: #0b5aa3;
  text-decoration: underline;
}

/* Pagination container inside the box */
.all-articles-box .pagination { margin-top: 26px; text-align: center; }

/* Style the page numbers */
.all-articles-box .pagination .page-numbers {
  display:inline-block;
  padding:8px 12px;
  margin:0 6px;
  border-radius:6px;
  border:1px solid rgba(11,33,60,0.08);
  color:#253642;
  text-decoration:none;
  min-width:36px;
  text-align:center;
}

.all-articles-box .pagination .page-numbers.current {
  background:#fff;
  border:1px solid rgba(11,33,60,0.12);
  box-shadow: 0 6px 20px rgba(11,33,60,0.06);
  font-weight:700;
}

.all-articles-box .pagination .page-numbers.next,
.all-articles-box .pagination .page-numbers.prev {
  background: #0b84ff;
  color: #fff;
  border-color: #0b84ff;
}

/* Responsive columns */
@media (max-width: 992px) {
  .all-articles-box .list-columns { columns: 2; column-gap: 28px; }
}
@media (max-width: 576px) {
  .all-articles-box .list-columns { columns: 1; }
  .all-articles-box { padding:18px; }
}

/* ---------- Categories section ---------- */
.categories-section { margin: 48px 0 70px; }
.categories-title { font-size:28px; margin: 0 0 22px; color:#0b2a47; font-weight:700; }

/* grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* card */
.category-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid rgba(11,42,71,0.06);
  box-shadow: 0 6px 18px rgba(11,33,60,0.03);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
  color: inherit;
}
.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(11,33,60,0.06);
}

/* icon box */
.category-card .cat-icon { width:56px; height:56px; min-width:56px; border-radius:8px; display:flex; align-items:center; justify-content:center; background: #f7fbff; }
.category-card svg { display:block; }

/* content */
.category-card .cat-content { flex:1; }
.category-card .cat-name { margin:0 0 8px; font-size:16px; color:#072042; font-weight:700; }
.category-card .cat-desc { margin:0; color:#5f6b74; font-size:14px; line-height:1.45; }

/* Responsive */
@media (max-width: 992px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
  .categories-grid { grid-template-columns: 1fr; }
  .category-card { padding:16px; gap:12px; }
  .category-card .cat-icon { width:48px; height:48px; min-width:48px; }
}
/* Single post layout adjustments (child) */
.single-post-wrap .main-content { padding-right: 24px; box-sizing: border-box; }
.post-sidebar .sticky-sidebar { position: -webkit-sticky; position: sticky; top: 120px; }

/* TOC card */
.toc-card { background:#fff; border-radius:10px; padding:16px; box-shadow:0 10px 20px rgba(11,33,60,0.05); margin-bottom:18px; border:1px solid rgba(11,33,60,0.03); }
.toc-card h4 { margin:0 0 10px; font-size:15px; color:#0b2a47; font-weight:700; }
.toc-card ol { margin:0; padding-left:18px; color:#4f5b6a; font-size:14px; line-height:1.5; }
.toc-card a { color:#0b5aa3; text-decoration:none; }
.toc-card a:hover { text-decoration:underline; }

/* Sidebar banner */
.sidebar-banner-card { background:#fff; border-radius:10px; padding:12px; box-shadow:0 10px 20px rgba(11,33,60,0.05); margin-bottom:18px; border:1px solid rgba(11,33,60,0.03); }
.sidebar-banner-card img { display:block; width:100%; height:auto; border-radius:8px; }

/* Responsive: collapse to single column under 992px */
@media (max-width: 992px) {
  .single-post-wrap .row { display:block !important; }
  .single-post-wrap .main-content, .single-post-wrap .post-sidebar { width:100%; max-width:100%; box-sizing:border-box; padding:0; }
  .post-sidebar .sticky-sidebar { position: static; top: auto; margin-top:18px; }
}

/* ================== SINGLE POST LAYOUT FIX ================== */
.single-post-wrap .row {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: nowrap;
  box-sizing: border-box;
}

/* Main content column */
.single-post-wrap .main-content {
  flex: 0 0 70%;
  max-width: 70%;
  box-sizing: border-box;
}

/* Sidebar column */
.single-post-wrap .post-sidebar {
  flex: 0 0 30%;
  max-width: 30%;
  box-sizing: border-box;
}

/* Sticky sidebar */
.post-sidebar .sticky-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 120px;
}

/* Responsive: stack below 992px */
@media (max-width: 992px) {
  .single-post-wrap .row { display: block; }
  .single-post-wrap .main-content,
  .single-post-wrap .post-sidebar {
    width: 100%;
    max-width: 100%;
    flex: none;
  }
  .post-sidebar .sticky-sidebar { position: static; top: auto; margin-top: 18px; }
}
/* ---------- Sticky TOC: css-only approach ---------- */

/* Make sure the row is not creating a new stacking context or overflow */
.single-post-wrap .row,
.single-post-wrap .container,
.single-post-wrap .main-content,
.single-post-wrap .post-sidebar {
  transform: none !important;   /* remove transforms that break sticky */
  will-change: auto !important;
  overflow: visible !important; /* ensure sticky ancestor can work */
}

/* Ensure the sidebar is aligned to top of the row (so sticky works) */
.single-post-wrap .post-sidebar {
  align-self: flex-start;
  display: block;
}

/* Make the inner sidebar sticky */
.single-post-wrap .sticky-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: calc(120px + env(safe-area-inset-top)); /* 120px offset already used */
  z-index: 8;
}

/* If WP admin bar is present (logged-in), reduce top so it won't be hidden */
.admin-bar .single-post-wrap .sticky-sidebar {
  top: calc(160px + env(safe-area-inset-top)); /* adjust if needed */
}

/* Limit sidebar width so it doesn't overflow on small containers */
.single-post-wrap .post-sidebar { box-sizing: border-box; }

/* Make the sidebar content scroll inside itself if it's taller than viewport */
.single-post-wrap .sticky-sidebar {
  max-height: calc(100vh - 140px); /* viewport height minus top offset */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* On small screens, disable sticky */
@media (max-width: 992px) {
  .single-post-wrap .sticky-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
}
