/*
 * Reusable gallery base theme.
 * Override the --gallery-* custom properties from the surrounding site.
 */
.gallery-module {
 --gallery-padding: 0;
  --gallery-background: #fff;
  --gallery-text: #202124;
  --gallery-muted-text: #62666b;
  --gallery-accent: #202124;
  --gallery-accent-text: #fff;
  --gallery-control-background: #fff;
  --gallery-control-border: #d9dadd;
  --gallery-surface: #f4f4f4;
  --gallery-border: #d9dadd;
  --gallery-radius: 0.65rem;
  --gallery-gap: clamp(0.65rem, 1.6vw, 1rem);
  --gallery-control-padding: 0.8rem;
  --gallery-focus: #1677ff;
  --gallery-overlay: rgba(10, 11, 13, 0.96);
  --gallery-viewer-text: #fff;
  --gallery-viewer-muted-text: rgba(255, 255, 255, 0.72);
  --gallery-viewer-control-background: rgba(0, 0, 0, 0.35);
  --gallery-viewer-control-border: rgba(255, 255, 255, 0.28);
  --gallery-viewer-video-background: #000;
  --gallery-video-badge-foreground: #fff;
  --gallery-video-badge-background: rgba(0, 0, 0, 0.65);
  --gallery-video-badge-border: rgba(255, 255, 255, 0.6);
    --gallery-padding: 1.5rem;

    --gallery-background: #111111;
    --gallery-text: #FFFFFF;
    --gallery-muted-text: #A9B2B8;

    --gallery-accent: #E24910;
    --gallery-accent-text: #FFFFFF;

    --gallery-control-background: #2B2B2B;
    --gallery-control-border: #7A7A7A;

    --gallery-surface: #2B2B2B;
    --gallery-border: #7A7A7A;

    --gallery-focus: #E24910;

    --gallery-overlay: rgba(17, 17, 17, 0.97);

    --gallery-viewer-text: #FFFFFF;
    --gallery-viewer-muted-text: #A9B2B8;

    --gallery-viewer-control-background: rgba(43, 43, 43, 0.85);
    --gallery-viewer-control-border: #7A7A7A;
    --gallery-viewer-video-background: #111111;

    --gallery-video-badge-foreground: #FFFFFF;
    --gallery-video-badge-background: rgba(226, 73, 16, 0.9);
    --gallery-video-badge-border: #FFFFFF;
	    
	--gallery-padding: 0.75rem;
		
  position: relative;
  box-sizing: border-box;
  width: 100%;
  padding: var(--gallery-padding);
  color: var(--gallery-text);
  background: var(--gallery-background);
  font: inherit;
  line-height: 1.45;
}

.gallery-module *,
.gallery-module *::before,
.gallery-module *::after {
  box-sizing: border-box;
}

.gallery-module [hidden] {
  display: none !important;
}

.gallery-module button,
.gallery-module input,
.gallery-module select {
  color: inherit;
  font: inherit;
}

.gallery-module button,
.gallery-module select {
  cursor: pointer;
}

.gallery-module :focus-visible {
  outline: 3px solid var(--gallery-focus);
  outline-offset: 3px;
}

.gallery-module__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1rem;
      min-height: 0;
    padding: 0.75rem 1rem;
}

.gallery-module__title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.gallery-module__description {
  max-width: 70ch;
  margin: 0.4rem 0 0;
  color: var(--gallery-muted-text);
}

.gallery-module__controls {
  position: relative;
  z-index: 5;
  display: none;
  grid-template-columns: minmax(12rem, 1fr) repeat(2, minmax(10rem, 14rem));
  gap: 0.75rem;
  align-items: end;
  margin: 0 0 1rem;
  padding: var(--gallery-control-padding);
  border: 1px solid var(--gallery-control-border);
  border-radius: var(--gallery-radius);
  background: var(--gallery-control-background);
  box-shadow: 0 0.35rem 1.3rem rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
   margin-top: 0.5rem;
}

.gallery-module__controls-toggle,
.gallery-module__controls-done,
.gallery-module__controls-handle {
  display: none;
}

.gallery-module--enhanced .gallery-module__controls-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  flex: 0 0 auto;
  border: 1px solid var(--gallery-control-border);
  border-radius: 999px;
  background: var(--gallery-control-background);
  padding: 0.55rem 0.9rem;
  font-weight: 650;
}

.gallery-module--enhanced .gallery-module__controls {
  position: absolute;
  z-index: 20;
  inset-inline-end: 0;
  display: grid;
  width: min(38rem, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  opacity: 0;
  pointer-events: none;
  translate: 0 -0.5rem;
  visibility: hidden;
  transition: opacity 140ms ease, translate 140ms ease, visibility 140ms;
}

.gallery-module--enhanced .gallery-module__field--search,
.gallery-module--enhanced .gallery-module__field--sort,
.gallery-module--enhanced .gallery-module__controls-done {
  grid-column: 1 / -1;
}

.gallery-module--enhanced .gallery-module__controls-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 0;
  border-radius: calc(var(--gallery-radius) * 0.75);
  color: var(--gallery-accent-text);
  background: var(--gallery-accent);
  padding: 0.55rem 1rem;
  font-weight: 700;
}

.gallery-module--enhanced .gallery-module__controls--open {
  opacity: 1;
  pointer-events: auto;
  translate: 0;
  visibility: visible;
}

.gallery-module__field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.gallery-module__field label {
  color: var(--gallery-muted-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gallery-module__field input,
.gallery-module__field select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--gallery-control-border);
  border-radius: calc(var(--gallery-radius) * 0.75);
  background: var(--gallery-control-background);
  padding: 0.55rem 0.7rem;
}

.gallery-module__summary {
  min-height: 1.4em;
  margin-block-end: 0.6rem;
  color: var(--gallery-muted-text);
  font-size: 0.9rem;
}

.gallery-module__notice {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-inline-start: 3px solid var(--gallery-muted-text);
  background: var(--gallery-surface);
}

.gallery-module__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: var(--gallery-gap);
}

.gallery-module__item {
  min-width: 0;
}

.gallery-module__item-button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--gallery-radius);
  background: transparent;
  padding: 0;
  text-align: start;
}

.gallery-module__thumbnail {
  position: relative;
  display: grid;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  place-items: center;
  border-radius: var(--gallery-radius);
  background: var(--gallery-surface);
}

.gallery-module__thumbnail > * {
  grid-area: 1 / 1;
}

.gallery-module__thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease, opacity 180ms ease;
}

.gallery-module__video-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  gap: 0.35rem;
  color: var(--gallery-muted-text);
  background:
    linear-gradient(135deg, transparent 0 49%, rgba(255, 255, 255, 0.35) 50% 51%, transparent 52%),
    var(--gallery-surface);
  text-align: center;
}

.gallery-module__video-placeholder-icon {
  font-size: 1.6rem;
}

.gallery-module__video-badge {
  z-index: 2;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid var(--gallery-video-badge-border);
  border-radius: 999px;
  color: var(--gallery-video-badge-foreground);
  background: var(--gallery-video-badge-background);
  padding-inline-start: 0.15rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.25);
}

.gallery-module__item-button:hover .gallery-module__thumbnail img,
.gallery-module__item-button:focus-visible .gallery-module__thumbnail img {
  transform: scale(1.025);
  opacity: 0.92;
}

.gallery-module__image-error {
  padding: 1rem;
  color: var(--gallery-muted-text);
  text-align: center;
}

.gallery-module__item-title {
  display: block;
  padding: 0.45rem 0.15rem 0;
  font-weight: 650;
}

.gallery-module__empty,
.gallery-module__message {
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--gallery-border);
  border-radius: var(--gallery-radius);
  background: var(--gallery-surface);
  text-align: center;
}

.gallery-module__message h2,
.gallery-module__message p {
  margin: 0;
}

.gallery-module__message p + p,
.gallery-module__message h2 + p {
  margin-block-start: 0.6rem;
}

.gallery-module__error-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.gallery-module__viewer {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100dvh;
  color: var(--gallery-viewer-text);
  background: var(--gallery-overlay);
  opacity: 0;
  overscroll-behavior: contain;
  transition: opacity 140ms ease;
}

.gallery-module__viewer--open {
  opacity: 1;
}

.gallery-module__viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  padding: max(0.5rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0.5rem max(0.75rem, env(safe-area-inset-left));
}

.gallery-module__viewer-actions {
  display: flex;
  gap: 0.35rem;
}

.gallery-module__viewer-button,
.gallery-module__viewer-nav {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--gallery-viewer-control-border);
  border-radius: 999px;
  color: var(--gallery-viewer-text);
  background: var(--gallery-viewer-control-background);
  font-size: 1.8rem;
  line-height: 1;
}

.gallery-module__viewer-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 0;
  align-items: center;
  touch-action: pan-y pinch-zoom;
}

.gallery-module__viewer-figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.gallery-module__viewer-image-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 0.5rem;
}

.gallery-module__viewer-image {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
}

.gallery-module__viewer-video {
  display: block;
  width: min(100%, 80rem);
  max-height: calc(100dvh - 9rem);
  background: var(--gallery-viewer-video-background);
  object-fit: contain;
}

.gallery-module__viewer-error {
  color: var(--gallery-viewer-muted-text);
  text-align: center;
}

.gallery-module__viewer-caption {
  display: grid;
  gap: 0.15rem;
  max-width: 70rem;
  margin-inline: auto;
  padding: 0.5rem 1rem max(1rem, env(safe-area-inset-bottom));
  text-align: center;
}

.gallery-module__viewer-caption span {
  color: var(--gallery-viewer-muted-text);
}

.gallery-module__viewer-nav {
  margin: 0.5rem;
  font-size: 2.2rem;
}

.gallery-viewer-is-open,
.gallery-controls-is-open {
  overflow: hidden;
}

.gallery-module__header {
    min-height: 0!important;
    padding: 0.75rem 1rem!important;
}
.gallery-module__controls {
    margin-top: 0.5rem!important;
}

.gallery-module {
    background: #111 !important;
    color: #fff !important;
}

.gallery-module__header {
    background: transparent !important;
    min-height: 0 !important;
    padding: 0.75rem 1rem !important;
}

.gallery-module__title {
    color: #fff !important;
    margin: 0 !important;
}

.gallery-module__controls {
    margin: 0 !important;
}

#gallery .gallery-module {
    padding-top: 0 !important;
    margin-top: 0 !important;
    min-height: 0 !important;
}

#gallery .gallery-module__header {
    height: auto !important;
    min-height: 0 !important;
    padding: 1rem !important;
    margin: 0 !important;
}

@media (max-width: 700px) {
  .gallery-module__header {
    align-items: center;
  }

  .gallery-module--enhanced .gallery-module__controls {
    position: fixed;
    z-index: 2147482999;
    inset: auto 0 0;
    top: auto;
    display: grid;
    grid-template-columns: 1fr;
    max-height: min(80dvh, 38rem);
    margin: 0;
    padding: 0.5rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    border-width: 1px 0 0;
    border-radius: calc(var(--gallery-radius) * 1.5) calc(var(--gallery-radius) * 1.5) 0 0;
    box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.2);
    opacity: 1;
    overflow: auto;
    pointer-events: none;
    translate: 0 105%;
    visibility: hidden;
    transition: translate 180ms ease, visibility 180ms;
  }

  .gallery-module--enhanced .gallery-module__controls--open {
    pointer-events: auto;
    translate: 0;
    visibility: visible;
  }

  .gallery-module__controls-handle {
    display: block;
    width: 2.6rem;
    height: 0.25rem;
    margin: 0 auto 0.2rem;
    border-radius: 999px;
    background: var(--gallery-control-border);
  }

  .gallery-module--enhanced .gallery-module__controls-done {
    min-height: 3rem;
    padding: 0.65rem 1rem;
  }

  .gallery-module__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-module__viewer-stage {
    position: relative;
    display: block;
  }

  .gallery-module__viewer-figure {
    height: 100%;
  }

  .gallery-module__viewer-nav {
    position: absolute;
    z-index: 1;
    top: 50%;
    translate: 0 -50%;
    margin: 0.5rem;
  }

  .gallery-module__viewer-nav--previous {
    left: 0;
  }

  .gallery-module__viewer-nav--next {
    right: 0;
  }

  .gallery-module__viewer-image-wrap {
    padding-inline: 0;
  }
  
  .gallery-module__header {
    min-height: 0!important;
    padding: 0.75rem 1rem!important;
}
.gallery-module__controls {
    margin-top: 0.5rem!important;
}

}

@media (max-width: 390px) {
  .gallery-module__grid {
    gap: 0.55rem;
  }

  .gallery-module__item-title {
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-module *,
  .gallery-module *::before,
  .gallery-module *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .gallery-module__viewer {
    background: Canvas;
  }
}
