/* ════════════════════════════════════════════════════════════
   AIن Media — Thème Ghost RTL
   Couleurs : #00cc88 (émeraude) · #1a1a2e (bleu nuit) · #1a1a1a (texte)
   Fonts    : Cairo (titres) · Tajawal (corps)
════════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────── */
:root {
  --green:      #00cc88;
  --green-dark: #00a870;
  --night:      #1a1a2e;
  --night-light:#16213e;
  --text:       #1a1a1a;
  --text-muted: #666;
  --bg:         #ffffff;
  --bg-light:   #f7f8fa;
  --border:     #e8e8e8;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
  --font-title: 'Cairo', sans-serif;
  --font-body:  'Tajawal', sans-serif;
  --max-width:  1200px;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; direction: rtl; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── Container ───────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════ */
.site-header {
  background: var(--night);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

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

/* Logo */
.site-logo { display: flex; align-items: center; }
.logo-text {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
}
.logo-eye { color: var(--green); }

/* Nav */
.site-nav { display: flex; align-items: center; gap: 0; }
.site-nav .nav { list-style: none; display: flex; gap: 4px; }
.site-nav .nav a {
  color: rgba(255,255,255,0.85);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.site-nav .nav a:hover { color: var(--green); background: rgba(0,204,136,0.1); }

/* Subscribe Button */
.btn-subscribe {
  background: var(--green);
  color: #fff !important;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 20px;
  border-radius: 50px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-subscribe:hover { background: var(--green-dark); transform: translateY(-1px); }

/* ════════════════════════════════════════════════════════════
   HERO SECTION
════════════════════════════════════════════════════════════ */
.hero-section { margin-bottom: 48px; }
.hero-section .container { padding: 0; }

.hero-link { display: block; }

.hero-image {
  position: relative;
  height: 520px;
  background-size: cover;
  background-position: center;
  border-radius: 0;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(26,26,46,0.95) 0%,
    rgba(26,26,46,0.6) 50%,
    rgba(26,26,46,0.1) 100%
  );
}

.hero-content {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  padding: 48px;
  color: #fff;
}

.hero-no-image {
  background: linear-gradient(135deg, var(--night) 0%, var(--night-light) 100%);
  min-height: 400px;
  display: flex;
  align-items: flex-end;
}

.hero-content--text { padding: 48px; width: 100%; color: #fff; }

.hero-tag {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 16px;
  max-width: 800px;
}

.hero-excerpt {
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0.88;
  max-width: 640px;
  margin-bottom: 20px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  opacity: 0.75;
}

.hero-meta span::before { content: '·'; margin-left: 16px; }
.hero-meta span:first-child::before { content: none; }

/* ════════════════════════════════════════════════════════════
   POSTS GRID
════════════════════════════════════════════════════════════ */
.posts-grid-section { padding: 0 0 60px; }

.section-header { margin-bottom: 28px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.section-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--night);
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -18px;
  right: 0;
  width: 48px;
  height: 3px;
  background: var(--green);
  border-radius: 2px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

/* Post Card */
.post-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.25s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: transparent; }

.post-card-link { display: block; height: 100%; }

.post-card-image {
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-light);
}

.post-card-image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--night) 0%, var(--night-light) 100%);
}

.post-card-image--placeholder span {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(255,255,255,0.2);
}

.post-card-image--placeholder span span { color: var(--green); opacity: 0.5; }

.post-card-body { padding: 20px; }

.post-tag {
  display: inline-block;
  background: rgba(0,204,136,0.12);
  color: var(--green-dark);
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  margin-bottom: 10px;
}

.post-card-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.btn-page {
  background: var(--night);
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 50px;
  transition: all 0.2s;
}
.btn-page:hover { background: var(--green); }
.page-info { font-size: 0.88rem; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   POST PAGE
════════════════════════════════════════════════════════════ */
.post-header {
  background: var(--night);
  color: #fff;
  padding: 56px 0 48px;
  text-align: center;
}

.post-header-inner { max-width: 820px; }

.post-tags { margin-bottom: 20px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.post-tag-link {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 50px;
  transition: background 0.2s;
}
.post-tag-link:hover { background: var(--green-dark); }

.post-title {
  font-family: var(--font-title);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 20px;
  color: #fff;
}

.post-excerpt {
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.85;
  margin-bottom: 28px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.post-meta { display: flex; justify-content: center; }

.post-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--green);
  object-fit: cover;
}

.author-info { display: flex; flex-direction: column; text-align: right; }

.author-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.post-date-time { font-size: 0.82rem; color: rgba(255,255,255,0.6); }

/* Feature Image */
.post-feature-image {
  max-height: 520px;
  overflow: hidden;
  background: var(--bg-light);
}

.post-feature-image img {
  width: 100%;
  height: 520px;
  object-fit: cover;
}

.image-caption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 16px;
  background: var(--bg-light);
}

/* Post Content */
.post-content-wrap { padding: 56px 0; }
.post-content-wrap .container { max-width: 820px; }

.post-content {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text);
}

.post-content h2 {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--night);
  margin: 2.2em 0 0.7em;
  border-right: 4px solid var(--green);
  padding-right: 14px;
}

.post-content h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--night);
  margin: 1.8em 0 0.6em;
}

.post-content p { margin-bottom: 1.4em; }

.post-content ul, .post-content ol {
  padding-right: 28px;
  margin-bottom: 1.4em;
}

.post-content li { margin-bottom: 0.5em; }

.post-content strong { font-weight: 700; color: var(--night); }

.post-content em { font-style: italic; color: var(--text-muted); }

.post-content a {
  color: var(--green-dark);
  border-bottom: 1px solid rgba(0,168,112,0.3);
  transition: border-color 0.2s;
}
.post-content a:hover { border-color: var(--green); }

.post-content blockquote {
  border-right: 4px solid var(--green);
  padding: 16px 20px;
  margin: 1.8em 0;
  background: rgba(0,204,136,0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.post-content figure { margin: 2em 0; }

.post-content figcaption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.post-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2.5em 0;
}

/* Tags footer */
.post-tags-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.tags-label {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.post-tag-badge {
  display: inline-block;
  background: rgba(0,204,136,0.1);
  color: var(--green-dark);
  border: 1px solid rgba(0,204,136,0.25);
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 50px;
  transition: all 0.2s;
}
.post-tag-badge:hover { background: var(--green); color: #fff; border-color: var(--green); }

/* Share */
.post-share {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.share-label {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.share-btn {
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 50px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  color: var(--text);
}
.share-btn:hover { background: var(--night); color: #fff; border-color: var(--night); }

/* ════════════════════════════════════════════════════════════
   RELATED POSTS
════════════════════════════════════════════════════════════ */
.related-posts {
  background: var(--bg-light);
  padding: 48px 0 56px;
  border-top: 1px solid var(--border);
}

.related-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--night);
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
  position: relative;
  display: inline-block;
}
.related-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 40px;
  height: 2px;
  background: var(--green);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.related-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: block;
  transition: all 0.25s;
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: transparent; }

.related-image {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-light);
}

.related-image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--night) 0%, var(--night-light) 100%);
}

.related-image--placeholder span {
  font-family: var(--font-title);
  font-weight: 900;
  color: rgba(255,255,255,0.15);
  font-size: 1.3rem;
}

.related-body { padding: 16px; }

.related-card-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  margin: 8px 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-date { font-size: 0.78rem; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--night);
  color: rgba(255,255,255,0.8);
  padding: 40px 0 28px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-brand .logo-text { font-size: 1.4rem; }
.footer-tagline { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-top: 6px; }

.footer-nav .nav { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.footer-nav .nav a {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 4px;
  transition: color 0.2s;
}
.footer-nav .nav a:hover { color: var(--green); }

.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.35); }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  html { font-size: 16px; }

  .header-inner { height: 56px; }
  .site-nav { display: none; }
  .logo-text { font-size: 1.3rem; }

  .hero-image { height: 380px; }
  .hero-content { padding: 28px; }
  .hero-title { font-size: 1.5rem; }
  .hero-excerpt { display: none; }

  .posts-grid { grid-template-columns: 1fr; gap: 20px; }
  .related-grid { grid-template-columns: 1fr; }

  .post-title { font-size: 1.7rem; }
  .post-feature-image img { height: 260px; }

  .post-share { gap: 8px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero-title { font-size: 1.3rem; }
  .post-title { font-size: 1.4rem; }
}

/* ════════════════════════════════════════════════════════════
   GHOST CARDS (images, embeds, etc.)
════════════════════════════════════════════════════════════ */
.kg-width-wide { margin-right: -10%; margin-left: -10%; }
.kg-width-full { margin-right: -24px; margin-left: -24px; }
.kg-image-card img { border-radius: var(--radius); }
.kg-gallery-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 1.5em 0; }
.kg-gallery-image img { border-radius: var(--radius); width: 100%; height: 220px; object-fit: cover; }
.kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5em 0;
}
.kg-bookmark-content { padding: 16px; }
.kg-bookmark-title { font-family: var(--font-title); font-weight: 700; }
.kg-bookmark-description { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.kg-callout-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 1.5em 0;
  background: rgba(0,204,136,0.07);
  border: 1px solid rgba(0,204,136,0.2);
  display: flex;
  gap: 12px;
}
.kg-callout-emoji { font-size: 1.2rem; }
