/* ═══════════════════════════════════════════════════════
   STEMNEST ACADEMY — BLOG / STUDENT LEARNING HUB
   blog.css — public blog listing + single post view
═══════════════════════════════════════════════════════ */

/* ── HERO ── */
.blog-hero {
  background: linear-gradient(135deg, #0d1b4b 0%, #1a56db 55%, #0e9f6e 100%);
  padding: 72px 5% 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%; transform: translateX(-50%);
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.blog-hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 12px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1px; padding: 6px 18px; border-radius: 50px;
  margin-bottom: 20px;
}
.blog-hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(32px, 5vw, 54px);
  color: #fff; line-height: 1.15; margin-bottom: 14px;
}
.blog-hero h1 span { color: #fbbf24; }
.blog-hero p {
  font-size: 17px; color: rgba(255,255,255,.8);
  max-width: 560px; margin: 0 auto 32px; line-height: 1.7;
}

/* ── SEARCH BAR ── */
.blog-search-wrap {
  max-width: 560px; margin: 0 auto;
  position: relative;
}
.blog-search-input {
  width: 100%;
  padding: 16px 56px 16px 20px;
  border-radius: 50px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--dark);
  outline: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.blog-search-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--blue); color: #fff; border: none;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.blog-search-btn:hover { background: var(--blue-dark); }

/* ── CATEGORY PILLS (hero) ── */
.blog-cat-pills {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-top: 24px;
}
.blog-cat-pill {
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
  color: #fff; font-size: 13px; font-weight: 800;
  padding: 7px 18px; border-radius: 50px; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.blog-cat-pill:hover,
.blog-cat-pill.active { background: #fff; color: var(--blue); border-color: #fff; }

/* ── MAIN LAYOUT ── */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 5%;
}

/* ── AD BANNER (top of content) ── */
.blog-ad-banner {
  background: var(--bg);
  border: 1.5px dashed #c3d4f5;
  border-radius: 14px;
  padding: 16px 20px;
  text-align: center;
  font-size: 12px; font-weight: 700; color: var(--light);
  margin-bottom: 32px;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}

/* ── RESULTS HEADER ── */
.blog-results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.blog-results-count {
  font-size: 14px; font-weight: 800; color: var(--light);
}
.blog-sort-sel {
  padding: 8px 14px; border: 2px solid #e8eaf0; border-radius: 10px;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--dark); outline: none; background: var(--white); cursor: pointer;
}

/* ── POST GRID ── */
.blog-post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

/* ── POST CARD ── */
.blog-card {
  background: var(--white);
  border-radius: 20px;
  border: 1.5px solid #e8eaf0;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(26,86,219,.12);
  border-color: var(--blue);
}
.blog-card-img {
  width: 100%; height: 190px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--blue-light), var(--green-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 56px;
  flex-shrink: 0;
}
.blog-card-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.blog-card-body {
  padding: 20px;
  flex: 1; display: flex; flex-direction: column;
}
.blog-card-cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 12px; border-radius: 50px; margin-bottom: 10px;
  width: fit-content;
}
.cat-learn   { background: #dbeafe; color: #1e40af; }
.cat-tech    { background: #d1fae5; color: #065f46; }
.cat-news    { background: #fef3c7; color: #92400e; }
.cat-tips    { background: #ede9fe; color: #5b21b6; }

.blog-card-title {
  font-family: 'Fredoka One', cursive;
  font-size: 18px; color: var(--dark); line-height: 1.3;
  margin-bottom: 8px;
}
.blog-card-excerpt {
  font-size: 13px; color: var(--light); line-height: 1.7;
  flex: 1; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; font-weight: 700; color: var(--light);
  border-top: 1px solid #f0f2f8; padding-top: 12px; flex-wrap: wrap;
}
.blog-card-author {
  display: flex; align-items: center; gap: 6px;
}
.blog-card-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.blog-card-read-more {
  margin-top: 12px;
  font-size: 13px; font-weight: 900; color: var(--blue);
  display: flex; align-items: center; gap: 4px;
}

/* ── FEATURED POST (full width) ── */
.blog-card-featured {
  grid-column: 1 / -1;
  flex-direction: row;
}
.blog-card-featured .blog-card-img {
  width: 380px; height: auto; min-height: 240px; flex-shrink: 0;
}
.blog-card-featured .blog-card-title { font-size: 24px; }
.blog-card-featured .blog-card-excerpt { -webkit-line-clamp: 4; }

/* ── IN-CONTENT AD ── */
.blog-inline-ad {
  grid-column: 1 / -1;
  background: var(--bg); border: 1.5px dashed #c3d4f5;
  border-radius: 14px; padding: 16px 20px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--light);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
}

/* ── PAGINATION ── */
.blog-pagination {
  display: flex; gap: 8px; justify-content: center; margin-top: 8px;
}
.blog-page-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: 2px solid #e8eaf0; background: var(--white);
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px;
  color: var(--mid); cursor: pointer; transition: .2s;
  display: flex; align-items: center; justify-content: center;
}
.blog-page-btn:hover,
.blog-page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.blog-sidebar { display: flex; flex-direction: column; gap: 28px; }

.sidebar-widget {
  background: var(--white);
  border: 1.5px solid #e8eaf0;
  border-radius: 20px;
  padding: 22px;
}
.sidebar-widget-title {
  font-family: 'Fredoka One', cursive;
  font-size: 18px; color: var(--dark);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 2px solid var(--blue-light);
}

/* CTA widget */
.sidebar-cta {
  background: linear-gradient(135deg, var(--blue), var(--green));
  border: none; text-align: center;
}
.sidebar-cta .sidebar-widget-title { color: #fff; border-bottom-color: rgba(255,255,255,.2); }
.sidebar-cta p { font-size: 13px; color: rgba(255,255,255,.85); line-height: 1.6; margin-bottom: 16px; }
.sidebar-cta-btn {
  display: block; background: #fff; color: var(--blue);
  text-decoration: none; font-family: 'Nunito', sans-serif;
  font-weight: 900; font-size: 14px; padding: 11px 20px;
  border-radius: 50px; transition: .2s;
}
.sidebar-cta-btn:hover { background: #fbbf24; color: var(--dark); }

/* Category list */
.sidebar-cat-list { display: flex; flex-direction: column; gap: 8px; }
.sidebar-cat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--mid);
  transition: background .15s, color .15s;
  border: 1.5px solid transparent;
}
.sidebar-cat-item:hover,
.sidebar-cat-item.active { background: var(--blue-light); color: var(--blue); border-color: #c3d4f5; }
.sidebar-cat-count {
  background: var(--bg); color: var(--light);
  font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 50px;
}
.sidebar-cat-item.active .sidebar-cat-count { background: var(--blue); color: #fff; }

/* Recent posts */
.sidebar-recent-list { display: flex; flex-direction: column; gap: 14px; }
.sidebar-recent-item {
  display: flex; gap: 12px; cursor: pointer;
  padding: 8px; border-radius: 10px; transition: background .15s;
}
.sidebar-recent-item:hover { background: var(--bg); }
.sidebar-recent-thumb {
  width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; overflow: hidden;
}
.sidebar-recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-recent-title {
  font-size: 13px; font-weight: 800; color: var(--dark); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sidebar-recent-date { font-size: 11px; font-weight: 700; color: var(--light); margin-top: 4px; }

/* Tags cloud */
.sidebar-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.sidebar-tag {
  background: var(--bg); border: 1.5px solid #e8eaf0;
  color: var(--mid); font-size: 12px; font-weight: 800;
  padding: 5px 12px; border-radius: 50px; cursor: pointer;
  transition: .15s;
}
.sidebar-tag:hover { background: var(--blue-light); color: var(--blue); border-color: #c3d4f5; }

/* Sidebar ad */
.sidebar-ad {
  background: var(--bg); border: 1.5px dashed #c3d4f5;
  border-radius: 14px; padding: 16px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--light);
  min-height: 250px; display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════════════════════════
   SINGLE POST VIEW
══════════════════════════════════════════════════════ */
.blog-post-view { display: none; }
.blog-post-view.active { display: block; }
.blog-list-view.hidden { display: none; }

.post-hero-img {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: 20px; margin-bottom: 32px;
  background: linear-gradient(135deg, var(--blue-light), var(--green-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; min-height: 200px;
}
.post-hero-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; }

.post-header { margin-bottom: 28px; }
.post-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--blue);
  background: var(--blue-light); border: none; border-radius: 50px;
  padding: 7px 16px; cursor: pointer; margin-bottom: 20px; transition: .2s;
}
.post-back-btn:hover { background: var(--blue); color: #fff; }

.post-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(26px, 4vw, 40px);
  color: var(--dark); line-height: 1.2; margin-bottom: 16px;
}
.post-meta-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; font-weight: 700; color: var(--light);
  padding-bottom: 20px; border-bottom: 2px solid #e8eaf0; margin-bottom: 28px;
}
.post-author-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 50px; padding: 6px 14px;
}
.post-author-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #fff;
}

/* Post body typography */
.post-body {
  font-size: 16px; color: var(--mid); line-height: 1.9;
  max-width: 720px;
}
.post-body h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 26px; color: var(--dark); margin: 36px 0 14px;
}
.post-body h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 20px; color: var(--dark); margin: 28px 0 10px;
}
.post-body p { margin-bottom: 18px; }
.post-body ul, .post-body ol {
  padding-left: 24px; margin-bottom: 18px;
}
.post-body li { margin-bottom: 8px; }
.post-body strong { color: var(--dark); font-weight: 800; }
.post-body code {
  background: #f1f5f9; color: var(--blue);
  padding: 2px 8px; border-radius: 6px; font-size: 14px;
  font-family: 'Courier New', monospace;
}
.post-body pre {
  background: #1e293b; color: #e2e8f0;
  padding: 20px 24px; border-radius: 14px; overflow-x: auto;
  margin-bottom: 20px; font-size: 14px; line-height: 1.7;
}
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body blockquote {
  border-left: 4px solid var(--blue); padding: 12px 20px;
  background: var(--blue-light); border-radius: 0 12px 12px 0;
  margin: 20px 0; font-style: italic; color: var(--dark);
}
.post-body img {
  max-width: 100%; border-radius: 14px; margin: 16px 0;
}
.post-body a { color: var(--blue); font-weight: 700; }

/* In-post ad */
.post-ad-block {
  background: var(--bg); border: 1.5px dashed #c3d4f5;
  border-radius: 14px; padding: 16px 20px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--light);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  margin: 32px 0;
}

/* Post footer */
.post-footer-ad {
  background: var(--bg); border: 1.5px dashed #c3d4f5;
  border-radius: 14px; padding: 16px 20px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--light);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  margin: 32px 0;
}

/* Post CTA */
.post-cta-banner {
  background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: 20px; padding: 32px 36px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin: 40px 0;
}
.post-cta-text { color: #fff; }
.post-cta-text h3 { font-family: 'Fredoka One', cursive; font-size: 22px; margin-bottom: 6px; }
.post-cta-text p  { font-size: 14px; color: rgba(255,255,255,.8); }
.post-cta-btn {
  background: #fff; color: var(--blue);
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 15px;
  padding: 12px 28px; border-radius: 50px; border: none;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: .2s; flex-shrink: 0;
}
.post-cta-btn:hover { background: #fbbf24; color: var(--dark); }

/* Tags on post */
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.post-tag {
  background: var(--bg); border: 1.5px solid #e8eaf0;
  color: var(--mid); font-size: 12px; font-weight: 800;
  padding: 5px 12px; border-radius: 50px;
}

/* Related posts */
.related-posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin-top: 16px;
}

/* ── EMPTY STATE ── */
.blog-empty {
  text-align: center; padding: 60px 20px; grid-column: 1 / -1;
}
.blog-empty-icon { font-size: 56px; margin-bottom: 16px; }
.blog-empty-title { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--dark); margin-bottom: 8px; }
.blog-empty-sub   { font-size: 14px; color: var(--light); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .blog-layout { grid-template-columns: 1fr 260px; gap: 28px; }
}
@media (max-width: 860px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .blog-post-grid { grid-template-columns: 1fr; }
  .blog-card-featured { flex-direction: column; }
  .blog-card-featured .blog-card-img { width: 100%; height: 200px; }
  .related-posts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .blog-hero { padding: 48px 5% 40px; }
  .blog-layout { padding: 32px 5%; }
  .blog-sidebar { grid-template-columns: 1fr; }
  .post-cta-banner { flex-direction: column; text-align: center; }
}
