/* =========================
   photo.css
   Styles spécifiques à photos.html.
   Le reset, header, footer viennent de style1.css.
========================= */


/* =========================
   SECTION GALERIE
========================= */
.gallery-section {
    padding: 60px 28px 90px;
    background: var(--gray-100);
    flex: 1;
}
.gallery-inner {
    max-width: 1200px;
    margin: 0 auto;

    /*
      MASONRY avec column-count.
      Chaque image tombe naturellement dans la colonne
      la plus courte — aucun JS nécessaire, ça marche
      avec n'importe quel nombre de photos.
    */
    column-count: 3;
    column-gap: 16px;
}


/* =========================
   ITEMS DE LA GALERIE
========================= */
.gallery-item {
    break-inside: avoid;          /* empêche une photo de se couper entre deux colonnes */
    margin-bottom: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
    background: #ddd;             /* couleur de fond pendant le chargement */
}

.gallery-item img {
    width: 100%;
    height: auto;                 /* hauteur naturelle = masonry authentique */
    display: block;
    transition: transform 0.35s ease, filter 0.35s ease;
}

/* overlay rouge au survol */
.gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(216, 35, 42, 0.0);
    transition: background 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius);
}

/* icône zoom */
.gallery-item::before {
    content: "⊕";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-size: 42px;
    color: var(--white);
    opacity: 0;
    z-index: 2;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    line-height: 1;
}

.gallery-item:hover img       { transform: scale(1.04); filter: brightness(0.8); }
.gallery-item:hover::after    { background: rgba(216, 35, 42, 0.18); }
.gallery-item:hover::before   { opacity: 1; transform: translate(-50%, -50%) scale(1); }


/* =========================
   MODAL ZOOM
========================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.94);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open { display: flex; }

/* animation d'ouverture */
.modal.open .modal-body { animation: modalIn 0.3s ease; }
@keyframes modalIn {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* image */
.modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 88vh;
}
#fullImg {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    display: block;
    user-select: none;
}

/* bouton fermer */
.modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: var(--white);
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition);
}
.modal-close:hover {
    background: var(--red);
    transform: rotate(90deg);
}

/* boutons prev / next */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.10);
    color: var(--white);
    font-size: 36px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
    line-height: 1;
}
.modal-nav:hover { background: var(--red); }
.modal-prev { left: 20px; }
.modal-next { right: 20px; }

/* compteur  "3 / 8" */
.modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
}


/* =========================
   RESPONSIVE
========================= */

/* Tablette — 2 colonnes */
@media (max-width: 900px) {
    .gallery-inner { column-count: 2; }

    .modal-prev { left: 10px; }
    .modal-next { right: 10px; }
    .modal-nav  { width: 42px; height: 42px; font-size: 28px; }
}

/* Mobile — 1 colonne */
@media (max-width: 540px) {
    .gallery-section { padding: 40px 16px 60px; }
    .gallery-inner   { column-count: 1; }

    .page-hero { padding: 50px 20px 40px; }

    /* sur très petit écran, cacher les boutons nav et utiliser le swipe */
    .modal-prev, .modal-next { display: none; }
}
