/*
Theme Name: ECMES Academic
Theme URI: https://ecmes.org
Author: ECMES
Description: قالب أكاديمي عربي للاقتصاد السياسي والدراسات الاستراتيجية. يدعم RTL ويحتوي سلايدر اقتباسات، مقالات، إحصائيات، حوارات وفريق العمل.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: ecmes-academic
Tags: rtl-language-support, custom-colors, featured-images, threaded-comments, translation-ready
*/

:root{
  --bg:#fbf9f4;
  --fg:#1a1a1a;
  --muted:#6b6b6b;
  --card:#ffffff;
  --border:#e8e1d2;
  --primary:#a07d3a;
  --primary-dark:#7a5d28;
  --primary-light:#f0e6d2;
  --surface-warm:#f5efe2;
  --shadow-sm:0 1px 3px rgba(0,0,0,.06);
  --shadow-md:0 6px 20px rgba(0,0,0,.08);
  --shadow-lg:0 14px 40px rgba(0,0,0,.12);
}

*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  background:var(--bg);
  color:var(--fg);
  font-family:'Amiri','Scheherazade New',Georgia,serif;
  line-height:1.85;
  direction:rtl;
  text-align:right;
}
img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
h1,h2,h3,h4{font-family:'Playfair Display','Amiri',Georgia,serif;line-height:1.3;font-weight:700}
.container{max-width:1180px;margin:0 auto;padding:0 24px}

/* HEADER */
.site-header{
  position:sticky;top:0;z-index:50;
  background:rgba(251,249,244,.92);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.site-header .inner{display:flex;align-items:center;justify-content:space-between;height:70px}
.brand{font-family:'Playfair Display',serif;font-size:1.35rem;font-weight:700;color:var(--primary)}
.nav{display:flex;gap:28px}
.nav a{font-size:.95rem;color:var(--fg);transition:color .2s}
.nav a:hover{color:var(--primary)}
.nav-toggle{display:none;background:none;border:0;font-size:1.6rem;cursor:pointer;color:var(--fg)}

/* HERO SLIDER */
.hero{
  position:relative;min-height:70vh;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(rgba(0,0,0,.6),rgba(0,0,0,.6)),
    url('https://images.unsplash.com/photo-1481627834876-b7833e8f5570?w=1600&h=900&fit=crop') center/cover;
  color:#fff;overflow:hidden;
}
.hero-inner{width:100%;max-width:900px;padding:60px 24px;text-align:center}
.quotes{position:relative;min-height:140px;display:flex;align-items:center;justify-content:center}
.quote{
  position:absolute;width:100%;
  font-family:'Playfair Display','Amiri',serif;
  font-size:clamp(1.25rem,3.5vw,2.5rem);
  line-height:1.7;opacity:0;transform:translateX(40px);
  transition:opacity .7s ease,transform .7s ease;
}
.quote.active{opacity:1;transform:translateX(0)}
.slider-controls{display:flex;align-items:center;justify-content:center;gap:24px;margin-top:40px}
.slider-btn{
  width:42px;height:42px;border-radius:50%;
  border:1px solid rgba(255,255,255,.3);
  background:transparent;color:rgba(255,255,255,.8);
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  font-size:1.2rem;transition:all .25s;
}
.slider-btn:hover{border-color:#fff;color:#fff;background:rgba(255,255,255,.1)}
.dots{display:flex;gap:10px}
.dot{
  width:8px;height:8px;border-radius:99px;background:rgba(255,255,255,.4);
  border:0;cursor:pointer;transition:all .4s;padding:0;
}
.dot.active{width:32px;background:#fff}

/* SECTIONS */
.section{padding:80px 0}
.section-warm{background:var(--surface-warm)}
.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:40px;flex-wrap:wrap;gap:16px}
.section-title{font-size:clamp(1.6rem,3vw,2rem);color:var(--fg)}
.see-all{font-size:.9rem;color:var(--primary);font-family:'DM Sans',system-ui,sans-serif}
.see-all:hover{color:var(--primary-dark)}

/* GRID + CARDS */
.grid{display:grid;gap:32px}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
.card{
  background:var(--card);border-radius:10px;overflow:hidden;
  box-shadow:var(--shadow-sm);transition:box-shadow .3s,transform .3s;
}
.card:hover{box-shadow:var(--shadow-md);transform:translateY(-2px)}
.card .thumb{aspect-ratio:16/10;overflow:hidden;position:relative}
.card .thumb img{width:100%;height:100%;object-fit:cover;transition:transform .5s}
.card:hover .thumb img{transform:scale(1.05)}
.card .body{padding:20px}
.tag{font-family:'DM Sans',sans-serif;font-size:.72rem;font-weight:600;color:var(--primary);text-transform:uppercase;letter-spacing:.08em}
.card h3{font-size:1.1rem;margin-top:8px;line-height:1.45;transition:color .2s}
.card:hover h3{color:var(--primary)}
.card .meta{font-family:'DM Sans',sans-serif;font-size:.75rem;color:var(--muted);margin-top:12px}

/* MEDIA OVERLAY (interviews) */
.media-overlay{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.2);color:#fff;font-size:2.5rem;
}

/* STATS BANNER */
.stats{background:#1a1a1a;color:#fbf9f4;padding:64px 0}
.stats h2{text-align:center;margin-bottom:48px;font-size:clamp(1.4rem,2.5vw,1.9rem)}
.stats-row{display:flex;flex-wrap:wrap;justify-content:center;gap:64px}
.stat{text-align:center;min-width:120px}
.stat .num{display:block;font-family:'Playfair Display',serif;font-size:clamp(2rem,4vw,3rem);font-weight:700;color:var(--primary)}
.stat .lbl{display:block;font-family:'DM Sans',sans-serif;font-size:.85rem;margin-top:8px;color:rgba(251,249,244,.7)}

/* TEAM */
.team-intro{text-align:center;margin-bottom:48px}
.team-intro p{color:var(--muted);max-width:520px;margin:12px auto 0;font-family:'DM Sans',sans-serif}
.member{
  background:var(--card);border-radius:14px;padding:28px 20px;text-align:center;
  box-shadow:var(--shadow-sm);transition:box-shadow .3s;
}
.member:hover{box-shadow:var(--shadow-lg)}
.member .avatar{
  width:112px;height:112px;border-radius:50%;overflow:hidden;margin:0 auto 18px;
  border:4px solid var(--primary-light);
}
.member .avatar img{width:100%;height:100%;object-fit:cover;transition:transform .5s}
.member:hover .avatar img{transform:scale(1.1)}
.member h3{font-size:1.1rem}
.member .role{color:var(--primary);font-weight:600;font-size:.9rem;font-family:'DM Sans',sans-serif;margin-top:4px}
.member .tasks{font-size:.78rem;color:var(--muted);margin-top:12px;font-family:'DM Sans',sans-serif;line-height:1.6}
.socials{display:flex;justify-content:center;gap:10px;margin-top:18px}
.socials a{
  width:34px;height:34px;border-radius:50%;background:#f0ece1;
  display:inline-flex;align-items:center;justify-content:center;
  color:var(--muted);transition:all .2s;
}
.socials a:hover{background:var(--primary);color:#fff}
.socials svg{width:14px;height:14px}

/* FOOTER */
.site-footer{background:#1a1a1a;color:#cfc8b5;padding:48px 0 24px;margin-top:0}
.footer-row{display:grid;grid-template-columns:repeat(3,1fr);gap:32px;margin-bottom:32px}
.footer-row h4{color:#fff;margin-bottom:14px;font-family:'Playfair Display',serif;font-size:1.05rem}
.footer-row a{display:block;font-size:.88rem;padding:4px 0;color:#cfc8b5;font-family:'DM Sans',sans-serif}
.footer-row a:hover{color:var(--primary)}
.copy{border-top:1px solid #2a2a2a;padding-top:18px;text-align:center;font-size:.8rem;color:#8a8675;font-family:'DM Sans',sans-serif}

/* RESPONSIVE */
@media (max-width:980px){
  .grid-3,.grid-4{grid-template-columns:repeat(2,1fr)}
  .footer-row{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:640px){
  .nav{display:none;position:absolute;top:70px;right:0;left:0;flex-direction:column;background:var(--bg);padding:20px 24px;border-bottom:1px solid var(--border);gap:14px}
  .nav.open{display:flex}
  .nav-toggle{display:block}
  .grid-3,.grid-4,.grid-2{grid-template-columns:1fr}
  .footer-row{grid-template-columns:1fr;text-align:center}
  .section{padding:56px 0}
  .hero{min-height:60vh}
  .quotes{min-height:160px}
  .stats-row{gap:32px}
}

/* Team member single page */
.member-single{max-width:900px}
.member-hero{display:flex;gap:32px;align-items:center;margin-bottom:32px;flex-wrap:wrap}
.avatar-xl{width:200px;height:200px;border-radius:50%;overflow:hidden;border:4px solid var(--primary-light);flex-shrink:0}
.avatar-xl img{width:100%;height:100%;object-fit:cover}
.member-info{flex:1;min-width:240px}
.member-info h1{font-size:2rem;margin-bottom:8px}
.member-info .role{color:var(--primary);font-weight:600;font-family:'DM Sans',sans-serif;margin-bottom:12px}
.member-info .tasks{color:var(--muted);font-family:'DM Sans',sans-serif;margin-bottom:16px}
.member-info .socials{display:flex;gap:12px}
.member-info .socials a{width:40px;height:40px;border-radius:50%;background:var(--primary-light);color:var(--primary);display:inline-flex;align-items:center;justify-content:center;font-weight:700;transition:all .2s}
.member-info .socials a:hover{background:var(--primary);color:#fff}
.member-bio{font-size:1.05rem;line-height:1.9;border-top:1px solid var(--border);padding-top:24px}
.member h3 a{transition:color .2s}
.member h3 a:hover{color:var(--primary)}


/* =========================
   ARTICLES GRID FINAL FIX
========================= */

.post-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

/* CARD */
.post-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all .25s ease;
}

.post-card:hover{
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

/* LINK */
.post-card a{
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

/* IMAGE */
.post-thumbnail{
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.post-thumbnail img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.post-card:hover .post-thumbnail img{
  transform: scale(1.07);
}

/* CONTENT */
.post-content{
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-content h4{
  font-size: 15px;
  line-height: 1.4;
  transition: color .2s;
}

.post-card:hover h4{
  color: var(--primary);
}

.post-content .meta{
  font-size: 12px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}

.post-content p{
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* PAGINATION */
.pagination{
  margin-top: 40px;
  text-align: center;
}

.pagination a,
.pagination span{
  display: inline-block;
  margin: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: 'DM Sans', sans-serif;
  transition: .2s;
}

.pagination a:hover{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination .current{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* RESPONSIVE */
@media (max-width: 900px){
  .post-grid{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px){
  .post-grid{
    grid-template-columns: 1fr;
  }
}


/* =========================
   SINGLE POST LAYOUT
========================= */

.single-layout{
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* MAIN */
.single-content{
  flex: 1 1 70%;
  min-width: 0;
}

.single-article{
  max-width: 780px;
  margin: 0 auto;
}

/* HEADER */
.single-header{
  margin-bottom: 20px;
}

.single-title{
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-bottom: 10px;
  line-height: 1.4;
}

.single-meta{
  display: flex;
  gap: 15px;
  font-size: .85rem;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}

/* IMAGE */
.single-thumb{
  border-radius: 12px;
  overflow: hidden;
  margin: 25px 0;
}

.single-thumb img{
  width: 100%;
  height: auto;
  display: block;
}

/* CONTENT */
.single-content-body{
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--fg);
}

/* SIDEBAR */
.single-sidebar{
  flex: 0 0 300px;
  position: sticky;
  top: 90px;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 12px;
}

/* RELATED POSTS */
.related-posts h3{
  margin-bottom: 15px;
  font-size: 1rem;
}

.related-item{
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}

.related-thumb img{
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.related-title{
  font-size: .85rem;
  font-weight: 600;
}

.related-date{
  font-size: .75rem;
  color: var(--muted);
}

/* RESPONSIVE */
@media (max-width: 900px){
  .single-layout{
    flex-direction: column;
  }

  .single-sidebar{
    position: static;
    width: 100%;
  }
}