/* ===== MIHD Institute — feuille de style principale ===== */

:root {
  --bg: #faf8f4;
  --bg-alt: #f1ede5;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #5d6470;
  --primary: #0e2240;     /* bleu nuit */
  --primary-soft: #1b3a66;
  --accent: #c79a3c;      /* or / ambre */
  --border: #e2ddd2;
  --shadow: 0 8px 24px rgba(14, 34, 64, 0.08);
}

[data-theme="dark"] {
  --bg: #0b1322;
  --bg-alt: #101b30;
  --surface: #14213a;
  --text: #eef1f6;
  --muted: #9aa6b8;
  --primary: #eef1f6;
  --primary-soft: #c9d4e6;
  --accent: #e0b75e;
  --border: #233453;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; line-height: 1.25; }
a { color: inherit; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 800px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: 'Playfair Display', serif; font-weight: 700; }
.logo-mark { background: var(--accent); color: #0e2240; padding: 4px 10px; border-radius: 4px; font-size: 0.95rem; letter-spacing: 1px; }
.logo-text { font-size: 1.1rem; }
.main-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.main-nav a { text-decoration: none; font-size: 0.92rem; font-weight: 500; color: var(--muted); }
.main-nav a:hover, .main-nav a.active { color: var(--accent); }
.btn-nav { background: var(--accent); color: #0e2240 !important; padding: 8px 16px; border-radius: 4px; font-weight: 600; }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.nav-burger { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text); cursor: pointer; }

/* ===== Hero ===== */
.hero { position: relative; background: #0e2240; color: #f5f1e8; overflow: hidden; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-content { position: relative; padding: 120px 20px 130px; text-align: center; }
.hero-kicker { text-transform: uppercase; letter-spacing: 3px; font-size: 0.8rem; color: #e0b75e; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 20px; }
.hero-sub { max-width: 680px; margin: 0 auto 32px; font-size: 1.1rem; opacity: 0.9; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn { display: inline-block; padding: 13px 26px; border-radius: 4px; text-decoration: none; font-weight: 600; font-size: 0.95rem; border: none; cursor: pointer; transition: transform 0.15s, filter 0.15s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #0e2240; }
.btn-ghost { background: transparent; color: #f5f1e8; border: 1px solid rgba(245, 241, 232, 0.5); }

/* ===== Stats ===== */
.stats { background: var(--surface); border-bottom: 1px solid var(--border); padding: 44px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; text-align: center; }
.stat strong { display: block; font-family: 'Playfair Display', serif; font-size: 2.4rem; color: var(--accent); }
.stat span { color: var(--muted); font-size: 0.9rem; }

/* ===== Sections ===== */
.section { padding: 76px 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: 1.9rem; margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.link-more { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.92rem; }

.page-hero { background: linear-gradient(135deg, #0e2240, #1b3a66); color: #f5f1e8; padding: 70px 0; }
.page-hero h1 { font-size: 2.4rem; margin-bottom: 8px; }
.page-hero p { opacity: 0.85; }

/* ===== À la une ===== */
.feature-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; }
.feature-main { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 32px; box-shadow: var(--shadow); }
.feature-main h3 { font-size: 1.5rem; margin: 10px 0 12px; }
.feature-main a, .feature-item a { text-decoration: none; }
.feature-main a:hover, .feature-item a:hover { color: var(--accent); }
.feature-side { display: flex; flex-direction: column; gap: 16px; }
.feature-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px 22px; }
.feature-item h4 { font-size: 1.02rem; margin-top: 6px; }
.tag { color: var(--accent); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.byline { color: var(--muted); font-size: 0.88rem; margin-top: 10px; }

/* ===== Cards ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 26px; transition: transform 0.2s, box-shadow 0.2s; }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.card h3 { font-size: 1.15rem; margin: 8px 0; }
.card p { color: var(--muted); font-size: 0.93rem; }
.card-num { font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--accent); font-weight: 700; }

/* ===== Équipe ===== */
.person { text-align: center; }
.avatar { width: 70px; height: 70px; border-radius: 50%; background: linear-gradient(135deg, #1b3a66, #0e2240); color: #e0b75e; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; margin: 0 auto 10px; border: 2px solid var(--accent); }
.role { color: var(--accent) !important; font-weight: 600; font-size: 0.85rem !important; text-transform: uppercase; letter-spacing: 1px; }

/* ===== Recherche (page) ===== */
.research-list { display: flex; flex-direction: column; gap: 28px; }
.research-item { display: flex; gap: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 30px; }
.research-item h2 { font-size: 1.4rem; margin-bottom: 8px; }
.research-item p { color: var(--muted); }
.research-item .tag { display: block; margin-top: 12px; }

/* ===== Événements ===== */
.event-list { display: flex; flex-direction: column; gap: 16px; }
.event { display: flex; gap: 22px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px 26px; }
.event-date { text-align: center; min-width: 72px; background: var(--bg-alt); border-radius: 8px; padding: 10px; }
.event-date strong { display: block; font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--accent); }
.event-date span { font-size: 0.78rem; color: var(--muted); }
.event h4 { font-size: 1.1rem; margin-bottom: 4px; }
.event p { color: var(--muted); font-size: 0.92rem; }

/* ===== Publications ===== */
.pub-toolbar { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 30px; }
#pub-search { flex: 1; min-width: 220px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.95rem; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 0.85rem; font-weight: 500; }
.filter-btn.active, .filter-btn:hover { background: var(--accent); color: #0e2240; border-color: var(--accent); }
.pub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.pub-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; transition: transform 0.2s, box-shadow 0.2s; }
.pub-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.pub-item h3 { font-size: 1.08rem; margin: 8px 0; }
.pub-empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ===== Newsletter ===== */
.newsletter { background: #0e2240; color: #f5f1e8; padding: 56px 0; }
.newsletter-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.newsletter h2 { font-size: 1.6rem; margin-bottom: 6px; }
.newsletter p { opacity: 0.85; }
.newsletter-form { display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter-form input { padding: 13px 18px; border-radius: 4px; border: none; min-width: 260px; font-size: 0.95rem; }

/* ===== Contact ===== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contact-form { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 30px; }
.contact-form input, .contact-form textarea, .contact-form select { padding: 13px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.95rem; }

/* ===== Footer ===== */
.site-footer { background: #0a1830; color: rgba(245, 241, 232, 0.75); padding-top: 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 32px; padding-bottom: 30px; }
.footer-grid h4 { color: #e0b75e; margin-bottom: 10px; font-size: 1rem; }
.footer-grid a { display: block; color: rgba(245, 241, 232, 0.75); text-decoration: none; margin-bottom: 6px; font-size: 0.92rem; }
.footer-grid a:hover { color: #e0b75e; }
.footer-logo { font-family: 'Playfair Display', serif; font-size: 1.3rem; color: #f5f1e8; margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid rgba(245, 241, 232, 0.15); padding: 18px 20px; text-align: center; font-size: 0.85rem; }

/* ===== Sélecteur de langue ===== */
.lang-switch { display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 20px; padding: 2px; }
.lang-switch a { padding: 4px 10px; border-radius: 16px; font-size: 0.78rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.lang-switch a.active, .lang-switch a:hover { background: var(--accent); color: #0e2240 !important; }

/* ===== Support RTL (arabe) ===== */
[dir="rtl"] body { font-family: 'Cairo', 'Inter', sans-serif; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
[dir="rtl"] .logo, [dir="rtl"] .stat strong, [dir="rtl"] .card-num,
[dir="rtl"] .event-date strong, [dir="rtl"] .footer-logo { font-family: 'Amiri', 'Cairo', serif; }
[dir="rtl"] .hero-kicker, [dir="rtl"] .tag, [dir="rtl"] .role { letter-spacing: 0; }

/* ===== Animations au scroll ===== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .feature-grid, .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-burger { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding: 16px 0; }
  .main-nav.open { display: flex; }
  .header-inner { flex-wrap: wrap; }
  .research-item { flex-direction: column; gap: 10px; }
}
