/* ============================================================
   MIES — Mutuelle Ivoirienne d'Entraide et de Solidarité
   Palette : clinic-teal (teal + sky) — confiance, santé, social
   Typo    : editorial-serif-warm (Fraunces + DM Sans)
   Motion  : gentle-fade-reveal (CSS scroll-driven, no JS)
   Layout  : split-hero-sections
   Signature: no-signature (restraint)
   Background: no-background
   ============================================================ */

:root {
  --bg: #ffffff;
  --surface: #f0f7f7;
  --surface-2: #ffffff;
  --ink: #12302e;
  --muted: #4a6663;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --sky: #dbeafe;
  --accent: #0ea5e9;
  --rule: #d8e6e4;
  --ph-bg: #fdf3d7;
  --ph-ink: #6b4e00;
  --shadow: 0 1px 2px rgba(18, 48, 46, .06), 0 12px 32px -18px rgba(18, 48, 46, .35);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #0b1a19;
  --surface: #102523;
  --surface-2: #13302d;
  --ink: #e8f2f0;
  --muted: #a3bfbb;
  --primary: #2dd4bf;
  --primary-ink: #06201d;
  --sky: #16323f;
  --accent: #38bdf8;
  --rule: #23423e;
  --ph-bg: #2a2410;
  --ph-ink: #e8d79a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -20px rgba(0, 0, 0, .8);
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.35rem); }

p { margin: 0 0 1.1em; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout primitives ---------- */

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 72px);
}

.section { padding-block: clamp(64px, 9vw, 120px); }
.section-tint { background: var(--surface); }

.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 { max-width: 22ch; }
.section-intro { margin-top: 1.1rem; color: var(--muted); font-size: 1.0625rem; }

.eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 .9rem;
}

/* Placeholders — obviously fill-in, never fake data */
.ph {
  background: var(--ph-bg);
  color: var(--ph-ink);
  border-bottom: 1px dotted currentColor;
  padding: .05em .3em;
  border-radius: 3px;
  font-size: .95em;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 76px;
  flex-wrap: wrap;
  padding-block: .6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--ink);
  margin-right: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  background: var(--primary);
  color: var(--primary-ink);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1rem; letter-spacing: .02em; }
.brand-text small { font-size: .72rem; color: var(--muted); max-width: 34ch; }

.nav { display: flex; gap: clamp(.75rem, 2vw, 1.6rem); flex-wrap: wrap; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: .94rem;
  font-weight: 500;
  padding: .55rem .1rem;
  border-bottom: 2px solid transparent;
  transition: border-color .18s ease, color .18s ease;
}
.nav a:hover { color: var(--primary); border-bottom-color: var(--primary); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Hero ---------- */

.hero { padding-block: clamp(48px, 7vw, 96px) clamp(56px, 8vw, 104px); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.hero-copy h1 { margin-bottom: 1.1rem; }
.hero-copy h1 em {
  font-style: italic;
  color: var(--primary);
}

.lede {
  font-size: clamp(1.05rem, 1.5vw, 1.16rem);
  color: var(--muted);
  max-width: 56ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin: 1.9rem 0 2.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .8rem 1.5rem;
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
  font-size: .98rem;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 84%, var(--ink)); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.hero-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}
.hero-facts li { display: grid; gap: .1rem; }
.hero-facts strong {
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
}
.hero-facts span { font-size: .95rem; color: var(--muted); }

.hero-figure { margin: 0; }
.hero-figure img {
  width: 100%;
  height: clamp(320px, 52vh, 560px);
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
figcaption {
  margin-top: .7rem;
  font-size: .82rem;
  color: var(--muted);
}

/* ---------- Mission ---------- */

.mission-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.mission-text p { font-size: 1.0625rem; }

.values {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 34px);
}
.values h3 { margin-bottom: 1.2rem; }
.values dl { margin: 0; display: grid; gap: 1.15rem; }
.values dt {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
  margin-bottom: .15rem;
}
.values dd { margin: 0; font-size: .95rem; color: var(--muted); }

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.card-num {
  font-family: 'Fraunces', Georgia, serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
}
.card h3 { margin: 0; }
.card p { font-size: .97rem; color: var(--muted); margin: 0; }

/* ---------- Steps ---------- */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(20px, 3vw, 36px);
}
.steps li {
  counter-increment: step;
  border-top: 2px solid var(--primary);
  padding-top: 1.1rem;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .5rem;
}
.steps h3 { margin-bottom: .5rem; }
.steps p { font-size: .97rem; color: var(--muted); margin: 0; }

/* ---------- Adhesion ---------- */

.adhesion-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.adhesion-copy h2 { margin-bottom: 1.1rem; max-width: 24ch; }
.adhesion-copy p { color: var(--muted); }

.adhesion-details,
.contact-details {
  margin: 1.8rem 0 0;
  display: grid;
  gap: 1rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.4rem;
}
.adhesion-details > div,
.contact-details > div {
  display: grid;
  grid-template-columns: minmax(120px, 34%) 1fr;
  gap: .5rem 1rem;
  align-items: baseline;
}
.adhesion-details dt,
.contact-details dt {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
}
.adhesion-details dd,
.contact-details dd { margin: 0; font-size: .97rem; }

.adhesion-figure { margin: 0; }
.adhesion-figure img {
  width: 100%;
  height: clamp(300px, 46vh, 480px);
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Quote ---------- */

.quote-section { padding-block: clamp(56px, 8vw, 104px); }
.quote-section blockquote {
  margin: 0;
  max-width: 46ch;
  padding-left: clamp(18px, 3vw, 32px);
  border-left: 3px solid var(--accent);
}
.quote-section blockquote p {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 1rem;
  max-width: none;
}
.quote-section blockquote footer { font-size: .88rem; color: var(--muted); }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.contact-copy h2 { margin-bottom: 1.1rem; max-width: 22ch; }
.contact-copy p { color: var(--muted); }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 34px);
  display: grid;
  gap: 1.1rem;
}

.field { display: grid; gap: .4rem; }
.field label {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink);
}
.optional { font-weight: 400; color: var(--muted); }

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: .7rem .85rem;
  min-height: 46px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 1px;
}

.contact-form .btn { justify-self: start; }

.form-status {
  margin: 0;
  font-size: .93rem;
  color: var(--muted);
}
.form-status.is-ok { color: var(--primary); font-weight: 500; }
.form-status.is-error { color: #b3261e; }
html[data-theme="dark"] .form-status.is-error { color: #ff9b93; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  padding-block: clamp(36px, 5vw, 56px) 1.5rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand strong { font-family: 'Fraunces', Georgia, serif; font-size: 1.02rem; }
.footer-brand p { margin: .4rem 0 0; font-size: .86rem; color: var(--muted); }

.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
}
.footer-nav a:hover { color: var(--primary); text-decoration: underline; }

.attribution {
  margin: 2rem 0 0;
  font-size: .78rem;
  color: var(--muted);
  opacity: 1;
}
.attribution a { color: var(--muted); text-decoration: underline; }
.attribution a:hover { color: var(--primary); }

/* ---------- Motion: gentle fade + rise (CSS scroll-driven) ---------- */

@keyframes fadeRise {
  from { opacity: 0; translate: 0 14px; }
  to   { opacity: 1; translate: 0 0; }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-head,
    .card,
    .steps li,
    .values,
    .adhesion-figure,
    .quote-section blockquote {
      animation: fadeRise 420ms cubic-bezier(.2, .7, .1, 1) both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero-grid,
  .mission-grid,
  .adhesion-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .hero-figure img { height: clamp(260px, 42vh, 420px); }
  .adhesion-figure { order: -1; }
  .brand-text small { display: none; }
}

@media (max-width: 640px) {
  .header-inner { min-height: 64px; gap: .75rem; }
  .nav {
    order: 3;
    width: 100%;
    gap: 1rem;
    padding-bottom: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; font-size: .88rem; }
  .adhesion-details > div,
  .contact-details > div { grid-template-columns: 1fr; gap: .1rem; }
  .hero-actions .btn { flex: 1 1 auto; }
}
