:root {
  --font-amiri: "Amiri", "Times New Roman", serif;
  --font-plex: "IBM Plex Sans Arabic", "Geeza Pro", "Noto Naskh Arabic", Tahoma, sans-serif;
  --bg: #f0f2f5;
  --ink: #050505;
  --muted: #65676b;
  --line: #dddfe2;
  --red: #1877f2;
  --card: #ffffff;
  --header: #1877f2;
  --header-text: #ffffff;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-plex), "Geeza Pro", "Noto Naskh Arabic", Tahoma, sans-serif;
  font-size: 1.02rem;
  line-height: 1.7;
}

a { color: inherit; }

.wrap {
  width: min(68rem, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  background: var(--header);
  color: var(--header-text);
}

.topbar-inner {
  padding: 1.15rem 0 1.25rem;
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.edition {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  white-space: nowrap;
}

.brand {
  margin: 0;
  font-family: var(--font-amiri), "Amiri", serif;
  font-size: clamp(3rem, 7vw, 4.4rem);
  font-weight: 700;
  line-height: 1;
}

.brand a { text-decoration: none; }

.dek {
  margin: 0.35rem 0 0;
  max-width: 40rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

.nav-wrap {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0;
}

.nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.18rem 0.62rem;
  border-radius: 999px;
}

.nav a:hover { background: #e7f3ff; }

.nav a[aria-current="page"] {
  background: var(--red);
  color: var(--header-text);
}

main.wrap { padding: 1.35rem 0 3rem; }

.page-head { margin: 0 0 1rem; }

.page-head h1,
.section-title {
  margin: 0;
  font-family: var(--font-amiri), "Amiri", serif;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.2;
  font-weight: 700;
}

.section-title { margin-bottom: 0.85rem; }

.sources-line {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.sources-line a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.lead {
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 0.9rem;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.lead.has-photo {
  display: flex;
  flex-direction: column;
}

.lead-body { padding: 1.15rem 1.25rem 1.3rem; }

.lead h2 {
  margin: 0.2rem 0 0.45rem;
  font-family: var(--font-amiri), "Amiri", serif;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  font-weight: 700;
  line-height: 1.35;
}

.lead h2 a,
.card h2 a { text-decoration: none; }

.lead h2 a:hover,
.card h2 a:hover { color: var(--red); }

.lead-photo {
  order: -1;
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: #e4e6eb;
  display: block;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 7.2rem;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card.has-photo,
.card:has(.card-photo) {
  display: grid;
  grid-template-columns: 7.25rem 1fr;
}

.card-photo {
  width: 7.25rem;
  height: 100%;
  min-height: 7.2rem;
  object-fit: cover;
  background: #e4e6eb;
  display: block;
}

.card-body { padding: 0.7rem 0.85rem 0.8rem; }

.card h2 {
  margin: 0.1rem 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
}

.meta {
  margin: 0;
  color: var(--red);
  font-size: 0.8rem;
}

.meta a { text-decoration: none; font-weight: 600; }
.meta a:hover { text-decoration: underline; }

.excerpt {
  margin: 0;
  color: #1c1e21;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .excerpt {
  -webkit-line-clamp: 2;
  font-size: 0.92rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.crumbs a { color: var(--ink); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.story-layout {
  display: grid;
  gap: 1.75rem;
  align-items: start;
  padding-top: 0.4rem;
}

.article {
  min-width: 0;
}

.rail h2,
.related h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--red);
  font-family: var(--font-amiri), "Amiri", serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-list li {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.rail-list a {
  color: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.45;
  text-decoration: none;
}

.rail-list a:hover { text-decoration: underline; }

.rail-photo {
  width: 4.6rem;
  height: 3.5rem;
  object-fit: cover;
  background: #e4e6eb;
  display: block;
}

.related { margin-top: 2.2rem; }

.related-list {
  display: grid;
  gap: 0.75rem;
}

.related-card {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  min-height: 5.2rem;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.related-card strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.related-card:hover strong { color: var(--red); }

.related-photo {
  width: 6.4rem;
  height: 100%;
  min-height: 5.2rem;
  object-fit: cover;
  background: #e4e6eb;
  display: block;
}

.article-title {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-amiri), "Amiri", serif;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.35;
  font-weight: 700;
}

.article-photo {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  display: block;
  margin: 0.9rem 0 0.2rem;
  background: #e4e6eb;
  border-radius: 8px;
}

.article-excerpt {
  margin: 1rem 0 0;
  font-size: 1.16rem;
  line-height: 1.9;
}

.missing { color: var(--muted); }

.original {
  margin-top: 2rem;
  padding: 1.1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem 1.2rem;
}

.original p { margin: 0; }

.original .button {
  background: var(--red);
  color: var(--header-text);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  padding: 0.7rem 1rem;
}

.original .button:hover { background: #166fe5; }

.url {
  margin-top: 0.7rem !important;
  width: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  direction: ltr;
  text-align: left;
  word-break: break-all;
}

.empty { padding: 2rem 0; color: var(--muted); }

.footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner { padding: 1.3rem 0 1.6rem; }

.footer strong { color: var(--ink); font-weight: 600; }

@media (min-width: 720px) {
  .lead.has-photo {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
  }
  .lead-photo { order: 0; height: 100%; min-height: 280px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .related-list { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 980px) {
  .story-layout {
    grid-template-columns: 19rem minmax(0, 1fr);
  }
  .rail {
    position: sticky;
    top: 4.4rem;
    order: -1;
  }
}

@media (max-width: 640px) {
  .wrap { width: min(100% - 1.25rem, 68rem); }
  .card.has-photo,
  .card:has(.card-photo) { grid-template-columns: 5.6rem 1fr; }
  .card-photo { width: 5.6rem; }
}
