/* ==== GALLERY PAGE FOR MOBILE DEVICES ==== */

@media (max-width: 600px) {

  .hp-gallery-desktop-layout {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .hp-gallery-mobile-layout {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .et_pb_section.hp-gallery-mobile-section,
  .et_pb_row.et_pb_row_2,
  .et_pb_row.hp-gallery-mobile-row {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    height: auto !important;
  }

  body.hp-gallery-modal-scroll-lock .et_pb_scroll_top {
    display: none !important;
  }

  .hp-gallery-header-block {
    margin-bottom: 0.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .hp-gallery-toggle-filters {
    display: block !important;
    background-color: var(--hp-gallery-accent) !important;
    color: white !important;
    border: none !important;
    padding: 0.6rem 1.2rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    transition: background-color 0.3s ease !important;
    text-align: center !important;
    width: auto !important;
    max-width: 320px !important;
    margin: 0 auto 1rem auto !important;
  }

  .hp-gallery-toggle-filters:hover {
    background-color: var(--hp-gallery-accent-hover) !important;
  }

  .hp-gallery-filters-panel {
    margin-top: 1rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
  }

  .hp-gallery-filters-panel.hidden {
    display: none !important;
  }

  .hp-gallery-active-filter-label-mobile {
    display: block !important;
  }

  .hp-gallery-group-tabs,
  .hp-gallery-subgroup-container,
  .hp-gallery-category-container,
  .hp-gallery-filters.hp-gallery-contributor-container {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    margin-bottom: 1rem !important;
  }

  .hp-gallery-group-tab-btn,
  .hp-gallery-subgroup-btn,
  .hp-gallery-filter-category-btn,
  .hp-gallery-filter-contributor-btn {
    flex: 0 1 auto !important;
    min-width: 120px !important;
    max-width: 45% !important;
    text-align: center !important;
    padding: 6px 12px !important;
    font-size: 0.85em !important;
  }

  .hp-gallery-active-filter-label {
    font-size: 0.85em !important;
    margin-bottom: 0.5rem !important;
  }

  .hp-gallery-caption {
    font-size: 0.85em !important;
    margin-top: 6px !important;
  }

  .hp-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 1rem !important;
    padding: 0 1rem !important;
  }

  .hp-gallery-item img {
    height: 140px !important;
  }

  .hp-gallery-modal-close,
  .hp-gallery-modal-arrow {
    font-size: 1.8rem !important;
    width: 32px !important;
    height: 32px !important;
    padding: 6px 10px !important;
  }

  .hp-gallery-modal-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: top !important;
    justify-content: flex-start !important;
    padding: 1rem !important;
    height: 100vh !important;
    overflow: hidden !important;
  }

  .hp-gallery-modal-image-wrapper {
    width: 100% !important;
    height: calc(100vh - 210px) !important;
    overflow: hidden !important;
    display: block !important;
    text-align: center !important;
    padding-top: 0rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
  }
  
  .hp-gallery-modal-panzoom {
    width: 100% !important;
    height: calc(100vh - 210px) !important;
    overflow: hidden !important;
    display: block !important;
    text-align: center !important;
    padding-top: 0rem !important;
    border-top: 1px solid rgba(255,255,255,0.2) !important;
  }
  
  .hp-gallery-modal-img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
  }

  .hp-gallery-modal-details {
    height: 155px !important;
    margin-top: 0rem !important;
    text-align: center !important;
    font-size: 0.85em !important;
    color: #eee !important;
    overscroll-behavior: contain !important;
    touch-action: pan-x pan-y !important;
  }

  .hp-gallery-modal-details > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .hp-gallery-modal-zoom-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    flex-wrap: wrap;
  }

  .hp-gallery-modal-zoom-controls .hp-gallery-modal-arrow,
  .hp-gallery-modal-zoom-controls .hp-gallery-modal-reset-zoom {
    flex: 0 0 auto;
    padding: 0.1rem 0.6rem !important;
    font-size: 0.9rem;
    line-height: 1.2;
  }

  .hp-gallery-modal-zoom-hint {
    font-size: 0.75rem !important;
    opacity: 0.7 !important;
    text-align: center !important;
    max-width: 95% !important;
    margin: 0rem auto 0 !important; /* ⬆ slightly more breathing room */
    line-height: 1.1 !important;
  }

  .hp-gallery-subgroup-container::-webkit-scrollbar,
  .hp-gallery-category-container::-webkit-scrollbar,
  .hp-gallery-filters.hp-gallery-contributor-container::-webkit-scrollbar {
    display: none !important;
  }
}
