/* ── Variables thème photos scolaires ── */
:root {
  --color-bg: #fff8f0;
  --color-bg-alt: #fff3e6;
  --color-bg-card: #ffffff;
  --color-text: #4a4035;
  --color-text-muted: #7a6f62;
  --color-accent: #f0a030;
  --color-accent-dark: #d4881a;
  --color-sky: #6eb5e0;
  --color-sky-light: #e8f4fc;
  --color-green: #7bc67e;
  --color-green-light: #edf8ee;
  --color-border: #f0e0cc;
  --color-shadow: rgba(180, 140, 80, 0.12);
  --radius: 16px;
}

/* ── Reset & base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Hero ── */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 2rem 1.25rem 3rem;
  padding-top: calc(2rem + env(safe-area-inset-top, 0));
  text-align: center;
  color: #fff;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    165deg,
    rgba(255, 200, 120, 0.45) 0%,
    rgba(110, 181, 224, 0.55) 50%,
    rgba(255, 248, 240, 0.35) 100%
  );
}

.hero__overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.hero__tag {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.4rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 2px 12px var(--color-shadow);
}

.hero__title {
  font-size: clamp(2.2rem, 9vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  color: #fff;
  text-shadow: 0 2px 20px rgba(120, 80, 30, 0.35);
}

.hero__subtitle {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 600;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 8px rgba(80, 60, 30, 0.25);
  margin-bottom: 2rem;
}

.hero__cta {
  display: inline-block;
  padding: 0.9rem 2.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--color-accent);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(240, 160, 48, 0.45);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.hero__cta:hover,
.hero__cta:focus-visible {
  transform: translateY(-2px);
  background: var(--color-accent-dark);
  box-shadow: 0 6px 20px rgba(240, 160, 48, 0.5);
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.hero__scroll span {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  position: relative;
}

.hero__scroll span::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  animation: scroll-bounce 2s infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50% { transform: translateX(-50%) translateY(10px); opacity: 0.3; }
}

/* ── Gallery ── */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2rem 1.25rem 1rem;
  background:
    radial-gradient(circle at 10% 20%, var(--color-sky-light) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, var(--color-green-light) 0%, transparent 50%),
    var(--color-bg);
}

.gallery-intro {
  padding: 0 0 2rem;
  margin-bottom: 2.5rem;
  text-align: left;
  border-bottom: 3px dashed var(--color-border);
}

.gallery-intro__text {
  font-size: clamp(0.95rem, 3.2vw, 1.05rem);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.gallery-intro__note {
  margin-top: 0.75rem;
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  font-weight: 700;
  line-height: 1.6;
  color: var(--color-accent-dark);
}

/* ── Menu horizontal rubriques ── */
.gallery-nav {
  margin-top: 1.5rem;
  scroll-margin-top: 1rem;
}

.gallery-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-nav__link {
  display: inline-block;
  padding: 0.55rem 1rem;
  font-size: clamp(0.8rem, 2.8vw, 0.9rem);
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.gallery-nav__link:hover,
.gallery-nav__link:focus-visible {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Rubriques ── */
.gallery-section {
  scroll-margin-top: 1rem;
}

.gallery-section__title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.25;
}

.gallery-section + .gallery-section {
  margin-top: 1rem;
  padding-top: 1.5rem;
}

/* ── Carrousel packs ── */
.pack-item__card {
  overflow: hidden;
}

.pack-carousel {
  position: relative;
  background: var(--color-bg-alt);
  overflow: hidden;
}

.pack-carousel__track {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  gap: 0;
  scrollbar-width: none;
}

.pack-carousel__track::-webkit-scrollbar {
  display: none;
}

.pack-carousel__slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  box-sizing: border-box;
}

.pack-carousel__slide .photo-item__zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: min(52vw, 420px);
  background: #fff;
  touch-action: pan-x;
  cursor: zoom-in;
}

.pack-carousel__slide .photo-item__zoom img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  background: #fff;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

@media (min-width: 768px) {
  .pack-carousel__slide .photo-item__zoom {
    height: 420px;
  }
}

.pack-carousel__label {
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--color-border);
}

.pack-carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 10px var(--color-shadow);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, transform 0.2s;
}

.pack-carousel__btn:hover,
.pack-carousel__btn:focus-visible {
  background: #fff;
  transform: translateY(-50%) scale(1.06);
}

.pack-carousel__btn--prev {
  left: 0.6rem;
}

.pack-carousel__btn--next {
  right: 0.6rem;
}

.pack-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0 0.4rem;
  background: var(--color-bg-card);
}

.pack-carousel__dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-border);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.pack-carousel__dot.is-active {
  background: var(--color-accent);
  transform: scale(1.2);
}

.photo-item {
  width: 100%;
  margin-bottom: 3.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 3px dashed var(--color-border);
}

.photo-item:last-of-type {
  margin-bottom: 1rem;
  padding-bottom: 0;
  border-bottom: none;
}

.photo-item__figure {
  margin: 0;
  background: var(--color-bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 28px var(--color-shadow);
  border: 2px solid var(--color-border);
}

.photo-item__image {
  position: relative;
  width: 100%;
  background: var(--color-bg-card);
  border: none;
  box-shadow: none;
}

.photo-item__zoom {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.photo-item__zoom::after {
  content: '';
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a4035' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3C/svg%3E") center / 1.1rem no-repeat;
  border-radius: 50%;
  box-shadow: 0 2px 8px var(--color-shadow);
  pointer-events: none;
  transition: transform 0.2s;
}

.photo-item__zoom:hover::after,
.photo-item__zoom:focus-visible::after {
  transform: scale(1.08);
}

.photo-item__zoom img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.photo-item__caption {
  padding: 1.5rem 1.25rem 2rem;
  background: var(--color-bg-card);
  text-align: left;
  border-left: 4px solid var(--color-accent);
  border-top: 1px solid var(--color-border);
}

.photo-item__number {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--color-sky);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.625rem;
}

.photo-item__title {
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.photo-item__description {
  font-size: clamp(0.92rem, 3.2vw, 1.02rem);
  line-height: 1.75;
  color: var(--color-text-muted);
}

.photo-item__description strong,
.photo-item__description b,
.gallery-intro__text strong,
.gallery-intro__text b,
.gallery-intro__note strong,
.gallery-intro__note b {
  font-weight: 800;
  color: var(--color-text);
}

.u-center,
center {
  display: block;
  text-align: center;
}

.photo-item:nth-of-type(even) .photo-item__caption {
  background: var(--color-bg-alt);
  border-left-color: var(--color-green);
}

.photo-item:nth-of-type(even) .photo-item__number {
  background: var(--color-green);
}

@media (min-width: 768px) {
  .gallery {
    max-width: 880px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
  }

  .gallery-intro {
    padding: 0 2rem 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 3px dashed var(--color-border);
  }

  .gallery-nav {
    margin-top: 1.75rem;
  }

  .gallery-nav__list {
    gap: 0.75rem;
  }

  .gallery-section__title {
    padding: 0 2rem;
    margin-bottom: 2rem;
  }

  .photo-item {
    margin-bottom: 4.5rem;
    padding-bottom: 4.5rem;
  }

  .photo-item__figure {
    box-shadow: 0 8px 32px var(--color-shadow);
  }

  .photo-item__image {
    border-radius: 0;
  }

  .photo-item__caption {
    padding: 1.75rem 2rem 2rem;
    border-left: none;
    border-top: 3px solid var(--color-accent);
  }

  .photo-item:nth-of-type(even) .photo-item__caption {
    border-top-color: var(--color-green);
  }
}

@media (min-width: 1024px) {
  .gallery {
    max-width: 920px;
  }

  .gallery-intro {
    padding: 0 2.5rem 2rem;
  }

  .gallery-section__title {
    padding: 0 2.5rem;
  }

  .photo-item__caption {
    padding: 2rem 2.5rem 2.25rem;
  }
}

/* ── Footer ── */
.footer {
  padding: 1.75rem 1.25rem;
  padding-bottom: calc(1.75rem + env(safe-area-inset-bottom, 0));
  background: var(--color-bg-alt);
  border-top: 2px dashed var(--color-border);
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ── Bouton remonter au menu ── */
.back-to-menu {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: #fff;
  background: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(240, 160, 48, 0.45);
  transition: opacity 0.25s, transform 0.25s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.back-to-menu[hidden] {
  display: none;
}

.back-to-menu:hover,
.back-to-menu:focus-visible {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
}

/* ── Lightbox zoom ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top, 0));
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 64, 53, 0.88);
  cursor: zoom-out;
  animation: lightbox-fade-in 0.25s ease;
}

.lightbox__close {
  position: absolute;
  top: calc(0.75rem + env(safe-area-inset-top, 0));
  right: 0.75rem;
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.75rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox__content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  animation: lightbox-zoom-in 0.3s ease;
}

.lightbox__img {
  display: block;
  max-width: 95vw;
  max-height: 90svh;
  max-height: 90dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  cursor: zoom-out;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightbox-zoom-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

body.lightbox-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ── Scroll reveal ── */
.photo-item__zoom img,
.photo-item__caption {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.photo-item--visible .photo-item__zoom img,
.photo-item--visible .photo-item__caption {
  opacity: 1;
  transform: translateY(0);
}

.photo-item--visible .photo-item__caption {
  transition-delay: 0.15s;
}

/* ── Small phones ── */
@media (max-width: 359px) {
  .photo-item__caption {
    padding: 1.25rem 1rem 2rem;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .photo-item__zoom img,
  .photo-item__caption {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__scroll span::after {
    animation: none;
  }
}
