/* File: css/blog.css */
/* ============================================
   BLOG.CSS - Bright blog design (mostly white),
   readable, using global vars where possible.
   ============================================ */

/* Theme tokens (derived from main.css vars) */
.blog-page {
    --blog-bg: var(--light-bg);
    --blog-surface: #ffffff;
    --blog-surface-soft: #ffffff;
    --blog-border: rgba(0,0,0,0.08);
    --blog-text: var(--text-light);
    --blog-muted: var(--text-muted);
    --blog-accent: var(--bridge-color);
    --blog-accent-2: var(--wisdom-color);
    --blog-shadow: 0 6px 24px rgba(0,0,0,0.08);
    --blog-shadow-lg: 0 14px 40px rgba(0,0,0,0.12);
}

/* Global page background now bright */
.blog-page {
    background: var(--blog-bg);
    color: var(--blog-text);
}

/* --------------------------------------------
   HEADER (mostly white with a very light wash)
   -------------------------------------------- */
/* Replace your existing blog header styles in css/blog.css with this block */

/* Blog Header — uses the same gradient style as index.html */
.blog-hero {
  background: var(--gradient-primary);
  color: var(--text-dark); /* near-white from main.css */
  padding: 88px 0 56px;
  position: relative;
  overflow: hidden;
}

/* Floating soft shapes like index header */
.blog-hero::before,
.blog-hero::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.10);
  border-radius: 50%;
  pointer-events: none;
}
.blog-hero::before {
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  animation: float 6s ease-in-out infinite;
}
.blog-hero::after {
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  animation: float 8s ease-in-out infinite reverse;
}


/* Blog Post "Back to Blog" Button */
a.btn.btn-outline-primary {
    border: 1px solid var(--bs-btn-color);
}

/* Title and subtitle (kept readable on gradient) */
.blog-hero__title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--text-dark); /* readable on gradient */
}

.blog-hero__subtitle {
  margin: 0 0 8px;
  color: rgba(255,255,255,0.9); /* readable, softer than title */
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  font-weight: 400;
}

/* If JS outputs <strong> in the subtitle (e.g., Tag view), accent it slightly */
.blog-hero__subtitle strong,
.blog-hero__subtitle b {
  color: var(--text-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.6);
  text-underline-offset: 3px;
}

/* Simple breadcrumb (no capsules) */
.blog-hero__breadcrumb {
  margin-top: 6px;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.8);
}
.blog-hero__breadcrumb .breadcrumb-link {
  color: var(--text-dark);
  text-decoration: none;
}
.blog-hero__breadcrumb .breadcrumb-link:hover {
  text-decoration: underline;
}
.blog-hero__breadcrumb .breadcrumb-sep {
  display: inline-block;
  padding: 0 8px;
  color: rgba(255,255,255,0.7);
}
.blog-hero__breadcrumb .breadcrumb-current {
  color: var(--text-dark);
  font-weight: 500;
}

/* Mobile spacing */
@media (max-width: 576px) {
  .blog-hero { padding: 64px 0 40px; }
}



/* --------------------------------------------
   LAYOUT
   -------------------------------------------- */
.section--blog {
    background: var(--blog-bg);
}

.blog-posts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Keep sidebar sticky on desktop (prevents dropping below footer) */
.blog-sidebar-sticky {
    position: sticky;
    top: 96px;
}
@media (max-width: 991.98px) {
    .blog-sidebar-sticky { position: static; top: auto; }
}

/* --------------------------------------------
   POST CARDS (bright surfaces + readable text)
   -------------------------------------------- */
.blog-post-card {
    background: var(--blog-surface);
    border: 1px solid var(--blog-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--blog-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}
.blog-post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--blog-shadow-lg);
    border-color: rgba(102,126,234,0.3);
}
.blog-post-card .card-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}
.blog-post-card .card-title a {
    color: var(--blog-text);
    text-decoration: none;
    transition: color 0.25s ease;
}
.blog-post-card .card-title a:hover {
    color: var(--blog-accent);
}
.blog-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.9rem;
    font-size: 0.92rem;
    color: var(--blog-muted);
}
.blog-post-meta i {
    margin-right: 6px;
    color: var(--blog-accent);
}
.blog-post-excerpt {
    color: var(--blog-text);
    opacity: 0.95;
    line-height: 1.7;
    margin-bottom: 1.1rem;
}
.blog-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

/* Featured badge (readable on white) */
.featured-badge {
    position: absolute;
    top: 12px; right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #ef4444 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 20px rgba(239,68,68,0.25);
    z-index: 2;
}
.featured-badge i { font-size: 14px; }

/* Short post badge (kept legible) */
.short-badge {
    position: absolute;
    top: 12px; left: 12px;
    background: var(--gradient-primary);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
}

/* Tag badges (high contrast on white) */
.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.blog-post-tags .badge {
    background: rgba(102,126,234,0.10);
    color: var(--blog-accent);
    border: 1px solid rgba(102,126,234,0.25);
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 999px;
    transition: all 0.25s ease;
    cursor: pointer;
}
.blog-post-tags .badge:hover {
    background: var(--blog-accent);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Category link */
.category-link {
    color: var(--blog-muted);
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
}
.category-link:hover { color: var(--blog-accent); transform: translateX(4px); }

/* --------------------------------------------
   SIDEBAR (bright boxes)
   -------------------------------------------- */
.sidebar-widget {
    background: var(--blog-surface);
    border: 1px solid var(--blog-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--blog-shadow);
    color: var(--blog-text);
}
.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.9rem;
    color: var(--blog-text);
    position: relative;
    padding-bottom: 0.65rem;
}
.widget-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 40px; height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Newsletter accent card (text is white for contrast) */
.widget-newsletter {
    background: var(--gradient-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 16px 36px rgba(102,126,234,0.25);
}
.widget-newsletter .widget-title { color: #ffffff; }
.widget-newsletter .widget-title::after { background: rgba(255,255,255,0.55); }
.widget-newsletter .widget-text { color: rgba(255,255,255,0.92); }

/* Categories list */
.categories-list ul { list-style: none; margin: 0; padding: 0; }
.categories-list li { margin-bottom: 0.65rem; }
.categories-list a {
    color: var(--blog-text);
    opacity: 0.95;
    text-decoration: none;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.35rem 0;
    transition: color 0.25s ease, transform 0.25s ease;
}
.categories-list a:hover { color: var(--blog-accent); transform: translateX(4px); }
.category-count {
    background: rgba(102,126,234,0.12);
    color: var(--blog-accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.875rem;
}

/* Popular posts */
.popular-posts-list { display: flex; flex-direction: column; gap: 1rem; }
.popular-post-item { display: flex; gap: 0.75rem; align-items: flex-start; transition: transform 0.25s ease; }
.popular-post-item:hover { transform: translateX(4px); }
.popular-post-number {
    background: var(--gradient-primary);
    color: #ffffff;
    width: 28px; height: 28px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.875rem;
    flex-shrink: 0;
}
.popular-post-title {
    color: var(--blog-text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    transition: color 0.25s ease;
}
.popular-post-title:hover { color: var(--blog-accent); }
.popular-post-views { color: var(--blog-muted); font-size: 0.85rem; }

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-cloud-item {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(102,126,234,0.1);
    border: 1px solid rgba(102,126,234,0.25);
    border-radius: 999px;
    color: var(--blog-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.25s ease;
}
.tag-cloud-item:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Archive links */
.archive-link {
    color: var(--blog-muted);
    text-decoration: none;
    display: block;
    padding: 5px 0;
    transition: color 0.25s ease, transform 0.25s ease;
}
.archive-link:hover { color: var(--blog-accent); transform: translateX(4px); }

/* --------------------------------------------
   STATES
   -------------------------------------------- */
.blog-loading {
    text-align: center;
    padding: 48px 20px;
    color: var(--blog-muted);
}
.blog-loading .spinner-border {
    width: 3rem; height: 3rem;
    color: var(--blog-accent);
}
.no-results-message {
    background: var(--blog-surface);
    border: 1px solid var(--blog-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--blog-shadow);
}
.no-results-message h5 { color: var(--blog-text); margin-bottom: 0.5rem; }
.no-results-message p { color: var(--blog-muted); }

/* --------------------------------------------
   PAGINATION
   -------------------------------------------- */
.blog-pagination-wrapper { margin-top: 2rem; display: flex; justify-content: center; }
.pagination {
    --bs-pagination-border-color: var(--blog-border);
    --bs-pagination-hover-border-color: var(--blog-accent);
    --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(102,126,234,0.25);
}
.pagination .page-link {
    background: var(--blog-surface);
    color: var(--blog-text);
    border-color: var(--blog-border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: all 0.25s ease;
}
.pagination .page-link:hover {
    background: rgba(102,126,234,0.10);
    border-color: var(--blog-accent);
    color: var(--blog-accent);
    transform: translateY(-2px);
}
.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}
.pagination .page-item.disabled .page-link {
    background: rgba(0,0,0,0.03);
    border-color: var(--blog-border);
    cursor: not-allowed;
}

/* --------------------------------------------
   MEDIA SAFEGUARDS
   -------------------------------------------- */
#blog-listing img,
#blog-listing iframe,
#blog-listing video {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* --------------------------------------------
   BACK-TO-HOME FAB
   -------------------------------------------- */
.back-home-fab {
    position: fixed;
    right: 24px; bottom: 24px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #ffffff;
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(102,126,234,0.35);
    z-index: 1050;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.back-home-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(102,126,234,0.45);
}

/* --------------------------------------------
   RESPONSIVE
   -------------------------------------------- */
@media (max-width: 991.98px) {
    .blog-hero.hero-slim { padding: 80px 0 44px; }
    .blog-post-card { padding: 1.5rem; }
}
@media (max-width: 576px) {
    .pagination .page-link { padding: 0.375rem 0.5rem; font-size: 0.875rem; }
    .pagination .page-item:not(.active):not(.disabled):nth-child(n+4):nth-last-child(n+4) { display: none; }
}

/* --------------------------------------------
   Search Suggestions Styles
   -------------------------------------------- */
.search-suggestion {
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-suggestion:hover,
.search-suggestion.active {
    background-color: #f8f9fa;
}

.search-suggestion mark {
    background-color: #fff3cd;
    padding: 0 2px;
    font-weight: bold;
}

.suggestion-meta {
    font-size: 0.85em;
}

.search-all {
    background-color: #f0f8ff;
}
