/* ==========================================================================
   Blog listing: /blog/, category, date and author archives, search results.
   The card styles are also loaded on single articles (related articles).
   ========================================================================== */

/* ---------- Hero search ---------- */
.blog-hero .blog-search { max-width: 560px; margin-top: 30px; }
.blog-search {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 6px;
  border-radius: 999px; background: #fff; box-shadow: var(--shadow); transition: box-shadow .2s;
}
.blog-search:focus-within { box-shadow: 0 0 0 4px rgba(95, 174, 78, 0.45), var(--shadow); }
.blog-search > i { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); font-size: 0.95rem; color: var(--muted); pointer-events: none; }
.blog-search input[type="search"] {
  flex: 1; min-width: 0; height: 46px; padding: 0 10px 0 44px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); font-size: 1rem;
}
.blog-search input[type="search"]:focus { outline: none; }
.blog-search input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.blog-search .btn { flex: none; min-height: 46px; padding: 9px 22px; box-shadow: none; }

/* ---------- Listing head ---------- */
.blog-list { padding-top: 72px; }
.blog-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 32px; margin-bottom: 24px; }
.blog-bar h2 { margin: 0; font-size: clamp(1.55rem, 2.4vw, 2rem); }
.blog-bar h2 + p { max-width: 620px; margin: 8px 0 0; color: var(--muted); }
.blog-bar a, .blog-count a { color: var(--green-700); font-weight: 700; text-decoration: underline; text-decoration-color: var(--green-100); text-underline-offset: 3px; }
.blog-bar a:hover { text-decoration-color: currentColor; }
.blog-count { margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--muted); }

/* ---------- Topic tabs ---------- */
.blog-tabs { margin-bottom: 40px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.blog-tabs ul { display: flex; flex-wrap: wrap; gap: 10px; }
.blog-tabs a {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 8px 10px 8px 16px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 0.93rem; font-weight: 600; color: var(--ink-2);
  transition: background-color .2s, border-color .2s, color .2s;
}
.blog-tabs a i { width: 16px; font-size: 0.9rem; text-align: center; color: var(--green-700); }
.blog-tabs a:hover { border-color: var(--green-100); background: var(--green-50); color: var(--green-800); }
.blog-tabs .count {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--bg-soft); font-size: 0.76rem; font-weight: 700; color: var(--muted);
}
.blog-tabs a[aria-current] { border-color: var(--navy-900); background: var(--navy-900); color: #fff; }
.blog-tabs a[aria-current] i { color: var(--green-500); }
.blog-tabs a[aria-current] .count { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* ---------- Article cards ---------- */
.blog-card { color: inherit; }
.blog-card .post-media { position: relative; margin: -26px -26px 20px; }
.blog-card .post-thumb { display: block; margin: 0; border-bottom: 1px solid var(--line); }
.blog-card .post-thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.post-cover-icon {
  position: relative; display: grid; place-items: center; height: 148px; overflow: hidden;
  background: linear-gradient(135deg, var(--navy-900), var(--green-700)); color: #fff;
}
.post-cover-icon::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}
.post-cover-icon::after {
  content: ""; position: absolute; width: 220px; height: 220px; right: -70px; bottom: -120px; border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, 0.08);
}
.post-cover-icon i {
  position: relative; z-index: 1; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 22px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2); font-size: 1.9rem; transition: transform .3s;
}
.blog-card:hover .post-cover-icon i { transform: scale(1.06); }
.post-cover-icon.cat-investment-tips { background: linear-gradient(135deg, #1d5576, #3f8a35); }
.post-cover-icon.cat-beginner-guides { background: linear-gradient(135deg, #11324d, #286890); }
.post-cover-icon.cat-myth-vs-fact { background: linear-gradient(135deg, #061827, #1b4a6b); }
.post-cover-icon.cat-myth-vs-fact i { color: var(--gold-500); }

.blog-card .post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 10px; font-size: 0.85rem; }
/* Topic pill on the card cover */
.blog-card .post-cat {
  position: absolute; z-index: 2; top: 16px; left: 16px; display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: #fff; color: var(--navy-900); font-size: 0.76rem; font-weight: 700; line-height: 1.5;
  box-shadow: 0 6px 16px -8px rgba(6, 24, 39, 0.6); transition: background-color .2s, color .2s;
}
.blog-card a.post-cat:hover { background: var(--green-50); color: var(--green-800); }
.post-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.post-meta-item .icon { width: 14px; height: 14px; color: var(--green-700); }
.blog-card .post-title { margin-bottom: 10px; font-size: 1.14rem; line-height: 1.38; letter-spacing: -0.01em; }
.blog-card .post-title a { transition: color .2s; }
/* The title link covers the whole card; the topic pill stays clickable above it. */
.blog-card .post-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 20px; }
.blog-card .post-title a:focus-visible { outline: none; }
.blog-card .post-title a:focus-visible::after { outline: 3px solid var(--green-500); outline-offset: 3px; }
.blog-card:hover .post-title a { color: var(--green-700); }
.blog-card .post-excerpt { margin-bottom: 20px; font-size: 0.95rem; line-height: 1.6; }
.blog-card .link-arrow { margin-top: auto; font-size: 0.94rem; }
.blog-card:hover .link-arrow .icon { transform: translateX(3px); }

/* ---------- Pagination ---------- */
.blog-list .pagination .prev, .blog-list .pagination .next { display: inline-flex; gap: 8px; padding: 0 18px; }
.pagination .prev .icon, .pagination .next .icon { width: 16px; height: 16px; }
.pagination .prev .icon { transform: rotate(180deg); }
.pagination .dots { border-color: transparent; background: transparent; }

/* ---------- Empty state ---------- */
.blog-empty { padding: 8px 0 16px; }
.blog-empty .icon-box { margin: 0 auto 20px; width: 64px; height: 64px; border-radius: 20px; }
.blog-empty h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.blog-empty p { color: var(--muted); }
.blog-empty-topics { justify-content: center; margin: 24px 0 28px; }
.blog-empty-topics .chip { min-height: 36px; font-size: 0.86rem; }
.blog-empty-topics .chip:hover { background: var(--green-100); }

/* ---------- Editorial note ---------- */
.blog-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: start; margin-top: 72px;
  padding: 32px 36px; border-radius: var(--radius-lg); background: var(--bg-soft); border: 1px solid var(--line);
}
.blog-note .advisor-photo, .blog-note .advisor-initials { width: 64px; height: 64px; font-size: 1.3rem; }
.blog-note h2 { margin-bottom: 8px; font-size: 1.3rem; letter-spacing: -0.01em; }
.blog-note p { max-width: 780px; color: var(--ink-2); }
.blog-note-risk { padding-top: 14px; border-top: 1px solid var(--line); font-weight: 700; color: var(--ink) !important; }
.blog-note-links { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.blog-note-links .link-arrow { font-size: 0.95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .blog-list { padding-top: 56px; }
}

/* Tablet: two columns. A lone last card spans the row, image beside text. */
@media (min-width: 641px) and (max-width: 980px) {
  .post-grid > .blog-card:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; column-gap: 28px; }
  .post-grid > .blog-card:last-child:nth-child(odd) .post-media { display: flex; grid-row: 1 / -1; margin: -26px 0 -26px -26px; }
  .post-grid > .blog-card:last-child:nth-child(odd) .post-cover-icon,
  .post-grid > .blog-card:last-child:nth-child(odd) .post-thumb { flex: 1; height: auto; min-height: 220px; border-bottom: 0; }
  .post-grid > .blog-card:last-child:nth-child(odd) .post-thumb img { height: 100%; aspect-ratio: auto; }
}

@media (max-width: 640px) {
  .blog-hero .blog-search { margin-top: 24px; }
  .blog-search > i { left: 18px; }
  .blog-search input[type="search"] { padding-left: 38px; font-size: 0.97rem; }
  .blog-search .btn { padding: 9px 18px; }
  .blog-list { padding-top: 44px; }
  .blog-bar { margin-bottom: 18px; }
  .blog-tabs { margin-bottom: 28px; padding-bottom: 20px; }
  .blog-tabs ul { gap: 8px; }
  .blog-tabs a { gap: 7px; min-height: 42px; padding: 7px 8px 7px 13px; font-size: 0.88rem; }
  .blog-card .post-media { margin: -24px -24px 18px; }
  .post-cover-icon { height: 128px; }
  .blog-note { grid-template-columns: 1fr; gap: 16px; margin-top: 56px; padding: 26px 22px; }
  .blog-note-links { flex-direction: column; }
}
