/* =====================================================
   AFSA Trading Skills — Blog Module Styles
   blog.css | Isolated from core style.css
   ===================================================== */

/* --- Search Bar --- */
.blog-search-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}
.blog-search-wrap svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}
#blog-search {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
#blog-search:focus {
  border-color: hsl(var(--gold) / 0.6);
  box-shadow: 0 0 0 3px hsl(var(--gold) / 0.12);
}
#blog-search::placeholder {
  color: hsl(var(--muted-foreground));
}

/* --- Category Filter Pills --- */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.blog-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.blog-filter-btn:hover {
  border-color: hsl(var(--gold) / 0.5);
  color: hsl(var(--gold));
  background: hsl(var(--gold) / 0.06);
}
.blog-filter-btn.active {
  border-color: hsl(var(--gold) / 0.6);
  background: hsl(var(--gold) / 0.12);
  color: hsl(var(--gold));
}

/* --- Blog Cards Grid --- */
.blog-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Blog Card --- */
.blog-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  border-color: hsl(var(--gold) / 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -15px hsl(var(--gold) / 0.2);
}
.blog-card-img {
  position: relative;
  overflow: hidden;
  background: hsl(var(--muted));
  aspect-ratio: 16 / 9;
}
.blog-card-img svg,
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-img svg,
.blog-card:hover .blog-card-img img {
  transform: scale(1.04);
}
.blog-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.blog-card-cat {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid hsl(var(--gold) / 0.3);
  background: hsl(var(--gold) / 0.1);
  color: hsl(var(--gold));
  width: fit-content;
}
.blog-card-title {
  font-family: var(--font-display, sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: hsl(var(--foreground));
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-title:hover { color: hsl(var(--gold)); }
.blog-card-desc {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}
.blog-card-meta svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}
.blog-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.blog-card-footer {
  padding: 0 1.25rem 1.25rem;
}
.blog-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--gold));
  text-decoration: none;
  transition: gap 0.2s;
}
.blog-read-more:hover { gap: 0.65rem; }
.blog-read-more svg { width: 0.85rem; height: 0.85rem; transition: transform 0.2s; }
.blog-read-more:hover svg { transform: translateX(3px); }

/* --- No Results State --- */
#blog-no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
  display: none;
}

/* --- Load More Button --- */
#load-more-btn {
  display: flex;
  margin: 2.5rem auto 0;
}

/* =====================================================
   SINGLE ARTICLE PAGE
   ===================================================== */

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}
.breadcrumb a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover { color: hsl(var(--gold)); }
.breadcrumb-sep { opacity: 0.5; }
.breadcrumb-current { color: hsl(var(--foreground)); font-weight: 500; }

/* --- Article Header --- */
.article-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid hsl(var(--gold) / 0.3);
  background: hsl(var(--gold) / 0.1);
  color: hsl(var(--gold));
  text-decoration: none;
  transition: background 0.2s;
}
.article-cat-badge:hover { background: hsl(var(--gold) / 0.18); }
.article-headline {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}
.article-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: hsl(var(--muted-foreground));
}
.article-byline svg { width: 0.9rem; height: 0.9rem; }
.article-byline-item { display: flex; align-items: center; gap: 0.3rem; }
.author-avatar-sm {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--gold)), hsl(var(--emerald)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--navy));
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* --- Featured Image --- */
.article-featured-img {
  width: 100%;
  aspect-ratio: 16 / 7;
  border-radius: 1rem;
  overflow: hidden;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
}
.article-featured-img svg,
.article-featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Two-column layout --- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr 300px;
  }
}

/* --- Article Body Typography --- */
.article-body {
  font-size: 1rem;
  line-height: 1.8;
  color: hsl(var(--foreground));
}
.article-body h2 {
  font-family: var(--font-display, sans-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}
.article-body h3 {
  font-family: var(--font-display, sans-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 2rem 0 0.75rem;
}
.article-body p {
  margin: 0 0 1.25rem;
  color: hsl(var(--muted-foreground));
}
.article-body p:first-child { color: hsl(var(--foreground)); }
.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin: 0 0 1.25rem;
  color: hsl(var(--muted-foreground));
}
.article-body li { margin-bottom: 0.4rem; }
.article-body strong { color: hsl(var(--foreground)); font-weight: 600; }
.article-body a {
  color: hsl(var(--gold));
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-body a:hover { opacity: 0.8; }

/* Callout boxes */
.callout {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  border-left: 3px solid;
  font-size: 0.9rem;
  line-height: 1.6;
}
.callout svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; margin-top: 0.15rem; }
.callout-tip {
  background: hsl(var(--emerald) / 0.08);
  border-color: hsl(var(--emerald) / 0.6);
  color: hsl(var(--emerald));
}
.callout-tip .callout-label { font-weight: 700; color: hsl(var(--emerald)); }
.callout-warn {
  background: hsl(43 89% 58% / 0.08);
  border-color: hsl(var(--gold) / 0.6);
  color: hsl(var(--gold));
}
.callout-warn .callout-label { font-weight: 700; color: hsl(var(--gold)); }
.callout-danger {
  background: hsl(0 63% 45% / 0.08);
  border-color: hsl(var(--destructive) / 0.6);
  color: hsl(var(--destructive));
}
.callout-danger .callout-label { font-weight: 700; }
.callout-body { color: hsl(var(--foreground)); opacity: 0.9; }

/* Blockquote */
.article-body blockquote {
  margin: 1.75rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid hsl(var(--gold) / 0.6);
  background: hsl(var(--gold) / 0.06);
  border-radius: 0 0.75rem 0.75rem 0;
  font-style: italic;
  color: hsl(var(--foreground));
  font-size: 1.05rem;
  line-height: 1.7;
}
.article-body blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 600;
  color: hsl(var(--gold));
}

/* Tables */
.article-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.article-body th {
  background: hsl(var(--muted));
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 600;
  color: hsl(var(--foreground));
  border-bottom: 1px solid hsl(var(--border));
}
.article-body td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}
.article-body tr:last-child td { border-bottom: none; }
.article-body tr:hover td { background: hsl(var(--muted) / 0.4); }

/* Highlight box */
.highlight-box {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--gold) / 0.25);
  border-radius: 0.85rem;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}
.highlight-box-title {
  font-family: var(--font-display, sans-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: hsl(var(--gold));
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.highlight-box ul {
  margin: 0;
  padding-left: 1.25rem;
  color: hsl(var(--muted-foreground));
}

/* Article tags */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 2rem;
}
.article-tag {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: all 0.15s;
}
.article-tag:hover {
  border-color: hsl(var(--gold) / 0.5);
  color: hsl(var(--gold));
  background: hsl(var(--gold) / 0.07);
}

/* --- Social Share --- */
.share-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.share-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  font-size: 0.78rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.share-btn:hover { border-color: hsl(var(--gold) / 0.5); color: hsl(var(--gold)); }
.share-btn svg { width: 0.85rem; height: 0.85rem; }
.share-btn.copied { border-color: hsl(var(--emerald) / 0.5); color: hsl(var(--emerald)); }

/* --- Prev / Next Navigation --- */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}
@media (max-width: 480px) {
  .prev-next { grid-template-columns: 1fr; }
}
.prev-next-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.85rem;
  background: hsl(var(--card));
  text-decoration: none;
  transition: all 0.2s;
}
.prev-next-link:hover {
  border-color: hsl(var(--gold) / 0.4);
  background: hsl(var(--gold) / 0.04);
}
.prev-next-link.next { justify-content: flex-end; text-align: right; }
.prev-next-dir {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
}
.prev-next-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prev-next-icon { color: hsl(var(--gold)); flex-shrink: 0; }
.prev-next-icon svg { width: 1.1rem; height: 1.1rem; }

/* --- Related Posts --- */
.related-posts-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .related-posts-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Comments Section --- */
.comment-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.comment-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.comment-input {
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}
.comment-input:focus {
  border-color: hsl(var(--gold) / 0.6);
  box-shadow: 0 0 0 3px hsl(var(--gold) / 0.1);
}
textarea.comment-input { resize: vertical; min-height: 120px; }

/* --- Sticky Sidebar --- */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .article-sidebar {
    position: sticky;
    top: 7rem;
  }
}
.sidebar-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  padding: 1.25rem;
}
.sidebar-title {
  font-family: var(--font-display, sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid hsl(var(--border));
}
.sidebar-author-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--gold)), hsl(var(--emerald)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--navy));
  font-weight: 800;
  font-size: 1.1rem;
}
.sidebar-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid hsl(var(--border));
  text-decoration: none;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  transition: color 0.15s;
}
.sidebar-cat-link:last-child { border-bottom: none; }
.sidebar-cat-link:hover { color: hsl(var(--gold)); }
.sidebar-cat-count {
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
.sidebar-recent-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid hsl(var(--border));
  text-decoration: none;
}
.sidebar-recent-item:last-child { border-bottom: none; }
.sidebar-recent-img {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
  background: hsl(var(--muted));
}
.sidebar-recent-img svg { width: 100%; height: 100%; }
.sidebar-recent-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  color: hsl(var(--foreground));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}
.sidebar-recent-item:hover .sidebar-recent-title { color: hsl(var(--gold)); }
.sidebar-recent-date {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.2rem;
}
.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sidebar-newsletter-input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 0.6rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 0.6rem;
}
.sidebar-newsletter-input:focus { border-color: hsl(var(--gold) / 0.6); }

/* --- Article TOC  --- */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.toc-link {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  display: block;
  padding: 0.2rem 0.5rem;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.toc-link:hover,
.toc-link.active {
  border-color: hsl(var(--gold));
  color: hsl(var(--gold));
  background: hsl(var(--gold) / 0.05);
  border-radius: 0 0.35rem 0.35rem 0;
}
