/**
 * Legal articles index — isolated (do not mix with home-standard.css).
 * Constitutions #03 / #22 · Ajman navy #0b1f33 · gold #c9a84c · Tajawal / Inter local.
 */

body[data-page="legal-articles"] .site-main {
  --ai-gold: #c9a84c;
  --ai-ink: #0b1f33;
  --ai-muted: #4a5563;
  --ai-mist: #f2f0e8;
  --ai-line: rgba(11, 31, 51, 0.08);
  font-family: "Tajawal", system-ui, sans-serif;
  background: #fff;
  color: var(--ai-ink);
  max-width: 100%;
  overflow-x: hidden;
}

html[lang="en"] body[data-page="legal-articles"] .site-main {
  font-family: "Inter", system-ui, sans-serif;
}

.articles-index {
  background: #fff;
  width: 100%;
  overflow-x: hidden;
}

.articles-wrap {
  width: min(100% - 32px, 1180px);
  margin-inline: auto;
  box-sizing: border-box;
}

.articles-hero {
  position: relative;
  isolation: isolate;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1f33;
  overflow: hidden;
  border-bottom: 3px solid var(--ai-gold);
}

.articles-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  z-index: 0;
}

.articles-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(11, 31, 51, 0.58) 0%, rgba(11, 31, 51, 0.78) 100%),
    linear-gradient(90deg, rgba(201, 168, 76, 0.28) 0%, transparent 58%);
}

.articles-hero__inner {
  position: relative;
  z-index: 2;
  padding: 48px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.articles-crumb {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
}

.articles-crumb a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}

.articles-crumb a:hover {
  color: var(--ai-gold);
}

.articles-hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.articles-hero__rule {
  display: block;
  width: 64px;
  height: 3px;
  margin: 14px auto 16px;
  background: var(--ai-gold);
  border-radius: 2px;
}

.articles-hero__lede {
  margin: 0;
  max-width: 36em;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.02rem;
  line-height: 1.8;
}

.articles-body {
  background: var(--ai-mist);
  padding: 32px 0 64px;
}

.articles-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

/* Mobile: horizontal scroll rail (App Store / news pattern) — no chip chaos */
@media (max-width: 719px) {
  .articles-filters-wrap {
    position: relative;
    margin: 0 -16px 18px;
    padding: 0 16px;
  }

  .articles-filters-wrap::before,
  .articles-filters-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    z-index: 1;
  }

  .articles-filters-wrap::before {
    inset-inline-start: 0;
    background: linear-gradient(90deg, var(--ai-mist) 0%, transparent 100%);
  }

  .articles-filters-wrap::after {
    inset-inline-end: 0;
    background: linear-gradient(270deg, var(--ai-mist) 0%, transparent 100%);
  }

  html[dir="rtl"] .articles-filters-wrap::before {
    background: linear-gradient(270deg, var(--ai-mist) 0%, transparent 100%);
  }

  html[dir="rtl"] .articles-filters-wrap::after {
    background: linear-gradient(90deg, var(--ai-mist) 0%, transparent 100%);
  }

  .articles-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    margin: 0;
    padding: 4px 2px 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .articles-filters::-webkit-scrollbar {
    display: none;
  }

  .articles-filters__chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 0.84rem;
    box-shadow: 0 2px 8px rgba(11, 31, 51, 0.04);
  }

  .articles-filters__chip.is-active {
    box-shadow: 0 4px 14px rgba(201, 168, 76, 0.22);
  }

  .articles-summary {
    margin-top: 0;
  }
}

@media (min-width: 720px) {
  .articles-filters-wrap {
    margin: 0 0 18px;
  }
}

.articles-filters__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ai-line);
  background: #fff;
  color: var(--ai-ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.articles-filters__chip:hover,
.articles-filters__chip.is-active {
  border-color: rgba(201, 168, 76, 0.55);
  background: rgba(201, 168, 76, 0.12);
  color: var(--ai-ink);
}

.articles-filters__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(11, 31, 51, 0.06);
  font-size: 0.78rem;
  font-weight: 800;
}

.articles-summary {
  margin: 0 0 18px;
  color: var(--ai-muted);
  font-size: 0.9rem;
}

.articles-empty {
  margin: 0;
  text-align: center;
  color: var(--ai-muted);
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

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

@media (min-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

.articles-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--ai-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(11, 31, 51, 0.05);
}

.articles-card__media {
  display: block;
  background: #0b1f33;
}

.articles-card__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.articles-card__body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding: 18px 20px 20px;
}

.articles-card__kicker {
  margin: 0;
  color: #6b5329;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
}

.articles-card__title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
}

.articles-card__title a {
  display: inline;
  color: var(--ai-ink);
  text-decoration: none;
}

.articles-card__title a:hover {
  color: #6b5329;
}

.articles-card__excerpt {
  margin: 0;
  color: var(--ai-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.articles-card__more {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--ai-gold);
  color: #0b1f33;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.articles-card__more:hover {
  filter: brightness(1.06);
  color: #0b1f33;
}

.articles-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
}

.articles-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--ai-line);
  background: #fff;
  color: var(--ai-ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.articles-pagination__btn:hover {
  border-color: rgba(201, 168, 76, 0.55);
  background: rgba(201, 168, 76, 0.1);
}

.articles-pagination__status {
  color: var(--ai-muted);
  font-size: 0.9rem;
  font-weight: 600;
}
