/* =====================================================
   أسامة كود — تنسيقات المدونة وصفحة المقال
   (يُحمَّل بعد style.css ويستخدم متغيراته)
   ===================================================== */

/* ---------- ترويسة الصفحات الداخلية ---------- */
.page-hero {
  position: relative;
  background:
    radial-gradient(900px 400px at 80% -20%, rgba(46, 230, 168, .14), transparent 60%),
    linear-gradient(160deg, var(--emerald-950) 0%, var(--emerald-900) 60%, var(--emerald-800) 100%);
  color: var(--on-dark);
  padding: calc(var(--header-h) + 56px) 0 64px;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M44 0H0v44' fill='none' stroke='rgba(46,230,168,0.06)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.page-hero .container { position: relative; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .9rem;
  color: var(--on-dark-muted);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--mint); }
.breadcrumb a:hover { color: var(--mint-soft); }

.page-hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  font-weight: 900;
  margin-bottom: 12px;
  max-width: 18ch;
}
.page-hero .page-sub {
  color: var(--on-dark-muted);
  font-size: 1.08rem;
  max-width: 38rem;
}

/* بيانات المقال داخل الترويسة */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: 22px;
  color: var(--on-dark-muted);
  font-size: .95rem;
}
.article-meta .meta-item { display: inline-flex; align-items: center; gap: 7px; }
.article-meta .avatar { width: 38px; height: 38px; font-size: .95rem; }

.post-tag {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--mint);
  background: rgba(46, 230, 168, .12);
  border: 1px solid rgba(46, 230, 168, .35);
  border-radius: 999px;
  padding: 4px 14px;
}
.page-hero .post-tag { margin-bottom: 16px; }

/* ---------- شريط البحث والتصنيفات ---------- */
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 38px;
}

.blog-search { position: relative; flex: 1; min-width: 240px; max-width: 380px; }
.blog-search input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 11px 44px 11px 18px;
  transition: border-color .25s, box-shadow .25s;
}
.blog-search input:focus {
  outline: none;
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(46, 230, 168, .15);
}
.blog-search .search-icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.tag-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  color: var(--emerald-700);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.tag-chip:hover { border-color: var(--mint); color: var(--emerald-600); }
.tag-chip.active {
  background: var(--emerald-800);
  border-color: var(--emerald-800);
  color: #fff;
}

/* ---------- شبكة المقالات ---------- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.post-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
  border-color: var(--mint);
}

.post-cover {
  position: relative;
  height: 170px;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  overflow: hidden;
}
.post-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.post-card:hover .post-cover img { transform: scale(1.05); }

.post-cover.g1 { background: linear-gradient(135deg, #0a4a38, #14cf8f); }
.post-cover.g2 { background: linear-gradient(135deg, #05382a, #10805d); }
.post-cover.g3 { background: linear-gradient(135deg, #0e5c45, #2ee6a8); }
.post-cover.g4 { background: linear-gradient(135deg, #03251b, #0e5c45); }
.post-cover.g5 { background: linear-gradient(135deg, #10805d, #66d9c4); }
.post-cover.g6 { background: linear-gradient(135deg, #0a4a38, #a7f3d0); }

.post-cover::after {
  content: "</>";
  position: absolute;
  inset-inline-end: 14px;
  top: 8px;
  font-family: var(--font-code);
  font-size: 3.4rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .12);
  pointer-events: none;
}
.post-cover.has-image::after { content: none; }
.post-cover .post-tag { position: relative; z-index: 1; background: rgba(3, 37, 27, .55); backdrop-filter: blur(4px); }

.post-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 24px; }

.post-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.post-body h2 { font-size: 1.15rem; line-height: 1.5; margin-bottom: 10px; }
.post-body h2 a { color: var(--emerald-950); }
.post-body h2 a:hover { color: var(--emerald-600); }

.post-excerpt { color: var(--muted); font-size: .95rem; flex: 1; margin-bottom: 16px; }

.post-more {
  font-weight: 700;
  font-size: .95rem;
  color: var(--emerald-600);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.post-card:hover .post-more { color: var(--mint-strong); }

/* حالات فارغة / تنبيه */
.blog-empty {
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  font-size: 1.05rem;
}
.blog-empty strong { display: block; font-size: 1.3rem; color: var(--emerald-950); margin-bottom: 8px; }

/* ---------- صفحة المقال ---------- */
.article-wrap { width: min(780px, 92%); margin-inline: auto; }

.article-body {
  font-size: 1.08rem;
  line-height: 2.05;
  color: var(--ink);
}
.article-body > * + * { margin-top: 1.1em; }
.article-body h2 {
  font-size: 1.45rem;
  margin-top: 1.8em;
  padding-inline-start: 14px;
  border-inline-start: 4px solid var(--mint);
}
.article-body h3 { font-size: 1.2rem; margin-top: 1.5em; }
.article-body ul, .article-body ol { padding-inline-start: 1.4em; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: arabic-indic; }
.article-body li { margin-top: .45em; }
.article-body li::marker { color: var(--emerald-600); }
.article-body a { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.article-body blockquote {
  background: var(--tint);
  border-inline-start: 4px solid var(--emerald-600);
  border-radius: 12px;
  padding: 18px 22px;
  font-weight: 700;
  color: var(--emerald-900);
}
.article-body img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-inline: auto;
}
.article-body pre {
  direction: ltr;
  text-align: left;
  background: #04211a;
  color: #d7efe4;
  font-family: var(--font-code);
  font-size: .88rem;
  line-height: 1.8;
  border: 1px solid rgba(46, 230, 168, .2);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.article-body hr { border: 0; border-top: 1px dashed var(--line); }

/* المشاركة */
.article-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.article-share span { font-weight: 700; color: var(--emerald-950); }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  color: var(--emerald-800);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color .25s, color .25s, transform .25s;
}
.share-btn:hover { border-color: var(--mint); color: var(--emerald-600); transform: translateY(-2px); }
.share-btn svg { width: 17px; height: 17px; }

/* مقالات ذات صلة */
.related-wrap { margin-top: 70px; }
.related-wrap h2 { font-size: 1.5rem; margin-bottom: 26px; text-align: center; }

/* ---------- التجاوب ---------- */
@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .posts-grid { grid-template-columns: 1fr; }
  .blog-toolbar { flex-direction: column; align-items: stretch; }
  .blog-search { max-width: none; }
  .article-body { font-size: 1.02rem; }
}
