/* Fixed CMS gallery only: existing brand tokens, no changes to other sections. */
.project-mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(150px, 17vw, 220px);
  gap: 16px;
}
.project-mosaic__card {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #f1f5f9;
  box-shadow: 0 0 0 1px rgb(15 23 42 / 7%);
  isolation: isolate;
  transition: box-shadow 200ms ease;
}
.project-mosaic__card:nth-child(8n + 1),
.project-mosaic__card:nth-child(8n + 7) { grid-column: span 2; grid-row: span 2; }
.project-mosaic__card:nth-child(8n + 2),
.project-mosaic__card:nth-child(8n + 8) { grid-column: span 2; }
.project-mosaic__card[hidden], #gallery-show-more[hidden] { display: none !important; }
.project-mosaic__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 220ms ease;
}
.project-mosaic__card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(transparent 50%, rgb(9 16 24 / 76%));
  opacity: .88;
  transition: opacity 200ms ease;
}
.project-mosaic__caption {
  position: absolute;
  inset: auto 18px 15px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgb(0 0 0 / 35%);
}
.project-mosaic__caption [data-project-year] { font-weight: 400; }
.project-mosaic__caption [data-project-year]:empty { display: none; }
.project-mosaic__caption [data-project-type] {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(11px, 1.15vw, 14px);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.project-mosaic__caption [data-project-type]::before,
.project-lightbox figcaption::before {
  content: '';
  display: inline-block;
  flex: 0 0 clamp(16px, 2.5vw, 36px);
  height: 1px;
  background: var(--brand, #059ffb);
  opacity: .85;
}
.project-mosaic__card:focus-visible { outline: 3px solid var(--brand, #059ffb); outline-offset: 4px; }
@media (hover: hover) {
  .project-mosaic__card:hover .project-mosaic__image { transform: scale(1.035); }
  .project-mosaic__card:hover::after { opacity: 1; }
  .project-mosaic__card:hover { box-shadow: 0 0 0 1px rgb(15 23 42 / 12%), 0 12px 32px -18px rgb(15 23 42 / 25%); }
}
@media (max-width: 767px) {
  .project-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; gap: 10px; }
  .project-mosaic .project-mosaic__card { grid-column: auto; grid-row: auto; aspect-ratio: 1 / 1; }
  .project-mosaic .project-mosaic__card:nth-child(3n + 1) { grid-column: span 2; aspect-ratio: 3 / 2; }
  .project-mosaic__caption { inset: auto 12px 12px; font-size: 13px; }
  .project-mosaic__caption [data-project-type] { font-size: 11px; gap: 8px; letter-spacing: .12em; }
  .project-mosaic__caption [data-project-type]::before { flex-basis: 16px; }
  #gallery-show-more { width: min(100%, 340px); min-height: 48px; }
}
.project-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 64px 24px 24px;
  border: 0;
  background: transparent;
  color: #fff;
}
.project-lightbox[open] { display: grid; place-items: center; }
.project-lightbox::backdrop { background: rgb(8 14 23 / 94%); }
.project-lightbox figure { display: grid; gap: 14px; margin: 0; max-width: 100%; }
.project-lightbox img { display: block; width: auto; max-width: 100%; height: auto; max-height: calc(100dvh - 130px); object-fit: contain; margin: auto; }
.project-lightbox figcaption { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; }
.project-lightbox__close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 50%;
  background: rgb(255 255 255 / 8%);
  color: #fff;
  font: 30px/1 Arial, sans-serif;
  cursor: pointer;
}
.project-lightbox__close:focus-visible { outline: 2px solid white; outline-offset: 4px; }
.project-lightbox-open { overflow: hidden; }
@media (max-width: 767px) { .project-lightbox { padding: 64px 12px 20px; } }
@media (prefers-reduced-motion: reduce) {
  .project-mosaic__card, .project-mosaic__image, .project-mosaic__card::after { transition: none; }
  .project-mosaic__card:hover .project-mosaic__image { transform: none; }
}
