.theobroma-photo-showcase {
  --photo-ink: var(--home-ink, #343434);
  --photo-muted: var(--home-muted, #756b63);
  --photo-gold: var(--home-gold, #b0903d);
  --photo-paper: var(--home-paper, #fbf7f1);
  --photo-sand: var(--home-sand, #f1e6d5);
  --photo-line: var(--home-line, #ded0bd);
  width: 100%;
  overflow: clip;
  color: var(--photo-ink);
  border-top: 1px solid var(--photo-line);
  background: var(--photo-paper);
}

.theobroma-photo-showcase__shell {
  width: min(var(--layout-container, 72.5rem), calc(100% - 2 * var(--layout-gutter, 4rem)));
  max-width: var(--layout-container, 72.5rem);
  margin-inline: auto;
  padding-block: clamp(4.75rem, 8vw, 7.5rem);
}

.theobroma-photo-showcase__intro {
  max-width: 47rem;
  margin-bottom: 2rem;
  display: block;
}

.theobroma-photo-showcase__intro h2 {
  margin: 0;
  color: var(--photo-ink);
  font: 400 clamp(3rem, 4.35vw, 3.5rem)/.95 'Cormorant', Georgia, serif;
  letter-spacing: -.025em;
  text-transform: none;
  text-wrap: balance;
}

.theobroma-photo-showcase__description {
  max-width: 28.75rem;
  margin: 1rem 0 0;
  color: var(--photo-muted);
  font: 400 .75rem/1.55 'Montserrat', Arial, sans-serif;
}

.theobroma-photo-showcase__gallery {
  min-width: 0;
  outline: none;
}

.theobroma-photo-showcase__gallery:focus-visible {
  outline: 2px solid var(--photo-gold);
  outline-offset: .625rem;
}

.theobroma-photo-showcase__item {
  min-width: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
  border-radius: .25rem;
  background: var(--photo-sand);
  isolation: isolate;
}

.theobroma-photo-showcase__trigger {
  width: 100%;
  height: 100%;
  padding: 0;
  display: block;
  position: relative;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
}

.theobroma-photo-showcase__trigger:focus-visible {
  outline: 2px solid var(--photo-gold);
  outline-offset: -.25rem;
}

.theobroma-photo-showcase__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(.22, .61, .36, 1), filter 500ms ease;
}

.theobroma-photo-showcase__item:hover .theobroma-photo-showcase__image {
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1.025);
}

.theobroma-photo-showcase__meta {
  position: absolute;
  z-index: 2;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 1rem;
  color: #fff;
  pointer-events: none;
}

.theobroma-photo-showcase__item::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 35% 0 0;
  background: linear-gradient(to bottom, transparent, rgba(34, 24, 16, .62));
  pointer-events: none;
}

.theobroma-photo-showcase__meta figcaption {
  max-width: 18rem;
  color: inherit;
  font: 500 .75rem/1.35 'Montserrat', Arial, sans-serif;
  text-align: left;
}

.theobroma-photo-showcase--home {
  background: var(--photo-paper);
}

.theobroma-photo-showcase--home .theobroma-photo-showcase__gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    'lead lead detail-a detail-b'
    'lead lead detail-c detail-d';
  grid-auto-flow: dense;
  grid-auto-rows: clamp(13rem, 19vw, 18.5rem);
  gap: clamp(.75rem, 1.4vw, 1.25rem);
}

.theobroma-photo-showcase--home .theobroma-photo-showcase__item--1 { grid-area: lead; }
.theobroma-photo-showcase--home .theobroma-photo-showcase__item--2 { grid-area: detail-a; }
.theobroma-photo-showcase--home .theobroma-photo-showcase__item--3 { grid-area: detail-b; }
.theobroma-photo-showcase--home .theobroma-photo-showcase__item--4 { grid-area: detail-c; }
.theobroma-photo-showcase--home .theobroma-photo-showcase__item--5 { grid-area: detail-d; }
.theobroma-photo-showcase--home .theobroma-photo-showcase__item:nth-child(n + 6) { aspect-ratio: 4 / 3; }

.theobroma-photo-showcase--corporate {
  background: var(--photo-paper);
  color: var(--photo-ink);
}

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__shell {
  padding-block: clamp(4.75rem, 7vw, 6.75rem);
}

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__intro h2 {
  color: var(--photo-ink);
}
.theobroma-photo-showcase--corporate .theobroma-photo-showcase__description { color: var(--photo-muted); }

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.75rem, 1.4vw, 1.25rem);
}

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__item {
  aspect-ratio: 3 / 4;
  background: var(--photo-sand);
}

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__item:nth-child(even) { aspect-ratio: 4 / 5; }

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__meta {
  right: 1.25rem;
  bottom: 1.25rem;
  left: 1.25rem;
  align-items: flex-end;
}

.theobroma-photo-showcase--corporate .theobroma-photo-showcase__meta figcaption {
  max-width: 20rem;
  font: 400 clamp(1.25rem, 2vw, 1.75rem)/1 'Cormorant', Georgia, serif;
  text-align: left;
  text-wrap: balance;
}

.theobroma-photo-lightbox[hidden] { display: none; }

.theobroma-photo-lightbox {
  --photo-ink: var(--home-ink, #343434);
  --photo-gold: var(--home-gold, #b0903d);
  --photo-paper: var(--home-paper, #fbf7f1);
  --photo-line: var(--home-line, #ded0bd);
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.theobroma-photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(52, 52, 52, .94);
  cursor: zoom-out;
  backdrop-filter: blur(.5rem);
}

.theobroma-photo-lightbox__panel {
  width: min(calc(100vw - 2rem), 90rem);
  height: min(calc(100dvh - 2rem), 60rem);
  position: relative;
  z-index: 1;
}

.theobroma-photo-lightbox figure {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  position: relative;
  display: grid;
  place-items: center;
}

.theobroma-photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .3);
}

.theobroma-photo-lightbox figcaption {
  max-width: min(42rem, calc(100% - 7rem));
  padding: .625rem .875rem;
  position: absolute;
  right: 50%;
  bottom: .75rem;
  color: var(--photo-ink);
  background: rgba(251, 247, 241, .94);
  font: 400 .75rem/1.5 'Montserrat', Arial, sans-serif;
  text-align: center;
  transform: translateX(50%);
  backdrop-filter: blur(.5rem);
}

.theobroma-photo-lightbox__nav,
.theobroma-photo-lightbox__close {
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--photo-line);
  border-radius: 50%;
  color: #fff;
  background: rgba(251, 247, 241, .94);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.theobroma-photo-lightbox__nav {
  width: 3rem;
  height: 3rem;
  position: absolute;
  z-index: 2;
  top: 50%;
  left: var(--photo-nav-previous-x, 1.5rem);
  color: var(--photo-ink);
  font: 300 1.25rem/1 'Montserrat', Arial, sans-serif;
  transform: translate(-50%, -50%);
  box-shadow: 0 .5rem 1.75rem rgba(52, 52, 52, .18);
}

.theobroma-photo-lightbox__nav--next { left: var(--photo-nav-next-x, calc(100% - 1.5rem)); }

.theobroma-photo-lightbox__nav:hover,
.theobroma-photo-lightbox__close:hover {
  color: #fff;
  border-color: var(--photo-gold);
  background: var(--photo-gold);
}

.theobroma-photo-lightbox__nav:focus-visible,
.theobroma-photo-lightbox__close:focus-visible {
  outline: 2px solid var(--photo-gold);
  outline-offset: .25rem;
}

.theobroma-photo-lightbox__close {
  width: 2.75rem;
  height: 2.75rem;
  position: fixed;
  z-index: 2;
  top: 1.25rem;
  right: 1.25rem;
  color: var(--photo-ink);
  box-shadow: 0 .5rem 1.75rem rgba(52, 52, 52, .18);
}

.theobroma-photo-lightbox__close::before,
.theobroma-photo-lightbox__close::after {
  content: '';
  width: 1.25rem;
  height: 1px;
  position: absolute;
  background: currentColor;
  transform: rotate(45deg);
}

.theobroma-photo-lightbox__close::after { transform: rotate(-45deg); }

html.theobroma-photo-lightbox-open { overflow: hidden; }

/* Keep controls outside the image, with a separate toolbar on small screens. */
.theobroma-photo-lightbox { box-sizing: border-box; }
.theobroma-photo-lightbox__panel { box-sizing: border-box; padding: 40px 88px 52px; pointer-events: none; }
.theobroma-photo-lightbox figure { pointer-events: none; }
.theobroma-photo-lightbox img { width: auto; height: auto; max-height: min(calc(100dvh - 124px), 868px); border-radius: 12px; pointer-events: auto; }
.theobroma-photo-lightbox__nav,
.theobroma-photo-lightbox__close { pointer-events: auto; -webkit-appearance: none; appearance: none; }
.theobroma-photo-lightbox__nav { left: 24px; transform: translateY(-50%); }
.theobroma-photo-lightbox__nav--next { left: auto; right: 24px; }
.theobroma-photo-lightbox__counter { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); color: #fbf7f1; font: 500 .875rem/1.5 'Montserrat', Arial, sans-serif; font-variant-numeric: tabular-nums; }
.theobroma-photo-lightbox figcaption { border-radius: 8px; }
@media (max-width: 600px) {
  .theobroma-photo-lightbox__panel { padding: 64px 8px 88px; }
  .theobroma-photo-lightbox__nav { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); left: calc(50% - 100px); transform: none; }
  .theobroma-photo-lightbox__nav--next { left: auto; right: calc(50% - 100px); }
  .theobroma-photo-lightbox__counter { bottom: max(27px, calc(env(safe-area-inset-bottom) + 11px)); }
  .theobroma-photo-lightbox__close { top: max(12px, env(safe-area-inset-top)); }
  .theobroma-photo-lightbox img { max-height: calc(100dvh - 168px); border-radius: 8px; }
}


@media (min-width: 601px) and (max-width: 1199px) {
  .theobroma-photo-showcase--home .theobroma-photo-showcase__gallery { grid-auto-rows: clamp(11rem, 22vw, 16rem); }
  .theobroma-photo-showcase--corporate .theobroma-photo-showcase__gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .theobroma-photo-showcase__shell {
    width: 100%;
    padding-block: 4rem;
  }

  .theobroma-photo-showcase__intro {
    width: calc(100% - 2 * var(--layout-gutter, 1.125rem));
    margin: 0 auto 2rem;
    display: block;
  }

  .theobroma-photo-showcase--home .theobroma-photo-showcase__gallery,
  .theobroma-photo-showcase--corporate .theobroma-photo-showcase__gallery {
    width: 100%;
    margin: 0;
    padding-inline: var(--layout-gutter, 1.125rem);
    display: grid;
    grid-template: none;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 21.5rem);
    grid-auto-rows: auto;
    gap: .875rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: var(--layout-gutter, 1.125rem);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .theobroma-photo-showcase__gallery::-webkit-scrollbar { display: none; }
  .theobroma-photo-showcase--home .theobroma-photo-showcase__item,
  .theobroma-photo-showcase--corporate .theobroma-photo-showcase__item,
  .theobroma-photo-showcase--corporate .theobroma-photo-showcase__item:nth-child(n) {
    grid-area: auto;
    aspect-ratio: 4 / 5;
    scroll-snap-align: start;
    transform: none;
  }

  .theobroma-photo-showcase--corporate .theobroma-photo-showcase__gallery { background: transparent; }

  .theobroma-photo-lightbox { padding: .5rem; }
  .theobroma-photo-lightbox__panel { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); }
  .theobroma-photo-lightbox__nav { width: 2.75rem; height: 2.75rem; }
  .theobroma-photo-lightbox__close { top: .75rem; right: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .theobroma-photo-showcase__image { transition: none; }
  .theobroma-photo-showcase__item:hover .theobroma-photo-showcase__image { transform: none; }
  .theobroma-photo-showcase__gallery { scroll-behavior: auto; }
  .theobroma-photo-lightbox__nav,
  .theobroma-photo-lightbox__close { transition: none; }
}
