/*
 * Spolek Za rozvoj Konské — Galerie mobile refresh / 0.9.121
 * Kompaktní veřejná fotogalerie + fullscreen swipe lightbox.
 */

@media (max-width: 760px) {
  /* Breadcrumb nad galerií: jen nízký orientační řádek. */
  .public-breadcrumb,
  .site-breadcrumbs,
  .archive-breadcrumb,
  .breadcrumbs,
  .breadcrumb,
  nav[aria-label="Drobečková navigace"],
  nav[aria-label="breadcrumb"],
  nav[aria-label="Breadcrumb"] {
    min-height: 0 !important;
    margin: 0 !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  /* Hlavní zelený blok galerie – na telefonu nepotřebuje desktopovou výšku. */
  body .archive-hero.archive-hero--gallery,
  body .archive-hero--gallery,
  body .gallery-hero,
  body .gallery-page-hero {
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body .archive-hero--gallery .archive-hero__inner,
  body .gallery-hero .wrap,
  body .gallery-page-hero .wrap {
    min-height: 0 !important;
    width: calc(100% - 28px) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    display: block !important;
  }

  body .archive-hero--gallery .archive-kicker,
  body .gallery-hero .archive-kicker,
  body .gallery-page-hero .archive-kicker {
    margin: 0 0 2px !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    letter-spacing: .08em !important;
  }

  body .archive-hero--gallery h1,
  body .gallery-hero h1,
  body .gallery-page-hero h1 {
    margin: 0 !important;
    font-size: 25px !important;
    line-height: 1.04 !important;
    letter-spacing: -.025em !important;
  }

  body .archive-hero--gallery .archive-hero__inner > div:first-child > p:not(.archive-kicker),
  body .gallery-hero p:not(.archive-kicker),
  body .gallery-page-hero p:not(.archive-kicker) {
    display: none !important;
  }

  body .archive-hero--gallery .archive-stat,
  body .gallery-hero .archive-stat,
  body .gallery-page-hero .archive-stat {
    display: none !important;
  }

  /* Kategorie: na telefonu pouze chips, žádné velké prezentační karty. */
  body .gallery-filter-section {
    width: calc(100% - 28px) !important;
    padding-top: 8px !important;
    padding-bottom: 5px !important;
  }

  body .gallery-filter-heading {
    display: none !important;
  }

  body .gallery-category-grid,
  body .gallery-category-cards,
  body .gallery-featured-category,
  body .gallery-archive-feature,
  body .gallery-archive-card {
    display: none !important;
  }

  body .gallery-filter-mobile {
    display: flex !important;
    flex-flow: row nowrap !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    margin: 0 !important;
    padding: 1px 0 5px !important;
  }
  body .gallery-filter-mobile::-webkit-scrollbar { display: none !important; }

  body .gallery-filter-mobile > a {
    flex: 0 0 auto !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 6px 9px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    scroll-snap-align: start;
  }

  body .gallery-filter-mobile > a span {
    min-width: 18px !important;
    padding: 2px 5px !important;
    border-radius: 999px !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  /* Rok + potvrzení do jediného nízkého řádku. */
  body .gallery-year-panel {
    margin: 2px 0 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body .gallery-year-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  body .gallery-year-form label {
    min-width: 0 !important;
    margin: 0 !important;
  }

  body .gallery-year-form label > span {
    display: none !important;
  }

  body .gallery-year-form select {
    width: 100% !important;
    min-height: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 5px 30px 5px 9px !important;
    border-radius: 10px !important;
    font-size: 11.5px !important;
    line-height: 1 !important;
  }

  body .gallery-year-form button {
    min-height: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 6px 10px !important;
    border-radius: 10px !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body .gallery-active-filters {
    display: flex !important;
    gap: 5px !important;
    overflow-x: auto !important;
    margin: 5px 0 0 !important;
    padding: 0 0 2px !important;
    scrollbar-width: none;
  }
  body .gallery-active-filters::-webkit-scrollbar { display: none !important; }
  body .gallery-active-filters a {
    flex: 0 0 auto !important;
    padding: 4px 7px !important;
    border-radius: 999px !important;
    font-size: 9.5px !important;
    line-height: 1 !important;
  }

  /* Nadpis výsledků do jednoho kompaktního řádku. */
  body .gallery-results-section,
  body .archive-section.gallery-results-section {
    width: calc(100% - 28px) !important;
    padding-top: 6px !important;
    padding-bottom: 12px !important;
  }

  body .gallery-results-heading {
    min-height: 0 !important;
    display: flex !important;
    align-items: end !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 0 0 7px !important;
    padding: 0 !important;
  }

  body .gallery-results-heading .archive-kicker {
    margin: 0 0 2px !important;
    font-size: 8.5px !important;
  }

  body .gallery-results-heading h2 {
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.08 !important;
  }

  body .gallery-results-count {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  /* Alba: dvě skutečně kompaktní karty vedle sebe. */
  body .gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  body .gallery-card,
  body .gallery-card--compact {
    min-width: 0 !important;
    margin: 0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
  }

  body .gallery-card__media {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 3 !important;
    overflow: hidden !important;
  }

  body .gallery-card__media > img,
  body .gallery-card__media .media-placeholder,
  body .gallery-card__media .media-placeholder > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  body .gallery-card .photo-count {
    left: 5px !important;
    right: auto !important;
    bottom: 5px !important;
    padding: 3px 5px !important;
    border-radius: 7px !important;
    font-size: 8px !important;
    line-height: 1 !important;
  }

  body .gallery-card__body {
    min-height: 0 !important;
    padding: 6px 7px 7px !important;
  }

  body .gallery-card__body time {
    display: block !important;
    margin: 0 0 2px !important;
    font-size: 8.5px !important;
    line-height: 1.1 !important;
  }

  body .gallery-card__body h2 {
    margin: 0 !important;
    font-size: 11.5px !important;
    line-height: 1.16 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
  }

  /* Detail alba: technické datum vložení na telefonu není důležité. */
  body .gallery-detail {
    width: calc(100% - 20px) !important;
    padding-top: 8px !important;
    padding-bottom: 12px !important;
  }

  body .gallery-detail__eyebrow {
    margin: 0 0 2px !important;
    font-size: 8.5px !important;
    line-height: 1.1 !important;
  }

  body .gallery-detail h1 {
    margin: 0 0 6px !important;
    font-size: 23px !important;
    line-height: 1.06 !important;
  }

  body .gallery-detail__meta {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5px !important;
    margin: 5px 0 7px !important;
  }

  body .gallery-detail__meta > span {
    min-width: 0 !important;
    padding: 6px 7px !important;
    border-radius: 9px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
  }

  body .gallery-detail__meta > span:nth-child(2) {
    display: none !important;
  }

  body .gallery-detail__meta strong {
    display: block !important;
    margin-bottom: 1px !important;
    font-size: 7.5px !important;
    line-height: 1.05 !important;
  }

  body .gallery-detail__description {
    margin: 0 0 7px !important;
    padding: 7px 8px !important;
    border-radius: 9px !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
  }

  /* Náhledová mřížka ve stylu mobilní galerie. */
  body .gallery-detail .photo-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 3px !important;
  }

  body .gallery-detail .photo-grid > a {
    display: block !important;
    min-width: 0 !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    background: #edf3f0 !important;
  }

  body .gallery-detail .photo-grid > a > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }
}

@media (max-width: 350px) {
  body .gallery-detail .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Fullscreen lightbox – používá se i na desktopu, mobil je hlavní cíl. */
html.sp-gallery-lightbox-open,
html.sp-gallery-lightbox-open body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

.sp-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(5, 12, 9, .97);
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.sp-gallery-lightbox.is-open { display: grid; }

.sp-gallery-lightbox__top {
  min-height: 52px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 4px;
  padding: max(6px, env(safe-area-inset-top)) 8px 4px;
}

.sp-gallery-lightbox__counter {
  text-align: center;
  font: 700 12px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(255,255,255,.82);
}

.sp-gallery-lightbox__button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #fff;
  font: 500 26px/1 system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sp-gallery-lightbox__button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sp-gallery-lightbox__stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}

.sp-gallery-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: translate3d(0,0,0);
  transition: opacity .12s ease;
  -webkit-user-drag: none;
  user-drag: none;
}

.sp-gallery-lightbox.is-loading .sp-gallery-lightbox__image { opacity: .35; }

.sp-gallery-lightbox__prev,
.sp-gallery-lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 54px;
  border-radius: 12px;
  font-size: 31px;
}
.sp-gallery-lightbox__prev { left: max(5px, env(safe-area-inset-left)); }
.sp-gallery-lightbox__next { right: max(5px, env(safe-area-inset-right)); }

.sp-gallery-lightbox__bottom {
  min-height: 44px;
  padding: 5px 14px max(8px, env(safe-area-inset-bottom));
  text-align: center;
}

.sp-gallery-lightbox__caption {
  min-height: 14px;
  margin: 0;
  font: 500 11px/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(255,255,255,.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-gallery-lightbox__hint {
  margin: 3px 0 0;
  font: 500 9px/1.2 system-ui, sans-serif;
  color: rgba(255,255,255,.48);
}

@media (max-width: 760px) {
  .sp-gallery-lightbox__prev,
  .sp-gallery-lightbox__next {
    width: 38px;
    height: 48px;
    font-size: 28px;
    background: rgba(0,0,0,.24);
  }
}
