/* ============================================================
   امرتات استور — Blog styles (blog.html + blog-post.html)
   Extends styles.css tokens; no raw values.
   ============================================================ */

/* ── Page head search ──────────────────────────────────────────────────── */
.blog-search-form {
  display: flex; gap: 8px; max-width: 480px;
  margin-top: 22px;
}
.blog-search-input {
  flex: 1; padding: 11px 16px; border-radius: var(--r);
  border: 1.5px solid var(--border-strong);
  font-family: var(--font-fa); font-size: 15px; color: var(--text);
  background: var(--bg); transition: border-color .2s;
}
.blog-search-input:focus { outline: none; border-color: var(--primary); }
.blog-search-input::placeholder { color: var(--text-3); }
.blog-search-btn {
  padding: 11px 18px; border-radius: var(--r);
  background: var(--primary); color: #fff;
  font-family: var(--font-fa); font-weight: 600; font-size: 15px;
  cursor: pointer; border: none; display: flex; align-items: center; gap: 6px;
  transition: background .2s, transform .15s;
}
.blog-search-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ── Category filter ──────────────────────────────────────────────────── */
.cat-filter {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-block: 36px 0;
}
.cat-chip {
  padding: 7px 16px; border-radius: 100px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1.5px solid var(--border-strong);
  background: var(--bg); color: var(--text-2);
  transition: all .18s ease; white-space: nowrap; text-decoration: none;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip--active {
  background: var(--primary); border-color: var(--primary);
  color: #fff;
}

/* ── Posts grid ───────────────────────────────────────────────────────── */
.posts-section { padding-block: 40px 96px; }
.posts-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; gap: 12px; flex-wrap: wrap;
}
.posts-count { font-size: 14px; color: var(--text-3); }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 56px;
}
@media (max-width: 900px) { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .posts-grid { grid-template-columns: 1fr; } }

/* ── Post card ────────────────────────────────────────────────────────── */
.post-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .25s ease, transform .2s ease, border-color .2s ease;
}
.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.post-card-img-wrap {
  display: block; overflow: hidden;
  aspect-ratio: 16 / 9; background: var(--surface-2);
}
.post-card-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease;
}
.post-card:hover .post-card-img { transform: scale(1.04); }
.post-card-img--placeholder {
  width: 100%; height: 100%; display: flex;
  align-items: center; justify-content: center;
  color: var(--text-3); font-size: 40px;
}
.post-card-body {
  padding: 22px; display: flex; flex-direction: column; flex: 1; gap: 10px;
}
.post-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-cat-badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  transition: background .18s;
}
.post-cat-badge:hover { background: var(--primary); color: #fff; }
.post-date {
  font-size: 12.5px; color: var(--text-3);
  margin-inline-start: auto;
}
.post-card-title {
  font-size: 17px; font-weight: 700; line-height: 1.4;
  letter-spacing: -0.01em;
}
.post-card-title a { color: var(--text); text-decoration: none; }
.post-card-title a:hover { color: var(--primary); }
.post-card-excerpt {
  font-size: 14.5px; color: var(--text-2); line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; flex: 1;
}
.post-card-footer {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.post-card-read {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; font-weight: 600; color: var(--primary);
  text-decoration: none; transition: gap .18s;
}
.post-card-read:hover { gap: 8px; }
.post-read-time {
  font-size: 13px; color: var(--text-3);
  display: flex; align-items: center; gap: 4px;
  margin-inline-start: auto;
}

/* Featured card (first post in listing) */
.post-card--featured {
  grid-column: 1 / -1;
  flex-direction: row;
}
.post-card--featured .post-card-img-wrap {
  aspect-ratio: unset; width: 45%; flex-shrink: 0;
}
.post-card--featured .post-card-body { padding: 32px; gap: 14px; }
.post-card--featured .post-card-title { font-size: 22px; }
.post-card--featured .post-card-excerpt { -webkit-line-clamp: 3; }
@media (max-width: 768px) {
  .post-card--featured { flex-direction: column; }
  .post-card--featured .post-card-img-wrap { width: 100%; aspect-ratio: 16/9; }
}

/* ── Skeleton loader ──────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-card { pointer-events: none; }
.skeleton-img { aspect-ratio: 16/9; border-radius: 0; }
.skeleton-badge { height: 22px; width: 80px; margin-bottom: 4px; border-radius: 100px; }
.skeleton-title { height: 20px; width: 90%; margin-bottom: 6px; }
.skeleton-text  { height: 14px; width: 100%; margin-bottom: 5px; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1; text-align: center;
  padding: 80px 24px; color: var(--text-2);
}
.empty-state i { font-size: 52px; color: var(--text-3); margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 15px; max-width: 360px; margin-inline: auto; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.pag-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 600; color: var(--text-2);
  border: 1.5px solid var(--border); background: var(--bg);
  text-decoration: none; transition: all .18s ease;
}
.pag-btn:hover { border-color: var(--primary); color: var(--primary); }
.pag-btn--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pag-prev, .pag-next { font-size: 16px; }

/* ── Error banner ─────────────────────────────────────────────────────── */
.fetch-error {
  grid-column: 1 / -1; text-align: center; padding: 48px;
  background: #FEF2F2; border-radius: var(--r-lg); color: #991B1B;
  border: 1px solid #FECACA;
}

/* ================================================================
   Single post (blog-post.html)
   ================================================================ */

/* ── Post hero image ─────────────────────────────────────────────────── */
.post-hero {
  width: 100%; aspect-ratio: 21 / 8; overflow: hidden;
  background: var(--surface-2);
}
.post-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Layout: article + sidebar ───────────────────────────────────────── */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 56px;
  padding-block: 56px 96px;
  align-items: start;
}
@media (max-width: 900px) { .post-layout { grid-template-columns: 1fr; } }

/* ── Article meta bar ────────────────────────────────────────────────── */
.post-meta-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text-3);
}
.post-meta-bar .post-cat-badge { font-size: 13px; }
.post-meta-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.post-author { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text-2); }
.post-author i { font-size: 16px; }

/* ── Prose (long-form content) ───────────────────────────────────────── */
.prose { font-size: 17px; line-height: 1.9; color: var(--text); }
.prose h2 {
  font-size: clamp(20px, 3vw, 26px); font-weight: 700;
  margin-block: 40px 14px; letter-spacing: -0.02em; color: var(--text);
}
.prose h3 {
  font-size: clamp(18px, 2.5vw, 22px); font-weight: 700;
  margin-block: 32px 10px; color: var(--text);
}
.prose h4 { font-size: 18px; font-weight: 700; margin-block: 24px 8px; }
.prose p  { margin-bottom: 20px; }
.prose ul, .prose ol { margin-bottom: 20px; padding-inline-start: 24px; }
.prose li { margin-bottom: 8px; line-height: 1.75; }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose blockquote {
  margin-block: 28px; padding: 20px 24px;
  border-inline-start: 4px solid var(--primary);
  background: var(--primary-soft); border-radius: 0 var(--r) var(--r) 0;
  color: var(--text-2); font-style: italic;
}
.prose blockquote p { margin-bottom: 0; }
.prose code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px; padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--primary-dark);
}
.prose pre {
  background: #0F0E17; border-radius: var(--r); padding: 20px 24px;
  margin-block: 24px; overflow-x: auto;
}
.prose pre code { background: none; color: #E8E6F0; font-size: 14px; padding: 0; }
.prose img {
  border-radius: var(--r-lg); max-width: 100%;
  display: block; margin-block: 28px;
  box-shadow: var(--shadow-md);
}
.prose hr { border: none; border-top: 1px solid var(--border); margin-block: 40px; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--primary-dark); }
.prose strong { font-weight: 700; color: var(--text); }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.post-sidebar { display: flex; flex-direction: column; gap: 28px; }
.sidebar-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
}
.sidebar-card-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-cat-list { display: flex; flex-direction: column; gap: 6px; }
.sidebar-cat-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text-2); text-decoration: none;
  transition: background .18s, color .18s;
}
.sidebar-cat-link:hover { background: var(--bg); color: var(--primary); }
.sidebar-cat-link i { font-size: 12px; }

.related-list { display: flex; flex-direction: column; gap: 16px; }
.related-item { display: flex; gap: 12px; text-decoration: none; color: inherit; }
.related-img {
  width: 68px; height: 50px; border-radius: var(--r-sm);
  object-fit: cover; flex-shrink: 0; background: var(--surface-2);
  display: block;
}
.related-img-placeholder {
  width: 68px; height: 50px; border-radius: var(--r-sm);
  background: var(--surface-2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 20px;
}
.related-info { display: flex; flex-direction: column; gap: 4px; }
.related-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--text); }
.related-item:hover .related-title { color: var(--primary); }
.related-date { font-size: 12px; color: var(--text-3); }

/* ── Post page head ───────────────────────────────────────────────────── */
.post-page-head { padding-block: 40px; }
.post-page-head h1 {
  font-size: clamp(26px, 4vw, 42px); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 18px;
}

/* ── Post not found ───────────────────────────────────────────────────── */
.post-not-found {
  text-align: center; padding: 96px 24px;
}
.post-not-found i { font-size: 64px; color: var(--text-3); margin-bottom: 20px; display: block; }
.post-not-found h2 { font-size: 26px; margin-bottom: 10px; }
.post-not-found p { color: var(--text-2); margin-bottom: 28px; }

/* ── CTA final section ────────────────────────────────────────────────── */
.cta-final { padding-block: 0 96px; }

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .post-card { transition: none; }
  .post-card-img { transition: none; }
}

/* ── Mobile adjustments ───────────────────────────────────────────────── */
@media (max-width: 760px) {
  .posts-section { padding-block: 28px 72px; }
  .blog-search-form { max-width: 100%; }
  .cat-filter { gap: 6px; }
  .cat-chip { padding: 6px 13px; font-size: 13px; }
  .post-card-body { padding: 18px; }
  .post-hero { aspect-ratio: 16 / 7; }
  .post-layout { gap: 40px; padding-block: 40px 72px; }
  .prose { font-size: 16px; }
}
