/*
 * Home page "Event Gallery" collage and photo viewer (02-12-2026).
 * Markup: application/views/frontend/home-past-editions.php
 *
 * The photos sit in bands; every tile is 3:2 (the shape of the event photos),
 * so nothing is cropped:
 *   hero-l / hero-r  one large photo beside two small ones
 *   one / two / three / four  equal photos in a row
 * Brand colours: change --pe-c1 / --pe-c2 for another site.
 */

.pe-collage,
.pe-lightbox {
  --pe-c1: #f47320;
  --pe-c2: #2E3273;
  --pe-gap: 10px;
  --pe-radius: 14px;
}

.pe-collage {
  display: flex;
  flex-direction: column;
  gap: var(--pe-gap);
}

/* ---------- bands ---------- */
.pe-band { display: grid; gap: var(--pe-gap); }
.pe-band-one   { grid-template-columns: minmax(0, 1fr); }
.pe-band-two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pe-band-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pe-band-four  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pe-band-hero-l { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.pe-band-hero-r { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* the large photo fills the height of the two small photos beside it */
.pe-band-hero-l > .pe-tile:first-child { grid-column: 1; grid-row: 1 / span 2; aspect-ratio: auto; }
.pe-band-hero-l > .pe-tile:not(:first-child) { grid-column: 2; }
.pe-band-hero-r > .pe-tile:first-child { grid-column: 2; grid-row: 1 / span 2; aspect-ratio: auto; }
.pe-band-hero-r > .pe-tile:not(:first-child) { grid-column: 1; }

/* ---------- tiles ---------- */
.pe-tile {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border-radius: var(--pe-radius);
  background: #e9eaf3;
  box-shadow: 0 8px 22px -10px rgba(46, 50, 115, .45);
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  cursor: zoom-in;
}
.pe-tile:hover, .pe-tile:focus { color: #fff; text-decoration: none; }
.pe-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;   /* a photo of another shape keeps the faces (upper part) */
  display: block;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
/* dark shade from the bottom, shown on hover, for the caption */
.pe-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(22, 24, 62, .88) 0%, rgba(22, 24, 62, .35) 40%, rgba(22, 24, 62, 0) 65%);
  opacity: 0;
  transition: opacity .35s ease;
}
.pe-tile-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
}
.pe-band-hero-l > .pe-tile:first-child .pe-tile-caption,
.pe-band-hero-r > .pe-tile:first-child .pe-tile-caption { left: 20px; right: 20px; bottom: 18px; font-size: 1rem; }

.pe-tile-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .92);
  color: var(--pe-c2);
  opacity: 0;
  transform: scale(.8);
  transition: opacity .3s ease, transform .3s ease;
}
.pe-tile-zoom svg { width: 16px; height: 16px; }

@media (hover: hover) {
  .pe-tile:hover img { transform: scale(1.06); }
  .pe-tile:hover::after,
  .pe-tile:hover .pe-tile-caption,
  .pe-tile:hover .pe-tile-zoom { opacity: 1; transform: none; }
}
.pe-tile:focus-visible { outline: 3px solid var(--pe-c1); outline-offset: 3px; }
.pe-tile:focus-visible::after,
.pe-tile:focus-visible .pe-tile-caption,
.pe-tile:focus-visible .pe-tile-zoom { opacity: 1; transform: none; }

/* edition label on the first large photo */
.pe-tile-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 70px);
  padding: 7px 14px 7px 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pe-c1), var(--pe-c2));
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .35);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pe-tile-chip svg { width: 14px; height: 14px; flex: none; }

/* ---------- entrance animation (added by the script; off for reduced motion) ---------- */
.pe-collage.pe-anim .pe-tile {
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(var(--pe-i, 0) * 70ms);
}
.pe-collage.pe-anim.pe-in .pe-tile { opacity: 1; transform: none; }

/* ---------- button under the collage ---------- */
.pe-collage-cta { text-align: center; margin-top: 22px; }

/* ---------- phones: two columns, the large photo full width ---------- */
@media (max-width: 575px) {
  .pe-collage, .pe-lightbox { --pe-gap: 8px; --pe-radius: 10px; }
  .pe-band-three,
  .pe-band-four,
  .pe-band-hero-l,
  .pe-band-hero-r { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pe-band-hero-l > .pe-tile:not(:first-child),
  .pe-band-hero-r > .pe-tile:not(:first-child) { grid-column: auto; }
  .pe-band-hero-l > .pe-tile:first-child,
  .pe-band-hero-r > .pe-tile:first-child,
  .pe-band-three > .pe-tile:first-child { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 3 / 2; }
  .pe-tile-chip { top: 10px; left: 10px; font-size: .72rem; padding: 6px 12px 6px 9px; }
}

/* ---------- photo viewer ---------- */
html.pe-lb-open { overflow: hidden; }
.pe-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  background: rgba(12, 13, 36, .94);
  color: #fff;
  font-family: inherit;
}
.pe-lightbox[hidden] { display: none; }
.pe-lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}
.pe-lb-count { font-size: .9rem; font-weight: 600; letter-spacing: .06em; opacity: .8; font-variant-numeric: tabular-nums; }
.pe-lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 18px;
}
.pe-lb-img {
  max-width: min(1100px, calc(100% - 140px));
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  background: #1a1b33;
}
.pe-lb-btn {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  transition: background .2s ease;
}
.pe-lb-btn:hover, .pe-lb-btn:focus-visible { background: var(--pe-c1); outline: none; }
.pe-lb-btn svg { width: 22px; height: 22px; }
.pe-lb-single .pe-lb-prev, .pe-lb-single .pe-lb-next { visibility: hidden; }
.pe-lb-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 22px;
  text-align: center;
}
.pe-lb-title { margin: 0; min-height: 1.4em; font-size: 1rem; font-weight: 600; color: #fff; }
.pe-lb-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pe-c1), var(--pe-c2));
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
}
.pe-lb-all:hover, .pe-lb-all:focus { color: #fff; text-decoration: none; filter: brightness(1.1); }
.pe-lb-all svg { width: 16px; height: 16px; }

@media (max-width: 575px) {
  .pe-lb-stage { position: relative; padding: 0; }
  .pe-lb-img { max-width: 100%; border-radius: 0; }
  .pe-lb-prev, .pe-lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; background: rgba(0, 0, 0, .45); }
  .pe-lb-prev { left: 8px; }
  .pe-lb-next { right: 8px; }
}
