/* =========================================================
   أخبار الشرق — Design System v2 (mockups)
   Palette derived from the existing logo (green + red),
   modernised with an editorial ink/sand base.
   ========================================================= */

:root {
  /* Exact extracted Brand colors from original logo */
  --brand-green: #51aa1c;
  --brand-green-hover: #439316;
  --brand-green-dark: #32700f;
  --green-50: #f2faee;
  --green-100: #dcf2d1;
  --green-500: #51aa1c;
  --green-600: #439316;
  --green-700: #32700f;

  --brand-red: #db241e;
  --brand-red-hover: #ba1914;
  --brand-red-dark: #96120e;
  --red-500: #db241e;
  --red-600: #ba1914;

  --brand-slate: #4b4b4b;
  --gold-500: #e9b949;

  /* Neutrals */
  --ink-950: #070b14;
  --ink-900: #0b1220;
  --ink-800: #141d2f;
  --ink-700: #1f2a40;
  --ink-500: #4a5670;
  --ink-400: #6b7690;
  --ink-300: #9aa3b8;
  --ink-200: #d5dae5;
  --ink-100: #eceff5;
  --sand-50: #fcfbf8;
  --sand-100: #f6f3eb;
  --white: #ffffff;

  /* Semantic (light) */
  --bg: var(--sand-50);
  --surface: var(--white);
  --surface-2: var(--sand-100);
  --text: var(--ink-900);
  --text-soft: var(--ink-500);
  --border: #e6e2d8;
  --brand: var(--brand-green);
  --accent: var(--brand-red);

  /* Type */
  --font-ui: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-head: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;
  --font-read: 'Noto Naskh Arabic', 'IBM Plex Sans Arabic', serif;

  /* Shape & depth */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .06), 0 1px 1px rgba(11, 18, 32, .04);
  --shadow-md: 0 10px 30px -12px rgba(11, 18, 32, .18);
  --shadow-lg: 0 30px 60px -20px rgba(11, 18, 32, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --container: 1280px;
}

[data-theme="dark"] {
  /* Warm, Restful Editorial Palette (Cozy & easy on the eyes for night reading)
     - Base: Deep warm charcoal #121316 (eliminates harsh blue glare)
     - Surface: Rich velvety slate #181a1f
     - Surface-2: Warm elevated tile #20232a
     - Text: Warm ivory #edf0f5 (optimal readability without blinding brightness)
     - Text-soft: Restful muted ash #9ca3af
     - Border: Gentle warm edge #292d36
     - Brand: Luminous newspaper green #5dc622
     - Accent: Warm coral red #f05252
  */
  --bg: #121316;
  --surface: #181a1f;
  --surface-2: #20232a;
  --text: #edf0f5;
  --text-soft: #9ca3af;
  --border: #292d36;
  --brand: #5dc622;
  --accent: #f05252;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

.container {
  width: min(var(--container), 100% - 40px);
  margin-inline: auto;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface-2);
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background .3s var(--ease), border-color .3s;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  gap: 16px;
}

.topbar .meta {
  display: flex;
  gap: 20px;
  align-items: center;
}

.topbar .meta span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  opacity: .9;
}

.topbar .meta b {
  color: var(--brand);
  font-weight: 700;
}

.topbar .social {
  display: flex;
  gap: 6px;
}

.topbar .social a {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-700);
  transition: all .2s;
}

.topbar .social a:hover {
  background: var(--brand);
  color: #fff;
}

.topbar svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

[data-theme="dark"] .topbar {
  background: #0f141d;
  color: var(--ink-300);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .topbar .social a {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-200);
}

[data-theme="dark"] .topbar .social a:hover {
  background: var(--brand);
  color: #fff;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.site-logo-img {
  height: 52px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  transition: transform 0.3s var(--ease);
}

.site-logo-img:hover {
  transform: scale(1.03);
}

[data-theme="dark"] .site-logo-img {
  filter: drop-shadow(0 2px 10px rgba(81, 170, 28, 0.25));
}

/* Scrolled Nav Corner Logo */
.nav-corner-logo {
  display: flex;
  align-items: center;
  position: absolute;
  right: 0;
  top: 50%;
  max-width: 0;
  opacity: 0;
  transform: translateY(-50%) translateX(14px) scale(0.88);
  pointer-events: none;
  overflow: hidden;
  text-decoration: none;
  z-index: 10;
  will-change: transform, opacity, max-width;
  transition: max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header.is-scrolled .nav-corner-logo {
  max-width: 160px;
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

.nav-corner-logo-img {
  height: 38px;
  width: auto;
  max-width: 135px;
  object-fit: contain;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.nav-corner-logo:hover .nav-corner-logo-img {
  transform: scale(1.04);
}

[data-theme="dark"] .nav-corner-logo-img {
  filter: drop-shadow(0 2px 8px rgba(93, 198, 34, 0.25));
}

.logo-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(81, 170, 28, 0.15);
}

.logo-icon-wrap img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
}

.logo-text-wrap small {
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .2px;
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-soft);
  transition: color .2s, background .2s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a.active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.header-actions .icon-btn,
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-soft);
  transition: color .2s ease, background .2s ease;
  box-shadow: none;
  cursor: pointer;
  padding: 0;
}

.header-actions .icon-btn:hover,
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--brand);
  transform: none;
}

.header-actions .icon-btn svg,
.icon-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: all .2s var(--ease);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(81, 170, 28, 0.45);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -8px rgba(81, 170, 28, 0.6);
}

.btn-ghost {
  border: 1px solid var(--border);
}

.btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* Sleek Notification Pill Button */
.btn-notif {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.btn-notif:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  transform: translateY(-1px);
}

.btn-notif .bell-wrap {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--brand);
}

.btn-notif svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.btn-notif .notif-badge {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
  animation: pulse 1.4s infinite;
}

/* ---------- Breaking ticker ---------- */
.ticker {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.ticker .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 48px;
  overflow: hidden;
}

.ticker-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
}

.ticker-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.4s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .3;
    transform: scale(.7);
  }
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-items {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  width: max-content;
}

.ticker-items a {
  font-weight: 600;
  font-size: 14.5px;
}

.ticker-items a::before {
  content: "●";
  color: var(--accent);
  margin-left: 10px;
  font-size: 9px;
  vertical-align: middle;
}

.ticker:hover .ticker-items {
  animation-play-state: paused;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(50%);
  }
}

/* ---------- Generic ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
}

.chip.red {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.chip.on-img {
  background: var(--brand);
  color: #fff;
}

.chip.on-img.red {
  background: var(--accent);
}

.meta-line {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--text-soft);
  font-size: 13px;
}

.meta-line svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  vertical-align: -2px;
  margin-left: 4px;
}

.section {
  padding: 44px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-head h2::before {
  content: "";
  width: 6px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(var(--brand), var(--accent));
}

.section-head a {
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.card .thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  position: relative;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}

.card:hover .thumb img {
  transform: scale(1.06);
}

.card .thumb .chip {
  position: absolute;
  top: 12px;
  right: 12px;
}

.card .body {
  padding: 16px 18px 18px;
}

.card h3 {
  margin: 8px 0 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.6;
}

.card:hover h3 {
  color: var(--brand);
}

.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 12px;
  position: relative;
  overflow: hidden;
}

.ad-slot::before {
  content: "إعلان";
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 11px;
  opacity: .7;
}

/* ---------- Footer (Adaptive Light & Dark Modes) ---------- */
.site-footer {
  background: var(--surface-2);
  color: var(--text-soft);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.site-footer a {
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--brand);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding: 56px 0 36px;
}

.site-footer h4 {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 16px;
  margin: 0 0 16px;
  font-weight: 700;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  font-size: 14px;
}

.site-footer .logo-text strong {
  color: var(--text);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-soft);
}

.legal {
  font-size: 13px;
  line-height: 2;
  margin-top: 14px;
  color: var(--text-soft);
}

[data-theme="dark"] .site-footer {
  background: #0f1013;
  color: #9ca3af;
  border-top: 1px solid #252830;
}

[data-theme="dark"] .site-footer a {
  color: #9ca3af;
}

[data-theme="dark"] .site-footer a:hover {
  color: var(--brand);
}

[data-theme="dark"] .site-footer h4 {
  color: #edf0f5;
}

[data-theme="dark"] .footer-bottom {
  border-top: 1px solid #252830;
  color: #6b7280;
}

[data-theme="dark"] .legal {
  color: #9ca3af;
}

/* reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (max-width: 1080px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .topbar .meta span:nth-child(n+3) {
    display: none;
  }

  .header-main {
    height: 64px;
  }

  .logo-text small {
    display: none;
  }

  .logo-text strong {
    font-size: 21px;
  }

  .header-actions .btn {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .section-head h2 {
    font-size: 21px;
  }
}