/* Jeu Bercy 2026 — documents légaux V0
   UX responsive V1:
   - largeur desktop augmentée;
   - marges latérales garanties;
   - aucun scroll horizontal;
   - un seul scroll vertical: .modal__content.
*/

.legal-inline-notice {
  margin: .6rem 0 0;
  font-size: .88rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .72);
}

/*
 * Le .modal historique est limité à 680px.
 * La classe dédiée doit donc redéfinir la largeur du <dialog> lui-même,
 * et non seulement celle du panneau enfant.
 */
.legal-modal {
  width: min(1080px, calc(100vw - 80px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  overflow: hidden;
  box-sizing: border-box;
}

.legal-modal__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  padding: 24px 28px 26px;
  overflow: hidden;
  box-sizing: border-box;
}

/*
 * UNIQUE zone scrollable.
 * Le dialog et le panel restent fixes.
 */
.legal-modal .modal__content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: none;
  margin-top: 16px;
  padding-right: 12px;

  overflow-y: auto;
  overflow-x: hidden;

  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  box-sizing: border-box;
}

.legal-document {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  line-height: 1.62;

  overflow-wrap: anywhere;
  word-break: normal;
}

.legal-document h3 {
  max-width: 100%;
  margin: 1.15rem 0 .45rem;
  font-size: 1.02rem;
  line-height: 1.3;
  color: #ffb15f;
}

.legal-document h4 {
  max-width: 100%;
  margin: .9rem 0 .4rem;
  font-size: .96rem;
  line-height: 1.3;
  color: #ffd0a1;
}

.legal-document h3:first-child {
  margin-top: 0;
}

.legal-document p {
  max-width: 100%;
  margin: 0 0 .75rem;
}

.legal-document ul,
.legal-document ol {
  max-width: 100%;
  margin: .25rem 0 .9rem;
  padding-left: 1.4rem;
  box-sizing: border-box;
}

.legal-document li {
  max-width: 100%;
  margin: 0 0 .38rem;
}

.legal-document strong {
  color: #fff4e7;
}

/* Tablettes */
@media (max-width: 900px) {
  .legal-modal {
    width: calc(100vw - 40px);
    max-height: calc(100dvh - 32px);
  }

  .legal-modal__panel {
    max-height: calc(100dvh - 32px);
    padding: 22px 22px 22px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .legal-modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  .legal-modal__panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 18px 16px 16px;
    border-radius: 22px;
  }

  .legal-modal .modal__close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }

  .legal-modal .eyebrow {
    max-width: calc(100% - 48px);
    padding-right: 4px;
    font-size: .72rem;
    line-height: 1.3;
  }

  .legal-modal h2 {
    max-width: calc(100% - 48px);
    padding-right: 4px;
    font-size: clamp(1.3rem, 6vw, 1.65rem);
    line-height: 1.15;
  }

  .legal-modal .modal__content {
    margin-top: 12px;
    padding-right: 7px;
    font-size: .94rem;
    line-height: 1.55;
    scrollbar-gutter: auto;
  }

  .legal-document h3 {
    margin-top: 1rem;
    font-size: .98rem;
  }

  .legal-document h4 {
    font-size: .93rem;
  }

  .legal-document ul,
  .legal-document ol {
    padding-left: 1.18rem;
  }
}

/* Petits mobiles: 8px de marge de chaque côté */
@media (max-width: 390px) {
  .legal-modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .legal-modal__panel {
    max-height: calc(100dvh - 16px);
    padding: 16px 13px 14px;
  }

  .legal-modal .modal__content {
    padding-right: 5px;
    font-size: .92rem;
  }
}


/* ==================================================================
   Navigation légale mobile
   ================================================================== */

.legal-mobile-nav {
  display: none;
}

@media (max-width: 640px) {
  /*
   * Les liens du header desktop sont masqués sur mobile et remplacés
   * par cette navigation légale compacte placée sous le header.
   */
  .topbar__links {
    display: none !important;
  }

  .legal-mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    width: 100%;
    max-width: 100%;
    margin: 10px 0 18px;
    padding: 4px;
    gap: 4px;

    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    background: rgba(50, 25, 15, .58);
    box-shadow: 0 14px 36px rgba(15, 7, 4, .16);
    backdrop-filter: blur(14px);

    overflow: hidden;
    box-sizing: border-box;
  }

  .legal-mobile-nav__item {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    min-height: 42px;
    padding: 8px 4px;

    border: 0;
    border-radius: 14px;
    background: transparent;

    color: rgba(255, 255, 255, .90);
    font: inherit;
    font-size: clamp(.66rem, 2.85vw, .76rem);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -.015em;
    text-align: center;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;

    overflow: hidden;
    overflow-wrap: anywhere;

    transition:
      background-color .18s ease,
      color .18s ease,
      transform .18s ease;
  }

  .legal-mobile-nav__item:hover,
  .legal-mobile-nav__item:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .10);
    outline: none;
  }

  .legal-mobile-nav__item:active {
    transform: scale(.98);
    background: rgba(255, 177, 95, .14);
  }
}

/* ==================================================================
   Footer légal — desktop + mobile
   ================================================================== */

.public-legal-footer {
  width: 100%;
  max-width: 100%;
  padding: 20px clamp(16px, 4vw, 48px) 26px;

  color: rgba(255, 255, 255, .78);
  background:
    linear-gradient(
      180deg,
      rgba(23, 11, 7, 0) 0%,
      rgba(23, 11, 7, .52) 18%,
      rgba(23, 11, 7, .92) 100%
    );

  box-sizing: border-box;
  overflow-x: hidden;
}

.public-legal-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  width: min(1180px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 18px 20px;

  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 20px;
  background: rgba(64, 31, 18, .45);

  box-sizing: border-box;
  overflow: hidden;
}

.public-legal-footer__brand {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.public-legal-footer__brand strong {
  color: #fff5e9;
  font-size: .94rem;
  line-height: 1.2;
}

.public-legal-footer__brand span {
  color: rgba(255, 255, 255, .62);
  font-size: .78rem;
  line-height: 1.25;
}

.public-legal-footer__links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;

  min-width: 0;
  gap: 6px;
}

.public-legal-footer__links button {
  min-height: 38px;
  padding: 8px 12px;

  border: 1px solid rgba(255, 177, 95, .20);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);

  color: rgba(255, 255, 255, .84);
  font: inherit;
  font-size: .8rem;
  font-weight: 750;
  line-height: 1.1;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  transition:
    border-color .18s ease,
    background-color .18s ease,
    color .18s ease,
    transform .18s ease;
}

.public-legal-footer__links button:hover,
.public-legal-footer__links button:focus-visible {
  color: #fff;
  border-color: rgba(255, 177, 95, .46);
  background: rgba(255, 177, 95, .10);
  outline: none;
}

.public-legal-footer__links button:active {
  transform: scale(.98);
}

/* Tablette / mobile */
@media (max-width: 700px) {
  .public-legal-footer {
    padding: 14px 12px 20px;
  }

  .public-legal-footer__inner {
    display: grid;
    gap: 14px;
    padding: 16px 12px;
    border-radius: 18px;
  }

  .public-legal-footer__brand {
    text-align: center;
  }

  .public-legal-footer__links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .public-legal-footer__links button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 4px;

    border-radius: 13px;
    font-size: clamp(.66rem, 2.9vw, .76rem);
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .legal-mobile-nav {
    gap: 2px;
    padding: 3px;
    border-radius: 16px;
  }

  .legal-mobile-nav__item {
    min-height: 40px;
    padding-inline: 2px;
    font-size: .64rem;
  }

  .public-legal-footer {
    padding-inline: 8px;
  }

  .public-legal-footer__inner {
    padding-inline: 8px;
  }

  .public-legal-footer__links {
    gap: 3px;
  }

  .public-legal-footer__links button {
    min-height: 40px;
    padding-inline: 2px;
    font-size: .64rem;
  }
}
