/* ============================================================
   خلاصة كتاب — الهوية الإبداعية 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;}
}
