/*
Theme Name: شبكة أطلس
Theme URI: https://example.com
Author: فريق شبكة أطلس
Author URI: https://example.com
Description: قالب ووردبريس أخباري سريع، متوافق مع RankMath SEO وإعلانات Google AdSense، مبني بأكواد نظيفة بدون إضافات ثقيلة، مع دعم كامل للغة العربية RTL.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: atlas-news
Tags: news, blog, grid-layout, right-to-left, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================
   1) إعادة ضبط أساسية (Reset) - بدون مكتبات خارجية
============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  direction: rtl;
  text-align: right;
  font-family: "Tahoma", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #1a1a1a;
  background: #f7f7f8;
}

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

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.3;
  font-weight: 700;
}

/* ============================================
   2) الحاوية العامة
============================================ */
.atlas-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================
   3) الهيدر
============================================ */

/* شريط علوي داكن يعرض التاريخ */
.atlas-topbar {
  background: #0e2a4a;
  color: #cfd8e3;
  font-size: 12px;
}

.atlas-topbar__inner {
  padding: 6px 0;
  display: flex;
  justify-content: flex-start;
}

.atlas-header {
  background: #fff;
  border-bottom: 3px solid #c0102b;
}

.atlas-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.atlas-logo {
  font-size: 26px;
  font-weight: 800;
  color: #c0102b;
  margin-inline-start: auto; /* يدفع اللوجو لأقصى اليمين في RTL */
}

.atlas-logo img {
  max-height: 50px;
}

.atlas-menu-toggle,
.atlas-search-toggle {
  background: none;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: #0e2a4a;
  padding: 6px 10px;
}

/* صندوق البحث المنسدل (مخفي افتراضيًا) */
.atlas-search-box {
  display: none;
  border-top: 1px solid #eee;
  padding: 14px 0;
}

.atlas-search-box.is-open {
  display: block;
}

.atlas-search-box form {
  display: flex;
  gap: 8px;
}

.atlas-search-box input[type="search"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.atlas-search-box button {
  background: #c0102b;
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 0 16px;
  cursor: pointer;
}

/* قائمة التنقل */
.atlas-nav {
  border-top: 1px solid #eee;
}

.atlas-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.atlas-nav a {
  display: block;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
}

.atlas-nav a:hover {
  color: #c0102b;
}

/* ============================================
   3.1) شريط "عاجل" المتحرك
============================================ */
.atlas-breaking {
  background: #0e2a4a;
}

.atlas-breaking__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
}

.atlas-breaking__badge {
  background: #c0102b;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.atlas-breaking__ticker {
  flex: 1;
  overflow: hidden;
  height: 20px;
  position: relative;
}

.atlas-breaking__ticker ul {
  position: relative;
}

.atlas-breaking__ticker li {
  display: none;
  height: 20px;
  line-height: 20px;
}

.atlas-breaking__ticker li.is-active {
  display: block;
}

.atlas-breaking__ticker a {
  color: #fff;
  font-size: 13px;
}

.atlas-breaking__nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.atlas-breaking__prev,
.atlas-breaking__next {
  background: rgba(255,255,255,.1);
  border: 0;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

/* ============================================
   4) مساحات الإعلانات - أبعاد ثابتة لمنع Layout Shift (CLS)
   مهم جدًا لتوافق AdSense وCore Web Vitals
============================================ */
.atlas-ad-slot {
  width: 100%;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  overflow: hidden;
}

.atlas-ad-slot--header {
  min-height: 90px; /* leaderboard 728x90 */
}

.atlas-ad-slot--in-content {
  min-height: 250px; /* medium rectangle 300x250 */
  max-width: 300px;
}

.atlas-ad-slot--sidebar {
  min-height: 250px;
}

.atlas-ad-slot--footer {
  min-height: 90px;
}

.atlas-ad-slot span {
  font-size: 11px;
  color: #999;
}

/* ============================================
   5) الشبكة الإخبارية (Grid) - الصفحة الرئيسية
============================================ */
.atlas-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px 0;
}

@media (min-width: 992px) {
  .atlas-layout {
    grid-template-columns: 2.2fr 1fr;
    align-items: start;
  }
}

.atlas-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.atlas-card {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .15s ease;
}

.atlas-card:hover {
  transform: translateY(-3px);
}

.atlas-card__thumb {
  aspect-ratio: 16 / 9; /* يحجز المساحة قبل تحميل الصورة لمنع CLS */
  background: #e5e5e5;
  overflow: hidden;
}

.atlas-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atlas-card__body {
  padding: 14px;
}

.atlas-card__cat {
  display: inline-block;
  background: #c0102b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
}

.atlas-card__title {
  font-size: 17px;
  margin-bottom: 6px;
}

.atlas-card__meta {
  font-size: 12px;
  color: #777;
}

/* ============================================
   5.1) الهيرو - الخبر الرئيسي + قائمة آخر الأخبار
============================================ */
.atlas-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}

@media (min-width: 992px) {
  .atlas-hero {
    grid-template-columns: 2.2fr 1fr;
    align-items: stretch;
  }
}

/* بطاقة الهيرو الكبيرة - صورة مع تراكب نص */
.atlas-hero-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  min-height: 320px;
  background: #1a1a1a;
}

.atlas-hero-card__thumb {
  display: block;
  position: relative;
  height: 100%;
  min-height: 320px;
}

.atlas-hero-card__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atlas-hero-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.15) 65%, transparent 100%);
  color: #fff;
}

.atlas-hero-card__title {
  font-size: 26px;
  color: #fff;
  margin: 8px 0;
}

.atlas-hero-card__meta {
  font-size: 12px;
  opacity: .85;
}

/* قائمة "آخر الأخبار" الجانبية بجانب الهيرو */
.atlas-hero__rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.atlas-rail-card {
  display: flex;
  gap: 10px;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.atlas-rail-card__thumb {
  flex-shrink: 0;
  width: 90px;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: #e5e5e5;
}

.atlas-rail-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atlas-rail-card__title {
  font-size: 14px;
  margin: 2px 0 4px;
  line-height: 1.5;
}

/* ============================================
   5.2) أقسام الصفحة الرئيسية (تجارة وأعمال، مصر، رياضة...)
============================================ */
.atlas-section {
  margin: 32px 0;
}

.atlas-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 19px;
  border-bottom: 3px solid #0e2a4a;
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.atlas-section__more {
  font-size: 13px;
  font-weight: 600;
  color: #c0102b;
}

.atlas-section__footer {
  text-align: center;
  margin-top: 20px;
}

.atlas-btn {
  display: inline-block;
  background: #0e2a4a;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 26px;
  border-radius: 4px;
}

/* ============================================
   5.3) قائمة "أحدث الأخبار" الأفقية (صورة + مقتطف)
============================================ */
.atlas-news-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.atlas-list-item {
  display: flex;
  gap: 16px;
  background: #fff;
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.atlas-list-item__thumb {
  flex-shrink: 0;
  width: 160px;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
  overflow: hidden;
  background: #e5e5e5;
}

.atlas-list-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atlas-list-item__title {
  font-size: 18px;
  margin: 6px 0;
}

.atlas-list-item__excerpt {
  font-size: 14px;
  color: #555;
  margin: 0 0 8px;
}

/* ============================================
   6) الشريط الجانبي
============================================ */
.atlas-widget {
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}

.atlas-widget__title {
  font-size: 15px;
  font-weight: 800;
  border-bottom: 2px solid #c0102b;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.atlas-widget li {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

/* ============================================
   7) صفحة المقال المفرد
============================================ */
.atlas-single {
  background: #fff;
  padding: 24px;
  border-radius: 6px;
}

.atlas-single__title {
  font-size: 28px;
}

.atlas-single__meta {
  color: #777;
  font-size: 13px;
  margin-bottom: 16px;
}

.atlas-single__updated {
  display: block;
  margin-top: 4px;
  color: #999;
}

.atlas-single__thumb {
  margin-bottom: 20px;
  border-radius: 6px;
  overflow: hidden;
}

.atlas-single__content {
  font-size: 17px;
  line-height: 1.9;
}

.atlas-single__content p {
  margin: 0 0 1.2em;
}

.atlas-breadcrumbs {
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
}

/* ============================================
   8) الفوتر
============================================ */
.atlas-footer {
  background: #0e2a4a;
  color: #cfd8e3;
  padding: 30px 0;
  margin-top: 30px;
  font-size: 14px;
  text-align: center;
}

.atlas-footer a {
  color: #fff;
}

.atlas-footer__widgets {
  text-align: right;
  margin-bottom: 20px;
}

.atlas-footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-bottom: 14px;
  font-size: 13px;
}

.atlas-footer__copy {
  color: #9fb0c3;
  font-size: 13px;
  margin: 0;
}

/* زر الرجوع لأعلى الصفحة */
.atlas-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #c0102b;
  color: #fff;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  display: none;
  z-index: 50;
}

.atlas-to-top.is-visible {
  display: block;
}

/* ============================================
   9) استجابة الموبايل
============================================ */
@media (max-width: 767px) {
  .atlas-nav ul {
    display: none;
    flex-direction: column;
  }

  .atlas-nav.is-open ul {
    display: flex;
  }

  .atlas-hero-card__title {
    font-size: 19px;
  }

  .atlas-hero-card,
  .atlas-hero-card__thumb {
    min-height: 220px;
  }

  .atlas-list-item {
    flex-direction: column;
  }

  .atlas-list-item__thumb {
    width: 100%;
  }

  .atlas-to-top {
    left: 12px;
    bottom: 12px;
  }
}

/* ============================================
   10) قسم المقترحات في صفحة 410
============================================ */
.atlas-suggested {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e5e5e5;
}
.skip-link {
  position: absolute;
  right: -9999px;
  top: 0;
  background: #c0102b;
  color: #fff;
  padding: 10px 16px;
  z-index: 999;
}

.skip-link:focus {
  right: 10px;
}
