/* Pearson Building photo gallery and lightbox.
   Shared by every case-study page; markup is .pb-gallery > .pb-gallery__grid > a.pb-gallery__item,
   and any <img data-pb-full> elsewhere on the page opens in the same lightbox. */

.pb-gallery {
  --pb-ink: #013537;
  --pb-accent: #cc043c;
  --pb-cream: #f8f6ee;
  box-sizing: border-box;
  max-width: 1120px;
  margin: 56px auto 24px;
  padding: 0 16px;
  text-align: left;
  font-family: "DM Sans", "DM Sans Fallback", sans-serif;
  color: var(--pb-ink);
}
.pb-gallery *, .pb-gallery *::before, .pb-gallery *::after { box-sizing: border-box; }

.pb-gallery__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(1, 53, 55, 0.15);
}
.pb-gallery__eyebrow {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pb-accent);
}
.pb-gallery__title {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--pb-ink);
}
.pb-gallery__hint {
  margin: 0;
  font-size: 15px;
  font-weight: 300;
  color: rgba(1, 53, 55, 0.75);
}

/* Tiled grid: 3:4 cells, a hero photo spanning 2x2 and landscape photos spanning two columns,
   ordered in the markup so the rows close up with no gaps. */
.pb-gallery__wrap { container-type: inline-size; }
.pb-gallery__grid {
  --pb-cols: 4;
  --pb-gap: 14px;
  display: grid;
  grid-template-columns: repeat(var(--pb-cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--pb-cols) - 1) * var(--pb-gap)) / var(--pb-cols) * 4 / 3);
  gap: var(--pb-gap);
}
.pb-gallery__item {
  position: relative;
  display: block;
  overflow: hidden;
  background: #e9e4d6;
  cursor: zoom-in;
  outline: none;
}
.pb-gallery__item--hero { grid-column: span 2; grid-row: span 2; }
.pb-gallery__item--wide { grid-column: span 2; }
.pb-gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s ease;
}
.pb-gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(1, 30, 31, 0.55), rgba(1, 30, 31, 0) 45%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.pb-gallery__cap {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 1;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.pb-gallery__item:hover img,
.pb-gallery__item:focus-visible img { transform: scale(1.04); }
.pb-gallery__item:hover::after,
.pb-gallery__item:focus-visible::after,
.pb-gallery__item:hover .pb-gallery__cap,
.pb-gallery__item:focus-visible .pb-gallery__cap { opacity: 1; transform: none; }
.pb-gallery__item:focus-visible { box-shadow: 0 0 0 3px var(--pb-accent); }

img[data-pb-full] { cursor: zoom-in; }

@media (max-width: 900px) {
  .pb-gallery__grid { --pb-cols: 2; --pb-gap: 10px; }
}
@media (max-width: 640px) {
  .pb-gallery { margin-top: 40px; padding: 0; }
  .pb-gallery__grid { --pb-gap: 8px; }
  .pb-gallery__title { font-size: 26px; }
  .pb-gallery__hint { font-size: 14px; }
  .pb-gallery__cap { display: none; }
}
@media (hover: none) {
  .pb-gallery__cap { display: none; }
}

/* Lightbox */
.pb-lb {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(1, 22, 23, 0.95);
  font-family: "DM Sans", "DM Sans Fallback", sans-serif;
  color: #f8f6ee;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y pinch-zoom;
}
.pb-lb.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
.pb-lb__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  padding: 64px 88px 8px;
}
.pb-lb__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.pb-lb__img.is-loading { opacity: 0.35; }
.pb-lb__bar {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  padding: 14px 24px 22px;
  text-align: center;
}
.pb-lb__cap { margin: 0; font-size: 16px; font-weight: 300; line-height: 1.4; }
.pb-lb__count {
  flex: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(248, 246, 238, 0.65);
}
.pb-lb button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(248, 246, 238, 0.1);
  color: #f8f6ee;
  cursor: pointer;
  transition: background 0.2s ease;
}
.pb-lb button:hover { background: rgba(248, 246, 238, 0.22); }
.pb-lb button:focus-visible { outline: 3px solid #cc043c; outline-offset: 2px; }
.pb-lb button svg { width: 24px; height: 24px; }
.pb-lb__close { top: 16px; right: 16px; }
.pb-lb__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.pb-lb__next { right: 20px; top: 50%; transform: translateY(-50%); }
.pb-lb.is-single .pb-lb__prev,
.pb-lb.is-single .pb-lb__next,
.pb-lb.is-single .pb-lb__count { display: none; }

@media (max-width: 640px) {
  .pb-lb__stage { padding: 64px 0 0; }
  .pb-lb__img { box-shadow: none; }
  .pb-lb__prev, .pb-lb__next { top: auto; bottom: 14px; transform: none; width: 46px; height: 46px; }
  .pb-lb__prev { left: 12px; }
  .pb-lb__next { right: 12px; }
  .pb-lb__bar { flex-direction: column; align-items: center; gap: 4px; padding: 14px 70px 20px; min-height: 76px; }
  .pb-lb__cap { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pb-gallery__item img, .pb-gallery__item::after, .pb-gallery__cap, .pb-lb, .pb-lb__img { transition: none; }
}
