/* ════════════════════════════════════════════
   MUTEKI GROUP — Blog Archive Page Styles
   Matches Archive-page-Blog.html exactly
   ════════════════════════════════════════════ */

/* ── Override body background on archive pages ──
   Original HTML sets body { background: var(--bg2) }
   The global.css sets body { background: var(--bg) / white }
   We override it here so the archive feels like the design. */
body.blog,
body.archive,
body.home {
  background: #F8F8FF; /* --bg2 from original */
}

/* ── Remove the generic 66px main-content padding on archive pages ──
   The .archive-hero already includes enough top padding to
   clear the fixed header, so the extra 66px from elementor.css
   creates a double-gap. We match the elementor.css specificity
   by using body:not(.elementor-page) pattern. */
body.blog:not(.elementor-page) #main-content,
body.archive:not(.elementor-page) #main-content,
body.home:not(.elementor-page) #main-content,
body.post-type-archive-case_study #main-content {
  padding-top: 0 !important;
}

/* ── Local shadow overrides to match original exactly ──
   Original defines its own shadow tokens, slightly different
   from global.css. We scope them to the archive wrapper. */
.archive-page-wrap {
  --shadow-sm: 0 2px 10px rgba(15,15,45,0.04);
  --shadow-md: 0 8px 30px rgba(15,15,45,0.08);
  --shadow-lg: 0 20px 50px rgba(15,15,45,0.12);
}

/* ════════════ ARCHIVE HERO ════════════ */
.archive-hero {
  padding: 100px 80px 80px;
  background: #FFFFFF; /* var(--bg) — hero is white, body bg is bg2 */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 600px;
  height: 600px;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(91,79,232,0.05) 0%, transparent 70%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--indigo);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.archive-h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1.5px;
  color: var(--ink);
  margin-bottom: 24px;
}

.archive-desc {
  font-size: 18px;
  line-height: 1.7;
  color: var(--sub);
  max-width: 600px;
  margin: 0 auto;
}

/* ════════════ FILTER BAR ════════════ */
.filter-section {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 40px 40px;
  position: relative;
  z-index: 10;
}

.filter-container {
  display: flex;
  align-items: center;
  background: #FFFFFF;
  padding: 10px 12px 10px 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(15,15,45,0.04);
  gap: 12px;
  flex-wrap: nowrap;
}

/* ── Scrollable chips wrapper with fade edges ── */
.filter-chips-wrap {
  position: relative;
  flex: 1;
  min-width: 0; /* Allow shrinking */
  overflow: hidden;
}

/* Left fade */
.filter-chips-wrap::before,
.filter-chips-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.filter-chips-wrap::before {
  left: 0;
  background: linear-gradient(90deg, #fff 0%, transparent 100%);
}

.filter-chips-wrap::after {
  right: 0;
  background: linear-gradient(-90deg, #fff 0%, transparent 100%);
}

/* JS will toggle these classes to show/hide fades */
.filter-chips-wrap.has-scroll-left::before {
  opacity: 1;
}
.filter-chips-wrap.has-scroll-right::after {
  opacity: 1;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 4px;

  /* Thin custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.filter-chips::-webkit-scrollbar {
  height: 4px;
}
.filter-chips::-webkit-scrollbar-track {
  background: transparent;
}
.filter-chips::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.filter-chips::-webkit-scrollbar-thumb:hover {
  background: var(--sub2, #999);
}

.chip {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  background: var(--bg2, #F8F8FF);
  border: 1px solid transparent;
  padding: 8px 18px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip:hover {
  color: var(--ink);
  background: #EDEDFF;
  border-color: var(--border-i, #C8C3FF);
}
.chip.active {
  color: #fff;
  background: var(--indigo);
  border-color: var(--indigo);
  box-shadow: 0 4px 14px rgba(91,79,232,0.3);
}

/* ── Divider between chips and search ── */
.filter-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  min-width: 200px;
  max-width: 260px;
  width: 100%;
  flex-shrink: 0;
}
.search-wrap svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--sub2);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 18px 10px 40px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: all 0.2s;
}
.search-input:focus {
  border-color: var(--indigo);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px var(--indigo-soft);
}

/* ════════════ BLOG GRID (3 Cards) ════════════ */
.blog-section {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 40px 100px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

/* ── Card Design ── */
.blog-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  color: inherit;
}
.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 30px rgba(15,15,45,0.08); /* original --shadow-md */
  border-color: var(--border-i);
}

.card-img-wrap {
  width: 100%;
  height: 240px;
  overflow: hidden;
  position: relative;
  background: var(--bg2);
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.blog-card:hover .card-img-wrap img { transform: scale(1.05); }

/* Placeholder when no featured image */
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--indigo-soft) 0%, #ddd8ff 100%);
}
.card-img-placeholder svg {
  width: 48px;
  height: 48px;
  color: var(--indigo);
  opacity: 0.4;
}

.card-tag {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  color: var(--indigo);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 2px 10px rgba(15,15,45,0.04);
}

.card-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.card-excerpt {
  font-size: 15px;
  color: var(--sub);
  line-height: 1.6;
  margin-bottom: 32px;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.author-info { display: flex; align-items: center; gap: 12px; }

.author-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg2);
  background: var(--indigo-soft);
}

/* Fallback initial avatar when no Gravatar */
.author-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.author-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.post-date {
  font-size: 13px;
  color: var(--sub);
  font-weight: 500;
}

/* ════════════ INFINITE SCROLL ════════════ */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 64px;
  gap: 12px;
  flex-wrap: wrap;
}

/* Spinner container */
.mcsi-infinite-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
  grid-column: 1 / -1;
}

.mcsi-infinite-loader.is-hidden {
  display: none;
}

.mcsi-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: mcsi-spin 0.75s linear infinite;
}

@keyframes mcsi-spin {
  to { transform: rotate(360deg); }
}

.mcsi-spinner-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--sub);
  font-weight: 500;
}

/* End-of-results */
.mcsi-end-of-results {
  text-align: center;
  padding: 40px 0;
  grid-column: 1 / -1;
}

.mcsi-end-of-results.is-hidden {
  display: none;
}

.mcsi-end-of-results span {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--sub2);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 10px 24px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

/* ── No posts / no search results ── */
.no-posts-message,
.search-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--sub);
}
.no-posts-message h2,
.search-no-results h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}
.no-posts-message p,
.search-no-results p { font-size: 16px; }

/* ── Read more arrow (shows on card hover) ── */
.card-footer .read-more-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--indigo);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s, transform 0.25s;
}
.blog-card:hover .read-more-arrow {
  opacity: 1;
  transform: translateX(0);
}
.card-footer .read-more-arrow svg {
  width: 12px;
  height: 12px;
}

/* ════════════ CTA FOOTER ════════════
   Matches .srv-cta from original Archive-page-Blog.html exactly */
.srv-cta {
  padding: 100px 80px;
  text-align: center;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.srv-cta h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 24px;
}

/* Override global .btn-primary for this page —
   original uses gradient + larger padding, global uses flat color */
.srv-cta .btn-primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  padding: 15px 32px;
  font-size: 15px;
  box-shadow: 0 2px 0 #3D32C4, 0 8px 28px rgba(91,79,232,0.32);
}
.srv-cta .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 0 #3D32C4, 0 16px 40px rgba(91,79,232,0.42);
  background: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
}
.srv-cta .btn-primary svg { width: 15px; height: 15px; }

/* ════════════ RESPONSIVE ════════════ */
@media (max-width: 1024px) {
  .grid-container { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .filter-container {
    flex-direction: column;
    align-items: stretch;
    border-radius: 16px;
    padding: 16px;
    gap: 12px;
  }
  .filter-divider {
    width: 100%;
    height: 1px;
  }
  .search-wrap { max-width: 100%; min-width: 0; }
}

@media (max-width: 768px) {
  .archive-hero { padding: 80px 20px 60px; }
  .archive-h1 { font-size: 36px; }
  .grid-container { grid-template-columns: 1fr; }
  .blog-section { padding: 0 20px 80px; }
  .filter-section { padding: 0 20px 32px; }
  .srv-cta { padding: 80px 20px; }
  .srv-cta h2 { font-size: 28px; }
}
