
/* ============== 
   DIAPORAMA - styles harmonisés
   Compatible Chrome, Samsung Internet (Android)
   ============== */

/* --------------------
   Base et typographie
   -------------------- */
:root {
  --primary: #2c2a71;
  --accent: #1E90FF;
  --bg: #b9ffc1;
  --panel-bg: #fff;
  --focus: 3px solid var(--primary);
  --gap: 8px;
  --control-size: 44px;
}

html, body {
  height: 100%;
  background-color: var(--bg);
  font-family: Verdana, Arial, Helvetica, sans-serif;
  color: #000;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Headings */
h1 {
  font-family: 'delius', Verdana, Arial, sans-serif;
  letter-spacing: 4px;
  font-size: 1.5em;
  color: var(--primary);
  margin-top: 5px;
}
h3, h4, h5, h6 { margin: 0; }
h2 { 
	text-transform: uppercase;
	letter-spacing: 2px;
	margin-top: 20px;
	margin-bottom: 10px;
	font-size: 1em;
    text-align: center;
    color: #565656;
    margin-bottom: 30px ;
  }
h5 { 
	text-transform: uppercase;
	font-size: 1.2em;
	font-weight: 400;
   text-align: center;
    color: #2c2a71;
    margin: 0px;
  }


/* --------------------
   Layout containers
   -------------------- */
#bandeau {
  margin: 0 auto;
  text-align: center;
  text-transform: uppercase;
  font-size: 0.9em;
  padding-bottom: 1px;
  background-color: var(--panel-bg);
}
#conteneur {
  max-width: 100%;
  margin: 0 5px;
  padding-bottom: 30px;
}
.contenu {
  max-width: 1060px;
  margin: 0 auto;
  text-align: center;
  padding: 0 12px;
}
.rubriques {
  background-color: var(--panel-bg);
  margin: 0 auto 20px;
  border-radius: 20px;
  padding: 10px;
}

/* --------------------
   Diaporama wrapper and figure
   -------------------- */
.diaporama-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  width: 100vw;
  height: 100svh;
}

/* Prefer 100dvh when supported for more consistent fullscreen height */
@supports (height: 100dvh) {
  .diaporama-wrapper { height: 100dvh; }
}

/* Figure acts as centering box; max-height keeps images from overflowing chrome UI */
figure {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  height: auto;
  max-height: calc(100svh - 80px);
  text-align: center;
  overflow: hidden;
}
@supports (height: 100dvh) {
  figure { max-height: calc(100dvh - 80px); }
}

/* --------------------
   Image slideshow (unifié)
   - use .slideshow for a class-based approach
   - img#slideshow remains supported and specific
   -------------------- */
img.slideshow,
img#slideshow {
  display: inline-block;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: calc(100svh - 80px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255,255,255,0.3);
  transition: opacity 0.5s ease, transform 0.5s ease;
  cursor: pointer;
  -webkit-user-drag: none;
  user-select: none;
}

/* Use 100dvh when available */
@supports (height: 100dvh) {
  img.slideshow,
  img#slideshow { max-height: calc(100dvh - 80px); }
}

/* Portrait / landscape helper classes (set by JS) */
img.slideshow.portrait,
img#slideshow.portrait,
img.slideshow.landscape,
img#slideshow.landscape {
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: calc(100vh - 80px);
}
@supports (height: 100dvh) {
  img.slideshow.portrait,
  img#slideshow.portrait,
  img.slideshow.landscape,
  img#slideshow.landscape {
    max-height: calc(100dvh - 80px);
  }
}

/* Fullscreen selectors */
img.slideshow:fullscreen,
img.slideshow:-webkit-full-screen,
img#slideshow:fullscreen,
img#slideshow:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background-color: #000;
  display: block;
  margin: 0 auto;
}

/* Error state for missing or broken image */
img.slideshow.error,
img#slideshow.error {
  filter: grayscale(100%);
  opacity: 0.6;
}

/* Small optimization to avoid flicker on mobile (Samsung Internet) */
@supports (-webkit-overflow-scrolling: touch) {
  img.slideshow,
  img#slideshow { -webkit-transform: translateZ(0); transform: translateZ(0); }
}

/* Compatibility alternative selectors used elsewhere */
img.imgslideshow { /* legacy / alternative class support */
  display: block;
  margin: 0 auto;
  max-width: 100vw;
  max-height: calc(100vh - 80px);
  object-fit: contain;
}

/* Force full-width for portrait mobile where appropriate */
@media screen and (max-width: 600px) and (orientation: portrait) {
  figure { height: auto !important; padding-top: 1em; }
  img.slideshow,
  img#slideshow,
  img.imgslideshow {
    width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 80px) !important;
  }
}

/* --------------------
   Controls and accessibility
   -------------------- */
.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-top: 1em;
}

/* Unified control button class */
.control-button,
button,
#pause {
  border: none;
  background: transparent;
  font-size: 2em;
  cursor: pointer;
  min-width: var(--control-size);
  min-height: var(--control-size);
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
  color: inherit;
  border-radius: 8px;
}
.control-button:focus,
button:focus,
#pause:focus {
  outline: var(--focus);
  outline-offset: 2px;
}

/* Hover affordance for touch and pointer */
.control-button:hover,
button:hover,
#pause:hover { transform: scale(1.05); }

/* Pause icon */
#pause-icon {
  width: 32px;
  height: 32px;
  fill: var(--accent);
}

/* Counter and thumbnails */
#counter {
  margin-top: 1em;
  font-size: 1em;
  text-align: center;
}
#thumbnails {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1em;
}
#thumbnails img {
  width: 40px;
  border-radius: 5px;
  cursor: pointer;
  transition: box-shadow 0.3s ease;
}

/* --------------------
   Focus visible and keyboard targets
   -------------------- */
.touch-target { min-width: var(--control-size); min-height: var(--control-size); }

button:focus,
img.slideshow:focus,
img#slideshow:focus {
  outline: var(--focus);
  outline-offset: 2px;
}

/* --------------------
   Hamburger menu
   -------------------- */
#menu__toggle { opacity: 0; }
.menu__btn {
  position: fixed;
  top: 30px;
  left: 20px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  z-index: 10;
}
.menu__btn > span,
.menu__btn > span::before,
.menu__btn > span::after {
  display: block;
  position: absolute;
  width: 100%;
  height: 4px;
  background-color: #616161;
  transition-duration: .25s;
}
.menu__btn > span::before { content: ''; top: -8px; }
.menu__btn > span::after  { content: ''; top: 8px; }
#menu__toggle:checked + .menu__btn > span { transform: rotate(45deg); }
#menu__toggle:checked + .menu__btn > span::before { top: 0; transform: rotate(0deg); }
#menu__toggle:checked + .menu__btn > span::after  { top: 0; transform: rotate(90deg); }
.menu__box {
  position: fixed;
  top: 0;
  left: -100%;
  width: 300px;
  height: 100%;
  padding: 80px 0;
  background-color: #ECEFF1;
  box-shadow: 2px 2px 6px rgba(0,0,0,.4);
  transition: left .25s ease;
  z-index: 9;
}
#menu__toggle:checked ~ .menu__box { left: 0 !important; }
.menu__item { display: block; padding: 12px 24px; color: #000; font-size: 1.2em; text-decoration: none; }
.menu__item:hover { font-weight: bold; }

/* --------------------
   Responsive safeguards and helpers
   -------------------- */
@media (max-width: 1000px) {
  * { box-sizing: border-box; }
  body { width: auto; margin: 0; padding: 0; }
  img, table, td, blockquote, code, pre, textarea, input, iframe, object, embed, video { max-width: 100%; height: auto; }
  textarea, table, td, th, code, pre, samp { -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; word-wrap: break-word; }
  code, pre, samp { white-space: pre-wrap; }
  .hide_mobile { display: none !important; }
}

/* Reduce font sizes harmoniously in landscape on small devices */
@media (max-device-width: 768px) and (orientation: landscape) {
  html { -webkit-text-size-adjust: 95%; -ms-text-size-adjust: 95%; text-size-adjust: 95%; }
}

/* Small screens */
@media (max-width: 480px) {
  figure { max-height: calc(100svh - 60px); }
  button, .control-button { font-size: 0.9em; padding: 8px 12px; }
  #counter { font-size: 0.9em; }
}

/* Portrait mobile specific adjustments */
@media (max-width: 600px) and (orientation: portrait) {
  figure { max-height: calc(100vh - 80px); }
  img.slideshow, img#slideshow { max-height: calc(100vh - 80px); width: 100% !important; height: auto !important; }
}

/* Generic fullscreen fallback for non-img container */
.slideshow:fullscreen, .slideshow:-webkit-full-screen { width: 100vw; height: 100vh; }

/* --------------------
   Small accessibility tweaks
   -------------------- */
figcaption { text-align: center; font-style: italic; margin-top: 0.5em; }

/* --------------------
   Utility: unify interactive target styling
   -------------------- */
.touch-target, .control-button, button { -webkit-tap-highlight-color: rgba(0,0,0,0.1); }

/* End of diaporama styles */