/* «أحدث المقالات / Latest articles» (front/partials/latest-articles.blade.php), homepage + course pages.
   Figma "Latest Articles": desktop 1905 (3 cards), tablet 768 (2 cards, scroll), mobile 390/320 (1 card, scroll).
   The heading reuses the parents' stories heading classes; their values are repeated here under .bnan-articles
   because home.css (where they live) is not loaded on the course pages. Breakpoints match home.css: 768 / 1101. */

.bnan-articles {
  position: relative;
  background: #fdf8ee;
  color: #10283c; /* the homepage's ink: other pages would pass on their own text colour */
  padding: 36px 0 32px;
}

.bnan-articles,
.bnan-articles h2,
.bnan-articles h3,
.bnan-articles p,
.bnan-articles a,
.bnan-articles span,
.bnan-articles time,
.bnan-articles button {
  font-family: "Poppins", sans-serif !important;
  font-style: normal;
}

[dir="rtl"] .bnan-articles,
[dir="rtl"] .bnan-articles h2,
[dir="rtl"] .bnan-articles h3,
[dir="rtl"] .bnan-articles p,
[dir="rtl"] .bnan-articles a,
[dir="rtl"] .bnan-articles span,
[dir="rtl"] .bnan-articles time,
[dir="rtl"] .bnan-articles button {
  font-family: "El Messiri", sans-serif !important;
}

.bnan-articles__inner {
  position: relative;
  width: min(350px, calc(100% - 40px));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Heading: same values as .bnan-parents in home.css ---------- */
.bnan-articles .bnan-parents__head {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.bnan-articles .bnan-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 !important;
  color: #0e7490 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
}

.bnan-articles .bnan-kicker::before,
.bnan-articles .bnan-kicker::after {
  display: none;
}

.bnan-articles .bnan-parents__title {
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #173449 !important;
  font-size: 32px !important;
  font-weight: 400 !important;
  line-height: 40px !important;
  text-align: center;
}

.bnan-articles .bnan-parents__title span {
  display: block;
  white-space: nowrap;
}

/* style.css capitalises every h2 ("Helpful Reads."); the homepage undoes it in home.css, the course pages did not */
.bnan-articles .bnan-parents__title,
.bnan-articles .bnan-parents__title span {
  text-transform: none !important;
}

.bnan-articles .bnan-parents__title .is-accent {
  color: #0e7490 !important;
}

.bnan-articles .bnan-parents__sub {
  margin: 0 !important;
  max-width: 350px;
  color: #173449 !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  text-align: center;
  opacity: 1;
}

.bnan-articles .bnan-parents__rule {
  width: 48px;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  background: #ebced1;
}

[dir="rtl"] .bnan-articles .bnan-kicker {
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-size: 14px !important;
  line-height: 22px !important;
}

[dir="rtl"] .bnan-articles .bnan-parents__title {
  font-size: 30px !important;
  font-weight: 600 !important;
  line-height: 46px !important;
}

[dir="rtl"] .bnan-articles .bnan-parents__sub {
  font-size: 16px !important;
  line-height: 26px !important;
  opacity: 1;
}

/* ---------- Cards ---------- */
.bnan-articles__viewport {
  /* the extra padding (cancelled by the negative margin) keeps card shadows from being cut off */
  margin: -12px -16px -40px;
  padding: 12px 16px 40px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.bnan-articles__viewport::-webkit-scrollbar {
  display: none;
}

.bnan-articles__track {
  display: flex;
  align-items: stretch;
  gap: 20px;
}

.bnan-article {
  box-sizing: border-box;
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scroll-snap-align: start;
  background: #fdf8ee;
  border: 1px solid #c5e4f4;
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(15, 41, 61, 0.1);
  color: inherit !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.bnan-article:hover,
.bnan-article:focus-visible {
  background: #f2fafb;
  border-color: #0e7490;
  box-shadow: 0 14px 34px rgba(15, 41, 61, 0.14);
}

.bnan-article:focus-visible {
  outline: 2px solid #0e7490;
  outline-offset: -2px;
}

.bnan-article__media {
  flex: none;
  height: 184px;
  overflow: hidden;
  background: #e9eff0;
}

.bnan-article__media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

.bnan-article__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 22px;
}

.bnan-article__date {
  display: block;
  color: #5e7380 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 20px !important;
  letter-spacing: 0.2px;
}

.bnan-article__title {
  margin: 0 !important;
  color: #173449 !important;
  font-size: 19px !important;
  font-weight: 600 !important;
  line-height: 27px !important;
  text-transform: none !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.bnan-article__excerpt {
  margin: 0 !important;
  color: #5e7380 !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  line-height: 23px !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.bnan-article__foot {
  margin-top: auto;
  padding-top: 11px;
}

.bnan-article__more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid #dde2e3;
  color: #0e7490 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 24px !important;
}

.bnan-article__more span {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

.bnan-article:hover .bnan-article__more span,
.bnan-article:focus-visible .bnan-article__more span {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.bnan-articles__arrow {
  flex: none;
  width: 20px;
  height: 20px;
}

[dir="rtl"] .bnan-articles__arrow {
  transform: scaleX(-1);
}

[dir="rtl"] .bnan-article__date {
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 22px !important;
  letter-spacing: 0;
}

[dir="rtl"] .bnan-article__title {
  font-size: 20px !important;
  line-height: 32px !important;
}

[dir="rtl"] .bnan-article__excerpt {
  font-size: 16px !important;
  line-height: 26px !important;
}

[dir="rtl"] .bnan-article__more {
  font-size: 17px !important;
  line-height: 26px !important;
}

/* ---------- Arrows and dots: same as the parents' stories controls ---------- */
.bnan-articles .bnan-parents__nav {
  position: relative;
  z-index: 1;
  width: auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.bnan-articles .bnan-parents__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.3px solid #c7cdd0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.bnan-articles .bnan-parents__arrow img {
  display: block;
}

.bnan-articles .bnan-parents__arrow:focus-visible {
  outline: 2px solid #0e7490 !important; /* style.css removes button outlines with !important */
  outline-offset: 3px;
}

[dir="rtl"] .bnan-articles .bnan-parents__arrow img {
  transform: scaleX(-1);
}

.bnan-articles .bnan-parents__dots {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bnan-articles .bnan-parents__dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #cecfce;
  cursor: pointer;
}

.bnan-articles .bnan-parents__dots button.is-on {
  width: 32px;
  background: #0e7490;
}

.bnan-articles .bnan-parents__dots button:focus-visible {
  outline: 2px solid #0e7490 !important;
  outline-offset: 3px;
}

/* ---------- "View all articles" outline pill ---------- */
.bnan-articles__all {
  align-self: center;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 26px;
  border: 1.5px solid #0e7490;
  border-radius: 999px;
  background: transparent;
  color: #0e7490 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 24px !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.bnan-articles__all span {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

.bnan-articles__all:hover {
  color: #0e7490 !important;
  opacity: 0.8;
}

.bnan-articles__all:focus-visible {
  outline: 2px solid #071e36;
  outline-offset: 3px;
  opacity: 1;
}

/* ---------- Narrow phones ---------- */
@media (max-width: 389px) {
  .bnan-articles .bnan-parents__title span {
    white-space: normal;
  }
}

@media (max-width: 359px) {
  .bnan-articles__inner {
    width: calc(100% - 40px);
  }

  .bnan-articles .bnan-parents__title {
    font-size: 28px !important;
    line-height: 36px !important;
  }

  [dir="rtl"] .bnan-articles .bnan-parents__title {
    font-size: 26px !important;
    line-height: 40px !important;
  }

  .bnan-articles__all {
    padding: 0 24px;
  }
}

/* ---------- Tablet (768+) ---------- */
@media (min-width: 768px) {
  .bnan-articles {
    padding: 48px 0 40px;
  }

  .bnan-articles__inner {
    width: min(704px, calc(100% - 64px));
    gap: 32px;
  }

  .bnan-articles .bnan-parents__head {
    gap: 14px;
  }

  .bnan-articles .bnan-kicker {
    font-size: 15px !important;
    letter-spacing: 1.4px !important;
  }

  .bnan-articles .bnan-parents__title {
    font-size: 46px !important;
    line-height: 56px !important;
  }

  .bnan-articles .bnan-parents__sub {
    max-width: 704px;
    font-size: 20px !important;
  }

  .bnan-articles .bnan-parents__rule {
    width: 64px;
  }

  [dir="rtl"] .bnan-articles .bnan-kicker {
    font-size: 16px !important;
    line-height: 26px !important;
  }

  [dir="rtl"] .bnan-articles .bnan-parents__title {
    font-size: 40px !important;
    line-height: 60px !important;
  }

  [dir="rtl"] .bnan-articles .bnan-parents__sub {
    font-size: 18px !important;
    line-height: 30px !important;
  }

  .bnan-article {
    flex-basis: calc((100% - 20px) / 2);
  }

  .bnan-article__media {
    height: 180px;
  }

  .bnan-article__body {
    padding: 20px 24px 24px;
  }

  .bnan-articles__all {
    height: 52px;
    padding: 0 30px;
    font-size: 18px !important;
    line-height: 27px !important;
  }
}

/* ---------- Desktop (1101+): 3 cards in a row, no carousel ---------- */
@media (min-width: 1101px) {
  .bnan-articles {
    padding: 64px 0 48px;
  }

  .bnan-articles__inner {
    width: min(1588px, calc(100% - 64px));
    gap: 38px;
  }

  .bnan-articles .bnan-parents__head {
    gap: 18px;
  }

  .bnan-articles .bnan-kicker {
    font-size: 18px !important;
    line-height: 1.5 !important;
    letter-spacing: 4px !important;
  }

  .bnan-articles .bnan-parents__title {
    font-size: 80px !important;
    line-height: 100px !important;
  }

  .bnan-articles .bnan-parents__sub {
    max-width: none;
    font-size: 28px !important;
    line-height: 1.5 !important;
    opacity: 0.7;
  }

  .bnan-articles .bnan-parents__rule {
    width: 76px;
  }

  [dir="rtl"] .bnan-articles .bnan-kicker {
    font-size: 22px !important;
    line-height: 34px !important;
  }

  [dir="rtl"] .bnan-articles .bnan-parents__title {
    font-size: 64px !important;
    line-height: 96px !important;
  }

  [dir="rtl"] .bnan-articles .bnan-parents__sub {
    font-size: 26px !important;
    line-height: 42px !important;
    opacity: 0.7;
  }

  .bnan-articles__viewport {
    margin: 0;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .bnan-articles__track {
    justify-content: center;
    gap: 28px;
  }

  .bnan-article {
    flex: 0 1 calc((100% - 56px) / 3);
  }

  .bnan-article__media {
    height: 268px;
  }

  .bnan-article__body {
    gap: 14px;
    padding: 28px 32px 32px;
  }

  .bnan-article__date {
    font-size: 15px !important;
    line-height: 22px !important;
  }

  .bnan-article__title {
    font-size: 24px !important;
    line-height: 34px !important;
  }

  .bnan-article__excerpt {
    font-size: 18px !important;
    line-height: 28px !important;
  }

  .bnan-article__foot {
    padding-top: 15px;
  }

  .bnan-article__more {
    padding-top: 15px;
    font-size: 18px !important;
    line-height: 27px !important;
  }

  [dir="rtl"] .bnan-article__date {
    font-size: 17px !important;
    line-height: 26px !important;
  }

  [dir="rtl"] .bnan-article__title {
    font-size: 26px !important;
    line-height: 40px !important;
  }

  [dir="rtl"] .bnan-article__excerpt {
    font-size: 20px !important;
    line-height: 32px !important;
  }

  [dir="rtl"] .bnan-article__more {
    font-size: 20px !important;
    line-height: 30px !important;
  }

  .bnan-articles__nav {
    display: none !important;
  }

  .bnan-articles__all {
    height: 60px;
    padding: 0 36px;
    font-size: 20px !important;
    line-height: 30px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bnan-article,
  .bnan-articles__all {
    transition: none;
  }
}
