/* HVF gallery. One big picture, thumbnails underneath, full screen lightbox.
   The !important rules hold the look against the theme's own button and image styles. */

.hvfg{
  --hvfg-paper: #F7F3EA;
  --hvfg-paper-2: #EBE5DB;
  --hvfg-ink: #2A211B;
  --hvfg-bush-deep: #223528;
  display: grid;
  gap: 10px;
  align-self: start;
  width: 100%;
  min-width: 0;
}

/* Big picture */
.hvfg .hvfg__main{
  display: block !important;
  position: relative;
  width: 100% !important;
  height: clamp(300px, 32vw, 440px) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: var(--hvfg-paper-2) !important;
  box-shadow: none !important;
  cursor: zoom-in;
  line-height: 0 !important;
  -webkit-appearance: none;
  appearance: none;
}
.hvfg .hvfg__main img{
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
  transition: opacity .25s ease;
}

/* Thumbnails, six across */
.hvfg .hvfg__thumbs{
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}
.hvfg .hvfg__thumb{
  display: block !important;
  position: relative;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 1;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background: var(--hvfg-paper-2) !important;
  box-shadow: none !important;
  cursor: pointer;
  opacity: .62;
  outline: 2px solid transparent !important;
  outline-offset: 2px;
  line-height: 0 !important;
  transition: opacity .2s, outline-color .2s !important;
  -webkit-appearance: none;
  appearance: none;
}
.hvfg .hvfg__thumb img{
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
}
.hvfg .hvfg__thumb:hover,
.hvfg .hvfg__thumb:focus-visible{ opacity: 1; }
.hvfg .hvfg__thumb.is-on{ opacity: 1; outline-color: var(--hvfg-bush-deep) !important; }
.hvfg .hvfg__main:focus-visible,
.hvfg .hvfg__thumb:focus-visible{ outline-color: var(--hvfg-bush-deep) !important; }
/* On a dark band, add class="hvfg--dark" so the selected ring shows */
.hvfg.hvfg--dark .hvfg__thumb.is-on,
.hvfg.hvfg--dark .hvfg__main:focus-visible,
.hvfg.hvfg--dark .hvfg__thumb:focus-visible{ outline-color: #F7F3EA !important; }
.hvfg.hvfg--dark .hvfg__main,
.hvfg.hvfg--dark .hvfg__thumb{ background: rgba(247, 243, 234, .08) !important; }
/* Full width bands, add class="hvfg--wide": a taller picture and smaller thumbnails */
.hvfg.hvfg--wide .hvfg__main{ height: clamp(360px, 44vw, 640px) !important; }
.hvfg.hvfg--wide .hvfg__thumbs{ grid-template-columns: repeat(6, minmax(0, 120px)); }
/* Add class="hvfg--center" to centre the thumbnails under the picture */
.hvfg.hvfg--center .hvfg__thumbs{ display: flex; flex-wrap: wrap; justify-content: center; }
.hvfg.hvfg--center .hvfg__thumb{ flex: 0 0 calc((100% - 40px) / 6); }
.hvfg.hvfg--center.hvfg--wide .hvfg__thumb{ flex-basis: 120px; }
.hvfg .hvfg__thumb--extra{ display: none !important; }
.hvfg.hvfg--single .hvfg__thumbs{ display: none; }

/* "+N" on the sixth thumbnail when there are more photos */
.hvfg .hvfg__thumb[data-more]{ opacity: 1; }
.hvfg .hvfg__more{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 53, 40, .72);
  color: var(--hvfg-paper);
  font-family: var(--display, "Playfair Display", Georgia, serif);
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

/* Lightbox. Added to the end of the page by gallery.js, one per page */
html.hvfg-lock{ overflow: hidden; }
.hvfg-lb{
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 96px;
  background: rgba(34, 53, 40, .96);
  box-sizing: border-box;
}
.hvfg-lb.open{ display: flex; }
.hvfg-lb .hvfg-lb__fig{
  margin: 0;
  max-width: min(1200px, 100%);
  text-align: center;
}
.hvfg-lb .hvfg-lb__img{
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 78vh !important;
  margin: 0 auto !important;
  border-radius: 12px !important;
}
.hvfg-lb .hvfg-lb__text{
  margin: 18px 0 0;
  padding: 0;
  font-family: var(--display, "Playfair Display", Georgia, serif);
  font-size: 20px;
  line-height: 1.3;
  color: #F7F3EA;
}
.hvfg-lb .hvfg-lb__cap{ display: block; }
.hvfg-lb .hvfg-lb__count{
  display: block;
  margin-top: 6px;
  font-family: var(--body, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(247, 243, 234, .6);
}
.hvfg-lb .hvfg-lb__btn,
.hvfg-lb .hvfg-lb__close{
  position: absolute !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 1px solid rgba(247, 243, 234, .45) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  color: #F7F3EA !important;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: 22px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  transition: background-color .2s, color .2s !important;
  -webkit-appearance: none;
  appearance: none;
}
.hvfg-lb .hvfg-lb__btn{
  top: 50%;
  transform: translateY(-50%);
  width: 50px !important;
  height: 50px !important;
}
.hvfg-lb .hvfg-lb__btn:hover,
.hvfg-lb .hvfg-lb__close:hover,
.hvfg-lb .hvfg-lb__btn:focus-visible,
.hvfg-lb .hvfg-lb__close:focus-visible{
  background: #F7F3EA !important;
  color: #2A211B !important;
}
.hvfg-lb .hvfg-lb__prev{ left: 28px; }
.hvfg-lb .hvfg-lb__next{ right: 28px; }
.hvfg-lb .hvfg-lb__close{
  top: 22px;
  right: 28px;
  width: 44px !important;
  height: 44px !important;
  font-size: 26px !important;
}
.hvfg-lb.hvfg-lb--single .hvfg-lb__btn,
.hvfg-lb.hvfg-lb--single .hvfg-lb__count{ display: none !important; }

/* Mobile: photo goes full width, arrows move underneath */
@media (max-width: 767px){
  .hvfg-lb{ padding: 60px 12px 100px; }
  .hvfg-lb .hvfg-lb__fig{ width: 100%; }
  .hvfg-lb .hvfg-lb__img{ max-height: 68vh !important; border-radius: 8px !important; }
  .hvfg-lb .hvfg-lb__text{ font-size: 17px; padding: 0 8px; }
  .hvfg-lb .hvfg-lb__btn{ top: auto; bottom: 26px; transform: none; width: 54px !important; height: 54px !important; }
  .hvfg-lb .hvfg-lb__prev{ left: calc(50% - 66px); }
  .hvfg-lb .hvfg-lb__next{ right: calc(50% - 66px); }
  .hvfg-lb .hvfg-lb__close{ top: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce){
  .hvfg .hvfg__main img,
  .hvfg .hvfg__thumb{ transition: none !important; }
}
