/* =========================================================
   DTECH Project Logo – v1.0.3
   Stable logo grid with optional centring of a lone final item.
========================================================= */
.dtech-project-logo {
  --dtech-logo-divider: #e8edf1;
  --dtech-project-logo-height: 70px;
  width: 100%;
  max-width: 100%;
}
.dtech-project-logo *,
.dtech-project-logo *::before,
.dtech-project-logo *::after { box-sizing: border-box; }

.dtech-project-logo__grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 30px;
  row-gap: 30px;
  align-items: stretch;
}
.dtech-project-logo__item {
  min-width: 0;
  min-height: var(--dtech-project-logo-height);
  height: var(--dtech-project-logo-height);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.dtech-project-logo__link {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.dtech-project-logo__image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: .95;
  transform-origin: center;
  transition: transform .22s ease, opacity .22s ease, filter .22s ease;
}
.dtech-project-logo--auto-size .dtech-project-logo__item {
  height: clamp(70px, 7vw, 104px);
  min-height: clamp(70px, 7vw, 104px);
}

/* Vertical separators */
.dtech-project-logo--separators-vertical .dtech-project-logo__item:not(:nth-child(4n))::after {
  content: "";
  position: absolute;
  right: -15px;
  top: 22%;
  bottom: 22%;
  width: 1px;
  background: var(--dtech-logo-divider);
}
.dtech-project-logo--separators-grid {
  border-top: 1px solid var(--dtech-logo-divider);
  border-left: 1px solid var(--dtech-logo-divider);
}
.dtech-project-logo--separators-grid .dtech-project-logo__item {
  border-right: 1px solid var(--dtech-logo-divider);
  border-bottom: 1px solid var(--dtech-logo-divider);
  padding: 16px;
}
.dtech-project-logo--hover-full .dtech-project-logo__item:hover .dtech-project-logo__image {
  opacity: 1 !important;
  filter: grayscale(0) !important;
}

/* ---------------------------------------------------------
   Centre the final item only when it is the sole item on its row.
   The final logo remains its normal size; only its grid position changes.
--------------------------------------------------------- */
.dtech-project-logo--centre-lone-final.dtech-project-logo--desktop-cols-2 .dtech-project-logo__item:last-child:nth-child(2n + 1) {
  grid-column: 1 / -1;
}
.dtech-project-logo--centre-lone-final.dtech-project-logo--desktop-cols-3 .dtech-project-logo__item:last-child:nth-child(3n + 1) {
  grid-column: 2;
}
.dtech-project-logo--centre-lone-final.dtech-project-logo--desktop-cols-4 .dtech-project-logo__item:last-child:nth-child(4n + 1) {
  grid-column: 2 / span 2;
}
.dtech-project-logo--centre-lone-final.dtech-project-logo--desktop-cols-5 .dtech-project-logo__item:last-child:nth-child(5n + 1) {
  grid-column: 3;
}
.dtech-project-logo--centre-lone-final.dtech-project-logo--desktop-cols-6 .dtech-project-logo__item:last-child:nth-child(6n + 1) {
  grid-column: 3 / span 2;
}
/* No trailing divider on a lone centred item */
.dtech-project-logo--centre-lone-final .dtech-project-logo__item:last-child:nth-child(4n + 1)::after { display: none; }

@media (max-width: 1024px) {
  .dtech-project-logo__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dtech-project-logo--separators-vertical .dtech-project-logo__item::after { display: none; }
  .dtech-project-logo--separators-vertical .dtech-project-logo__item:not(:nth-child(3n))::after { display: block; right: -15px; }
  .dtech-project-logo--auto-size .dtech-project-logo__item { height: var(--dtech-project-logo-height); min-height: var(--dtech-project-logo-height); }

  .dtech-project-logo--centre-lone-final.dtech-project-logo--tablet-cols-2 .dtech-project-logo__item:last-child:nth-child(2n + 1) { grid-column: 1 / -1; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--tablet-cols-3 .dtech-project-logo__item:last-child:nth-child(3n + 1) { grid-column: 2; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--tablet-cols-4 .dtech-project-logo__item:last-child:nth-child(4n + 1) { grid-column: 2 / span 2; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--tablet-cols-5 .dtech-project-logo__item:last-child:nth-child(5n + 1) { grid-column: 3; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--tablet-cols-6 .dtech-project-logo__item:last-child:nth-child(6n + 1) { grid-column: 3 / span 2; }
}

@media (max-width: 767px) {
  .dtech-project-logo__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 18px; }
  .dtech-project-logo__item,
  .dtech-project-logo--auto-size .dtech-project-logo__item { height: 58px; min-height: 58px; }
  .dtech-project-logo--separators-vertical .dtech-project-logo__item::after { display: none; }
  .dtech-project-logo--separators-vertical .dtech-project-logo__item:not(:nth-child(2n))::after { display: block; right: -8px; }

  .dtech-project-logo--centre-lone-final.dtech-project-logo--mobile-cols-2 .dtech-project-logo__item:last-child:nth-child(2n + 1) { grid-column: 1 / -1; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--mobile-cols-3 .dtech-project-logo__item:last-child:nth-child(3n + 1) { grid-column: 2; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--mobile-cols-4 .dtech-project-logo__item:last-child:nth-child(4n + 1) { grid-column: 2 / span 2; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--mobile-cols-5 .dtech-project-logo__item:last-child:nth-child(5n + 1) { grid-column: 3; }
  .dtech-project-logo--centre-lone-final.dtech-project-logo--mobile-cols-6 .dtech-project-logo__item:last-child:nth-child(6n + 1) { grid-column: 3 / span 2; }
}
