@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,400&family=Tajawal:wght@300;400;500;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #faf9f7;
  --surface: #f2f0ec;
  --card: #ffffff;
  --card-hover: #f8f7f5;
  --border: #e0dbd2;
  --border-dark: #c8c0b4;
  --accent: #c8102e;
  --accent-dark: #a00d24;
  --accent2: #1a3a5c;
  --accent2-light: rgba(26,58,92,0.08);
  --accent-muted: rgba(200,16,46,0.1);
  --gold: #b8860b;
  --green: #0a6640;
  --red: #c8102e;
  --muted: #8c7b6b;
  --text: #1a1008;
  --text-dim: #5a4a3a;
  --text-muted: #8c7b6b;
  --header-bg: #faf9f7;
  --ticker-bg: #1a1008;
  --ticker-text: #f2f0ec;
  --bullish: #0a6640;
  --bearish: #c8102e;
  --shadow-sm: 0 1px 3px rgba(26,16,8,.08);
  --shadow-md: 0 4px 16px rgba(26,16,8,.1);
  --shadow-lg: 0 12px 40px rgba(26,16,8,.12);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Serif 4', 'Tajawal', Georgia, serif;
  min-height: 100vh;
  line-height: 1.6;
}

body.rtl { direction: rtl; }
body.ltr { direction: ltr; }

a { color: inherit; text-decoration: none; }

/* ── Paper texture ──────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: .4;
}

/* ── Ticker ─────────────────────────────────────────────────── */
.ticker-wrap {
  overflow: hidden;
  background: var(--ticker-bg);
  color: var(--ticker-text);
  padding: 6px 0;
  direction: ltr;
}
.ticker-inner {
  display: flex;
  width: max-content;
  animation: ticker-ltr 30s linear infinite;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: monospace;
  white-space: nowrap;
  margin: 0 16px;
}
@keyframes ticker-ltr {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  transition: background .3s, box-shadow .3s;
}
.site-header.scrolled {
  background: rgba(250,249,247,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}
.header-inner { max-width: 1280px; margin: 0 auto; padding: 12px 16px; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-logo { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
.logo-count {
  font-size: .75rem; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-muted); color: var(--accent);
  font-family: monospace;
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-lang {
  font-size: .75rem; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; background: transparent; transition: all .2s;
}
.btn-lang:hover { background: var(--surface); }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); transition: all .3s; }

.header-nav { display: flex; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.nav-link {
  padding: 4px 12px; border-radius: 999px; font-size: .875rem;
  color: var(--text-muted); transition: all .2s; cursor: pointer;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active { background: var(--accent); color: #fff; }

.mobile-menu {
  display: none;
  padding: 12px 16px 16px;
  background: var(--header-bg);
  border-top: 1px solid var(--border);
}
.mobile-menu.open { display: block; }
.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mobile-nav-link {
  padding: 8px 4px; border-radius: 8px; font-size: .875rem;
  text-align: center; background: var(--surface);
  color: var(--text-muted); border: 1px solid var(--border);
  cursor: pointer; display: block;
}
.mobile-nav-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Hero / Main Grid ───────────────────────────────────────── */
.main-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 16px; position: relative; z-index: 1; }

.stats-bar {
  display: flex; gap: 12px; margin-bottom: 20px;
  font-family: 'IBM Plex Mono', monospace; font-size: .7rem;
  color: var(--muted); flex-wrap: wrap; align-items: center;
}
.stat-item { display: flex; align-items: center; gap: 4px; }
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pulseGlow 2.5s infinite;
}
@keyframes pulseGlow { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 16px; border-radius: 999px; font-size: .8rem;
  border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; background: transparent; transition: all .2s;
  font-family: 'IBM Plex Mono', monospace;
}
.filter-btn:hover, .filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Cards ──────────────────────────────────────────────────── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.article-card {
  background: var(--card); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-img { width: 100%; height: 180px; object-fit: cover; display: block; }
.card-body { padding: 16px; }
.card-tags { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.card-title {
  font-size: 1rem; font-weight: 700; line-height: 1.4;
  color: var(--text); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  font-size: .85rem; color: var(--text-dim); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 12px;
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .75rem; font-family: 'IBM Plex Mono', monospace; color: var(--muted);
}
.source-name { font-weight: 600; color: var(--text-dim); }

/* ── Sentiment Tags ─────────────────────────────────────────── */
.tag {
  font-size: .7rem; padding: 2px 8px; border-radius: 4px;
  border: 1px solid; font-family: 'IBM Plex Mono', monospace;
  display: inline-block;
}
.tag-bullish  { background: rgba(10,102,64,.15);  color: #0a6640; border-color: rgba(10,102,64,.3); }
.tag-bearish  { background: rgba(200,16,46,.12);  color: #c8102e; border-color: rgba(200,16,46,.2); }
.tag-breaking { background: rgba(234,88,12,.12);  color: #ea580c; border-color: rgba(234,88,12,.2); }
.tag-neutral  { background: rgba(140,123,107,.12);color: var(--muted); border-color: rgba(140,123,107,.2); }

.category-tag {
  font-size: .7rem; padding: 2px 8px; border-radius: 4px;
  background: var(--accent2-light); color: var(--accent2);
  border: 1px solid rgba(26,58,92,.2); font-family: 'IBM Plex Mono', monospace;
  display: inline-block;
}

/* ── Article Page ───────────────────────────────────────────── */
.article-wrap { max-width: 768px; margin: 0 auto; padding: 32px 16px; flex: 1; position: relative; z-index: 1; }
.breadcrumb { font-size: .75rem; color: var(--muted); margin-bottom: 16px; font-family: 'IBM Plex Mono', monospace; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { margin: 0 6px; }

.article-headline {
  font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 700;
  line-height: 1.3; color: var(--text); margin-bottom: 16px;
}
.article-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: .75rem; font-family: 'IBM Plex Mono', monospace; color: var(--muted);
}
.article-source { color: var(--text-dim); font-weight: 600; }
.hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; margin-bottom: 24px; }
.article-summary {
  font-size: 1.05rem; line-height: 1.85; color: var(--text-dim);
  border-left: 3px solid var(--accent); padding-left: 16px; margin-bottom: 24px;
  font-style: italic;
}
.rtl .article-summary { border-left: none; border-right: 3px solid var(--accent); padding-left: 0; padding-right: 16px; }
.article-body p { margin-bottom: 16px; line-height: 1.85; font-size: .95rem; color: var(--text-dim); }

/* ── Social Share ───────────────────────────────────────────── */
.social-share { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: .8rem;
  cursor: pointer; transition: opacity .2s; text-decoration: none; color: #fff;
}
.share-btn:hover { opacity: .85; }
.share-twitter  { background: #000; }
.share-facebook { background: #1877f2; }
.share-whatsapp { background: #25d366; }
.share-copy     { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ── Newsletter ─────────────────────────────────────────────── */
.newsletter-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; margin: 32px 0;
}
.newsletter-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.newsletter-sub   { font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.newsletter-form  { display: flex; gap: 8px; flex-wrap: wrap; }
.newsletter-input {
  flex: 1; min-width: 200px; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; font-size: .9rem;
  outline: none; font-family: inherit;
}
.newsletter-input:focus { border-color: var(--accent); }
.btn-primary {
  padding: 10px 20px; border-radius: 8px; background: var(--accent);
  color: #fff; font-size: .9rem; cursor: pointer; border: none;
  font-family: inherit; transition: background .2s;
}
.btn-primary:hover { background: var(--accent-dark); }

/* ── Related Articles ───────────────────────────────────────── */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.related-card { cursor: pointer; }
.related-img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; transition: transform .3s; }
.related-card:hover .related-img { transform: scale(1.03); }
.related-title {
  font-size: .8rem; font-weight: 700; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-card:hover .related-title { color: var(--accent); }
.related-time { font-size: .7rem; color: var(--muted); font-family: 'IBM Plex Mono', monospace; margin-top: 4px; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: .875rem;
  margin-top: 64px; padding: 40px 0 24px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 32px; margin-bottom: 32px; }
.footer-brand { font-size: 1.25rem; font-weight: 900; color: var(--accent); margin-bottom: 8px; }
.footer-desc  { font-size: .75rem; line-height: 1.7; color: var(--text-muted); }
.footer-heading { font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.footer-links a { font-size: .75rem; color: var(--text-muted); }
.footer-links a:hover { text-decoration: underline; color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 16px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.footer-copy { font-size: .75rem; color: var(--text-muted); }
.footer-powered { font-size: .75rem; color: var(--text-muted); font-family: 'IBM Plex Mono', monospace; }

/* ── Load More ──────────────────────────────────────────────── */
.load-more-wrap { text-align: center; margin-top: 32px; }
.btn-load-more {
  padding: 12px 32px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text-dim);
  font-size: .9rem; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.btn-load-more:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: #1a1008; color: #fff; padding: 12px 24px; border-radius: 8px;
  font-size: .875rem; z-index: 9999; transition: transform .3s;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Skeleton ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Coin filter on homepage ───────────────────────────────── */
.coins-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 24px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.coin-btn {
  padding: 4px 12px; border-radius: 999px; font-size: .75rem;
  border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; background: transparent; transition: all .2s;
  font-family: 'IBM Plex Mono', monospace;
}
.coin-btn:hover, .coin-btn.active { background: var(--accent2); color: #fff; border-color: var(--accent2); }

/* ── Source link ───────────────────────────────────────────── */
.source-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .75rem; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--border-dark); color: var(--text-dim);
  margin-bottom: 40px; transition: background .2s;
  font-family: 'IBM Plex Mono', monospace;
}
.source-link:hover { background: #fff5f5; }

/* ── Section rule ───────────────────────────────────────────── */
.section-rule {
  border: none; border-top: 2px solid var(--accent);
  width: 32px; margin-bottom: 6px;
}

/* ── Page layouts ─────────────────────────────────────────── */
.page-layout { display: flex; flex-direction: column; min-height: 100vh; }
.page-content { flex: 1; position: relative; z-index: 1; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .hamburger   { display: flex; }
  .articles-grid { grid-template-columns: 1fr; }
  .footer-grid   { grid-template-columns: 1fr; }
  .related-grid  { grid-template-columns: 1fr; }
  .today-date    { display: none; }
}
