  :root {
    --bg: #dceefb;
    --bg-soft: #eaf6fd;
    --text: #1f2d3a;
    --text-soft: #4a5b6b;
    --card-shadow: 0 10px 30px rgba(31, 45, 58, 0.10);
    --accent: #5b8fb9;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 6vh 5vw;
  }

  .page {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(28px, 5vw, 56px);
  }

  .intro {
    text-align: center;
    max-width: 520px;
  }

  .intro h1 {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
    color: var(--accent);
  }

  .triangle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(20px, 4vw, 40px);
    width: 100%;
  }

  .item-main {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .row-bottom {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(28px, 8vw, 72px);
    width: 100%;
  }

  /* Responsive: stack every element vertically on narrow screens */
  @media (max-width: 560px) {
    .row-bottom {
      flex-direction: column;
      align-items: center;
      gap: 20px;
    }

    .card span {
      white-space: nowrap;
    }

    /* No popup on smartphone for Plateforme précarité: the explanation is
       shown inline instead. Ensemble-ne et Nesos gardent leur pop-up. */
    .modal-overlay--precarite-only {
      display: none !important;
    }

    .card-main {
      cursor: default;
    }

    .card-main:hover, .card-main:focus-visible {
      transform: none;
      box-shadow: var(--card-shadow);
    }

    /* Pop-up Ensemble-ne / Nesos : version optimisée petit écran
       (la pop-up Plateforme précarité reste désactivée sur mobile,
       voir la règle .modal-overlay--precarite-only ci-dessus) */
    .modal-overlay {
      align-items: flex-start;
      padding: 16px;
    }

    .modal {
      max-width: none;
      width: 100%;
      max-height: calc(100vh - 32px);
      border-radius: 16px;
      padding: 20px;
    }

    #ensemble-content h2,
    #nesos-content h2 {
      font-size: 1.15rem;
    }

    #ensemble-content p,
    #nesos-content p {
      font-size: 0.92rem;
      line-height: 1.55;
    }

    .modal-close {
      top: 12px;
      right: 12px;
    }

  }

  .precarite-inline-slot:empty {
    display: none;
  }

  .precarite-inline-slot #precarite-content {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    padding: 20px 24px;
    margin-top: 20px;
    text-align: left;
    max-width: 420px;
    width: 100%;
  }

  .card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    border: none;
    padding: clamp(18px, 3vw, 28px);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    font-family: inherit;
  }

  .card:hover, .card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(31, 45, 58, 0.16);
    outline: none;
  }

  .card:active {
    transform: translateY(-1px);
  }

  /* Les 3 logos ont tous la même taille (taille de la Plateforme précarité + 25%, puis -10%) */
  .card-main,
  .card-secondary {
    width: clamp(253px, 50.6vw, 338px);
    height: clamp(253px, 50.6vw, 338px);
  }

  .card img {
    width: 62%;
    height: 62%;
    object-fit: contain;
  }

  .card span {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
  }

  /* Modal */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 40, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 10;
  }

  .modal-overlay.open {
    display: flex;
  }

  /* Sur desktop, les pop-up s'affichent sur le côté droit plutôt qu'au centre */
  @media (min-width: 561px) {
    .modal-overlay {
      justify-content: flex-end;
      padding-right: clamp(24px, 5vw, 64px);
    }
  }

  .modal {
    background: #ffffff;
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 40px);
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  }

  #precarite-content h2,
  #ensemble-content h2,
  #nesos-content h2 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
    font-weight: 600;
  }

  #precarite-content p,
  #ensemble-content p,
  #nesos-content p {
    line-height: 1.6;
    color: var(--text-soft);
    margin: 0 0 12px 0;
  }

  #precarite-content a,
  #ensemble-content a,
  #nesos-content a {
    color: var(--accent);
    font-weight: 600;
  }

  #precarite-content a:hover,
  #ensemble-content a:hover,
  #nesos-content a:hover {
    text-decoration: none;
  }

  .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-close:hover {
    background: var(--bg);
  }

  footer {
    color: var(--accent);
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 8px;
  }

  .contact-cta {
    position: fixed;
    top: clamp(14px, 3vw, 28px);
    left: clamp(14px, 3vw, 28px);
    padding: 8px 22px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: var(--card-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    z-index: 5;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .contact-cta:hover, .contact-cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(31, 45, 58, 0.16);
    outline: none;
  }

  /* Le CTA Contact repasse dans le flux (au-dessus, aligné à gauche)
     pour ne pas chevaucher le titre sur petit écran */
  @media (max-width: 560px) {
    .contact-cta {
      position: static;
      align-self: flex-start;
      margin: 0 0 20px 0;
    }
  }
