/* ===================================================================
   Blogs Listing & Detail Page Styles
   - Matches Yess theme design tokens and dark mode styling.
   =================================================================== */

/* Blogs Listing Page Grid & Wrapper */
.blogs-page {
  background: #090b15;
  min-height: 100vh;
}

.blogs-grid-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: max(5vmin, 30px) 2rem max(8vmin, 60px);
}

/* Section Header (Featured Articles + Filter Toggles) */
.blogs-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.blogs-section-title {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
}

.blogs-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.blogs-filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.6rem 1.6rem;
  border-radius: 6px;
  font-size: 1.3rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.blogs-filter-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.blogs-filter-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Cards Grid */
.blogs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

/* Premium Dark Theme Blog Card */
.blog-card {
  background: #111425;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), 
              box-shadow 0.4s ease, 
              border-color 0.4s ease;
  text-decoration: none;
  color: #ffffff;
  height: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
}

.blog-card:hover {
  transform: translateY(-6px);
  border-color: rgba(116, 156, 246, 0.4);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 24px rgba(116, 156, 246, 0.15);
}

.blog-card-image-wrap {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
  background: #0d1222;
}

.blog-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.blog-card:hover .blog-card-image {
  transform: scale(1.06);
}

/* Tag Badge Pinned Top Left on Image */
.blog-card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  background: rgba(85, 130, 240, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  white-space: nowrap;
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-card-body {
  padding: 2rem 2rem 2.2rem 2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.blog-card-date {
  margin: 0 0 0.8rem 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.blog-card-title {
  margin: 0 0 1.2rem 0;
  font-size: 2.0rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-excerpt {
  margin: 0 0 1.8rem 0;
  font-size: 1.4rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.blog-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
}

.blog-card-readmore {
  font-size: 1.35rem;
  font-weight: 600;
  color: #749cf6;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: color 0.3s ease;
}

.blog-card-arrow {
  font-size: 1.4rem;
  transition: transform 0.3s ease;
  display: inline-block;
}

.blog-card:hover .blog-card-readmore {
  color: #9cbaff;
}

.blog-card:hover .blog-card-arrow {
  transform: translateX(4px);
}

/* Pagination Dots */
.blogs-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 4rem;
}

.blogs-pagination-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.blogs-pagination-dot:hover {
  background: rgba(255, 255, 255, 0.4);
}

.blogs-pagination-dot.active {
  width: 28px;
  border-radius: 10px;
  background: #749cf6;
  box-shadow: 0 0 10px rgba(116, 156, 246, 0.5);
}

/* RTL Adjustment for Blogs */
html[dir="rtl"] .blog-card {
  text-align: right;
}
html[dir="rtl"] .blog-card-badge {
  left: auto;
  right: 14px;
}
html[dir="rtl"] .blog-card-arrow {
  transform: scaleX(-1);
}
html[dir="rtl"] .blog-card:hover .blog-card-arrow {
  transform: translateX(-4px) scaleX(-1);
}

/* Admin Page Content Overrides */
.blogs-admin-content {
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(1.5rem, 0.4vw + 1.3rem, 1.6rem);
  line-height: 1.75;
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.blogs-admin-content h1,
.blogs-admin-content h2,
.blogs-admin-content h3,
.blogs-admin-content h4,
.blogs-admin-content h5,
.blogs-admin-content h6 {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
  font-weight: 700;
  margin-top: 3.5rem;
  margin-bottom: 1.2rem;
  line-height: 1.3;
}

.blogs-admin-content h1 { font-size: clamp(2.6rem, 3.8vw, 3.6rem); }
.blogs-admin-content h2 { font-size: clamp(2.2rem, 3vw, 2.8rem); }
.blogs-admin-content h3 { font-size: clamp(1.8rem, 2.4vw, 2.2rem); }
.blogs-admin-content h4 { font-size: clamp(1.6rem, 2vw, 1.9rem); }

.blogs-admin-content p {
  font-size: clamp(1.5rem, 0.4vw + 1.3rem, 1.6rem);
  margin-bottom: 1.8rem;
  color: rgba(255, 255, 255, 0.82);
}

.blogs-admin-content a {
  font-family: inherit;
  color: #749cf6;
  border-bottom: 1px solid rgba(116, 156, 246, 0.3);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.blogs-admin-content a:hover {
  color: #ffffff;
  border-color: #ffffff;
}

.blogs-admin-content figure,
.blogs-admin-content img {
  border-radius: 12px;
  max-width: 100%;
  margin: 2.5rem 0;
}

/* ===================================================================
   Blog Post Detail Page Overrides
   =================================================================== */

.blog-detail-page {
  background: #090b15;
  color: #ffffff;
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Blog Detail Hero Header */
.blog-detail-hero {
  position: relative;
  min-height: 52vh;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #090b15;
  overflow: hidden;
  padding-top: clamp(8rem, 16vh, 12rem);
  padding-bottom: clamp(4rem, 8vh, 6rem);
}

.blog-detail-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(9, 11, 21, 0.75) 0%, rgba(9, 11, 21, 0.9) 70%, #090b15 100%),
              radial-gradient(circle at top right, rgba(116, 156, 246, 0.18), transparent 50%);
}

.blog-detail-hero-container {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.blog-detail-hero-inner {
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.blog-detail-meta-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.blog-detail-tag-badge {
  display: inline-block;
  background: rgba(116, 156, 246, 0.15);
  border: 1px solid rgba(116, 156, 246, 0.35);
  color: #8cb5ff;
  padding: 0.4rem 1.4rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  backdrop-filter: blur(4px);
}

.blog-detail-bullet {
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.2rem;
}

.blog-detail-date,
.blog-detail-reading-time {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.blog-detail-title {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(3.2rem, 5.5vw, 5.6rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 950px;
  text-align: left;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* Article Content Body */
.blog-detail-article {
  background: #090b15;
  padding: 3rem 2rem 6rem;
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.blog-detail-body-container {
  max-width: 780px;
  margin: 0 auto;
}

.blog-detail-lead-excerpt {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.6rem, 1.5vw, 1.9rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 400;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-detail-content {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.5rem, 0.4vw + 1.3rem, 1.6rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.82);
}

.blog-detail-content p,
.blog-detail-content div,
.blog-detail-content span,
.blog-detail-content li {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.5rem, 0.4vw + 1.3rem, 1.6rem);
  line-height: 1.75;
  margin-bottom: 1.8rem;
  color: rgba(255, 255, 255, 0.82);
}

.blog-detail-content h1,
.blog-detail-content h2,
.blog-detail-content h3,
.blog-detail-content h4,
.blog-detail-content h5,
.blog-detail-content h6,
.blog-detail-content h1[id],
.blog-detail-content h2[id],
.blog-detail-content h3[id],
.blog-detail-content h4[id],
.blog-detail-content h5[id],
.blog-detail-content h6[id] {
  font-family: var(--yes-font-stack-mixed), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff !important;
  font-weight: 700;
  margin-top: 3.5rem;
  margin-bottom: 1.2rem;
  line-height: 1.3;
}

.blog-detail-content h1 { font-size: clamp(2.6rem, 3.8vw, 3.6rem); }
.blog-detail-content h2 { font-size: clamp(2.2rem, 3vw, 2.8rem); }
.blog-detail-content h3 { font-size: clamp(1.8rem, 2.4vw, 2.2rem); }
.blog-detail-content h4 { font-size: clamp(1.6rem, 2vw, 1.9rem); }

.blog-detail-content a {
  font-family: inherit;
  color: #749cf6;
  border-bottom: 1px solid rgba(116, 156, 246, 0.3);
  transition: color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.blog-detail-content a:hover {
  color: #ffffff;
  border-color: #ffffff;
}

/* Blockquote Styling */
.blog-detail-content blockquote,
.post-template .gh-content blockquote {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid #749cf6;
  border-radius: 12px;
  padding: 2.2rem 2.5rem;
  margin: 3.5rem 0;
  color: #ffffff;
  font-style: italic;
  font-size: clamp(1.5rem, 1.4vw, 1.75rem);
  line-height: 1.65;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.blog-detail-content blockquote p {
  color: #ffffff;
  margin: 0 0 0.8rem 0;
}

.blog-detail-content blockquote cite {
  display: block;
  font-style: normal;
  font-size: 1.35rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.8rem;
}

/* Figures & Images */
.blog-detail-content figure,
.blog-detail-content img {
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
  margin: 3rem 0;
}

.blog-detail-content figcaption {
  text-align: center;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 1rem;
}

/* Author Card */
.blog-author-card {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 2rem 2.2rem;
  margin-top: 5rem;
}

.blog-author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(116, 156, 246, 0.4);
  flex-shrink: 0;
}

.blog-author-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.blog-author-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.blog-author-bio {
  margin: 0;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}

/* Related Insights Section */
.related-insights-section {
  background: #060810;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: max(6vmin, 50px) 2rem max(8vmin, 80px);
}

.related-insights-container {
  max-width: 1240px;
  margin: 0 auto;
}

.related-insights-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.related-insights-titles {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.related-insights-label {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #749cf6;
  letter-spacing: 0.12em;
}

.related-insights-title {
  font-size: clamp(2.4rem, 3.8vw, 3.4rem);
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
}

.related-insights-link {
  font-size: 1.35rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.3s ease;
}

.related-insights-link:hover {
  color: #749cf6;
}

/* ===================================================================
   Responsive & RTL Adjustments
   =================================================================== */
html[dir="rtl"] .blog-detail-hero-container,
html[dir="rtl"] .blog-detail-hero-inner {
  align-items: flex-end;
  text-align: right;
}
html[dir="rtl"] .blog-detail-meta-bar {
  justify-content: flex-start;
  text-align: right;
}
html[dir="rtl"] .blog-detail-title {
  text-align: right;
}
html[dir="rtl"] .blog-author-card {
  flex-direction: row;
  text-align: right;
}
html[dir="rtl"] .blog-detail-content blockquote {
  border-left: none;
  border-right: 4px solid #749cf6;
}

@media (max-width: 1024px) {
  .blogs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  .blogs-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
    gap: 2.5rem;
  }
  
  .blogs-grid-container,
  .related-insights-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .blog-detail-article {
    padding: 3rem 1.5rem 5rem;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  
  .blog-detail-body-container {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .blog-detail-content iframe,
  .blog-detail-content object,
  .blog-detail-content embed {
    max-width: 100%;
  }

  .blog-detail-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .blog-detail-content {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  
  .blog-detail-content .kg-width-wide,
  .blog-detail-content .kg-width-full {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
  }

  .blog-detail-content pre, 
  .blog-detail-content code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
  }
}

.blog-detail-tag-badge-item:not(:first-of-type) { display: none !important; }
