/* ================================
   ALEXANDRE FERREIRA — MOBILE v3
   ================================ */

@media (max-width: 768px) {

  /* ================================
     NAV MOBILE
     ================================ */

  nav {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 0 20px;
    height: 52px;
    /* Fond visible dès l'apparition (scroll haut) */
    background: var(--bg);
  }

  /* Nom centré en absolu */
  .nav-name {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    grid-column: unset;
    white-space: nowrap;
  }

  /* Liens desktop cachés */
  .nav-links {
    display: none !important;
  }

  /* Burger à droite */
  .nav-burger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    z-index: 110;
    margin-left: auto;
    flex-shrink: 0;
  }

  .nav-burger span {
    display: block;
    width: 22px;
    height: 1px;
    background: var(--black);
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
  }

  .nav-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-burger.open span:nth-child(2) { opacity: 0; }
  .nav-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* Menu mobile overlay */
  .nav-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 105;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
  }
  .nav-mobile-menu.open { display: flex !important; }

  .nav-mobile-menu a {
    font-family: var(--font);
    font-size: 20px;
    font-weight: normal;
    letter-spacing: 0.04em;
    color: var(--black);
    text-transform: lowercase;
    text-decoration: none;
  }

  /* ================================
     INDEX MOBILE
     ================================ */

  .works-page, .editions-page {
    padding-top: var(--nav-h);
  }

  .photo-section {
    height: 88svh;
    padding: 0 10px;
  }

  .hit-zone {
    width: 100%;
    max-width: 100%;
    height: 78svh;
    cursor: default !important;
    overflow: hidden;
  }

  #custom-cursor, #ed-cursor { display: none !important; }

  /* Images solo */
  .slide.solo img {
    max-height: 78svh;
    max-width: 100%;
    width: auto; height: auto;
  }

  /* Toutes les grilles : occupent toute la largeur hit-zone */
  .slide-grid {
    display: grid;
    height: 78svh;
    width: 100%;
    gap: 10px;
  }

  /* 1x2 : 2 colonnes égales */
  .slide-grid.duo {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    height: 78svh;
    width: 100%;
    align-items: center;
    justify-items: center;
  }
  .slide-grid.duo img {
    max-height: 78svh;
    max-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* 2x2 et 2x3 : flex colonne */
  .slide-grid.rows-2 {
    display: flex;
    flex-direction: column;
    height: 78svh;
    gap: 10px;
    width: 100%;
  }
  .slide-grid.rows-2 .grid-row {
    display: flex;
    flex: 1;
    gap: 10px;
    min-height: 0;
  }
  .slide-grid.rows-2 .grid-row img {
    flex: 1;
    min-width: 0;
    height: 100%;
    width: 100%;
    object-fit: contain;
  }

  .photo-section:last-child { margin-bottom: 40px; }

  /* ================================
     ARCHIVE MOBILE
     ================================ */

  .archive-layout { flex-direction: column; }

  /* Sidebar : sticky mais disparaît au scroll bas */
  .archive-sidebar {
    position: sticky;
    top: var(--nav-h);
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 16px;
    gap: 0 16px;
    background: var(--bg);
    z-index: 50;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 1px solid #eee;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .archive-sidebar::-webkit-scrollbar { display: none; }

  /* Sidebar cachée au scroll bas */
  .archive-sidebar.hidden-bar {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
  }

  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 11px;
  }

  .archive-main {
    margin-left: 0;
    padding: 16px 8px 80px;
  }

  /* Bouton retour haut */
  .archive-back-top {
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 60;
    background: var(--bg);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-size: 14px;
    color: var(--grey);
  }
  .archive-back-top.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Visionneuse */
  .viewer-hit-zone {
    width: 96vw;
    max-width: 96vw;
    height: 78svh;
    cursor: default;
  }

  /* ================================
     EDITIONS MOBILE
     ================================ */

  /* Éditions : 2x2, toutes visibles sur l'écran */
  .editions-covers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    padding: calc(var(--nav-h) + 16px) 16px 16px;
    height: calc(100svh - var(--nav-h));
    box-sizing: border-box;
    align-items: center;
    justify-items: center;
  }

  .edition-cover-item {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .edition-cover-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .editions-viewer .hit-zone {
    width: 96vw;
    max-width: 96vw;
    height: 78svh;
    cursor: default !important;
  }

  .editions-viewer .edition-info-wrapper { display: none; }

  /* ================================
     INFO MOBILE
     ================================ */

  .info-page { padding: calc(var(--nav-h) + 40px) 24px 60px; }
  .info-link a { font-size: clamp(16px, 5vw, 28px); }
  .info-footer {
    flex-direction: column; align-items: center;
    gap: 8px; font-size: 9px; bottom: 16px;
    padding: 0 16px; text-align: center;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .photo-section { padding: 0 60px; }
}
