.articles-page {
  direction: rtl;
  /* nothing inside an article may widen the page on phones */
  overflow-x: clip;
}

.articles-list {
  gap: var(--space-5);
}

.article-card {
  overflow: hidden;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
}

.article-row {
  direction: ltr;
}

.article-image {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  object-fit: cover;
}

/* List page: fixed image height so tall images don't stretch the card */
.article-row .article-image {
  height: 320px;
  min-height: 0;
}

.article-content {
  padding: var(--space-5);
}

.article-title {
  margin-bottom: var(--space-3);
  color: var(--text-dark);
  font-weight: var(--font-bold);
  font-size: 22px;
}

.article-link {
  color: inherit;
  text-decoration: none;
}

.article-card:hover .article-image {
  opacity: 0.92;
}

.article-detail {
  max-width: 820px;
  min-width: 0;
  margin: 0 auto;
}

.article-detail .article-image {
  min-height: 0;
  max-height: 460px;
  border-radius: var(--radius-lg);
}

.article-detail .article-body {
  white-space: pre-line;
}

.article-body {
  color: var(--text-secondary);
  line-height: 1.8;
}

.article-tags {
  gap: var(--space-2);
}

.article-tag {
  padding: 6px 12px;

  background: var(--bg-weak);
  color: var(--text-secondary);

  border-radius: 16px;

  font-size: 13px;
  font-weight: var(--font-medium);
}

@media (max-width: 768px) {
  .article-image,
  .article-row .article-image {
    height: 220px;
    min-height: 0;
  }

  .article-content {
    padding: var(--space-4);
  }
}
/* ---- Articles list page (articles.html): card grid ---- */
.articles-wrapper {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}

.articles-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.articles-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background-color: var(--bg-primary);
  color: var(--primary);
  font-size: 13px;
  font-weight: var(--font-medium);
}

.articles-heading {
  margin: 12px 0 8px;
  color: var(--text-dark);
  font-weight: var(--font-bold);
}

.articles-subtitle {
  color: var(--text-secondary);
  margin: 0;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.articles-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border: 1.5px solid var(--primary);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(223, 28, 65, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.articles-card:hover,
.articles-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px rgba(223, 28, 65, 0.16);
}

.articles-card-media {
  margin: 8px 8px 0;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

.articles-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.articles-card:hover .articles-card-media img {
  transform: scale(1.06);
}

.articles-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  padding: var(--space-4);
}

.articles-card-date {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: var(--bg-primary-section);
  color: var(--primary);
  font-size: 12px;
}

.articles-card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  font-weight: var(--font-bold);
}

.articles-card-title a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

.articles-card:hover .articles-card-title a {
  color: var(--primary);
}

.articles-card-excerpt {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.articles-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.articles-card .article-tag {
  padding: 3px 10px;
  font-size: 12px;
}

.articles-card-more {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: var(--font-medium);
}

.articles-card-more i {
  transition: transform 0.3s ease;
}

.articles-card:hover .articles-card-more i {
  transform: translateX(-6px);
}

.articles-empty {
  text-align: center;
  color: var(--text-secondary);
}

/* Entrance animation - only once JS has added .articles-animate. A keyframe
   (fill-mode backwards) rather than a transition, so the stagger delay
   doesn't also delay the hover lift afterwards. */
.articles-animate .articles-card:not(.is-visible) {
  opacity: 0;
}

.articles-animate .articles-card.is-visible {
  animation: articles-card-in 0.6s ease backwards;
  animation-delay: calc(min(var(--card-index, 0), 5) * 80ms);
}

@keyframes articles-card-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

@media (max-width: 992px) {
  .articles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .articles-wrapper {
    padding: var(--space-4) 16px;
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .articles-card-title {
    font-size: 16px;
  }
}

/* Article detail: header */
.article-detail .article-title {
  margin: 0 0 var(--space-2);
  font-size: 30px;
  line-height: 1.5;
}

.article-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-gray);
  font-size: 14px;
}

/* Article detail: HTML body (headings, tables, links, images) */
.article-rich {
  color: #3d4541;
  font-size: 17px;
  line-height: 2;
  overflow-wrap: anywhere;
}

/* opening summary paragraph */
.article-rich .article-lead {
  margin-bottom: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-primary-section);
  border-inline-start: 4px solid var(--primary);
  border-radius: var(--radius-lg);
}

.article-rich .article-lead strong {
  font-weight: var(--font-medium);
}

.article-rich .article-meta {
  color: var(--text-gray);
  font-size: 14px;
}

.article-rich h2 {
  margin: var(--space-7) 0 var(--space-4);
  padding-inline-start: var(--space-3);
  border-inline-start: 4px solid var(--primary);
  color: var(--text-dark);
  font-weight: var(--font-bold);
  font-size: 23px;
  line-height: 1.6;
}

.article-rich h3 {
  margin: var(--space-5) 0 var(--space-2);
  color: var(--text-dark);
  font-weight: var(--font-semibold);
  font-size: 19px;
}

.article-rich p {
  margin-bottom: var(--space-4);
}

.article-rich ul {
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
}

.article-rich li {
  position: relative;
  margin-bottom: var(--space-2);
  padding-inline-start: var(--space-5);
}

.article-rich ol {
  margin: 0 0 var(--space-5);
  padding-inline-start: var(--space-5);
}

.article-rich ol > li {
  padding-inline-start: var(--space-1);
}

.article-rich ol > li::marker {
  color: var(--primary);
  font-weight: var(--font-bold);
}

.article-rich ul > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: 0.85em;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
}

.article-rich strong {
  color: var(--text-dark);
}

.article-rich a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.article-rich figure {
  margin: var(--space-5) 0;
}

.article-rich figure img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

.article-rich figcaption {
  margin-top: var(--space-2);
  font-size: 14px;
  text-align: center;
}

.article-rich .table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
}

.article-rich table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.8;
}

.article-rich th,
.article-rich td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-primary);
  text-align: right;
  vertical-align: top;
}

@media (min-width: 641px) {
  .article-rich tbody tr:last-child > * {
    border-bottom: none;
  }
}

.article-rich thead th {
  background: var(--primary);
  color: var(--bg-white);
  font-weight: var(--font-semibold);
}

.article-rich tbody th,
.article-rich tbody td:first-child {
  color: var(--text-dark);
  font-weight: var(--font-semibold);
}

.article-rich tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.article-rich .table-note {
  font-size: 14px;
}

/* row of product photos, each one linking to its product page */
.article-rich .product-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.article-rich .product-row a {
  display: block;
  color: var(--text-dark);
  font-size: 15px;
  font-weight: var(--font-semibold);
  line-height: 1.6;
  text-align: center;
  text-decoration: none;
}

.article-rich .product-row img {
  aspect-ratio: 1;
  max-height: none;
  margin-bottom: var(--space-2);
  object-fit: contain;
  background: var(--bg-primary-section);
  transition: transform 0.3s ease;
}

.article-rich .product-row a:hover img {
  transform: translateY(-4px);
}

.article-rich .article-related ul + p {
  margin-top: var(--space-3);
}

/* FAQ: each question/answer as a soft card */
.article-rich .article-faq h3 {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4) 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-size: 17px;
}

.article-rich .article-faq h3 + p {
  margin-bottom: var(--space-3);
  padding: var(--space-1) var(--space-4) var(--space-3);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* related links / call to action box */
.article-rich .article-related {
  margin-top: var(--space-7);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--bg-primary);
  border-radius: var(--radius-lg);
  background: var(--bg-primary-section);
}

.article-rich .article-related h2 {
  margin-top: 0;
  font-size: 19px;
}

.article-rich .article-related ul,
.article-rich .article-related p {
  margin-bottom: 0;
}

/* sources: small print at the end */
.article-rich .article-sources {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
  font-size: 14px;
  line-height: 1.9;
}

.article-rich .article-sources h2 {
  margin-top: 0;
  padding: 0;
  border: none;
  font-size: 16px;
}

.article-rich .article-sources ul > li::before {
  background: var(--text-gray);
}

/* Phones: each table row becomes a card - cells get their column name from
   data-label (set by the script in article.html), so nothing scrolls sideways */
@media (max-width: 640px) {
  .article-detail .article-title {
    font-size: 23px;
  }

  .article-rich {
    font-size: 16px;
    line-height: 1.95;
  }

  .article-rich .article-lead,
  .article-rich .article-related {
    padding: var(--space-3) var(--space-4);
  }

  .article-rich h2 {
    margin-top: var(--space-6);
    font-size: 20px;
  }

  .article-rich h3 {
    font-size: 17px;
  }

  .article-rich figure img {
    max-height: 320px;
  }

  .article-rich .product-row {
    gap: var(--space-2);
  }

  .article-rich .product-row a {
    font-size: 12px;
  }

  .article-rich .product-row img {
    max-height: none;
  }

  .article-rich .table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
  }

  .article-rich thead th {
    background: none;
  }

  .article-rich table {
    min-width: 0;
    font-size: 14px;
  }

  .article-rich thead {
    display: none;
  }

  .article-rich table,
  .article-rich tbody,
  .article-rich tr,
  .article-rich tbody th,
  .article-rich td {
    display: block;
    width: 100%;
  }

  .article-rich tr {
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-white) !important;
  }

  .article-rich tbody th,
  .article-rich td {
    border: none;
    border-bottom: 1px solid var(--border-primary);
  }

  .article-rich tr > :last-child {
    border-bottom: none;
  }

  .article-rich td {
    display: flex;
    gap: var(--space-3);
  }

  .article-rich td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--text-dark);
    font-weight: var(--font-semibold);
  }

  /* first cell of each row is the card title */
  .article-rich tr > :first-child {
    background: var(--bg-primary-section);
    color: var(--text-dark);
    font-weight: var(--font-semibold);
  }

  .article-rich tr > td:first-child::before {
    display: none;
  }
}
