/* ==============================================================
   SABOLAY Blog — Matery-inspired Design
   ==============================================================
   Design patterns adapted from hexo-theme-matery:
   - Cover hero with gradient + scroll-down
   - Card images with title overlay
   - Material-shadow card grid
   - Tag cloud with varied sizes
   - Archive timeline
   - Reading progress bar
   - Back to top
   - AOS-like fade-in animations
   ============================================================== */

/* ===== COVER HERO ===== */
.blog-cover {
  position: relative; min-height: 520px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #07101c 0%, #0d2137 40%, #0a1c2e 100%);
  overflow: hidden; text-align: center; color: #fff;
}
.blog-cover::before {
  content: ''; position: absolute; inset: 0;
  background: url('../assets/images/v18/insights-hero-v18.png') center/cover;
  opacity: 0.15; filter: blur(2px);
}
.bc-content { position: relative; z-index: 1; max-width: 700px; padding: 60px 20px; }
.bc-content h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; margin-bottom: 16px; }
.bc-content p { font-size: 18px; color: rgba(255,255,255,.75); line-height: 1.65; margin-bottom: 24px; }
.bc-stats { display: flex; justify-content: center; gap: 32px; font-family: var(--font-tech); }
.bc-stats span { font-size: 14px; color: var(--cyan); }
.bc-stats strong { font-size: 28px; display: block; color: #fff; font-weight: 800; }
.scroll-down {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  width: 32px; height: 50px; border: 2px solid rgba(255,255,255,.3); border-radius: 20px;
  display: flex; justify-content: center; padding-top: 8px;
}
.scroll-down::after {
  content: ''; width: 4px; height: 8px; background: var(--cyan); border-radius: 2px;
  animation: scrollBounce 1.6s ease infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(12px); opacity: .4; }
}

/* ===== FEATURED POST (matery recommend section) ===== */
.blog-featured { background: #fff; padding: 0 4vw 50px; }
.bf-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  max-width: 1200px; margin: -48px auto 0; position: relative; z-index: 2;
}
.bf-image { border-radius: var(--radius-md); overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,.15); }
.bf-image img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; transition: .5s; }
.bf-image:hover img { transform: scale(1.03); }
.bf-content { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.bf-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--cyan), #0d9ca4); color: #fff;
  padding: 5px 14px; border-radius: 50px; font-family: var(--font-tech);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; width: fit-content;
}
.bf-content h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 700; line-height: 1.25; }
.bf-content h2 a { color: var(--ink); text-decoration: none; background: linear-gradient(to right, var(--cyan), var(--cyan)) no-repeat left 100%; background-size: 0 2px; transition: background-size .3s; }
.bf-content h2 a:hover { background-size: 100% 2px; }
.bf-excerpt { font-size: 15px; color: var(--slate); line-height: 1.65; }
.bf-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.bf-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px;
  background: var(--ink); color: #fff; border-radius: 8px; font-weight: 700; font-size: 14px;
  text-decoration: none; width: fit-content; transition: .2s ease;
}
.bf-link:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(7,16,28,.25); }

/* ===== CATEGORY FILTER (matery style) ===== */
.blog-categories { background: #f5f7fa; padding: 20px 4vw; }
.bc-inner { display: flex; flex-wrap: wrap; gap: 10px; max-width: 1200px; margin: 0 auto; }
.bc-item {
  padding: 8px 20px; border: 1px solid var(--line); border-radius: 50px;
  font-size: 13px; font-weight: 600; color: var(--slate); text-decoration: none;
  transition: all .25s; background: #fff;
}
.bc-item i { margin-right: 4px; font-size: 12px; }
.bc-item:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(23,198,211,.12); }
.bc-item.active { background: var(--cyan); color: #fff; border-color: var(--cyan); }

/* ===== POST CARD GRID (matery card style) ===== */
.blog-grid-section { background: #f5f7fa; padding: 40px 4vw 64px; }
.bg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; max-width: 1200px; margin: 0 auto; }
.bg-card {
  background: #fff; border-radius: var(--radius-sm); overflow: hidden;
  transition: transform .3s cubic-bezier(.25,.8,.25,1), box-shadow .3s cubic-bezier(.25,.8,.25,1);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.bg-card:hover { transform: translateY(-8px); box-shadow: 0 16px 48px rgba(0,0,0,.12); }

/* Card image with title overlay (matery signature) */
.bg-card-image { display: block; position: relative; height: 200px; overflow: hidden; background: #e8edf2; }
.bg-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.bg-card:hover .bg-card-image img { transform: scale(1.08); }

/* Title overlay on image */
.bg-card-title-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 40px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; font-size: 15px; font-weight: 700; line-height: 1.3;
  transition: padding .3s;
}
.bg-card:hover .bg-card-title-overlay { padding-bottom: 20px; }

.bg-card-body { padding: 16px 18px 20px; }
.bg-card-cat {
  display: inline-block; padding: 3px 10px; background: rgba(23,198,211,.1); color: #0a8891;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-radius: 20px; margin-right: 6px; margin-bottom: 8px;
}
.bg-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.bg-card-tag { font-size: 11px; color: var(--muted); }
.bg-card-excerpt {
  font-size: 13px; color: var(--slate); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px;
}
.bg-card-meta {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  padding-top: 12px; border-top: 1px solid var(--line);
}
.bg-card-meta i { font-size: 11px; }

/* ===== TAG CLOUD (matery style) ===== */
.tag-cloud-section { background: #fff; padding: 60px 4vw; }
.tag-cloud { max-width: 1000px; margin: 0 auto; text-align: center; line-height: 2.4; }
.tag-cloud a {
  display: inline-block; padding: 4px 14px; margin: 4px 6px; border-radius: 20px;
  color: var(--slate); text-decoration: none; transition: all .3s;
  border: 1px solid var(--line); background: #fff;
}
.tag-cloud a:hover { color: #fff; background: var(--cyan); border-color: var(--cyan); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(23,198,211,.2); }
/* Varied tag sizes */
.tag-size-1 { font-size: 13px; }
.tag-size-2 { font-size: 15px; font-weight: 600; }
.tag-size-3 { font-size: 18px; font-weight: 700; color: var(--cyan) !important; }

/* ===== TIMELINE / ARCHIVE ===== */
.timeline-section { background: #fff; padding: 60px 4vw; }
.timeline { max-width: 800px; margin: 0 auto; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 24px; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}
.timeline-year { margin: 32px 0 12px 60px; font-family: var(--font-tech); font-size: 20px; font-weight: 800; color: var(--cyan); }
.timeline-item { position: relative; padding-left: 60px; margin-bottom: 24px; }
.timeline-item::before {
  content: ''; position: absolute; left: 18px; top: 8px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 3px solid var(--cyan); transition: all .3s;
}
.timeline-item:hover::before { background: var(--cyan); transform: scale(1.3); }
.timeline-item h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.timeline-item h3 a { color: var(--ink); text-decoration: none; transition: color .2s; }
.timeline-item h3 a:hover { color: var(--cyan); }
.timeline-item .tl-date { font-size: 12px; color: var(--muted); }
.timeline-item .tl-excerpt { font-size: 13px; color: var(--slate); margin-top: 4px; }

/* ===== READING PROGRESS BAR ===== */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--cyan), #0d9ca4);
  z-index: 1000; transition: width .1s linear;
}

/* ===== BACK TO TOP (matery style) ===== */
.back-to-top {
  position: fixed; bottom: 32px; right: 32px; z-index: 50;
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  cursor: pointer; opacity: 0; transform: translateY(20px);
  transition: all .3s ease; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.back-to-top.show { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--cyan); transform: translateY(-4px); }

/* Fade-in animation for cards */
.fade-up { opacity: 0; transform: translateY(30px); transition: all .6s ease; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* Padding fix for nav overlap */
.blog-grid-section:first-of-type { padding-top: 100px; }

/* ===== ARTICLE PAGE ===== */
.article-hero { background: #fff; padding: 60px 4vw 30px; }
.article-hero-inner { max-width: 780px; margin: 0 auto; }
.article-hero .bf-badge { margin-bottom: 8px; }
.article-hero h1 { font-size: clamp(28px, 5vw, 42px); font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.article-cover { max-width: 960px; margin: 0 auto 40px; border-radius: var(--radius-md); overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.1); }
.article-cover img { width: 100%; display: block; }
.article-body { max-width: 780px; margin: 0 auto; padding: 0 4vw 60px; }
.article-body p { font-size: 18px; line-height: 1.75; color: var(--slate); margin-bottom: 20px; }
.article-body h2 { font-size: 26px; font-weight: 700; color: var(--ink); margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.article-body h3 { font-size: 20px; font-weight: 700; color: var(--ink); margin: 28px 0 12px; }
.article-body ul, .article-body ol { margin: 16px 0; padding-left: 24px; }
.article-body li { font-size: 17px; line-height: 1.7; color: var(--slate); margin-bottom: 8px; }
.article-body blockquote {
  border-left: 4px solid var(--cyan); padding: 16px 24px; background: #f5f7fa;
  margin: 24px 0; border-radius: 0 8px 8px 0; font-style: italic; color: var(--slate);
}
.article-footer { max-width: 780px; margin: 0 auto 40px; padding: 24px 0; border-top: 1px solid var(--line); }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.article-tag { padding: 6px 14px; background: #f0f4f8; color: var(--slate); font-size: 13px; border-radius: 20px; transition: .2s; }
.article-tag:hover { background: var(--cyan); color: #fff; }
.article-share { margin-top: 20px; display: flex; align-items: center; gap: 12px; }
.article-share span { font-size: 13px; color: var(--slate); font-weight: 600; }
.article-share a {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-size: 15px; text-decoration: none; transition: .2s;
}
.article-share a:hover { background: var(--cyan); transform: translateY(-2px); }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .bf-inner { grid-template-columns: 1fr; gap: 24px; }
  .bg-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .bg-card-image { height: 180px; }
  .blog-cover { min-height: 380px; }
}
@media (max-width: 680px) {
  .bg-grid { grid-template-columns: 1fr; }
  .bg-card-image { height: 220px; }
  .blog-cover { min-height: 320px; }
  .bc-stats { gap: 16px; }
  .bc-stats strong { font-size: 22px; }
  .article-body p { font-size: 16px; }
  .timeline::before { left: 16px; }
  .timeline-item { padding-left: 48px; }
  .timeline-item::before { left: 10px; }
  .timeline-year { margin-left: 48px; }
}
