/* ================================================================
   BLOG PAGES — Listing + Detail
================================================================ */


/* ----------------------------------------------------------------
   BLOG GRID
---------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  width: 100%;
}

/* ----------------------------------------------------------------
   BLOG CARD
---------------------------------------------------------------- */
.blog-card {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
  overflow: hidden;
  background: #fff;
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.blog-card img {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.blog-card:hover img {
  transform: scale(1.03);
}

/* ----------------------------------------------------------------
   CATEGORY & FEATURED BADGES
---------------------------------------------------------------- */
.featured {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #EBEEEB;
  color: #385435;
  font-size: calc(12px * var(--a11y-font-scale, 1));
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
  z-index: 2;
  line-height: 1.4;
}

.category-badge {
  background: #EBEEEB;
  color: #385435;
}

.featured-badge {
  left: auto;
  right: 12px;
  background: #ffd700;
  color: #333;
}

.category-link {
  text-decoration: none;
}
.category-link:focus-visible {
  outline: 2px solid #E77727;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----------------------------------------------------------------
   CARD CONTENT
---------------------------------------------------------------- */
.card-content {
  position: relative;
  padding-top: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-content a {
  text-decoration: none;
  color: inherit;
}
.card-content a:focus-visible {
  outline: 3px solid #E77727;
  outline-offset: 2px;
  border-radius: 4px;
}

.card-title {
  font-size: calc(16px * var(--a11y-font-scale, 1));
  font-weight: 600;
  color: #181A2A;
  font-family: 'Poppins', system-ui, sans-serif;
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}
.card-content a:hover .card-title {
  color: #E77727;
}

.card-meta {
  font-size: calc(13px * var(--a11y-font-scale, 1));
  color: #909090;
  font-family: 'Poppins', system-ui, sans-serif;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  margin-bottom: 0;
  flex-wrap: wrap;
  gap: 8px;
}
.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-meta svg {
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   PAGINATION
---------------------------------------------------------------- */
.blog-pagination {
  margin: 60px 0 40px;
  text-align: center;
}
.blog-pagination ul {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.blog-pagination li {
  display: inline-block;
}
.blog-pagination a,
.blog-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid #ddd;
  text-decoration: none;
  font-weight: 500;
  font-size: calc(14px * var(--a11y-font-scale, 1));
  font-family: 'Poppins', system-ui, sans-serif;
  color: #022D50;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.blog-pagination .current {
  background: #022D50;
  color: #fff;
  border-color: #022D50;
}
.blog-pagination a:hover {
  background: #f3f3f3;
  border-color: #bbb;
}
.blog-pagination a:focus-visible {
  outline: 3px solid #022D50;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ----------------------------------------------------------------
   NO POSTS MESSAGE
---------------------------------------------------------------- */
.no-posts {
  text-align: center;
  grid-column: 1 / -1;
  padding: 48px 20px;
  color: #909090;
  font-size: calc(15px * var(--a11y-font-scale, 1));
  font-family: 'Poppins', system-ui, sans-serif;
}

/* ----------------------------------------------------------------
   BLOG DETAIL — Article wrapper
---------------------------------------------------------------- */
.blog-article {
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.blog-featured-image {
  margin-bottom: 24px;
}
.blog-featured-image img {
  width: 100%;
  border-radius: 10px;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

/* ----------------------------------------------------------------
   BLOG DETAIL — Meta row
---------------------------------------------------------------- */
.blog-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 13px;
  color: #9ca3af;
  font-family: inherit;
  margin-top: 20px;
  margin-bottom: 20px;
}

.featured-tag {
  background-color: #fff7ed;
  color: var(--clr-head-orange, #E77727);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 9999px;
  border: 1px solid #fed7aa;
}

.blog-category {
  display: inline-flex;
  align-items: center;
}

.blog-meta-row .category-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--clr-head-orange, #E77727);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: color 0.15s ease;
}
.blog-meta-row .category-link:hover {
  text-decoration: underline;
}
.blog-meta-row .category-link svg {
  stroke: var(--clr-head-orange, #E77727);
  flex-shrink: 0;
}

.meta-separator {
  color: #d1d5db;
  font-weight: 300;
  user-select: none;
}

.blog-date time {
  color: #9ca3af;
  font-size: 13px;
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #9ca3af;
  font-size: 13px;
}
.reading-time svg {
  stroke: #9ca3af;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   BLOG DETAIL — Content
---------------------------------------------------------------- */
.blog-content {
  font-size: calc(16px * var(--a11y-font-scale, 1));
  line-height: 1.8;
  color: #222;
}
.blog-content ul {
  margin: 0;
  list-style: disc;
  padding-left: 1.5rem;
}
.blog-content li {
  margin-bottom: 0;
}
.blog-content ul li:last-child {
  margin-bottom: 20px;
}
.blog-content h2 { font-size: calc(20px * var(--a11y-font-scale, 1)); font-weight: 700; margin-top: 28px; margin-bottom: 12px; }
.blog-content h3 { font-size: calc(18px * var(--a11y-font-scale, 1)); font-weight: 700; margin-top: 24px; margin-bottom: 10px; }
.blog-content h4 { font-size: calc(16px * var(--a11y-font-scale, 1)); font-weight: 600; margin-top: 20px; margin-bottom: 8px; }
.blog-content p  { margin-bottom: 16px; }

/* ----------------------------------------------------------------
   TABLE OF CONTENTS
---------------------------------------------------------------- */
.toc-wrapper {
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 16px 20px;
  max-width: max-content;
  width: auto;
  margin: 0 0 32px 0;
  background: #f9f9f9;
  font-size: 14px;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 100px;
}

.toc-title {
  font-size: 18px;
  font-weight: 500;
  color: #111827;
}

.toc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  cursor: pointer;
  color: #6b7280;
  transition: background 0.15s ease;
}
.toc-toggle:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.toc-chevron {
  transition: transform 0.25s ease;
}
.toc-wrapper.collapsed .toc-chevron {
  transform: rotate(180deg);
}

.toc-list {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 1000px;
  opacity: 1;
}
.toc-wrapper.collapsed .toc-list {
  max-height: 0;
  opacity: 0;
}
.toc-list li {
  padding: 3px 0;
  line-height: 1.6;
}
.toc-list li a {
  color: #374151;
  text-decoration: none;
  transition: color 0.15s ease;
  font-size: 16px;
}
.toc-list li a:hover {
  color: var(--clr-head-orange, #E77727);
  text-decoration: underline;
}

/* ----------------------------------------------------------------
   DISCLAIMER
---------------------------------------------------------------- */
.disclaimer {
  background: #f8f9fa;
  border-left: 3px solid var(--clr-primary, #E77727);
  padding: 16px 20px;
  border-radius: 4px;
  margin-top: 32px;
}

/* ----------------------------------------------------------------
   SOCIAL SHARE
---------------------------------------------------------------- */
.share-options {
  display: flex;
  vertical-align: middle;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

.share-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.share-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 1px solid #385435;
  color: #385435;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.share-btn:hover {
  background: #385435;
  color: #ffffff !important;
}
.share-btn:focus-visible {
  outline: 3px solid #385435;
  outline-offset: 2px;
}
.share-btn svg { flex-shrink: 0; }

/* ----------------------------------------------------------------
   RELATED ARTICLES
---------------------------------------------------------------- */
.related-blogs-title {
  font-size: calc(22px * var(--a11y-font-scale, 1));
  font-weight: 700;
  color: #181A2A;
  margin-bottom: 28px;
}

/* ----------------------------------------------------------------
   ACCESSIBILITY
---------------------------------------------------------------- */
.blog-card,
.blog-card * {
  letter-spacing: var(--a11y-letter-spacing, 0em);
}

body.high-contrast .blog-card {
  border-color: #ffffff !important;
  background: #000000 !important;
}
body.high-contrast .card-title { color: #ffffff !important; }
body.high-contrast .card-meta  { color: #cccccc !important; }
body.high-contrast .blog-pagination a,
body.high-contrast .blog-pagination span {
  border-color: #ffffff !important;
  color: #ffffff !important;
}
body.high-contrast .blog-pagination .current {
  background: #ffffff !important;
  color: #000000 !important;
}

body.greyscale .blog-card img { filter: grayscale(100%); }
body.greyscale .featured { filter: grayscale(100%); }

body.hide-images .blog-card img,
body.hide-images .blog-featured-image img { visibility: hidden; }

body.pause-animations .blog-card,
body.pause-animations .blog-card img {
  transition: none !important;
  animation: none !important;
}

body.dark-mode .blog-card {
  background: #1e293b;
  border-color: #334155;
}
body.dark-mode .card-title { color: #f1f5f9; }
body.dark-mode .card-meta  { color: #94a3b8; }
body.dark-mode .blog-pagination a,
body.dark-mode .blog-pagination span {
  border-color: #334155;
  color: #f1f5f9;
}
body.dark-mode .blog-pagination .current {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}
body.dark-mode .blog-pagination a:hover {
  background: #1e293b;
}

/* ----------------------------------------------------------------
   RESPONSIVE
---------------------------------------------------------------- */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .blog-pagination {
    margin: 40px 0 28px;
  }
  .toc-header {
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .blog-card img {
    height: 160px;
  }
  .card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  .blog-pagination a,
  .blog-pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: calc(13px * var(--a11y-font-scale, 1));
  }
}
