/* ============================================================
   آتلیه کودک نینو — بلاگ (blog.css)
   RTL، فارسی، طراحی شده با اصول better-ui و better-typography
   ============================================================ */

/* ===== متغیرهای اختصاصی بلاگ ===== */
:root {
  --blog-max-width: 72ch;          /* حداکثر عرض متن برای خوانایی بهتر */
  --blog-card-radius: 16px;
  --blog-card-shadow: 
    0 1px 3px rgba(0,0,0,.08),
    0 4px 12px rgba(0,0,0,.06);
  --blog-card-shadow-hover: 
    0 4px 8px rgba(0,0,0,.1),
    0 12px 24px rgba(0,0,0,.08);
  --blog-transition: transform .12s cubic-bezier(.2,.8,.2,1), 
                     box-shadow .12s cubic-bezier(.2,.8,.2,1),
                     border-color .2s ease;
}

/* ===== هیرو بلاگ ===== */
.blog-hero {
  position: relative;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--beige-light) 0%, var(--white) 100%);
  padding: 80px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.blog-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../photos/hero-v2-desktop.webp') center/cover no-repeat;
  opacity: 0.06;
  pointer-events: none;
}

.blog-hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.kicker {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--black);
  opacity: 0.5;
  margin-bottom: 16px;
}

.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  color: var(--black);
  line-height: 1.2;
  margin-bottom: 16px;
  text-wrap: balance;
}

.blog-hero p {
  font-family: var(--font-body);
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.7;
  color: rgba(0,0,0,.65);
  max-width: 560px;
  margin: 0 auto;
}

/* ===== سکشن بلاگ ===== */
.blog-section {
  padding: 60px 0 80px;
  background: var(--white);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== گرید پست‌ها ===== */
.blog-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 860px;
  margin: 0 auto;
}

/* ===== کارت پست ===== */
.blog-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--white);
  border-radius: var(--blog-card-radius);
  box-shadow: var(--blog-card-shadow);
  border: 1px solid rgba(0,0,0,.04);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: var(--blog-transition);
  will-change: transform, box-shadow;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--blog-card-shadow-hover);
  border-color: rgba(0,0,0,.08);
}

.blog-card:active {
  transform: scale(0.99);
  transition-duration: 40ms;
}

/* عکس کارت */
.blog-card-image {
  position: relative;
  flex: 0 0 300px;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: var(--blog-card-radius) 0 0 var(--blog-card-radius);
  background: var(--beige-light);
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* صورت/سر بچه معمولاً بالای عکسه — از ۲۰٪ بالای عکس نشون بده که توی کادر بمونه */
  object-position: 50% 20%;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.04);
}

/* برچسب دسته‌بندی روی عکس */
.blog-card-category {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(0,0,0,.65);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  z-index: 2;
}

/* محتوای کارت */
.blog-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 20px 24px;
  gap: 10px;
}

/* متای کارت (تاریخ و زمان مطالعه) */
.blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: rgba(0,0,0,.45);
  margin-bottom: 4px;
}

.blog-card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* عنوان پست */
.blog-card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--black);
  margin-bottom: 6px;
  text-wrap: balance;
  transition: color .2s ease;
}

.blog-card:hover .blog-card-title {
  color: rgba(0,0,0,.8);
}

/* چکیده پست */
.blog-card-excerpt {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: rgba(0,0,0,.55);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

/* آیکون ایموجی */
.blog-card-emoji {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
  display: inline-block;
}

/* ===== حالت خالی ===== */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: rgba(0,0,0,.4);
}

.blog-empty .emoji {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.blog-empty h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--black);
  margin-bottom: 8px;
}

.blog-empty p {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: rgba(0,0,0,.5);
  max-width: 400px;
  margin: 0 auto;
}

/* ===== اسکرول لود (بهینه‌سازی عملکرد) ===== */
.blog-card {
  opacity: 0;
  transform: translateY(20px);
  animation: blogCardEnter .5s cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes blogCardEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تاخیر برای każ کارت */

/* موبایل: کارت‌ها دوباره عمودی (عکس بالا، محتوا پایین) */
@media (max-width: 767px) {
  .blog-card { flex-direction: column; }
  .blog-card-image {
    flex: none;
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: var(--blog-card-radius) var(--blog-card-radius) 0 0;
  }
  .blog-grid { padding: 0 14px; }
}

.blog-grid > *:nth-child(1) { animation-delay: 0ms; }
.blog-grid > *:nth-child(2) { animation-delay: 60ms; }
.blog-grid > *:nth-child(3) { animation-delay: 120ms; }
.blog-grid > *:nth-child(4) { animation-delay: 180ms; }
.blog-grid > *:nth-child(5) { animation-delay: 240ms; }
.blog-grid > *:nth-child(6) { animation-delay: 300ms; }
.blog-grid > *:nth-child(7) { animation-delay: 360ms; }
.blog-grid > *:nth-child(8) { animation-delay: 420ms; }

/* ===== موبایل ===== */
@media (max-width: 768px) {
  .blog-hero {
    min-height: 36vh;
    padding: 60px 16px 40px;
  }
  
  .blog-hero h1 {
    font-size: 30px;
  }
  
  .blog-hero p {
    font-size: 15px;
  }
  
  .blog-section {
    padding: 40px 0 60px;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .blog-card-content {
    padding: 18px 16px 20px;
  }
  
  .blog-card-title {
    font-size: 20px;
  }
  
  .blog-card-excerpt {
    font-size: 13.5px;
    -webkit-line-clamp: 4;
  }
  
  .blog-card-image {
    aspect-ratio: 16/9;
  }
}

/* ===== پرینت ===== */
@media print {
  .blog-hero,
  .site-header,
  .site-footer,
  .auth-btn,
  .hamburger {
    display: none !important;
  }
  
  .blog-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .blog-card-image {
    display: none;
  }
  
  .blog-grid {
    display: block;
  }
}