/* Charte — déclinaison fidèle du pilier Mathieu 32" (≤1024px) · après theme_clair */

.tab-text-short {
  display: none;
}

@media screen and (max-width: 1024px) {
  body {
    overflow-x: hidden;
    background: #f2eee6;
  }

  /* Même ciel étoilé que Mathieu — pas d’atténuation */
  #stars-bg {
    opacity: 1;
  }

  .legal-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 30px 16px 40px;
    box-sizing: border-box;
  }

  /* Pilule blanche supérieure centrée */
  .legal-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 950px;
    margin: 0 auto 20px;
    padding: 8px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #492e1c;
    box-shadow: 0 10px 30px rgba(73, 46, 28, 0.1);
    backdrop-filter: blur(15px);
    box-sizing: border-box;
  }

  .legal-tabs div {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 8px;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    white-space: nowrap;
    display: flex;
    align-items: center;
  }

  .legal-tabs div i {
    font-size: 1rem;
    opacity: 0.8;
  }

  /* CNED : pas de palier tablette — short labels jusqu’à 1024 inclus */
  .tab-text {
    display: none !important;
  }

  .tab-text-short {
    display: inline !important;
  }

  /* Monolithe beige */
  .legal-container {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(73, 46, 28, 0.15);
    overflow: hidden;
    padding: 30px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  .btn-retour-inside {
    position: absolute;
    top: 20px;
    left: 20px;
  }

  header {
    text-align: center;
    padding-top: 20px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  header .shield-logo {
    width: 130px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 5px;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
  }

  header h1 {
    font-family: "Outfit", sans-serif;
    font-size: 1.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 800;
    margin-top: 10px;
  }

  header .meta {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
  }

  header .intro-pro {
    font-style: italic;
    font-size: 0.95rem;
    opacity: 0.8;
    margin-top: 10px;
    padding: 0 15px;
  }

  .legal-notice {
    margin: 16px 0;
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    border-radius: 10px;
    text-align: left;
  }

  .legal-notice h2 {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }

  .legal-notice p {
    margin: 6px 0;
  }

  .btn-doc-shield {
    margin-top: 12px;
    padding: 10px 20px;
    font-size: 0.85rem;
  }

  /* Grille des piliers en 3 colonnes (centrée) pour tablette */
  .legal-pillars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    margin-top: 20px;
    background: #f6f3ed;
    border-bottom: 1px solid rgba(73, 46, 28, 0.08);
  }

  .legal-pillars .pillar-card {
    flex: 0 0 calc(33.33% - 8px);
    padding: 14px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(73, 46, 28, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
  }

  .legal-pillars .pillar-card i {
    font-size: 1.3rem;
  }

  .legal-pillars .pillar-card span.pillar-num {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
  }

  .legal-pillars .pillar-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
  }

  .legal-pillars .pillar-card p {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
  }

  .legal-content {
    padding: 0;
  }

  .legal-chapter {
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(73, 46, 28, 0.1);
  }

  footer {
    padding: 24px 0 0;
    margin-top: 24px;
    border-top: 1px solid rgba(73, 46, 28, 0.1);
  }

  .legal-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Tablette paysage — proche Mathieu, 5 piliers serrés */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .legal-wrapper {
    padding: 30px 16px 40px;
  }

  .legal-tabs {
    margin-bottom: 24px;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .legal-tabs div {
    padding: 12px 18px;
    font-size: 0.88rem;
  }

  .legal-content {
    padding: 0;
  }

  header .shield-logo {
    width: 148px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
  }

  header h1 {
    font-size: 1.85rem;
  }
}

/* Téléphone — même langage visuel, proportions réduites */
@media screen and (max-width: 768px) {
  .legal-wrapper {
    padding: 20px 10px 30px;
  }

  #simple-legal-tabs.legal-tabs,
  #tech-legal-tabs.legal-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .legal-tabs div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 6px;
    font-size: 0.75rem;
    border-radius: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .legal-container {
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    padding: 20px 16px;
  }

  .btn-retour-inside {
    position: static;
    display: inline-flex;
    align-self: flex-start;
    margin: 0 0 12px 0;
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  header {
    padding-top: 4px;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  header .shield-logo {
    width: 120px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 8px;
  }

  header h1 {
    font-size: clamp(1.2rem, 4.5vw, 1.5rem);
    letter-spacing: 1px;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  header .meta {
    font-size: 0.55rem;
    line-height: 1.4;
    padding: 0 6px;
    margin-top: 4px;
  }

  header .intro-pro {
    font-size: 0.82rem;
    margin-top: 8px;
    padding: 0 10px;
    line-height: 1.4;
  }

  .legal-notice {
    margin: 12px 0 16px 0;
    padding: 14px 12px;
    font-size: 0.8rem;
    line-height: 1.45;
    text-align: left;
  }

  .legal-notice p {
    margin-top: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed rgba(73, 46, 28, 0.15);
    padding-bottom: 8px;
  }

  .legal-notice p:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Piliers en 2 colonnes centrées pour mobile */
  .legal-pillars {
    gap: 8px;
    padding: 12px;
    margin-top: 16px;
  }

  .legal-pillars .pillar-card {
    flex: 0 0 calc(50% - 4px);
    padding: 12px 10px;
    gap: 4px;
  }

  .legal-pillars .pillar-card:last-child {
    flex: 0 0 100%;
  }

  .legal-pillars .pillar-card i {
    font-size: 1.2rem;
  }

  .legal-pillars .pillar-card span.pillar-num {
    font-size: 0.65rem;
  }

  .legal-pillars .pillar-card h3 {
    font-size: 0.85rem;
  }

  .legal-pillars .pillar-card p {
    font-size: 0.7rem !important;
    line-height: 1.25 !important;
  }

  .legal-content {
    padding: 0;
  }

  .legal-chapter {
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(73, 46, 28, 0.1);
    border-radius: 12px;
  }

  .legal-chapter section {
    border-bottom: 1px dashed rgba(73, 46, 28, 0.2);
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .legal-chapter section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .article-body p {
    text-align: left !important;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  footer {
    padding: 20px 0 0 0;
    margin-top: 20px;
    border-top: 1px solid rgba(73, 46, 28, 0.1);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }

  .footer-top {
    flex-direction: column;
    gap: 8px;
    letter-spacing: 2px;
    align-items: center;
  }

  .footer-top span {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }

  .footer-bottom .separator {
    display: none;
  }
}

/* Très petit écran */
@media screen and (max-width: 480px) {
  .legal-content {
    padding: 0;
  }
}

/* Charte simple / technique — schémas */
@media screen and (max-width: 768px) {
  .legal-content {
    padding: 0 12px !important;
  }

  .legal-mode-bar {
    max-width: 100%;
    flex-direction: column;
  }

  .legal-mode-bar div {
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  .charte-simple-body,
  .charte-simple-notice,
  .tech-schema-overview {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  .charte-simple-body {
    padding: 0 16px 24px;
  }

  .charte-shield-grid,
  .charte-accounts-grid,
  .charte-schema-split,
  .tech-schema-grid {
    grid-template-columns: 1fr;
  }

  .charte-schema-flow {
    flex-direction: column;
  }

  .charte-schema-arrow {
    transform: rotate(90deg);
  }

  .charte-vigikid-flow {
    flex-direction: column;
  }

  .charte-vigikid-mid {
    flex-direction: row;
    min-width: auto;
  }
}
