/*
Theme Name: نبض المغرب
Theme URI: https://nabdalmaghrib.com
Author: نبض المغرب
Description: قالب إخباري عصري لموقع نبض المغرب — عربي (RTL)، بخط Cairo وألوان الهوية.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: nabd
*/

@font-face {
  font-family: "Cairo";
  src: url("assets/fonts/Cairo.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --navy: #102A43;
  --navy-2: #0B1E31;
  --red: #C1272D;
  --cream: #F7F4ED;
  --green: #477A5B;
  --ink: #14212E;
  --muted: #5B6B7B;
  --line: #E4E0D6;
  --bg: #FBFAF6;
  --card: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 42, 67, .06), 0 8px 24px rgba(16, 42, 67, .06);
  --shadow-hover: 0 2px 4px rgba(16, 42, 67, .08), 0 16px 40px rgba(16, 42, 67, .12);
  --c: var(--red);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }
.wrap.narrow { width: min(820px, 100% - 40px); }
.skip-link { position: absolute; inset-inline-start: -999px; top: 0; background: #fff; padding: 8px 14px; z-index: 99; }
.skip-link:focus { inset-inline-start: 10px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
.topbar { background: var(--navy-2); color: #B9C6D3; font-size: 13px; }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.social { display: flex; gap: 6px; }
.social a { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: inherit; transition: .2s; }
.social a:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.brandbar { background: var(--navy); color: var(--cream); }
.brandbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 92px; }
.brand { display: flex; align-items: center; gap: 16px; }
.nabd-logo { width: 116px; height: 31px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 34px; font-weight: 900; letter-spacing: -.3px; }
.brand-text small { font-size: 13px; color: #B9C6D3; font-weight: 500; margin-top: 4px; }

.search { display: flex; align-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; padding: 4px 6px 4px 4px; min-width: 300px; transition: .2s; }
.search:focus-within { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); }
.search input { flex: 1; background: transparent; border: 0; color: #fff; font: inherit; font-size: 15px; padding: 8px 14px; outline: none; }
.search input::placeholder { color: #9FB0C1; }
.search button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--red); color: #fff; cursor: pointer; }

.catnav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--line); }
.catnav .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.catnav .wrap::-webkit-scrollbar { display: none; }
.catnav a { position: relative; white-space: nowrap; padding: 14px 14px; font-weight: 700; font-size: 15.5px; color: var(--navy); }
.catnav a::after { content: ""; position: absolute; inset-inline: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--c, var(--red)); transform: scaleX(0); transition: transform .2s; }
.catnav a:hover::after, .catnav a.is-active::after { transform: scaleX(1); }
.catnav a.is-active { color: var(--c, var(--red)); }

.ticker { background: #fff; border-bottom: 1px solid var(--line); }
.ticker .wrap { display: flex; align-items: center; gap: 14px; min-height: 46px; overflow: hidden; }
.ticker-label { flex: none; background: var(--red); color: #fff; font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 6px; position: relative; }
.ticker-label::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-inline-end: 7px; vertical-align: middle; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(to left, transparent, #000 4%, #000 96%, transparent); }
.ticker-move { display: inline-flex; gap: 40px; white-space: nowrap; animation: tick 60s linear infinite; }
.ticker-track:hover .ticker-move { animation-play-state: paused; }
.ticker-move a { font-weight: 600; font-size: 15px; color: var(--navy); }
.ticker-move a::before { content: "•"; color: var(--red); margin-inline-end: 10px; }
.ticker-move a:hover { color: var(--red); }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(50%); } }
[dir="ltr"] .ticker-move { animation-name: tick-ltr; }
@keyframes tick-ltr { to { transform: translateX(-50%); } }

.site-main { padding-block: 28px 56px; min-height: 50vh; }

/* ---------- Cards ---------- */
.card { position: relative; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-media { display: block; aspect-ratio: 16 / 9; background: #E9ECEF; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-media img { transform: scale(1.04); }
.card-placeholder { display: grid; place-items: center; height: 100%; }
.card-placeholder .nabd-logo { width: 40%; height: auto; opacity: .6; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pill { align-self: flex-start; background: color-mix(in srgb, var(--c) 12%, white); color: var(--c); font-size: 12.5px; font-weight: 800; padding: 2px 10px; border-radius: 999px; }
.card-title { margin: 0; font-size: 17.5px; line-height: 1.55; font-weight: 800; color: var(--navy); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-title a:hover { color: var(--c); }
.meta { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

.card--hero { height: 100%; }
.card--hero .card-media { aspect-ratio: 16 / 9; }
.card--hero .card-body { padding: 18px 22px 22px; gap: 10px; }
.card--hero .card-title { font-size: 30px; line-height: 1.45; -webkit-line-clamp: 3; }
.card-excerpt { margin: 0; color: #3E4C5A; font-size: 16.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card--list { flex-direction: row; align-items: stretch; box-shadow: none; border-radius: 12px; background: transparent; }
.card--list:hover { transform: none; box-shadow: none; background: #fff; }
.card--list .card-media { flex: 0 0 132px; aspect-ratio: 16 / 10; border-radius: 10px; }
.card--list .card-body { padding: 2px 12px; gap: 4px; }
.card--list .card-title { font-size: 15.5px; -webkit-line-clamp: 3; }
.card--list .pill { font-size: 11.5px; padding: 0 8px; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1.65fr 1fr; gap: 24px; margin-bottom: 40px; }
.hero--solo { grid-template-columns: 1fr; max-width: 900px; margin-inline: auto; }
.hero-side { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.side-title, .block-head h2 { position: relative; margin: 0; font-size: 21px; font-weight: 900; color: var(--navy); padding-inline-start: 14px; }
.side-title { font-size: 18px; margin-bottom: 6px; }
.side-title::before, .block-head h2::before { content: ""; position: absolute; inset-inline-start: 0; top: 18%; bottom: 18%; width: 5px; border-radius: 4px; background: var(--c, var(--red)); }
.hero-side .card--list + .card--list { border-top: 1px solid var(--line); border-radius: 0; padding-top: 10px; }

.block { margin-bottom: 44px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.more { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--c, var(--red)); font-size: 14px; }
.more:hover { gap: 8px; }
.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.archive-head { padding: 26px 0 22px; margin-bottom: 26px; border-bottom: 2px solid var(--line); position: relative; }
.archive-head::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -2px; width: 90px; height: 4px; border-radius: 4px; background: var(--c, var(--red)); }
.archive-kicker { color: var(--c, var(--red)); font-weight: 800; font-size: 14px; }
.archive-head h1 { margin: 2px 0 0; font-size: 38px; font-weight: 900; color: var(--navy); line-height: 1.3; }

.pagination { margin-top: 36px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { min-width: 42px; height: 42px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 10px; background: #fff; box-shadow: var(--shadow); font-weight: 700; }
.pagination .current { background: var(--navy); color: #fff; }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty .nabd-logo { width: 180px; height: auto; margin: 0 auto 16px; }
.empty h1, .empty h2 { color: var(--navy); margin: 0 0 8px; }
.btn { display: inline-block; background: var(--red); color: #fff; padding: 10px 22px; border-radius: 999px; font-weight: 800; }

/* ---------- Single ---------- */
.single { padding-top: 6px; }
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.crumbs a:hover { color: var(--c); }
.single-title { margin: 10px 0 12px; font-size: clamp(28px, 4vw, 42px); line-height: 1.35; font-weight: 900; color: var(--navy); }
.single-meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; font-weight: 600; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.single-meta span { display: inline-flex; align-items: center; gap: 6px; }
.single-meta .by { color: var(--navy); font-weight: 800; }
.single-media { margin: 22px 0 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.single-media img { width: 100%; }
.share { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; color: var(--muted); font-weight: 700; font-size: 14px; }
.share a, .share button { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; transition: .2s; }
.share a:hover, .share button:hover { color: #fff; border-color: transparent; }
.s-fb:hover { background: #1877F2; } .s-wa:hover { background: #25D366; } .s-tg:hover { background: #229ED9; } .s-x:hover { background: #111; } .s-copy:hover, .s-copy.copied { background: var(--green); color: #fff; }
.entry { font-size: 19px; line-height: 2; color: #1E2B38; margin-top: 10px; }
.entry p { margin: 0 0 1.1em; }
.entry p[dir="ltr"] { background: #fff; border-inline-start: 4px solid var(--c); border-radius: 10px; padding: 14px 18px; font-size: 17.5px; line-height: 1.75; box-shadow: var(--shadow); }
.entry small { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 14px; }
.entry small a { color: var(--c); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.entry a { color: var(--red); }
.page .single-title { margin-top: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #C9D3DD; margin-top: 30px; }
.zellige { height: 34px; background-color: var(--navy-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='68' height='34' viewBox='0 0 68 34'%3E%3Cg fill='none' stroke-width='2'%3E%3Crect x='22' y='5' width='24' height='24' stroke='%23C1272D'/%3E%3Crect x='22' y='5' width='24' height='24' stroke='%23477A5B' transform='rotate(45 34 17)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 68px 34px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.3fr; gap: 36px; padding: 44px 0 34px; }
.site-footer h3 { color: #fff; font-size: 16px; margin: 4px 0 14px; font-weight: 800; }
.site-footer .brand-text strong { font-size: 28px; color: #fff; }
.footer-about p { margin: 14px 0; font-size: 15px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-links.two-col { grid-template-columns: 1fr 1fr; }
.footer-links a:hover, .footer-legal a:hover { color: #fff; }
.footer-legal dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.footer-legal dt { color: #8FA3B6; }
.footer-legal dd { margin: 0; color: #E2E8EE; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13.5px; color: #8FA3B6; }
.footer-bottom .wrap { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 16px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .search { min-width: 0; width: 100%; }
  .brandbar .wrap { flex-wrap: wrap; padding: 14px 0; min-height: 0; }
  .card--hero .card-title { font-size: 24px; }
}
@media (max-width: 560px) {
  .wrap, .wrap.narrow { width: calc(100% - 24px); }
  .grid-4, .grid-3 { grid-template-columns: 1fr; gap: 16px; }
  .brand-text strong { font-size: 27px; }
  .nabd-logo { width: 86px; height: 23px; }
  .brand-text small { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .archive-head h1 { font-size: 30px; }
  .entry { font-size: 18px; }
  .card--list .card-media { flex-basis: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
