/*
 * LMFA - adaptation aux petits écrans (charte 2 du Kit CNRS)
 * Chargée par squelettes/inc/inc-ajout-head.html, avec la balise viewport.
 * Toutes les règles sont dans des @media : au-delà de 1000 px de large, rien ne change.
 * Les sélecteurs commencent par "html body" pour l'emporter sur ceux du Kit CNRS
 * quel que soit l'ordre de chargement des feuilles de style.
 */

/* ---------- Écrans moyens (tablettes, petites fenêtres) : 3 colonnes fluides ---------- */
@media screen and (max-width: 1000px) {
  html body #nom-labo,
  html body #bandeau,
  html body #menu ul.level1,
  html body #menu > ul.menu-liste,
  html body #centre,
  html body #bas-de-page,
  html body #pied-de-page ul,
  html body div#formulaire_menu_lang {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
  html body #centre {
    left: 0;
    margin-left: 0;
    padding: 0 10px;
  }
  html body #colgauche { width: 18%; }
  html body #pageune,
  html body #pageseconde { width: 80%; }
  html body #texte_gauche { width: 70%; }
  html body #texte_droite { width: 27%; }
  html body.p-rubrique-portraits #texte #texte_gauche { width: 100%; }
  html body #colgauche #recherche input.box,
  html body #texte_droite #recherche input.box { width: 85%; }
  /* logos des tutelles et partenaires : pas plus larges que la colonne */
  html body #colgauche #partenaires a.pleinelargeur {
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
  html body #colgauche #partenaires img { max-width: 100%; height: auto; }

  /* bandeau : on coupe ce qui dépasse au lieu d'élargir la page */
  html body #bandeau { overflow: hidden; }

  /* contenus : rien ne doit dépasser de sa colonne */
  html body #texte img,
  html body #texte iframe,
  html body #texte video,
  html body #texte embed,
  html body #texte object {
    max-width: 100%;
  }
  html body #texte img { height: auto; }
  html body #texte table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  html body #texte pre { overflow-x: auto; }
  html body #carrousel,
  html body #carrousel .nivoSlider {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ---------- Téléphones : une seule colonne ---------- */
@media screen and (max-width: 760px) {
  html body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* en-tête : logo, puis titre ; le slogan répète le titre, on le masque */
  html body #nom-labo { padding: 0 10px 8px; min-height: 0; }
  html body.avec-logo #nom-labo h1,
  html body.avec-logo #slogan,
  html body #nom-labo h1 {
    position: static;
    float: none;
    width: auto;
    margin: 0;
    text-align: left;
  }
  html body #nom-labo h1 a { font-size: 1.1em; line-height: 1.3em; padding: 0; }
  /* le fond bleu de #titre-site n'est prévu que pour le titre positionné à droite */
  html body #titre-site { background: none; }
  html body #slogan { display: none; }
  html body #nom-labo ul#menu_lang { position: static; text-align: right; }
  html body #nom-labo ul#menu_lang li { display: inline-block; }
  html body #logo-site img { max-width: 120px; height: auto; }

  /* bandeau photo : décoratif, on le masque sur téléphone */
  html body #bandeau { display: none; }

  /* menu principal : entrées sur plusieurs lignes, sans sous-menus déroulants
     (le survol n'existe pas au doigt ; chaque entrée mène à sa rubrique) */
  html body #menu li { float: left; margin: 0; padding: 0; }
  html body #menu li a,
  html body #menu li.menu-entree span.texte_libre {
    padding: 10px 10px;
    font-size: 0.7em;
  }
  html body #menu ul.level1 ul,
  html body #menu > ul.menu-liste ul.menu-liste,
  html body #menu ul.level1 li:hover > ul,
  html body #menu > ul.menu-liste li.menu-entree:hover > ul.menu-liste {
    display: none !important;
  }

  /* corps : contenu d'abord, colonne de gauche ensuite */
  html body #centre {
    display: flex;
    flex-direction: column;
    padding: 0 10px;
  }
  html body #pageune,
  html body #pageseconde { order: 1; }
  html body #colgauche { order: 2; }
  html body #centre > .clearer { order: 3; }

  html body #colgauche,
  html body #pageune,
  html body #pageseconde,
  html body #texte_gauche,
  html body #texte_droite,
  html body.p-rubrique-portraits #texte #texte_gauche {
    float: none;
    width: 100%;
    min-height: 0;
  }
  html body #texte, html body #colgauche { margin-top: 12px; }
  html body #texte_droite { margin-top: 20px; }
  html body .page-seconde #texte_droite nav.nav-art,
  html body .page-seconde #texte_droite nav.nav-rub { margin-left: 0; }
  html body .page-seconde #texte_droite nav { float: none; width: auto; }

  /* colonne de gauche : blocs pleine largeur, logos des tutelles en ligne */
  html body #colgauche .partenaire,
  html body #colgauche #recherche,
  html body #colgauche div.menu2,
  html body #deconnexion {
    float: none;
    width: auto;
    box-sizing: border-box;
    margin-bottom: 10px;
  }
  html body #colgauche > div { clear: both; }
  html body #colgauche .partenaire::after,
  html body #colgauche #partenaires::after {
    content: "";
    display: block;
    clear: both;
  }
  html body #colgauche #partenaires a { margin: 4px; }
  html body #colgauche #recherche input.box { width: 85%; }
  html body #colgauche div.menu2 ul.level1 ul { display: block; }

  /* portraits d'équipe */
  html body.p-rubrique-portraits #texte div.resume {
    width: 100%;
    max-width: 320px;
    margin: 10px auto;
    float: none;
  }

  /* texte : moins de justification forcée sur colonne étroite */
  html body .content { text-align: left; }

  /* pied de page : liens sur plusieurs lignes */
  html body #pied-de-page ul { padding: 10px; }
  html body #pied-de-page li {
    display: inline-block;
    margin: 4px 6px;
    padding: 0 8px 0 0;
  }

  /* accès à l'espace privé */
  html body .spip-admin-float { left: 0; }
}

/* Toutes tailles d'ecran : images limitees a la largeur de leur colonne
   (SPIP 4 n'emballe plus les documents comme SPIP 3, les grandes images debordaient) */
html body .texte img,
html body .spip_document img,
html body .spip_documents img,
html body .spip_doc_inner img { max-width: 100%; height: auto; }
html body .spip_document,
html body .spip_documents,
html body .spip_doc_inner { max-width: 100%; }
