/* ============================================================
   خلاصة كتاب — الهوية الإبداعية B (زمردي + ليموني)
   ============================================================ */

:root{
  --khk-emerald:#14443A;
  --khk-emerald-700:#0E2E27;
  --khk-emerald-300:#1C7A5E;
  --khk-lime:#C4F046;
  --khk-lime-600:#A6CE2E;
  --khk-ink:#0E2E27;
  --khk-muted:#5B746C;
  --khk-surface:#FFFFFF;
  --khk-border:#DDEAE0;
  --khk-base:#F2F7F3;
}

/* ===== خلفية حيّة: نقاط زمردية خفيفة جداً ===== */
body{
  background-color:var(--khk-base);
  background-image:radial-gradient(rgba(20,68,58,.045) 1px, transparent 1px);
  background-size:22px 22px;
}

/* ===== الشعار المميّز ===== */
.khk-logo{display:flex;align-items:center;gap:.6rem;text-decoration:none;}
.khk-logo__mark{
  width:42px;height:42px;border-radius:12px;flex:0 0 auto;
  background:var(--khk-emerald);color:var(--khk-lime);
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 4px 12px rgba(20,68,58,.25);
}
.khk-logo__text{display:flex;flex-direction:column;line-height:1.1;}
.khk-logo__name{font-family:'Cairo',sans-serif;font-weight:900;font-size:1.3rem;color:var(--khk-ink);}
.khk-logo__tag{font-size:.72rem;font-weight:700;color:var(--khk-emerald-300);margin-top:2px;}

/* ===== عناوين الأقسام مع الشريط الليموني ===== */
.khk-sechead{display:flex;align-items:center;gap:.7rem;}
.khk-sechead__bar{
  display:inline-block;width:6px;height:28px;border-radius:3px;
  background:var(--khk-lime);box-shadow:0 0 0 3px rgba(196,240,70,.25);
}
.khk-sechead h2{margin:0 !important;}

/* ===== الهيرو ===== */
.khk-hero__pill{
  display:inline-block;margin:0 auto 1rem !important;
  background:var(--khk-lime);color:var(--khk-emerald-700);
  font-family:'Cairo',sans-serif;font-weight:800;font-size:.85rem;
  padding:6px 18px;border-radius:30px;width:fit-content;
}
.khk-hero .wp-block-search__input{border:none !important;}
.khk-hero .wp-block-search__button{background:var(--khk-lime) !important;color:var(--khk-emerald-700) !important;font-weight:800 !important;}

/* ===== شبكة التصنيفات (شورت كود khkitab_categories) ===== */
.khk-catgrid{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.8rem;margin:0;
}
.khk-catgrid__item{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;gap:.3rem;text-decoration:none;
  background:var(--khk-surface);border:1px solid var(--khk-border);
  border-radius:14px;padding:1.1rem .6rem;min-height:84px;
  position:relative;overflow:hidden;transition:transform .15s ease,border-color .15s ease;
}
.khk-catgrid__item::before{
  content:"";position:absolute;inset:0 0 auto 0;height:3px;background:var(--khk-lime);
  transform:scaleX(0);transform-origin:right;transition:transform .2s ease;
}
.khk-catgrid__item:hover{transform:translateY(-3px);border-color:var(--khk-emerald-300);}
.khk-catgrid__item:hover::before{transform:scaleX(1);}
.khk-catgrid__name{font-family:'Cairo',sans-serif;font-weight:700;font-size:1.02rem;color:var(--khk-emerald);}
.khk-catgrid__count{font-size:.78rem;color:var(--khk-muted);}

/* ===== كروت المقالات (بلوك Query: أحدث المقالات/الأرشيف/البحث) ===== */
/* إجبار الأعمدة (يغلب قاعدة ووردبريس 1fr) */
.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid{
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.khk-posts.is-layout-grid{align-items:stretch;}
.khk-posts.is-layout-grid > li{display:flex;}
.khk-postcard{
  display:flex !important;flex-direction:column;width:100%;height:100%;
  background:var(--khk-surface);border:1px solid var(--khk-border);
  border-radius:16px;overflow:hidden;padding:0 0 .9rem !important;
  transition:transform .18s ease,box-shadow .18s ease;
}
.khk-postcard:hover{transform:translateY(-5px);box-shadow:0 16px 40px rgba(20,68,58,.13);}
.khk-postcard__img{margin:0 !important;position:relative;overflow:hidden;}
.khk-postcard__img img{aspect-ratio:3/4;object-fit:cover;width:100%;height:auto;display:block;transition:transform .3s ease;}
.khk-postcard:hover .khk-postcard__img img{transform:scale(1.04);}
.khk-postcard__cat{padding:0 .85rem;margin:.7rem 0 .2rem !important;}
.khk-postcard__cat a{
  display:inline-block;background:#EAF7E0;color:var(--khk-emerald-300);
  font-family:'Cairo',sans-serif;font-weight:700;font-size:.72rem;
  padding:2px 10px;border-radius:20px;text-decoration:none;
}
.khk-postcard__title{padding:0 .85rem !important;margin:.15rem 0 0 !important;}
.khk-postcard__title a{
  font-family:'Cairo',sans-serif;font-weight:700;color:var(--khk-ink);text-decoration:none;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;
  overflow:hidden;text-overflow:ellipsis;min-height:4.7em;line-height:1.55;
}
.khk-postcard__title a:hover{color:var(--khk-emerald-300);}

/* ===== كروت "الأكثر قراءة" (شورت كود khkitab_popular) ===== */
.khk-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1.2rem;align-items:stretch;}
.khk-grid > p{display:contents;}
.khk-card{
  display:flex;flex-direction:column;height:100%;text-decoration:none;
  background:var(--khk-surface);border:1px solid var(--khk-border);
  border-radius:16px;overflow:hidden;transition:transform .18s ease,box-shadow .18s ease;
}
.khk-card:hover{transform:translateY(-5px);box-shadow:0 16px 40px rgba(20,68,58,.13);}
.khk-card__media{aspect-ratio:3/4;overflow:hidden;background:#EAF7E0;flex:0 0 auto;position:relative;}
.khk-card__img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s ease;}
.khk-card:hover .khk-card__img{transform:scale(1.04);}
.khk-card__badge{
  position:absolute;top:10px;right:10px;z-index:2;
  background:var(--khk-lime);color:var(--khk-emerald-700);
  font-family:'Cairo',sans-serif;font-weight:800;font-size:.7rem;
  padding:3px 11px;border-radius:30px;
}
.khk-card p{margin:0;}
.khk-card__title{
  font-family:'Cairo',sans-serif;font-weight:700;font-size:1rem;line-height:1.55;
  color:var(--khk-ink);margin:.7rem .85rem .9rem;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;
  overflow:hidden;text-overflow:ellipsis;min-height:4.65em;
}

/* ===== سطر معلومات المقال (شارات) ===== */
.khk-meta{align-items:center;}
.khk-chip{
  display:inline-flex;align-items:center;gap:.3rem;margin:0 !important;
  background:#EAF7E0;color:var(--khk-emerald-300);font-weight:700;
  padding:3px 11px;border-radius:20px;font-size:.82rem;
}

/* ===== فهرس المحتويات التلقائي ===== */
.khk-toc{
  background:#FAFFEE;border:1px solid var(--khk-border);
  border-inline-start:4px solid var(--khk-lime);border-radius:14px;
  padding:1rem 1.25rem;margin-block:1.5rem 2rem;
}
.khk-toc__title{font-family:'Cairo',sans-serif;font-weight:800;font-size:1.15rem;cursor:pointer;color:var(--khk-emerald);}
.khk-toc__list{margin:.75rem 0 0;padding-inline-start:1.1rem;line-height:2;}
.khk-toc__list a{text-decoration:none;color:var(--khk-emerald-300);}
.khk-toc__list a:hover{text-decoration:underline;}
.khk-toc__sub{margin-inline-start:1rem;font-size:.95em;opacity:.85;list-style:circle;}
:is(h2,h3)[id]{scroll-margin-top:90px;}

/* ===== المقالات ذات الصلة ===== */
.khk-related{margin-block-start:3rem;padding-block-start:1.5rem;border-top:1px solid var(--khk-border);}
.khk-related__title{margin-block-end:1.25rem;}

/* ===== الأسئلة الشائعة (أكورديون) ===== */
.khk-faq{margin:2.5rem 0;}
.khk-faq__heading{font-family:'Cairo',sans-serif;font-size:1.6rem !important;font-weight:800 !important;color:var(--khk-emerald-700) !important;margin:0 0 1rem !important;padding-bottom:.5rem;border-bottom:2px solid #EAF7E0;}
.khk-faq__item{background:var(--khk-surface);border:1px solid var(--khk-border);border-radius:14px;margin-bottom:.7rem;overflow:hidden;}
.khk-faq__q{cursor:pointer;list-style:none;padding:1rem 1.2rem;font-family:'Cairo',sans-serif;font-weight:700;font-size:1.05rem;color:var(--khk-emerald);display:flex;align-items:center;justify-content:space-between;gap:10px;}
.khk-faq__q::-webkit-details-marker{display:none;}
.khk-faq__q::after{content:"+";font-size:1.4rem;color:var(--khk-emerald-300);font-weight:400;transition:transform .2s;}
.khk-faq__item[open] .khk-faq__q{background:var(--khk-emerald);color:var(--khk-lime);}
.khk-faq__item[open] .khk-faq__q::after{transform:rotate(45deg);color:var(--khk-lime);}
.khk-faq__a{padding:1rem 1.2rem;line-height:1.9;color:var(--khk-ink);border-top:1px solid var(--khk-border);}
.khk-faq__a em{color:var(--khk-emerald-300);font-style:italic;}

/* ===== المقاسات ===== */
@media (max-width:1024px){
  .khk-catgrid,.khk-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width:600px){
  .khk-catgrid,.khk-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid.wp-block-post-template-is-layout-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .khk-catgrid__name{font-size:.92rem;}
  .khk-postcard__title a,.khk-card__title{font-size:.95rem;}
  .khk-logo__name{font-size:1.1rem;}
}

/* ============================================================
   التطويرات الإبداعية (v2.1)
   ============================================================ */

/* ===== كلمات بحث سريعة تحت الهيرو ===== */
.khk-hero__quick{
  display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center;margin-top:1.1rem;
}
.khk-hero__quick a{
  background:rgba(255,255,255,.12);border:1px solid rgba(196,240,70,.35);
  color:#EAF7E0;text-decoration:none;font-family:'Cairo',sans-serif;font-weight:600;
  font-size:.82rem;padding:5px 14px;border-radius:30px;transition:all .15s ease;
}
.khk-hero__quick a:hover{background:var(--khk-lime);color:var(--khk-emerald-700);border-color:var(--khk-lime);}

/* ===== شريط الإحصائيات المتحرّك ===== */
.khk-stats{
  display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;
  max-width:760px;margin:2.2rem auto 0;
}
.khk-stat{
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.15);
  border-radius:14px;padding:1.1rem .8rem;text-align:center;backdrop-filter:blur(4px);
}
.khk-stat__num{font-family:'Cairo',sans-serif;font-weight:900;font-size:2rem;color:var(--khk-lime);line-height:1;}
.khk-stat__label{font-size:.85rem;color:#BFE0CF;margin-top:.4rem;}

/* ===== قسم خلاصة الأسبوع (Featured) ===== */
.khk-featured{
  display:grid;grid-template-columns:300px 1fr;gap:2rem;align-items:center;
  background:linear-gradient(135deg,#FFFFFF 0%,#F4FBED 100%);
  border:1px solid var(--khk-border);border-radius:24px;
  padding:2rem;position:relative;overflow:hidden;
}
.khk-featured::before{
  content:"";position:absolute;top:-40px;left:-40px;width:160px;height:160px;
  background:radial-gradient(circle,rgba(196,240,70,.25),transparent 70%);border-radius:50%;
}
.khk-featured__media{position:relative;z-index:1;}
.khk-featured__media img{width:100%;aspect-ratio:3/4;object-fit:cover;border-radius:16px;box-shadow:0 20px 50px rgba(20,68,58,.25);}
.khk-featured__body{position:relative;z-index:1;}
.khk-featured__label{
  display:inline-flex;align-items:center;gap:.4rem;background:var(--khk-emerald);color:var(--khk-lime);
  font-family:'Cairo',sans-serif;font-weight:800;font-size:.8rem;padding:5px 16px;border-radius:30px;margin-bottom:1rem;
}
.khk-featured__title{font-family:'Cairo',sans-serif;font-weight:900;font-size:2rem;color:var(--khk-ink);line-height:1.3;margin-bottom:.8rem;}
.khk-featured__excerpt{color:var(--khk-muted);font-size:1.05rem;line-height:1.9;margin-bottom:1.2rem;}
.khk-featured__cta{
  display:inline-flex;align-items:center;gap:.5rem;background:var(--khk-emerald);color:var(--khk-lime);
  font-family:'Cairo',sans-serif;font-weight:800;padding:.8rem 1.8rem;border-radius:12px;text-decoration:none;transition:all .15s ease;
}
.khk-featured__cta:hover{background:var(--khk-emerald-700);transform:translateX(-4px);}
.khk-featured__meta{display:flex;gap:.6rem;margin-top:1rem;}
.khk-featured__meta .khk-chip{background:#EAF7E0;color:var(--khk-emerald-300);}

/* ===== تأثير 3D خفيف على الكروت ===== */
.khk-card,.khk-postcard{transform-style:preserve-3d;will-change:transform;}
.khk-card.khk-tilt,.khk-postcard.khk-tilt{transition:transform .1s ease-out,box-shadow .18s ease;}

/* ===== قسم "اقرأ في 5 دقائق" — شريط أفقي ===== */
.khk-quick5{
  background:var(--khk-emerald);border-radius:24px;padding:2rem;position:relative;overflow:hidden;
}
.khk-quick5::after{
  content:"";position:absolute;bottom:-50px;right:-30px;width:180px;height:180px;
  background-image:radial-gradient(rgba(196,240,70,.12) 2px,transparent 2px);background-size:24px 24px;
}
.khk-quick5__head{display:flex;align-items:center;gap:.7rem;margin-bottom:1.4rem;position:relative;z-index:1;}
.khk-quick5__head h2{font-family:'Cairo',sans-serif;font-weight:800;font-size:1.6rem;color:#fff;margin:0;}
.khk-quick5__head .ic{font-size:1.6rem;}
.khk-quick5 .khk-grid{position:relative;z-index:1;}
.khk-quick5 .khk-card{background:rgba(255,255,255,.97);}
.khk-quick5 .khk-card__media{background:#0E2E27;}

/* ===== المقاسات للتطويرات ===== */
@media (max-width:768px){
  .khk-featured{grid-template-columns:1fr;text-align:center;padding:1.5rem;}
  .khk-featured__media{max-width:200px;margin:0 auto;}
  .khk-featured__title{font-size:1.6rem;}
  .khk-featured__meta{justify-content:center;}
  .khk-stats{grid-template-columns:repeat(3,1fr);gap:.5rem;}
  .khk-stat__num{font-size:1.4rem;}
  .khk-stat__label{font-size:.72rem;}
}

/* ============================================================
   تنقّل صفحات المقال (Pagination) — تصميم إبداعي (v2.2)
   ============================================================ */

/* شريط التقدّم أعلى الجزء */
.khk-progress{
  height:8px;background:#E3EFE6;border-radius:30px;overflow:hidden;margin:0 0 .6rem;
}
.khk-progress__fill{
  height:100%;border-radius:30px;
  background:linear-gradient(90deg,var(--khk-emerald),var(--khk-lime));
  transition:width .4s ease;
}
.khk-progress__label{
  font-family:'Cairo',sans-serif;font-weight:700;font-size:.85rem;
  color:var(--khk-emerald-300);margin-bottom:1.5rem;text-align:center;
}

/* أزرار التالي/السابق */
.khk-pager{margin:2.5rem 0 1rem;}
.khk-pager__inner{
  display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;
  background:linear-gradient(135deg,#FFFFFF,#F4FBED);
  border:1px solid var(--khk-border);border-radius:18px;padding:1.1rem 1.3rem;
}
.khk-pager a{
  display:inline-flex;align-items:center;gap:.5rem;
  font-family:'Cairo',sans-serif;font-weight:800;font-size:1rem;text-decoration:none;
  background:var(--khk-emerald);color:var(--khk-lime);
  padding:.75rem 1.6rem;border-radius:12px;transition:all .15s ease;
}
.khk-pager a:hover{background:var(--khk-emerald-700);transform:translateY(-2px);box-shadow:0 8px 20px rgba(20,68,58,.25);}
/* الصفحة الحالية (نص بدون رابط) */
.khk-pager > .khk-pager__inner > span,
.khk-pager .post-page-numbers.current{
  font-family:'Cairo',sans-serif;font-weight:800;color:var(--khk-muted);
}

/* أرقام الصفحات (نقاط) */
.khk-pagedots{
  display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center;margin:1.5rem 0 .5rem;
}
.khk-pagedots__d{
  display:flex;align-items:center;justify-content:center;
  width:40px;height:40px;border-radius:11px;text-decoration:none;
  font-family:'Cairo',sans-serif;font-weight:700;font-size:.95rem;
  background:var(--khk-surface);border:1px solid var(--khk-border);color:var(--khk-emerald);
  transition:all .15s ease;
}
.khk-pagedots__d:hover{border-color:var(--khk-emerald-300);transform:translateY(-2px);}
.khk-pagedots__d.is-active{background:var(--khk-emerald);color:var(--khk-lime);border-color:var(--khk-emerald);}

@media (max-width:560px){
  .khk-pager__inner{flex-direction:column;}
  .khk-pager a{width:100%;justify-content:center;}
  .khk-pagedots__d{width:36px;height:36px;font-size:.85rem;}
}

/* حماية: إخفاء أي كارت فاضي (بلا صورة) في الشبكات */
.khk-grid > p:empty{display:none !important;}
.khk-grid .khk-card:not(:has(.khk-card__media)){display:none !important;}
