@font-face {
  font-family: Signika;
  src: url('../assets/Signika-Regular-webfont.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Signika;
  src: url('../assets/Signika-Bold-webfont.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}

:root { color-scheme: light; --accent: #b8312f; --ink: #292929; --muted: #686864; --line: #dededb; --page: #f3f3f1; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.45 Signika, Arial, sans-serif; }
button, a { font: inherit; }

.public-header {
  display: flex;
  width: min(1180px, calc(100% - 32px));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  margin: 0 auto;
}
.public-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.public-brand img { width: 54px; height: 54px; object-fit: contain; }
.public-brand span { display: grid; }
.public-brand small { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.public-brand strong { font-size: 22px; }
.back-link { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; }

.public-gallery { width: min(1180px, calc(100% - 32px)); padding: 26px; margin: 0 auto 48px; border-radius: 18px; background: #fff; box-shadow: 0 12px 35px rgb(0 0 0 / 8%); }
.gallery-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 3px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.gallery-heading h1 { margin: 0; font-size: clamp(28px, 5vw, 48px); line-height: 1.05; }
.gallery-heading p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.photo-count { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; background: #f4dfde; color: #8e2523; font-size: 13px; font-weight: 700; }

.gallery-stage { position: relative; }
.gallery-grid { display: grid; gap: 10px; }
.layout-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.layout-masonry { display: block; columns: 3 270px; column-gap: 10px; }
.layout-masonry .gallery-tile { break-inside: avoid; margin-bottom: 10px; }
.layout-carousel { grid-auto-flow: column; grid-auto-columns: minmax(260px, 38%); overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.layout-carousel .gallery-tile { scroll-snap-align: start; }

.gallery-tile { position: relative; display: grid; width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: 4.5px; background: transparent; cursor: zoom-in; color: #fff; text-align: left; }
.gallery-tile:focus-visible { outline: 4px solid rgb(184 49 47 / 30%); outline-offset: 3px; }
.gallery-tile img { display: block; width: 100%; height: auto; object-fit: cover; transition: transform .25s ease; }
.layout-grid .gallery-tile img { aspect-ratio: 4 / 3; }
.layout-carousel .gallery-tile img { height: min(54vw, 480px); }
.gallery-tile:hover img { transform: scale(1.025); }
.gallery-tile > span { position: absolute; right: 0; bottom: 0; left: 0; padding: 28px 12px 10px; background: linear-gradient(transparent, rgb(0 0 0 / 75%)); font-size: 14px; }

.is-preview body { background: transparent; }
.preview-gallery { width: 100%; min-height: 100vh; padding: 14px; margin: 0; border-radius: 0; box-shadow: none; }
.preview-gallery .gallery-heading { margin-bottom: 12px; }
.preview-gallery .gallery-heading h1 { font-size: clamp(23px, 5vw, 34px); }
.layout-preview-grid {
  --preview-row-height: 190px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: var(--preview-row-height);
  max-height: calc(var(--preview-row-height) + var(--preview-row-height) + 10px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: #b9b9b4 #efefec;
  scrollbar-width: thin;
}
.layout-preview-grid.preview-grid-2x2 {
  --preview-row-height: clamp(190px, calc((100vh - 161px) / 2), 280px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.layout-preview-grid.preview-grid-1x3,
.layout-preview-grid.preview-grid-1x2 {
  --preview-row-height: clamp(280px, calc(100vh - 161px), 560px);
  max-height: var(--preview-row-height);
}
.layout-preview-grid.preview-grid-1x3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.layout-preview-grid.preview-grid-1x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-preview-grid .gallery-tile { place-items: center; background: transparent; }
.layout-preview-grid .gallery-tile img {
  width: auto;
  height: auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4.5px;
  object-fit: contain;
}
.layout-preview-grid .gallery-tile:hover img { transform: none; }
.layout-preview-grid::-webkit-scrollbar { width: 8px; }
.layout-preview-grid::-webkit-scrollbar-track { border-radius: 999px; background: #efefec; }
.layout-preview-grid::-webkit-scrollbar-thumb { border-radius: 999px; background: #b9b9b4; }

/* Keep the columns at their natural height; only the outer stage scrolls.
   A height limit directly on CSS columns would create horizontal overflow. */
.preview-masonry-gallery { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.preview-masonry-gallery .gallery-heading,
.preview-masonry-gallery .preview-footer { flex: 0 0 auto; }
.has-preview-masonry { flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 6px; scrollbar-color: #b9b9b4 #efefec; scrollbar-width: thin; }
.layout-preview-masonry { display: block; columns: 3 220px; column-gap: 10px; }
.layout-preview-masonry .gallery-tile { break-inside: avoid; margin-bottom: 10px; }
.layout-preview-masonry .gallery-tile img { width: 100%; height: auto; border-radius: 4.5px; }
.layout-preview-masonry .gallery-tile:hover img { transform: none; }

.public-gallery.preview-image-only-gallery {
  width: 100%;
  height: 100vh;
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.has-preview-image-only { height: 100%; min-height: 0; overflow: hidden; }
.layout-preview-image-only { width: 100%; height: 100%; min-height: 0; }
.layout-preview-image-only .gallery-tile {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  border-radius: 0;
}
.layout-preview-image-only .gallery-tile.is-active { display: grid; }
.layout-preview-image-only .gallery-tile img {
  width: auto;
  height: auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4.5px;
  object-fit: contain;
}
.layout-preview-image-only .gallery-tile:hover img { transform: none; }
.has-preview-image-only .preview-carousel-arrow {
  width: 38px;
  height: 58px;
  border: 0;
  border-radius: 4px;
  background: rgb(41 41 41 / 30%);
  box-shadow: none;
  color: rgb(255 255 255 / 90%);
  font-size: 31px;
}
.has-preview-image-only .preview-carousel-arrow:hover { background: rgb(41 41 41 / 46%); }
.has-preview-image-only .preview-carousel-arrow.previous { left: 8px; }
.has-preview-image-only .preview-carousel-arrow.next { right: 8px; }

.has-preview-carousel { min-height: 280px; overflow: hidden; border-radius: 4px; background: transparent; }
.layout-preview-carousel {
  --preview-active-width: min(48vw, 440px);
  --preview-side-width: min(24vw, 210px);
  display: flex;
  height: 280px;
  align-items: center;
  gap: 12px;
  overflow-x: hidden;
  padding: 20px calc((100% - var(--preview-active-width)) / 2);
  scroll-behavior: smooth;
}
.layout-preview-carousel .gallery-tile {
  flex: 0 0 var(--preview-side-width);
  height: 145px;
  border-radius: 4.5px;
  opacity: .42;
  filter: saturate(.65) blur(.35px);
  transform: scale(.9);
  transition: flex-basis .25s ease, height .25s ease, opacity .25s ease, filter .25s ease, transform .25s ease;
}
.layout-preview-carousel .gallery-tile.is-active {
  flex-basis: var(--preview-active-width);
  height: 232px;
  z-index: 2;
  opacity: 1;
  filter: none;
  transform: scale(1);
}
.layout-preview-carousel .gallery-tile img { height: 100%; min-height: 0; }
.layout-preview-carousel .gallery-tile > span { display: none; }
.layout-preview-carousel .gallery-tile.is-active > span { display: block; }
.preview-carousel-arrow {
  position: absolute;
  z-index: 5;
  top: 50%;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 50%;
  background: rgb(41 41 41 / 82%);
  box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
  color: #fff;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  transform: translateY(-50%);
}
.preview-carousel-arrow:hover { background: var(--accent); }
.preview-carousel-arrow:focus-visible { outline: 4px solid rgb(184 49 47 / 30%); outline-offset: 2px; }
.preview-carousel-arrow.previous { left: 12px; }
.preview-carousel-arrow.next { right: 12px; }
.preview-carousel-status { position: absolute; z-index: 4; bottom: 8px; left: 50%; padding: 3px 9px; border-radius: 999px; background: rgb(41 41 41 / 72%); color: #fff; font-size: 12px; transform: translateX(-50%); }
.preview-footer { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; margin-top: 12px; }
.preview-footer button,
.preview-footer a { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; padding: 9px 14px; border: 1px solid var(--accent); border-radius: 10px; background: #fff; color: var(--accent); cursor: pointer; font-weight: 700; text-decoration: none; }
.preview-footer .open-first { background: var(--accent); color: #fff; }

.lightbox { position: fixed; z-index: 1000; inset: 0; overflow: hidden; background: rgb(0 0 0 / 94%); color: #fff; touch-action: none; }
.lightbox[hidden] { display: none; }
.lightbox-toolbar { position: absolute; z-index: 3; top: 0; right: 0; left: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); background: linear-gradient(rgb(0 0 0 / 72%), transparent); }
.lightbox-toolbar > div { display: flex; gap: 7px; }
.lightbox-toolbar button,
.lightbox-nav { display: grid; width: 46px; height: 46px; place-items: center; border: 0; border-radius: 50%; background: rgb(255 255 255 / 14%); color: #fff; cursor: pointer; font-size: 27px; }
.lightbox-toolbar button:hover,
.lightbox-nav:hover { background: rgb(255 255 255 / 25%); }
.lightbox figure { display: grid; width: 100%; height: 100%; grid-template-rows: minmax(0, 1fr) auto; align-items: center; justify-items: center; padding: 68px 76px max(18px, env(safe-area-inset-bottom)); margin: 0; }
.lightbox figure img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; transform-origin: center; transition: transform .2s ease; }
.lightbox figure.zoomed { overflow: auto; touch-action: pan-x pan-y; }
.lightbox figure.zoomed img { max-width: none; max-height: none; transform: scale(1.7); cursor: zoom-out; }
.lightbox figcaption { min-height: 26px; max-width: 840px; padding-top: 10px; color: #efefec; text-align: center; }
.lightbox-nav { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); }
.lightbox-nav.previous { left: 15px; }
.lightbox-nav.next { right: 15px; }

.gallery-empty { display: grid; width: min(560px, calc(100% - 32px)); min-height: 70vh; place-content: center; justify-items: center; margin: 0 auto; text-align: center; }
.gallery-empty img { width: 86px; }
.gallery-empty h1 { margin-bottom: 5px; }
.gallery-empty p { color: var(--muted); }

@media (max-width: 720px) {
  .public-header,
  .public-gallery { width: min(100% - 20px, 1180px); }
  .public-gallery { padding: 15px; }
  .layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-masonry { columns: 2 150px; }
  .layout-preview-masonry { columns: 1; }
  .layout-carousel { grid-auto-columns: 82%; }
  .layout-preview-grid,
  .layout-preview-grid.preview-grid-2x2,
  .layout-preview-grid.preview-grid-1x3,
  .layout-preview-grid.preview-grid-1x2 {
    --preview-row-height: 250px;
    grid-template-columns: 1fr;
    max-height: var(--preview-row-height);
  }
  .has-preview-carousel,
  .layout-preview-carousel { height: 224px; min-height: 0; }
  .layout-preview-carousel {
    --preview-active-width: min(68vw, 300px);
    --preview-side-width: min(38vw, 150px);
    gap: 8px;
    padding: 14px calc((100% - var(--preview-active-width)) / 2);
  }
  .layout-preview-carousel .gallery-tile { height: 125px; }
  .layout-preview-carousel .gallery-tile.is-active { height: 188px; }
  .preview-carousel-arrow { width: 42px; height: 42px; }
  .preview-carousel-arrow.previous { left: 7px; }
  .preview-carousel-arrow.next { right: 7px; }
  .gallery-heading { align-items: flex-start; }
  .gallery-heading h1 { font-size: 29px; }
  .lightbox figure { padding: 64px 10px max(18px, env(safe-area-inset-bottom)); }
  .lightbox-nav { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); }
  .lightbox-nav.previous { left: 12px; }
  .lightbox-nav.next { right: 12px; }
  .lightbox figcaption { padding-right: 58px; padding-left: 58px; }
}

@media (max-width: 430px) {
  .public-brand strong { font-size: 19px; }
  .back-link { font-size: 13px; }
  .photo-count { font-size: 12px; }
  .preview-footer > * { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
