/* Scalable articles layout */
:root {
  --articles-primary: #1a3a52;
  --articles-secondary: #d4a574;
  --articles-accent: #c41e3a;
  --articles-text: #243447;
  --articles-muted: #6b7280;
  --articles-border: #d9dfe7;
  --articles-surface: #ffffff;
  --articles-soft: #f6f8fb;
  --articles-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
  --articles-shadow-hover: 0 24px 50px rgba(17, 24, 39, 0.12);
}

.articles-shell,
.article-shell {
  padding: 1.5rem 0 3rem;
}

.articles-hero,
.article-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, #0f2940 0%, #1a3a52 46%, #244b67 100%);
  color: #fff;
  box-shadow: var(--articles-shadow);
}

.articles-hero::after,
.article-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(212, 165, 116, 0.35), transparent 28%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.12), transparent 36%);
  pointer-events: none;
}

.articles-hero-inner,
.article-hero-inner {
  position: relative;
  z-index: 1;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.articles-kicker,
.article-kicker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .92);
  font-size: .85rem;
  letter-spacing: .02em;
  margin-bottom: 1rem;
}

.articles-title,
.article-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.articles-subtitle,
.article-subtitle {
  margin-top: .9rem;
  max-width: 60rem;
  color: rgba(255, 255, 255, .86);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
}

.articles-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .9rem;
  align-items: center;
  margin: 1.5rem 0 1rem;
}

.articles-search {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .85rem 1rem;
  border: 1px solid var(--articles-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.articles-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--articles-text);
}

.articles-search button,
.articles-action,
.articles-pagination button,
.article-back-button {
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease;
}

.articles-search button,
.articles-action.primary {
  padding: .85rem 1.1rem;
  background: var(--articles-primary);
  color: #fff;
  box-shadow: 0 14px 28px rgba(26, 58, 82, .18);
}

.articles-search button:hover,
.articles-action.primary:hover,
.articles-pagination button:hover,
.article-back-button:hover {
  transform: translateY(-1px);
}

.articles-action.secondary,
.article-back-button {
  padding: .85rem 1.1rem;
  background: #fff;
  color: var(--articles-primary);
  border: 1px solid var(--articles-border);
}

.articles-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1rem 0 1.75rem;
}

.articles-filter {
  padding: .55rem .9rem;
  border: 1px solid var(--articles-border);
  border-radius: 999px;
  background: #fff;
  color: var(--articles-text);
  font-size: .92rem;
}

.articles-filter.active {
  background: var(--articles-primary);
  color: #fff;
  border-color: var(--articles-primary);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.article-card {
  overflow: hidden;
  border: 1px solid rgba(217, 223, 231, .9);
  border-radius: 22px;
  background: var(--articles-surface);
  box-shadow: var(--articles-shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--articles-shadow-hover);
  border-color: rgba(212, 165, 116, .75);
}

.article-card a {
  color: inherit;
  text-decoration: none;
}

.article-card-image {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--articles-soft);
}

.article-card-body {
  padding: 1.15rem 1.1rem 1.2rem;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .75rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: rgba(196, 30, 58, .08);
  color: var(--articles-accent);
  font-size: .78rem;
  font-weight: 800;
}

.article-card-title,
.article-detail-title {
  margin: 0;
  color: var(--articles-text);
  font-size: 1.15rem;
  line-height: 1.38;
}

.article-card-meta,
.article-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  margin-top: .7rem;
  color: var(--articles-muted);
  font-size: .88rem;
}

.article-card-summary,
.article-detail-content p,
.article-subtitle {
  color: var(--articles-muted);
}

.article-card-summary {
  margin: .95rem 0 1rem;
  line-height: 1.6;
  font-size: .96rem;
}

.article-card-tags,
.article-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.article-tag,
.article-chip {
  display: inline-flex;
  align-items: center;
  padding: .32rem .65rem;
  border-radius: 999px;
  background: var(--articles-soft);
  color: var(--articles-primary);
  border: 1px solid rgba(26, 58, 82, .08);
  font-size: .8rem;
  font-weight: 700;
}

.pagination,
.articles-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  justify-content: center;
  margin-top: 1.8rem;
}

.pagination-btn,
.articles-pagination button {
  padding: .72rem .95rem;
  background: #fff;
  color: var(--articles-primary);
  border: 1px solid var(--articles-border);
}

.pagination-btn.active,
.articles-pagination button.active {
  background: var(--articles-primary);
  color: #fff;
  border-color: var(--articles-primary);
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  border-radius: 22px;
  background: #fff;
  border: 1px dashed var(--articles-border);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: .65rem;
}

.article-detail-layout {
  display: grid;
  gap: 1.5rem;
}

.article-detail-card {
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(217, 223, 231, .95);
  box-shadow: var(--articles-shadow);
}

.article-detail-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
  background: var(--articles-soft);
}

.article-detail-body {
  padding: clamp(1.25rem, 3vw, 2.25rem);
}

.article-detail-content {
  color: var(--articles-text);
  font-size: 1.05rem;
  line-height: 1.9;
}

.article-detail-content h2,
.article-detail-content h3,
.article-detail-content h4 {
  color: var(--articles-primary);
  line-height: 1.25;
  scroll-margin-top: 1.25rem;
}

.article-detail-content h2 { margin: 1.8rem 0 .85rem; font-size: 1.55rem; }
.article-detail-content h3 { margin: 1.5rem 0 .7rem; font-size: 1.25rem; }
.article-detail-content p { margin: 0 0 1rem; }
.article-detail-content ul,
.article-detail-content ol { margin: 0 0 1rem 1.25rem; }
.article-detail-content a { color: var(--articles-primary); text-decoration: underline; text-underline-offset: 2px; }
.article-detail-content blockquote {
  margin: 1rem 0;
  padding: .9rem 1rem;
  border-left: 4px solid var(--articles-secondary);
  background: #faf7f2;
  color: var(--articles-text);
}

.toc {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: var(--articles-soft);
  border: 1px solid rgba(26, 58, 82, .08);
}

.toc h3 {
  margin: 0 0 .75rem;
  font-size: .95rem;
  color: var(--articles-primary);
}

.toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.toc a { color: var(--articles-primary); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: var(--articles-primary);
  color: #fff;
  box-shadow: var(--articles-shadow);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.back-to-top.show {
  display: inline-flex;
}

@media (max-width: 900px) {
  .articles-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .articles-hero-inner,
  .article-hero-inner,
  .article-detail-body {
    padding: 1.05rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .article-card-image {
    height: 190px;
  }
}
