/* Styles communs du site Géologie structurale.
   Chargé avant les styles propres à chaque page : ceux-ci gardent la priorité. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 32px;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

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

/* Dans une cellule, un max-width en % écrase l'image : on borne à la largeur d'écran */
td img {
  max-width: calc(100vw - 32px);
}

table {
  max-width: 100%;
}

/* Petits écrans : les tableaux de mise en page passent en une seule colonne */
@media (max-width: 600px) {
  table.mise-en-page,
  table.mise-en-page > tbody,
  table.mise-en-page > tbody > tr,
  table.mise-en-page > tbody > tr > td {
    display: block;
    width: auto !important;
  }
  table.mise-en-page > tbody > tr > td {
    text-align: left;
    margin-bottom: 12px;
  }
  /* Tableaux de données (horaires, etc.) : défilement horizontal */
  table:not(.mise-en-page):not(.galerie) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- En-tête et menu ---------- */

.site-header {
  position: relative;
  margin: 0 -16px 20px;
  background: #1a1a1a url(menu.jpg) center bottom / cover no-repeat;
  font-family: Verdana, Arial, sans-serif;
}

.site-header .skip {
  position: absolute;
  left: -9999px;
}
.site-header .skip:focus {
  left: 8px;
  top: 8px;
  padding: 4px 8px;
  background: #fff;
  color: #000;
  z-index: 20;
}

.site-header .site-title {
  display: block;
  padding: 22px 16px 42px;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: .5px;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.site-header .site-title:hover {
  color: #fff;
  text-decoration: underline;
}

.site-nav {
  position: relative;
  display: flex;
  background: #000;
  gap: 1px;
  border: 1px solid #000;
}

.site-nav details {
  flex: 1 1 0;
}

.site-nav summary {
  display: block;
  padding: 7px 4px;
  background: #888;
  color: #000;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.site-nav summary::-webkit-details-marker {
  display: none;
}
.site-nav summary::after {
  content: " \25BE";
}
.site-nav summary:hover,
.site-nav details[open] summary {
  background: #fff;
  color: #cc0000;
}

.site-nav ul {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  background: #fff;
  border: 1px solid #000;
  border-top: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
}

.site-nav li {
  display: inline;
}
.site-nav li + li::before {
  content: " | ";
  color: #888;
}

.site-nav a:link,
.site-nav a:visited,
.site-nav a:active {
  color: #000;
  text-decoration: none;
  border: 0;
}
.site-nav a:hover,
.site-nav a:focus {
  color: #cc0000;
  text-decoration: none;
}

/* Petits écrans : menu en colonne */
@media (max-width: 600px) {
  .site-header .site-title {
    padding: 16px 16px 28px;
    font-size: 18px;
  }
  .site-nav {
    flex-direction: column;
  }
  .site-nav ul {
    position: static;
    border: 0;
    box-shadow: none;
    text-align: left;
    line-height: 1.5;
  }
  .site-nav li {
    display: block;
    padding: 5px 0;
  }
  .site-nav li + li::before {
    content: none;
  }
}

/* ---------- Galeries photo : grille adaptée à l'écran ---------- */

table.galerie {
  display: block;
  width: 100%;
}
table.galerie > tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}
table.galerie tr {
  display: contents;
}
table.galerie td {
  min-width: 0;
  height: auto;
  text-align: center;
  overflow-wrap: anywhere;
}
