/* ==========================================================================
   Sadeed — مركز المعرفة (articles hub + article template)
   Extends styles.css. Loaded AFTER it, so it only adds; it never rewrites
   the landing page. Same tokens, same shell (.sheet / .wrap / .footer).

   Two deliberate departures from the landing sheet, both defect fixes:
   1. --ink-3 is darkened here. The landing value (#7c8885) measures 3.67:1
      on white and fails WCAG AA for body text; long-form reading is exactly
      where that hurts most.
   2. Nothing is gated behind a JS reveal class. On the landing, .reveal
      leaves 27 elements at opacity:0 until an observer fires, so the page
      ships blank without JS. Articles must be readable as plain HTML —
      that is also what makes them legible to crawlers and LLMs.
   ========================================================================== */

.hub, .art-page {
  /* 5.56:1 on white — was 3.67:1 */
  --ink-3: #5f6b68;
  --rule: #e6ecea;

  /* --teal (#6ba8a4) and --teal-dark (#4a8b87) are brand *surface* colors.
     Neither is legible as small text on white (3.94:1) nor as a button fill
     under white text (2.71:1). These two are the readable pair; the brand
     hue is unchanged, only the lightness. */
  --teal-ink: #2f625e;   /* 7.0:1 on white — teal text and links */
  --teal-btn: #3a736e;   /* 5.5:1 under white text — filled buttons */
}

/* ── shared page furniture ────────────────────────────────────────────── */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--teal-ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs li { display: flex; align-items: center; gap: 8px; }
.crumbs li + li::before { content: "/"; color: var(--ink-3); opacity: 0.6; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; padding: 0; }

/* category label — 4.9:1 on its own tint, unlike the landing's .tag (1.68:1) */
.cat {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--teal-wash);
  color: #2f625e;
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.cat::before {
  content: "";
  inline-size: 5px;
  block-size: 5px;
  border-radius: 50%;
  background: var(--teal-ink);
  flex: none;
}

/* dot-separated metadata: date · read time */
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.84rem;
  color: var(--ink-3);
}
.meta > * + *::before {
  content: "·";
  margin-inline-end: 10px;
  opacity: 0.55;
}

/* text link that reads as an action without becoming a button */
.readmore {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-block-size: 44px;
  color: var(--teal-ink);
  font-weight: 700;
  font-size: 0.94rem;
}
.readmore svg { inline-size: 15px; flex: none; transition: translate 0.18s ease; }
.readmore:hover { color: #2f625e; }
.readmore:hover svg { translate: -4px 0; }

/* ══ hub hero ═══════════════════════════════════════════════════════════ */
.hub-hero {
  padding-block: clamp(38px, 6vw, 76px) clamp(34px, 5vw, 60px);
  border-block-end: 1px solid var(--rule);
}
.hub-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--teal-wash);
  color: #2f625e;
  font-size: 0.85rem;
  font-weight: 700;
}
.hub-badge svg { inline-size: 15px; flex: none; }
.hub-hero h1 {
  margin-block-start: 20px;
  max-inline-size: 19ch;
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem);
  font-weight: 900;
  line-height: var(--lh-display);
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.hub-hero .lede { margin-block-start: 18px; max-inline-size: 58ch; }
.hub-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 30px; }
.btn-teal { background: var(--teal-btn); color: #fff; box-shadow: var(--shadow-pill); }
.btn-teal:hover { background: var(--teal-ink); transform: translateY(-2px); }
.btn-line { border: 1px solid rgb(107 168 164 / 42%); color: var(--ink); }
.btn-line:hover { background: var(--teal-wash); border-color: var(--teal); }

/* ══ section rhythm — no repeated kicker above every heading ════════════ */
.hub-section { padding-block: clamp(46px, 6vw, 78px); }
.hub-section + .hub-section { border-block-start: 1px solid var(--rule); }
.hub-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.hub-head h2 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); }
.hub-head p { margin-block-start: 10px; max-inline-size: 52ch; color: var(--ink-2); }
.hub-head .meta { padding-block-end: 6px; }

/* ══ featured ═══════════════════════════════════════════════════════════ */
.feat {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(26px, 4vw, 54px);
  align-items: center;
  margin-block-start: clamp(26px, 3vw, 38px);
  padding: clamp(24px, 3vw, 40px);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--teal-wash), #fbfdfc 62%, #fff);
  border: 1px solid rgb(107 168 164 / 20%);
}
.feat h3 {
  margin-block-start: 14px;
  font-size: clamp(1.35rem, 1.05rem + 1.5vw, 2.05rem);
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.feat p { margin-block-start: 14px; color: var(--ink-2); max-inline-size: 46ch; }
.feat .meta { margin-block-start: 16px; }
.feat .readmore { margin-block-start: 6px; }

/* Featured image sits opposite the copy; the takeaways strip spans beneath
   both, so the block reads as one unit rather than three stacked ones. */
.feat-art {
  border-radius: 13px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--teal-wash);
}
.feat-art img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.feat > .feat-points { grid-column: 1 / -1; }
.feat-points { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: start; }
.feat-points > strong { grid-column: 1 / -1; }

.feat-points {
  display: grid;
  gap: 12px;
  padding: clamp(20px, 2.4vw, 28px);
  border-radius: 14px;
  background: rgb(255 255 255 / 88%);
  border: 1px solid rgb(107 168 164 / 16%);
}
.feat-points strong { display: block; font-size: 0.86rem; color: var(--ink-3); font-weight: 700; }
.feat-points li { display: flex; align-items: start; gap: 11px; color: var(--ink-2); font-size: 0.95rem; line-height: 1.7; }
.feat-points svg { inline-size: 17px; flex: none; margin-block-start: 6px; color: var(--teal-ink); }

/* ══ topics ═════════════════════════════════════════════════════════════ */
/* 280px not 230px: at five topics, a 230px track fits four per row on the
   1180px sheet and orphans the fifth. 280px lands 3+2, which reads as two
   deliberate rows instead of a leftover. */
.topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-block-start: clamp(26px, 3vw, 36px);
}
.topic {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}
.topic:hover { border-color: rgb(107 168 164 / 45%); background: #fcfefd; }
.topic-mark {
  display: grid;
  place-items: center;
  inline-size: 38px;
  block-size: 38px;
  border-radius: 11px;
  background: var(--teal-wash);
  color: var(--teal-ink);
}
.topic-mark svg { inline-size: 19px; }
.topic h3 { font-size: 1.02rem; line-height: 1.5; }
.topic p { font-size: 0.9rem; color: var(--ink-3); line-height: 1.7; }
.topic-count { margin-block-start: auto; font-size: 0.82rem; font-weight: 700; color: var(--teal-ink); }

/* ══ article grid ═══════════════════════════════════════════════════════ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: clamp(18px, 2.4vw, 26px);
  margin-block-start: clamp(26px, 3vw, 38px);
}
.card {
  --card-pad: clamp(20px, 2.2vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--card-pad);
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: #fff;
  transition: border-color 0.2s, transform 0.2s;
}

/* The image bleeds to the card edge by cancelling the card's own padding, so
   the padding stays a single source of truth. 13px, not 14px, because the
   1px border sits outside the radius. */
.card-art {
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 4px;
  border-start-start-radius: 13px;
  border-start-end-radius: 13px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--teal-wash);
}
.card-art img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transition: scale 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.card:hover .card-art img { scale: 1.04; }
.card:hover { border-color: rgb(107 168 164 / 45%); transform: translateY(-3px); }
.card h3 { font-size: 1.12rem; line-height: 1.55; text-wrap: balance; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card p { color: var(--ink-2); font-size: 0.94rem; line-height: 1.75; }
.card .meta { margin-block-start: auto; padding-block-start: 4px; }
.card .readmore { min-block-size: 0; }

/* ══ guides list ════════════════════════════════════════════════════════ */
.guides { display: grid; gap: 2px; margin-block-start: clamp(22px, 3vw, 32px); }
.guide {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
  border-block-end: 1px solid var(--rule);
  transition: background 0.18s;
}
.guide:hover { background: #fbfdfc; }
.guide:last-child { border-block-end: 0; }
.guide-n { font-size: 0.9rem; font-weight: 900; color: var(--teal-ink); min-inline-size: 22px; }
.guide h3 { font-size: 1rem; line-height: 1.6; }
.guide h3 a::after { content: ""; position: absolute; inset: 0; }
.guide p { margin-block-start: 3px; font-size: 0.88rem; color: var(--ink-3); line-height: 1.65; }
.guide svg { inline-size: 16px; color: var(--ink-3); flex: none; }
.guide:hover svg { color: var(--teal-ink); }

/* ══ suggest-a-topic ════════════════════════════════════════════════════ */
.suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-block: clamp(46px, 6vw, 72px) 0;
  padding: clamp(26px, 3.4vw, 42px);
  border-radius: 16px;
  background: var(--teal-wash);
}
.suggest h2 { font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.75rem); max-inline-size: 20ch; }
.suggest p { margin-block-start: 10px; color: var(--ink-2); max-inline-size: 44ch; }

/* ══ article page ═══════════════════════════════════════════════════════ */
.art { max-inline-size: 46rem; margin-inline: auto; padding-block: clamp(24px, 4vw, 44px) clamp(48px, 7vw, 84px); }
.art-head { padding-block-end: clamp(24px, 3vw, 34px); border-block-end: 1px solid var(--rule); }
.art-head h1 {
  margin-block-start: 16px;
  font-size: clamp(1.85rem, 1.25rem + 2.6vw, 2.9rem);
  font-weight: 900;
  line-height: var(--lh-display);
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.art-head .lede { margin-block-start: 16px; max-inline-size: 100%; }
.art-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-block-start: 22px;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.art-byline b { color: var(--ink-2); font-weight: 700; }
.art-byline .dot { opacity: 0.5; }

/* lead image — sized by aspect-ratio so it reserves its space before load */
.art-hero {
  margin-block-start: clamp(26px, 3vw, 36px);
}
.art-hero img {
  inline-size: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: var(--teal-wash);
}
.art-hero figcaption {
  margin-block-start: 10px;
  font-size: 0.82rem;
  color: var(--ink-3);
}
.art-hero figcaption a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.art-hero figcaption a:hover { color: var(--teal-ink); }

/* Unsplash asks for a credit wherever a photo appears. On a card grid a
   caption per card is noise, so the hub credits them once, here. */
.photo-credits {
  margin-block-start: clamp(30px, 4vw, 44px);
  padding-block-start: 18px;
  border-block-start: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.9;
}
.photo-credits a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.photo-credits a:hover { color: var(--teal-ink); }

/* table of contents */
.toc {
  margin-block-start: clamp(26px, 3vw, 36px);
  padding: 20px 22px;
  border-radius: 14px;
  background: #fafcfb;
  border: 1px solid var(--rule);
}
.toc > strong { display: block; font-size: 0.86rem; color: var(--ink-3); font-weight: 700; }
.toc ol { margin-block-start: 12px; padding-inline-start: 1.2em; display: grid; gap: 9px; }
.toc li { color: var(--ink-2); line-height: 1.6; }
.toc li::marker { color: var(--teal-ink); font-weight: 700; }
.toc a { color: var(--ink-2); }
.toc a:hover { color: var(--teal-ink); text-decoration: underline; text-underline-offset: 3px; }

/* long-form body */
.art-body { margin-block-start: clamp(30px, 4vw, 44px); }
.art-body > section + section { margin-block-start: clamp(34px, 4vw, 48px); }
.art-body h2 {
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem);
  font-weight: 900;
  line-height: 1.45;
  letter-spacing: -0.008em;
  /* scroll-margin keeps the TOC anchors clear of the top edge */
  scroll-margin-block-start: 24px;
}
.art-body h3 { margin-block-start: 26px; font-size: 1.08rem; font-weight: 700; line-height: 1.6; }
.art-body p { margin-block-start: 16px; color: var(--ink-2); max-inline-size: 68ch; text-wrap: pretty; }
.art-body a:not(.btn):not(.readmore) {
  color: var(--teal-ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.art-body ul, .art-body ol {
  margin-block-start: 16px;
  padding-inline-start: 1.25em;
  display: grid;
  gap: 10px;
  color: var(--ink-2);
  list-style: disc;
}
.art-body ol { list-style: decimal; }
.art-body li { line-height: 1.8; max-inline-size: 66ch; }
.art-body li::marker { color: var(--teal-ink); }
.art-body strong { color: var(--ink); font-weight: 700; }

/* a pulled-out practical note — the one decorated block, used sparingly */
.note {
  margin-block-start: 22px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--teal-wash);
}
.note p { margin-block-start: 0; color: var(--ink-2); }
.note p + p { margin-block-start: 10px; }
.note b { color: var(--ink); }

/* comparison table for long-form: scrolls inside itself, never the page */
.table-scroll { margin-block-start: 20px; overflow-x: auto; border-radius: 12px; border: 1px solid var(--rule); }
.art-body table { inline-size: 100%; border-collapse: collapse; font-size: 0.93rem; min-inline-size: 400px; }
.art-body th, .art-body td { padding: 13px 16px; text-align: start; border-block-end: 1px solid var(--rule); }
.art-body th { background: #fafcfb; font-weight: 700; color: var(--ink); }
.art-body td { color: var(--ink-2); line-height: 1.7; }
.art-body tr:last-child td { border-block-end: 0; }

/* end-of-article CTA */
.art-cta {
  margin-block-start: clamp(40px, 5vw, 60px);
  padding: clamp(26px, 3.4vw, 40px);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--teal-wash), #fbfdfc);
  border: 1px solid rgb(107 168 164 / 20%);
  text-align: center;
}
.art-cta h2 { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.6rem); max-inline-size: 24ch; margin-inline: auto; }
.art-cta p { margin-block-start: 12px; color: var(--ink-2); max-inline-size: 46ch; margin-inline: auto; }
.art-cta .btn { margin-block-start: 22px; }

/* related */
.related { margin-block-start: clamp(44px, 5vw, 64px); padding-block-start: clamp(30px, 4vw, 42px); border-block-start: 1px solid var(--rule); }
.related h2 { font-size: clamp(1.2rem, 1.05rem + 0.8vw, 1.5rem); }
.related .cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .feat { grid-template-columns: 1fr; }
  .hub-head { align-items: start; }
}
@media (max-width: 720px) {
  .hub-actions .btn { flex: 1 1 100%; justify-content: center; }
  .guide { grid-template-columns: auto 1fr; gap: 12px; }
  .guide > svg { display: none; }
  .suggest { flex-direction: column; align-items: stretch; }
  .suggest .btn { justify-content: center; }
  .toc { padding: 18px; }
}

/* ── motion: enhancement only, never a visibility gate ────────────────── */
@media (prefers-reduced-motion: reduce) {
  .card, .topic, .readmore svg, .guide, .studio-arrow { transition: none; }
  .card:hover { transform: none; }
}
