:root {
  --et-g-gallery-gap: clamp(14px, 1.2vw, 28px);
  --et-g-radius: 16px;
  --et-g-bg-grad-top: #F5F6FF;
  --et-g-bg-grad-mid: #FFFFFF;
  --et-g-bg-grad-bottom: #ECECFF;

  --et-g-shape-size: clamp(220px, 21vw, 440px);
  --et-g-shape-left: 70%;
  --et-g-shape-translate-x: -55%;
  --et-g-shape-rise: -0.20;
  --et-g-shape-rotate: 0deg;

  --et-g-row-height-a: 190px;
  --et-g-row-height-b: 160px;
  --et-g-row-height-c: 150px;

  --et-text-dark: #000;
}

/* Full-bleed wrapper for section background */
.et-section-bleed{
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.et-gallery-section {
  position: relative;
  padding: clamp(56px, 6vw, 100px) 0 clamp(66px, 7.2vw, 120px);
  overflow: hidden;
}
.et-gallery-section.has-shape { overflow: visible; }
.et-gallery-section.has-gradient {
  background: linear-gradient(
    180deg,
    var(--et-g-bg-grad-top) 0%,
    var(--et-g-bg-grad-mid) 6%,
    var(--et-g-bg-grad-mid) 22%,
    var(--et-g-bg-grad-bottom) 100%
  );
}

.et-gallery-shape {
  position: absolute;
  width: var(--et-g-shape-size);
  top: calc(var(--et-g-shape-rise) * var(--et-g-shape-size));
  left: var(--et-g-shape-left);
  transform: translateX(var(--et-g-shape-translate-x)) rotate(var(--et-g-shape-rotate));
  pointer-events: none;
  z-index: 5;
  animation: etGalleryShapeFloat 12s ease-in-out infinite;
  transform-origin: center;
  filter: drop-shadow(0 16px 38px rgba(15,37,94,0.10)) drop-shadow(0 4px 12px rgba(15,37,94,0.18));
}
.et-gallery-shape img { width:100%; height:auto; display:block; }

@media (max-width: 1400px) {
  :root {
    --et-g-shape-size: clamp(180px, 24vw, 340px);
    --et-g-shape-left: 70%;
    --et-g-shape-translate-x: -60%;
    --et-g-shape-rise: -0.20;
  }
}
@media (max-width: 980px) {
  :root {
    --et-g-shape-size: clamp(150px, 30vw, 260px);
    --et-g-shape-left: 72%;
    --et-g-shape-translate-x: -72%;
    --et-g-shape-rise: -0.22;
  }
}
@media (max-width: 640px) {
  :root {
    --et-g-shape-size: clamp(120px, 35vw, 220px);
    --et-g-shape-left: 62%;
    --et-g-shape-translate-x: -64%;
    --et-g-shape-rise: -0.24;
  }
}

@keyframes etGalleryShapeFloat {
  0%,100% { transform: translateX(var(--et-g-shape-translate-x)) translateY(0) rotate(var(--et-g-shape-rotate)); }
  50%     { transform: translateX(var(--et-g-shape-translate-x)) translateY(22px) rotate(var(--et-g-shape-rotate)); }
}

.et-gallery-inner { position:relative; z-index:10; }
.et-gallery-head { margin: 0 0 clamp(24px, 3vw, 40px); }

.et-gallery-section .et-section-title {
  margin: 0;
  font-size: 38px;
  line-height: 1.05;
  font-weight: var(--et-font-weight-semibold);
  color: var(--et-text-dark);
  letter-spacing: -0.5px;
}

.et-gallery-grid {
  display:grid;
  gap:var(--et-g-gallery-gap);
  position:relative;
  z-index:2;
}

.et-gallery-item {
  position:relative;
  border-radius:var(--et-g-radius);
  overflow:hidden;
  background:#E5E9F5;
  aspect-ratio:4/3;
  cursor:pointer;
  transform:translateY(18px);
  opacity:0;
  transition:
    opacity .55s cubic-bezier(.25,.6,.3,1),
    transform .55s cubic-bezier(.25,.6,.3,1),
    box-shadow .5s cubic-bezier(.25,.6,.3,1);
  box-shadow:0 2px 4px rgba(0,0,0,0.04), 0 8px 20px -8px rgba(0,0,0,0.08);
  will-change:transform,opacity;
}
.et-gallery-item.is-in { opacity:1; transform:translateY(0); }

.et-gallery-item::after {
  content:"";
  position:absolute; inset:0;
  background:linear-gradient(140deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02));
  opacity:0;
  transition:opacity .45s;
  pointer-events:none;
}
.et-gallery-item:hover::after { opacity:1; }

.et-gallery-link { display:block; width:100%; height:100%; }
.et-gallery-img {
  width:100%; height:100%; object-fit:cover; display:block;
  transition:transform .75s cubic-bezier(.25,.6,.3,1), filter .45s;
  will-change:transform;
}
.et-gallery-item:hover .et-gallery-img { transform:scale(1.055); }

.et-gallery-item.is-swapping .et-gallery-img { animation: etGallerySwapOut .34s ease forwards; }
.et-gallery-item.is-swapped-in .et-gallery-img { animation: etGallerySwapIn .44s ease forwards; }
@keyframes etGallerySwapOut {
  0% { opacity:1; transform:scale(1); }
  100% { opacity:0; transform:scale(.86); }
}
@keyframes etGallerySwapIn {
  0% { opacity:0; transform:scale(1.11); }
  100% { opacity:1; transform:scale(1); }
}

.et-gallery-section[data-layout="layout-a"] .et-gallery-grid {
  grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
}
@media (min-width: 992px) {
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: var(--et-g-row-height-a);
  }
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item { aspect-ratio:auto;height:100%; }
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item:nth-child(1),
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item:nth-child(2),
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item:nth-child(3) {
    grid-column: span 2; grid-row:1;
  }
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item:nth-child(4) {
    grid-column:1 / span 3; grid-row:2;
  }
  .et-gallery-section[data-layout="layout-a"][data-count="5"] .et-gallery-item:nth-child(5) {
    grid-column:4 / span 3; grid-row:2;
  }
  .et-gallery-section[data-layout="layout-a"]:not([data-count="5"]) .et-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: var(--et-g-row-height-a);
  }
  .et-gallery-section[data-layout="layout-a"]:not([data-count="5"]) .et-gallery-item {
    aspect-ratio:auto;height:100%;
  }
}

.et-gallery-section[data-layout="layout-b"] .et-gallery-grid {
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  grid-auto-rows: var(--et-g-row-height-b);
}
@media (min-width: 992px) {
  .et-gallery-section[data-layout="layout-b"] .et-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: var(--et-g-row-height-b);
  }
  .et-gallery-section[data-layout="layout-b"] .et-gallery-item:nth-child(1) {
    grid-column:1 / 3;
    grid-row:1 / 3;
    aspect-ratio:auto;
  }
  .et-gallery-section[data-layout="layout-b"] .et-gallery-item { aspect-ratio:auto; }
}

.et-gallery-section[data-layout="layout-c"] .et-gallery-grid {
  grid-auto-flow:dense;
  grid-template-columns: repeat(auto-fill,minmax(210px,1fr));
  grid-auto-rows: var(--et-g-row-height-c);
}
@media (min-width: 992px) {
  .et-gallery-section[data-layout="layout-c"] .et-gallery-item:nth-child(3n) { grid-row: span 2; }
  .et-gallery-section[data-layout="layout-c"] .et-gallery-item:nth-child(5n) { grid-column: span 2; }
}

.et-gallery-section[data-layout="layout-custom"] .et-gallery-grid {
  grid-template-columns: repeat(auto-fill,minmax(160px,1fr));
}
@media (max-width: 991.98px) {
  .et-gallery-section[data-layout="layout-custom"] .et-gallery-item { aspect-ratio:4/3; }
}

@media (max-width: 991.98px) {
  .et-gallery-grid {
    grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
  }
  .et-gallery-item { aspect-ratio:4/3; }
}

@media (prefers-reduced-motion:reduce) {
  .et-gallery-item,
  .et-gallery-img,
  .et-gallery-shape {
    transition:none !important;
    animation:none !important;
  }
}