/* =========================================================
   Africa Governance Institute, shared styles
   Brand: deep olive, AGI red, ochre, gold + warm cream
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,300;8..60,400;8..60,500;8..60,600;8..60,700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand */
  --agi-red:        #B22F28;
  --agi-red-dark:   #8E1F1A;
  --agi-olive:      #5E6B27;
  --agi-olive-dark: #3F4A18;
  --agi-olive-deep: #2A3210;
  --agi-orange:     #DD8728;
  --agi-yellow:     #E8B936;

  /* Surfaces */
  --paper:    #FFFFFF;
  --cream:    #F8F2E2;
  --cream-2:  #EFE7D1;
  --cream-3:  #E5DCC0;
  --ink:      #181612;
  --ink-2:    #3A352A;
  --ink-3:    #6A6354;
  --line:     #E2D9BF;
  --line-2:   #C9BE9E;

  /* Type */
  --serif: 'Source Serif 4', 'Times New Roman', serif;
  --sans:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --maxw: 1320px;
  --gutter: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Layout wrappers ----------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap-wide { max-width: 1480px; margin: 0 auto; padding: 0 var(--gutter); }

/* Breadcrumbs, shared base (pages may override colors) ----- */
.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.crumbs a { transition: color .2s; }
.crumbs .sep { opacity: 0.5; }
.crumbs .now { color: var(--ink); }

/* Eyebrow / labels ---------------------------------------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--agi-red);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  display: none;
}
.eyebrow.no-rule::before { display: none; }
.eyebrow.on-dark { color: var(--agi-yellow); }

/* Display headlines --------------------------------------- */
.h-display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}
.h-section {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4.2vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}
.h-card {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.005em;
  margin: 0;
}
.lead {
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  font-weight: 400;
}

/* Buttons ------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 26px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform .25s ease, background .25s ease, color .25s ease, border-color .25s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn .arrow { transition: transform .3s ease; }
.btn:hover .arrow { transform: translateX(4px); }
.btn-primary {
  background: var(--agi-red);
  color: #fff;
}
.btn-primary:hover { background: var(--agi-red-dark); }
.btn-outline {
  border-color: rgba(255,255,255,0.55);
  color: #fff;
}
.btn-outline:hover { background: #fff; color: var(--ink); border-color: #fff; }
.btn-outline-dark {
  border-color: var(--ink);
  color: var(--ink);
}
.btn-outline-dark:hover { background: var(--ink); color: var(--cream); }
.btn-ghost {
  padding: 14px 0;
  border-bottom: 1.5px solid currentColor;
  border-radius: 0;
  color: var(--ink);
}
.btn-yellow {
  background: var(--agi-yellow);
  color: var(--ink);
}
.btn-yellow:hover { background: #d6a824; }

/* =========================================================
   Top utility bar
   ========================================================= */
.utility-bar {
  background: var(--agi-olive-deep);
  color: var(--cream);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.utility-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
  gap: 24px;
}
.util-left, .util-right {
  display: flex;
  align-items: center;
  gap: 22px;
}
.util-left span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.util-left svg { opacity: 0.75; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(248, 242, 226, 0.25);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.lang-switch button {
  padding: 4px 10px;
  color: var(--cream);
  opacity: 0.65;
}
.lang-switch button.active {
  background: var(--agi-yellow);
  color: var(--ink);  opacity: 1;
}
/* Translating indicator on the active FR button */
html.i18n-translating .lang-switch button.active {
  position: relative;
  pointer-events: none;
}
html.i18n-translating .lang-switch button.active::after {
  content: "";
  position: absolute;
  inset: -1px -1px -1px -1px;
  border: 1px solid currentColor;
  border-top-color: transparent;
  border-radius: 2px;
  animation: agi-i18n-spin 0.8s linear infinite;
  opacity: 0.55;
}
@keyframes agi-i18n-spin { to { transform: rotate(360deg); } }
html.i18n-translating { cursor: progress; }

.util-right .socials { display: inline-flex; gap: 14px; }
.util-right .socials a { opacity: 0.75; transition: opacity .2s; }
.util-right .socials a:hover { opacity: 1; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(180%) blur(10px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.brand img {
  height: 56px;
  width: auto;
}
.brand-text {
  display: none;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--agi-red);
  line-height: 1;
  font-size: 13px;
}
.nav-primary {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.nav-primary a {
  padding: 10px 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  position: relative;
  white-space: nowrap;
  transition: color .2s;
}
.nav-primary a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  background: var(--agi-red);
  transform: translateX(-50%);
  transition: width .3s ease;
}
.nav-primary a:hover { color: var(--agi-red); }
.nav-primary a:hover::after,
.nav-primary a.active::after { width: 22px; }
.nav-primary a.active { color: var(--agi-red); font-weight: 600; }

.header-cta {
  display: flex;
  align-items: center;
  gap: 14px;
}
/* Keep the header CTA compact so the bilingual nav fits on one row */
.site-header .header-cta .btn-primary {
  padding: 13px 20px;
  letter-spacing: 0.08em;
}
/* Hamburger / mobile menu toggle */
.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex-shrink: 0;
  transition: border-color .2s, color .2s;
}
.nav-toggle:hover { border-color: var(--agi-red); color: var(--agi-red); }
.nav-toggle .ico-close { display: none; }
.nav-toggle[aria-expanded="true"] .ico-open { display: none; }
.nav-toggle[aria-expanded="true"] .ico-close { display: block; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--agi-olive-deep);
  color: var(--cream);
  padding: 88px 0 0;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 60px 48px;
  padding-bottom: 64px;
}
.footer-brand img {
  height: 70px;
  filter: brightness(0) invert(1);
  margin-bottom: 22px;
}
.footer-brand p {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  color: var(--cream);
  opacity: 0.9;
  max-width: 320px;
  margin: 0 0 28px;
}
.footer-h {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--agi-yellow);
  margin: 0 0 22px;
  font-weight: 500;
}
.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.footer-list a {
  font-size: 15px;
  opacity: 0.82;
  transition: opacity .2s, color .2s;
}
.footer-list a:hover { opacity: 1; color: var(--agi-yellow); }

.newsletter-form {
  display: flex;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  overflow: hidden;
  padding: 6px;
  margin-top: 18px;
}
.newsletter-form input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--cream);
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
}
.newsletter-form input::placeholder { color: rgba(248, 242, 226, 0.5); }
.newsletter-form input:focus { outline: none; }
.newsletter-form button {
  background: var(--agi-yellow);
  color: var(--ink);
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  transition: background .2s;
}
.newsletter-form button:hover { background: #d6a824; }
.site-footer .ok-msg,
.aside-card .ok-msg {
  font-size: 13px;
  opacity: 0.75;
  margin: 10px 0 0;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 28px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  opacity: 0.65;
}
.footer-bottom .legal {
  display: flex; gap: 28px;
}
.footer-stripe {
  display: flex;
  height: 4px;
}
.footer-stripe span { flex: 1; }
.footer-stripe span:nth-child(1) { background: var(--agi-olive); }
.footer-stripe span:nth-child(2) { background: var(--agi-orange); }
.footer-stripe span:nth-child(3) { background: var(--agi-yellow); }
.footer-stripe span:nth-child(4) { background: var(--agi-red); }

/* =========================================================
   Utility
   ========================================================= */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s ease, transform .8s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Bilingual nav collapses to a dropdown menu below the width where it fits inline */
@media (max-width: 1240px) {
  .nav-toggle { display: inline-flex; }
  .nav-primary {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 44px -24px rgba(0,0,0,0.28);
    padding: 6px var(--gutter) 14px;
  }
  .nav-primary.open { display: flex; }
  .nav-primary a {
    padding: 15px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }
  .nav-primary a:last-child { border-bottom: none; }
  .nav-primary a::after { display: none; }
}

/* CTA repeated inside the mobile dropdown (injected by site.js).
   Hidden everywhere except small screens, where the bar CTA is hidden. */
.nav-primary .nav-cta { display: none; }
@media (max-width: 720px) {
  .header-cta .btn-primary { display: none; }
  .nav-primary .nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 16px 0 8px;
    padding: 15px 22px;
    background: var(--agi-red);
    color: #fff;
    border-radius: 999px;
    border-bottom: none !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .nav-primary .nav-cta:hover { background: var(--agi-red-dark); color: #fff; }
}

/* Utility bar: drop phone + email once the row gets tight */
@media (max-width: 1020px) {
  .util-left .hide-sm { display: none; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}

@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .utility-bar { display: none; }
  .header-inner { padding-top: 14px; padding-bottom: 14px; }
  .brand img { height: 46px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 14px; text-align: center; }
}

/* =========================================================
   Article card (shared: home + news pages)
   ========================================================= */
.article-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.ac-img {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--cream-2);
}
.ac-illu, .ac-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .6s ease;
}
.article-card:hover .ac-illu, .article-card:hover .ac-photo { transform: scale(1.04); }
.ac-date {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.ac-date .day {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--agi-red);
}
.ac-date .mon {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 4px;
}
.ac-body {
  padding: 22px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ac-cat {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--agi-red);
  font-weight: 500;
}
.ac-body .h-card {
  font-size: 26px;
  line-height: 1.18;
}
.ac-body .h-card a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .35s ease;
}
.ac-body .h-card a:hover { background-size: 100% 1px; }
.ac-meta {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-3);
}
