/* Home “Life and works” — edge-to-edge thumbnail mosaic
   Run via: Merge Home Life Works Gallery.command
*/

.mal-home-life-works {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Break out of GHL section padding / max-width (mal-unified 1170px) */
.mal-site-unified .c-section:has(.mal-home-life-works),
.mal-site-unified .c-section:has(.mal-home-life-works) > .inner,
.mal-site-unified .c-column:has(.mal-home-life-works),
.mal-site-unified .c-column:has(.mal-home-life-works) > .inner,
.mal-site-unified .c-row:has(.mal-home-life-works),
.mal-site-unified .c-row:has(.mal-home-life-works) > .inner,
.mal-site-unified .c-custom-code:has(.mal-home-life-works),
.mal-site-unified .custom-code-container:has(.mal-home-life-works) {
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.mal-site-unified .c-section:has(.mal-home-life-works) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.mal-home-life-works__bleed {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
}

.mal-home-life-works__head {
  padding: 1.25rem max(16px, env(safe-area-inset-right)) 0.75rem max(16px, env(safe-area-inset-left));
  text-align: center;
}

.mal-home-life-works .gallery-panel-title,
.mal-home-life-works [data-gallery-title] {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1f2a2d;
  line-height: 1.3;
}

.mal-home-gallery-grid.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .mal-home-gallery-grid.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

@media (min-width: 1200px) {
  .mal-home-gallery-grid.gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

@media (max-width: 767px) {
  .mal-home-gallery-grid.gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.mal-home-gallery-grid .gallery-item {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #e8e6e1;
  cursor: pointer;
  aspect-ratio: 1;
  content-visibility: auto;
  contain-intrinsic-size: 100px 100px;
}

.mal-home-gallery-grid .gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  vertical-align: middle;
}

.mal-home-gallery-grid .gallery-item img.mal-gallery-deferred {
  min-height: 1px;
  background: #e8e6e1;
}

/* Lightbox (scoped; works with mal-gallery-lightbox.js) */
.mal-home-life-works .lightbox-overlay,
#lightbox.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 14, 0.92);
  padding: 16px;
  box-sizing: border-box;
}

.mal-home-life-works .lightbox-overlay.is-open,
#lightbox.lightbox-overlay.is-open {
  display: flex;
}

.mal-home-life-works .lightbox-content-wrap,
#lightbox .lightbox-content-wrap {
  position: relative;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mal-home-life-works .lightbox-header,
#lightbox .lightbox-header {
  color: #f5f5f2;
  text-align: center;
  width: 100%;
}

.mal-home-life-works .lightbox-brandline,
#lightbox .lightbox-brandline {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
}

.mal-home-life-works .lightbox-close-btn,
#lightbox .lightbox-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.mal-home-life-works .lightbox-overlay img,
#lightbox.lightbox-overlay img {
  max-width: 96vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
