/* ============================================================
   Global Medical Group — الدليل الصحي (Health Guide)
   Article + index components. Loaded IN ADDITION to style.css.
   Reuses the dark teal / gold design tokens from style.css.
   RTL-first, logical properties.
   ============================================================ */

/* ---------- Reading progress bar (fixed, top) ---------- */
.read-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 3px;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}
.read-progress > span {
  display: block;
  block-size: 100%;
  inline-size: 0;
  background: var(--gold-surface);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.5);
  transition: inline-size 0.08s linear;
}

/* ---------- Draft / review badge ---------- */
.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-ar);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--gold-300);
  background: rgba(201, 162, 39, 0.10);
  border: 1px solid rgba(201, 162, 39, 0.35);
}
html[lang="en"] .draft-badge { font-family: var(--font-en); }
.draft-badge::before { content: "🔶"; font-size: 0.9em; }

/* ---------- Article meta row (dept · reading time · updated) ---------- */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-block-start: var(--space-2);
  color: var(--text-low);
  font-size: 0.9rem;
}
.article-meta .am-item { display: inline-flex; align-items: center; gap: 7px; }
.article-meta svg { inline-size: 16px; block-size: 16px; opacity: 0.8; }
.article-meta .am-dep {
  color: var(--brand-100);
  background: var(--glass);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
}

/* ---------- Two-column article layout (content + sticky TOC) ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}
@media (min-width: 980px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .article-layout .article-main { order: 1; }
  .article-layout .article-aside { order: 2; }
}

/* ---------- Table of contents ---------- */
.article-toc {
  position: sticky;
  inset-block-start: 90px;
  background: var(--bg-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-2);
  box-shadow: var(--shadow-sm);
}
.article-toc .toc-title {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--text-hi);
  font-size: 0.95rem;
  margin-block-end: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.article-toc .toc-title svg { inline-size: 18px; block-size: 18px; color: var(--gold-400); }
.article-toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.article-toc li { counter-increment: toc; margin: 2px 0; }
.article-toc a {
  display: block;
  padding: 7px 12px;
  border-radius: 10px;
  color: var(--text-mid);
  font-size: 0.92rem;
  line-height: 1.55;
  border-inline-start: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.article-toc a::before {
  content: counter(toc) ". ";
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}
.article-toc a:hover { color: var(--text-hi); background: var(--glass); }
.article-toc a.active {
  color: var(--gold-300);
  background: rgba(201, 162, 39, 0.08);
  border-inline-start-color: var(--gold-500);
}
@media (max-width: 979px) {
  .article-toc { position: static; inset-block-start: auto; }
}

/* ---------- Article body typography ---------- */
.article-body { max-inline-size: 74ch; }
.article-body > h2 {
  margin-block: var(--space-4) var(--space-2);
  scroll-margin-block-start: 96px;
  position: relative;
  padding-inline-start: 16px;
}
.article-body > h2::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 0.28em 0.18em;
  inline-size: 4px;
  border-radius: 4px;
  background: var(--gold-surface);
}
.article-body > h3 { margin-block: var(--space-3) var(--space-1); color: var(--brand-100); }
.article-body p { margin-block-end: var(--space-2); }
.article-body ul, .article-body ol { margin: 0 0 var(--space-2); padding-inline-start: 1.4em; }
.article-body ul { list-style: none; padding-inline-start: 0; }
.article-body ul > li {
  position: relative;
  padding-inline-start: 26px;
  margin-block-end: 10px;
}
.article-body ul > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  inset-block-start: 0.62em;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}
.article-body ol { padding-inline-start: 1.3em; }
.article-body ol > li { margin-block-end: 10px; padding-inline-start: 6px; }
.article-body ol > li::marker { color: var(--gold-400); font-weight: 700; }
.article-body strong { color: var(--text-hi); font-weight: 700; }

/* Key-fact callout inside body */
.article-note {
  background: var(--bg-850);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--brand-500);
  border-radius: 14px;
  padding: var(--space-2);
  margin-block: var(--space-2);
  color: var(--text-mid);
}
.article-note strong { color: var(--brand-100); }

/* ---------- Triage box: متى تراجع الطبيب؟ ---------- */
.triage-box {
  background: linear-gradient(180deg, var(--bg-900), var(--bg-850));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-block: var(--space-4);
  box-shadow: var(--shadow-sm);
  scroll-margin-block-start: 96px;
}
.triage-box > h2 { margin: 0 0 6px; padding: 0; }
.triage-box > h2::before { display: none; }
.triage-head-sub { color: var(--text-low); font-size: 0.92rem; margin-block-end: var(--space-2); }
.triage-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  padding: var(--space-2);
  border-radius: 16px;
  border: 1px solid var(--line);
  margin-block-end: 12px;
  background: var(--glass);
}
.triage-row:last-of-type { margin-block-end: 0; }
.triage-dot {
  inline-size: 44px;
  block-size: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}
.triage-row h3 { font-size: 1.02rem; margin: 2px 0 6px; color: var(--text-hi); }
.triage-row p { margin: 0 0 8px; font-size: 0.95rem; }
.triage-row ul { margin: 0; padding: 0; list-style: none; }
.triage-row li { position: relative; padding-inline-start: 20px; margin-block-end: 6px; font-size: 0.94rem; }
.triage-row li::before {
  content: "";
  position: absolute; inset-inline-start: 2px; inset-block-start: 0.6em;
  inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; opacity: 0.6;
}
.triage-red    { border-color: rgba(239, 116, 102, 0.45); }
.triage-red    .triage-dot { background: rgba(239, 116, 102, 0.15); }
.triage-red    h3 { color: #ff9384; }
.triage-amber  { border-color: rgba(220, 187, 85, 0.45); }
.triage-amber  .triage-dot { background: rgba(220, 187, 85, 0.15); }
.triage-amber  h3 { color: var(--gold-300); }
.triage-green  { border-color: rgba(111, 207, 151, 0.40); }
.triage-green  .triage-dot { background: rgba(111, 207, 151, 0.14); }
.triage-green  h3 { color: var(--success); }
.triage-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: var(--space-2); }

/* ---------- In-article booking CTA ---------- */
.article-cta {
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(201, 162, 39, 0.10), transparent 60%),
    var(--bg-900);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-block: var(--space-4);
  text-align: center;
}
.article-cta h2 { margin: 0 0 8px; padding: 0; }
.article-cta h2::before { display: none; }
.article-cta p { margin: 0 auto var(--space-2); max-inline-size: 52ch; }
.article-cta .cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- FAQ (details/summary) ---------- */
.faq-list { margin-block: var(--space-2); }
.faq-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-850);
  margin-block-end: 12px;
  overflow: hidden;
}
.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-2);
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--text-hi);
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
html[lang="en"] .faq-item > summary { font-family: var(--font-en); }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "";
  inline-size: 11px; block-size: 11px;
  border-inline-end: 2px solid var(--gold-400);
  border-block-end: 2px solid var(--gold-400);
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex: 0 0 auto;
}
.faq-item[open] > summary::after { transform: rotate(-135deg); }
.faq-item > .faq-a { padding: 0 var(--space-2) var(--space-2); color: var(--text-mid); }
.faq-item > .faq-a p { margin: 0; }

/* ---------- Disclaimer ---------- */
.article-disclaimer {
  color: var(--text-low);
  font-size: 0.88rem;
  border-block-start: 1px solid var(--line);
  padding-block-start: var(--space-2);
  margin-block-start: var(--space-3);
}

/* ============================================================
   Index page (articles.html) — filter + card grid
   ============================================================ */
.guide-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-block-end: var(--space-3);
}
.guide-search {
  position: relative;
  flex: 1 1 260px;
  max-inline-size: 340px;
}
.guide-search input {
  inline-size: 100%;
  padding: 12px 44px 12px 16px;
  background: var(--bg-850);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-hi);
  font-family: inherit;
  font-size: 0.95rem;
}
html[dir="ltr"] .guide-search input { padding: 12px 16px 12px 44px; }
.guide-search input:focus { outline: none; border-color: var(--gold-500); }
.guide-search svg {
  position: absolute;
  inset-inline-end: 16px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  inline-size: 18px; block-size: 18px;
  color: var(--text-low);
  pointer-events: none;
}
html[dir="ltr"] .guide-search svg { inset-inline-end: auto; inset-inline-start: 16px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text-mid);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.filter-chip:hover { color: var(--text-hi); border-color: var(--line-strong); }
.filter-chip.active {
  color: var(--bg-950);
  background: var(--gold-surface);
  border-color: transparent;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-3);
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--space-3);
  background: var(--bg-850);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.guide-card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.guide-card .gc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guide-card .gc-dep {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-100);
  background: var(--glass);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: 999px;
}
.guide-card h3 { font-size: 1.16rem; line-height: 1.5; color: var(--text-hi); }
.guide-card h3 a { display: block; }
.guide-card h3 a:hover { color: var(--gold-300); }
.guide-card p { font-size: 0.95rem; color: var(--text-mid); flex: 1 0 auto; }
.guide-card .gc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-block-start: 1px solid var(--line);
  padding-block-start: 14px;
  color: var(--text-low);
  font-size: 0.88rem;
}
.guide-card .gc-read { color: var(--gold-300); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.guide-card .gc-read svg { inline-size: 16px; block-size: 16px; }
.guide-card .gc-time { display: inline-flex; align-items: center; gap: 6px; }
.guide-card .gc-time svg { inline-size: 15px; block-size: 15px; }

.guide-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-low);
  padding: var(--space-5) var(--space-2);
}
/* JS toggles the [hidden] attribute; ensure it beats the flex/grid display rules. */
.guide-card[hidden],
.guide-empty[hidden] { display: none !important; }

/* small draft dot for cards */
.gc-draft {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-300);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.gc-draft::before { content: "🔶"; font-size: 0.85em; }

/* --------------------------------------------------------------------------
   Clinic working hours (CTA card + guide index hero)
   -------------------------------------------------------------------------- */
.article-hours {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-mid);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.article-hours svg {
  inline-size: 18px;
  block-size: 18px;
  flex: 0 0 auto;
  margin-block-start: 3px;
  color: var(--gold-300);
}

/* Emergency / 24h note inside the red triage row */
.triage-note {
  margin-block-start: 6px;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-mid);
}
.triage-note strong { color: var(--text-hi); }
