/* ==========================================================================
   24ForCrypto — Design System
   ========================================================================== */

:root {
  --bg: #06080d;
  --bg-alt: #0a0e17;
  --surface: #10141f;
  --surface-2: #161c2b;
  --border: #232a3d;
  --text: #f4f6fa;
  --text-dim: #98a2b8;
  --text-faint: #5c6580;

  --primary: #21e6a1;
  --primary-dark: #14b584;
  --primary-soft: rgba(33, 230, 161, 0.12);
  --accent: #7c5cfc;
  --accent-soft: rgba(124, 92, 252, 0.14);
  --cyan: #2fb8ff;
  --gold: #f5b942;
  --up: #21e6a1;
  --down: #ff5470;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-1: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, 0.45);
  --container: 1240px;

  --font-ar: "Cairo", "Tajawal", sans-serif;
  --font-en: "Inter", "Cairo", sans-serif;
  --font: var(--font-ar);
}

html[lang="en"] {
  --font: var(--font-en);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(33, 230, 161, 0.10), transparent 60%),
    radial-gradient(50rem 26rem at 110% 10%, rgba(124, 92, 252, 0.12), transparent 60%),
    var(--bg);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.pill.crypto { background: var(--primary-soft); color: var(--primary); }
.pill.tech { background: var(--accent-soft); color: #b6a4ff; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #04140e;
  box-shadow: 0 8px 24px rgba(33, 230, 161, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(33, 230, 161, 0.35); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 8, 13, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  white-space: nowrap;
}
.logo .mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--cyan) 60%, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; color: #05130d;
  box-shadow: 0 6px 18px rgba(33, 230, 161, 0.3);
}
.logo .name b { color: var(--primary); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.lang-switch button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.lang-switch button.active { background: var(--primary); color: #05130d; }

.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  align-items: center; justify-content: center;
  cursor: pointer;
}

/* ---------- Ticker ---------- */
.ticker-bar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
  position: relative;
}
.ticker-track {
  display: flex;
  gap: 34px;
  padding: 9px 0;
  width: max-content;
  animation: ticker-scroll 42s linear infinite;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
html[dir="rtl"] .ticker-track { animation-name: ticker-scroll-rtl; }
@keyframes ticker-scroll-rtl {
  from { transform: translateX(0); }
  to { transform: translateX(50%); }
}
.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  white-space: nowrap;
  color: var(--text-dim);
  direction: ltr;
}
.ticker-item img { width: 18px; height: 18px; border-radius: 50%; }
.ticker-item b { color: var(--text); font-weight: 700; }
.ticker-item .chg.up { color: var(--up); }
.ticker-item .chg.down { color: var(--down); }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
  text-align: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--primary); font-size: 13px; font-weight: 700; margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.15;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 620px;
  margin: 0 auto 30px;
  color: var(--text-dim);
  font-size: 17px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Section ---------- */
.section { padding: 52px 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 26px;
  margin: 0 0 6px;
  font-weight: 800;
}
.section-head p { margin: 0; color: var(--text-dim); font-size: 14.5px; }
.section-head .link-more {
  color: var(--primary);
  font-weight: 700;
  font-size: 14.5px;
  display: flex; align-items: center; gap: 4px;
}

/* ---------- News Grid / Cards ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.news-card:hover {
  transform: translateY(-4px);
  border-color: rgba(33, 230, 161, 0.35);
  box-shadow: var(--shadow-1);
}
.news-card .thumb {
  aspect-ratio: 16/9.5;
  background: linear-gradient(135deg, #16233a, #1c1533);
  position: relative;
  overflow: hidden;
}
.news-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.news-card .thumb .fallback-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: rgba(255,255,255,0.25);
}
.news-card .thumb .pill { position: absolute; top: 10px; inset-inline-start: 10px; }
.news-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.news-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); direction: ltr; justify-content: flex-start; }
.news-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }
/* News titles/excerpts come from English-language sources — force LTR so
   webkit-line-clamp truncates at the visual end, not mid-sentence. */
.news-card h3, .news-card p.excerpt {
  direction: ltr;
  text-align: start;
}
.news-card h3 {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.4;
  font-weight: 700;
}
.news-card p.excerpt {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card .read-more {
  margin-top: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 5px;
}
.news-card.skeleton { pointer-events: none; }
.news-card.skeleton .thumb, .news-card.skeleton .line {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.6s ease infinite;
}
.news-card.skeleton .line { height: 12px; border-radius: 6px; margin-bottom: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 8px auto;
  text-align: center;
  min-height: 90px;
}
.ad-slot .ad-label {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* ---------- Converter widget ---------- */
.converter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: var(--shadow-2);
}
.converter-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 560px) { .converter-row { flex-direction: column; } }
.field {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.field label { display: block; font-size: 11.5px; color: var(--text-faint); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  outline: none;
  font-family: inherit;
}
.field select { cursor: pointer; }
.field select option { background: var(--surface-2); color: var(--text); }
.swap-btn {
  align-self: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(33,230,161,0.3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.rate-line {
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 6px;
  direction: ltr;
}
.rate-line b { color: var(--text); }

.price-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}
.price-table th {
  text-align: start;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.price-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.price-table tr:last-child td { border-bottom: none; }
.coin-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; direction: ltr; }
.price-table td:not(:first-child) { direction: ltr; text-align: end; }
.price-table th:not(:first-child) { text-align: end; }
.coin-cell img { width: 26px; height: 26px; border-radius: 50%; }
.coin-cell small { color: var(--text-faint); font-weight: 500; display: block; }
.chg.up { color: var(--up); font-weight: 700; }
.chg.down { color: var(--down); font-weight: 700; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- Category tabs (news page) ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 26px; flex-wrap: wrap; }
.tabs button {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.tabs button.active { background: var(--primary); color: #04140e; border-color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 46px 0 24px;
  margin-top: 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}
.footer-grid h4 { font-size: 14px; margin: 0 0 14px; color: var(--text); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { color: var(--text-dim); font-size: 13.5px; }
.footer-grid a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-faint);
  font-size: 12.5px;
}
.disclaimer {
  font-size: 12px;
  color: var(--text-faint);
  max-width: 640px;
  line-height: 1.7;
}

/* ---------- About / misc ---------- */
.page-hero { padding: 50px 0 20px; text-align: center; }
.page-hero h1 { font-size: 34px; margin-bottom: 10px; }
.page-hero p { color: var(--text-dim); }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin: 30px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-card b { display: block; font-size: 26px; color: var(--primary); }
.stat-card span { color: var(--text-dim); font-size: 13px; }

.prose { max-width: 760px; margin: 0 auto; color: var(--text-dim); }
.prose h2 { color: var(--text); margin-top: 34px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 620px) {
  .news-grid { grid-template-columns: 1fr; }
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 20px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.mobile-nav.open { display: flex; }
.mobile-nav a { padding: 10px 4px; color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--border); }

[data-i18n], [data-i18n-html] { }
.hide { display: none !important; }
