/* AMALGAM Homepage grid equalizer, 2026-10-16.
   Equal media stages, uncropped foreground photos and subtle ambient image fill.
   Only homepage capability cards and 12-card home work gallery are affected. */
.expertise-section .expertise-grid {align-items:stretch}
.expertise-section .expertise-grid > .expertise-card,
.expertise-section .expertise-grid > .am-cap-card-shell {min-width:0;height:100%}
.expertise-section .expertise-grid > .expertise-card {display:flex;flex-direction:column}
.expertise-section .expertise-grid .expertise-image {height:255px;flex:0 0 255px;min-height:0}
.expertise-section .expertise-grid .expertise-content {flex:1 1 auto;min-height:236px}
.expertise-section .expertise-grid .expertise-image:not(.am-cap-image) {position:relative;isolation:isolate;background:#0a2c45}
.expertise-section .expertise-grid .expertise-image:not(.am-cap-image)::before {
  content:"";position:absolute;inset:-12px;z-index:-1;
  background-image:var(--am-equal-background);background-size:cover;background-position:center;
  filter:blur(17px) brightness(.48);opacity:.72;transform:scale(1.06);
}
.expertise-section .expertise-grid .expertise-image:not(.am-cap-image) > img {
  position:relative;z-index:1;width:100%;height:100%;object-fit:contain!important;
  object-position:center;transform:none!important;
}
/* The fifth and sixth tiles had a conflicting 315px rule in original CSS.
   Enforce exactly one card size across all homepage work-gallery rows. */
.gallery-section .gallery-grid {grid-auto-rows:252px;align-items:stretch;gap:12px}
.gallery-section .gallery-grid > .gallery-card,
.gallery-section .gallery-grid > .gallery-card:nth-child(5),
.gallery-section .gallery-grid > .gallery-card:nth-child(6) {
  position:relative;isolation:isolate;width:100%;height:100%!important;min-height:0;
  aspect-ratio:auto!important;display:block;overflow:hidden;background:#0b2b44;
  border-radius:6px;box-sizing:border-box;transform:none;
}
.gallery-section .gallery-grid > .gallery-card::before {
  content:"";position:absolute;inset:-20px;z-index:0;pointer-events:none;
  background:var(--am-equal-background) center / cover no-repeat;
  filter:blur(17px) brightness(.55) saturate(.95);
  opacity:.85;transform:scale(1.08);
}
.gallery-section .gallery-grid > .gallery-card > img {
  display:block;position:absolute;inset:0;z-index:1;width:100%!important;height:100%!important;
  max-width:none;object-fit:contain!important;object-position:center center!important;
  transform:none!important;filter:none!important;box-sizing:border-box;
}
.gallery-section .gallery-grid > .gallery-card:hover > img,
.gallery-section .gallery-grid > .gallery-card:focus-visible > img {transform:none!important}
.gallery-section .gallery-grid > .gallery-card .gallery-over {
  position:absolute;inset:0;z-index:2;min-width:0;
  padding:18px;gap:8px;justify-content:flex-end;
  background:linear-gradient(180deg,transparent 34%,rgba(3,19,34,.16) 52%,rgba(2,17,32,.92) 100%);
}
.gallery-section .gallery-grid > .gallery-card .gallery-over strong {
  max-width:calc(100% - 21px);font-size:16px;line-height:1.22;overflow-wrap:break-word;
}
@media(max-width:1260px){
  .expertise-section .expertise-grid .expertise-image{height:220px;flex-basis:220px}
  .gallery-section .gallery-grid{grid-auto-rows:238px}
}
@media(max-width:740px){
  .expertise-section .expertise-grid .expertise-image{height:265px;flex-basis:265px}
  .gallery-section .gallery-grid{grid-auto-rows:215px;gap:9px}
  .gallery-section .gallery-grid > .gallery-card .gallery-over{padding:14px}
  .gallery-section .gallery-grid > .gallery-card .gallery-over strong{font-size:14px}
}
@media(max-width:480px){
  .gallery-section .gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:185px;gap:8px}
  .gallery-section .gallery-grid > .gallery-card .gallery-over{padding:10px;gap:4px}
  .gallery-section .gallery-grid > .gallery-card .gallery-over strong{font-size:12px}
  .gallery-section .gallery-grid > .gallery-card .gallery-over span{font-size:8px}
}
@media(prefers-reduced-motion:reduce){.gallery-section .gallery-grid > .gallery-card,.gallery-section .gallery-grid > .gallery-card img{transition:none!important}}
