/* مرصد الاقتصاد — self-hosted Tajawal, RTL editorial layout.
   Palette and rules are fixed by spec — no colour outside the approved
   token set below appears anywhere in this file. The card border colour
   encodes SOURCE TYPE only (news/policy/macro), never impact or sentiment. */

/* ---- self-hosted Tajawal (400/500/700), Arabic + Latin subsets ---- */
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Tajawal-400-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Tajawal-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Tajawal-500-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Tajawal-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/Tajawal-700-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/Tajawal-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F;
}

/* ---- palette (exact hex, no substitutions) + type scale ---- */
:root {
  --bg: #0D1B2A;
  --card: #16324D;
  --text: #F5F1E8;
  --text-secondary: #8FA3B8;
  --accent: #D4AF37;
  --accent-dark: #A8862A;
  --neutral: #6B7A8C;

  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: 2.75rem;

  --content-width: 720px;
  --grid-width: 1100px;
  --side-padding: 1.25rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  font-weight: 400;
  font-size: var(--step-0);
  line-height: 1.9;
  min-width: 320px;
}

a { color: var(--text); text-decoration: none; }

h1, h2 { font-weight: 700; line-height: 1.5; margin: 0; }

/* Eyebrow label: small, letter-spaced, above every section. Arabic is a
   joining script — a wide Latin-style tracking value reads as broken, so
   this is a deliberately light touch of the same idea, not 0.08em+. */
.eyebrow {
  font-size: var(--step--1);
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  font-weight: 500;
  margin: 0 0 0.6rem;
}

/* Western digits (macro stat values) need true LTR isolation. */
.ltr-num { unicode-bidi: isolate; direction: ltr; display: inline-block; }
/* Eastern Arabic-Indic digits (dates/relative time) read correctly inside
   RTL flow natively — only isolate them from neighbouring text, don't force
   direction (that would visually reverse an Indic-digit number). */
.num-isolate { unicode-bidi: isolate; display: inline-block; }

/* ---- header / wordmark ---- */
.site-header {
  max-width: var(--grid-width);
  margin: 0 auto;
  padding: 1.1rem var(--side-padding);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(143, 163, 184, 0.15);
}

.wordmark {
  display: flex;
  flex-direction: column;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid rgba(212, 175, 55, 0.4); /* accent, ~40% opacity, wordmark only */
}

.wordmark-main {
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--text);
  line-height: 1.2;
}

.wordmark-sub {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.site-nav { display: flex; gap: 1.4rem; font-size: var(--step--1); }

.site-nav a {
  color: var(--text-secondary);
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
}
.site-nav a.active,
.site-nav a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---- horizontal rule, newspaper style ---- */
hr.rule {
  border: none;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  max-width: var(--grid-width);
  margin: 0 auto;
}

main {
  max-width: var(--grid-width);
  margin: 0 auto;
  padding: 0 var(--side-padding) 3rem;
}

/* ---- ZONE A: hero (compact, <=45vh desktop) ---- */
.hero {
  max-width: var(--content-width);
  padding: 2.5rem 0 1.75rem;
  max-height: 45vh;
}

.hero h1 { font-size: var(--step-4); margin: 0 0 0.75rem; }

.hero-lede {
  color: var(--text-secondary);
  font-size: var(--step-1);
  line-height: 1.6;
  max-width: 60ch;
  margin: 0 0 1.1rem;
}

.hero-pills {
  color: var(--neutral);
  font-size: var(--step--1);
  margin: 0;
}
.pill-sep { margin: 0 0.5em; color: rgba(107, 122, 140, 0.6); }

.hero-rule { opacity: 0.3; margin-bottom: 2.5rem; }

/* ---- ZONE B: feed ---- */
.feed-zone { padding-bottom: 1rem; }

.notice-card {
  max-width: var(--content-width);
  background: var(--card);
  border-radius: 8px;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--step-1);
}

/* < 5 items: single column, generous spacing, no lead */
.feed-list {
  max-width: var(--content-width);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* >= 5 items: one full-width lead + 2-column grid below */
.feed-lead-grid { max-width: var(--grid-width); }

.card-lead { margin-bottom: 2.5rem; }
.card-lead .card-title { font-size: var(--step-3); }
.card-lead .card-body { font-size: var(--step-1); }

.feed-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}
@media (min-width: 720px) {
  .feed-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem 2rem; }
}

/* ---- CARD (the core unit) ---- */
.card {
  background: var(--card);
  border-radius: 8px;
  padding: 1.75rem;
  border-inline-start: 3px solid var(--neutral); /* default; overridden per pipeline below */
  min-width: 0;
}
.card[data-pipeline="news"]   { border-inline-start-color: var(--accent); }
.card[data-pipeline="policy"] { border-inline-start-color: var(--text-secondary); }
.card[data-pipeline="macro"]  { border-inline-start-color: var(--neutral); }

/* 1. meta row */
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--step--1);
  color: var(--neutral);
  margin-bottom: 0.6rem;
}
.meta-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge {
  display: inline-block;
  font-size: var(--step--1);
  color: var(--neutral);
  border: 1px solid rgba(107, 122, 140, 0.5);
  border-radius: 3px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}
.meta-time { flex-shrink: 0; }

/* 2. title */
.card-title {
  font-size: var(--step-2);
  line-height: 1.5;
  margin: 0 0 0.6rem;
  color: var(--text);
}

/* 3. body + CSS-only clamp/expand (checkbox hack, no JS) */
.body-toggle { display: none; }

.card-body {
  color: var(--text-secondary);
  font-size: var(--step-0);
  line-height: 1.9;
  margin: 0;
}
.card-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.body-toggle:checked ~ .card-body.clamp {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.body-toggle-label {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--accent);
  font-size: var(--step--1);
  cursor: pointer;
  border-bottom: 1px solid rgba(212, 175, 55, 0.4);
}
.body-toggle-label:hover { color: var(--accent-dark); }
.body-toggle-label::after { content: "قراءة الخبر كاملاً"; }
.body-toggle:checked ~ .body-toggle-label::after { content: "إخفاء"; }

/* 4. footer — source name only, no URL */
.card-footer {
  margin-top: 0.9rem;
  font-size: var(--step--1);
  color: var(--neutral);
}

/* ---- macro card: three stat blocks, not a table ---- */
.macro-stats {
  display: flex;
  margin: 0.25rem 0 0.75rem;
}
.stat-block {
  flex: 1 1 0;
  text-align: center;
  padding: 0 0.5rem;
  border-inline-start: 1px solid rgba(143, 163, 184, 0.2);
}
.stat-block:first-child { border-inline-start: none; padding-inline-start: 0; }
.stat-label {
  display: block;
  font-size: var(--step--1);
  color: var(--neutral);
  margin-bottom: 0.3rem;
}
.stat-value {
  display: block;
  font-size: var(--step-2);
  font-weight: 700;
  color: var(--text);
}
.fred-attribution {
  font-size: var(--step--1);
  color: var(--neutral);
  margin: 0;
}

/* ---- ZONE C: CTA strip ---- */
.cta-strip {
  margin-top: 3rem;
  background: var(--card);
  border-radius: 8px;
  padding: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cta-strip p { margin: 0; color: var(--text); font-size: var(--step-0); }
.cta-button {
  display: inline-block;
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: var(--step--1);
  white-space: nowrap;
}
.cta-button:hover { background: var(--accent); color: var(--bg); }

/* ---- static pages (about / legal / 404) ---- */
.static-page, .notice-page { max-width: var(--content-width); }
.static-page h1 { font-size: var(--step-3); margin-top: 0.5rem; }
.static-page h2 { font-size: var(--step-1); color: var(--accent); margin-top: 1.75rem; }
.static-page p, .static-page li { color: var(--text-secondary); max-width: 70ch; }
.static-page ul { padding-inline-start: 1.25rem; }

.notice-page { text-align: center; padding: 3rem 1rem; margin: 0 auto; }
.notice-page h1 { color: var(--accent); font-size: var(--step-4); margin-bottom: 0.5rem; }

/* ---- footer (every page) ---- */
.site-footer {
  max-width: var(--grid-width);
  margin: 2rem auto 0;
  padding: 1.5rem var(--side-padding) 2rem;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--neutral);
  font-size: var(--step--1);
}
.footer-disclaimer p { margin: 0.2rem 0; }
.footer-links { margin-top: 0.75rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); text-decoration: underline; }
.footer-links a:hover { color: var(--accent); }

/* ---- mobile floor: fully readable at 380px ---- */
@media (max-width: 400px) {
  :root { --side-padding: 1.25rem; }
  .site-header { padding: 0.9rem var(--side-padding); }
  .wordmark-main { font-size: 1.1rem; }
  .hero { padding: 1.75rem 0 1.25rem; }
  .hero h1 { font-size: var(--step-3); }
  .card { padding: 1.25rem; }
  .card-title, .card-lead .card-title { font-size: var(--step-1); }
  .macro-stats { flex-direction: row; }
  .stat-value { font-size: var(--step-1); }
  .cta-strip { flex-direction: column; align-items: flex-start; }
}
