:root {
  --corner-radius-normal: 0.25rem;
  --corner-radius-huge: 6rem;
}

@media (min-width: 768px) {
  :root {
    --corner-radius-normal: 1rem;
    --corner-radius-huge: 12.25rem;
  }
}

.image-overlay {
  margin-block: var(--spacing-offset, 6rem);
  max-width: var(--content-wrapper-max-width, 100vw);
  margin-inline: auto;
  height: 750px;
  position: relative;
}

@media (max-width: 768px) {
  .module.image-overlay .container.content-wrapper {
    border-radius: 0 4rem 0 0;
    margin-left: 1rem;
    margin-right: 1rem;
  }
}

.image-overlay .container.content-wrapper {
  max-width: 550px;
  background-color: var(--color-black-0);
  padding: var(--container-padding-inline);
  position: absolute;
  bottom: 0;
  border-radius: 0 8rem 0 0;
}

.image-overlay .button {
  padding: 1rem 2rem;
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: fit-content;
  border-radius: 62.4375rem;
  gap: var(--Spacing-spacing-xs, 0.5rem);
  background-color: inherit;
  transition: background-color 150ms ease-in-out;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
  border: 1px solid transparent;
  color: var(--color-black-100);
  border-color: var(--color-black-100);
  background-color: transparent;
  margin-top: auto;
  margin-bottom: 1px;
}
.image-overlay .button::after {
  filter: brightness(0);
}
.image-overlay .button:hover,
.image-overlay .button:focus {
  color: var(--color-black-0);
  background-color: var(--color-black-70);
}
.image-overlay .button:hover::after,
.image-overlay .button:focus::after {
  filter: brightness(255);
}
.image-overlay .button:active {
  color: var(--color-black-100);
  background-color: transparent;
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
}
.image-overlay .button:active::after {
  filter: brightness(0);
}

.image-overlay .buttons.orange :first-child .button {
  color: var(--color-black-0);
  background-color: var(--color-orange-75);
}
.image-overlay .buttons.orange :first-child .button:hover,
.image-overlay .buttons.orange :first-child .button:focus {
  background-color: var(--color-orange-50);
}
.image-overlay .buttons.orange :first-child .button:active {
  background-color: var(--color-orange-75);
  box-shadow: 0 0 0 0.25rem var(--color-orange-25);
}

.image-overlay .buttons.blue :first-child .button {
  color: var(--color-black-0);
  background-color: var(--color-blue-75);
}
.image-overlay .buttons.blue :first-child .button:hover,
.image-overlay .buttons.blue :first-child .button:focus {
  background-color: var(--color-blue-50);
}
.image-overlay .buttons.blue :first-child .button:active {
  background-color: var(--color-blue-75);
  box-shadow: 0 0 0 0.25rem var(--color-blue-25);
}

.image-overlay .buttons.purple .button:first-child {
  color: var(--color-black-0);
  background-color: var(--color-purple-75);
}
.image-overlay .buttons.purple .button:first-child:hover,
.image-overlay .buttons.purple .button:first-child:focus {
  background-color: var(--color-purple-50);
}
.image-overlay .buttons.purple .button:first-child:active {
  background-color: var(--color-purple-75);
  box-shadow: 0 0 0 0.25rem var(--color-purple-25);
}

.image-overlay .buttons.black :first-child .button {
  color: var(--color-black-0);
  background-color: var(--color-black-100);
}
.image-overlay .buttons.black :first-child .button:hover,
.image-overlay .buttons.black :first-child .button:focus {
  background-color: var(--color-black-70);
}
.image-overlay .buttons.black :first-child .button:active {
  background-color: var(--color-black-100);
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
}

.image-overlay .buttons.secondary .button {
  color: var(--color-black-100);
  border-color: var(--color-black-100);
  background-color: transparent;
}
.image-overlay .buttons.secondary .button::after {
  filter: brightness(0);
}
.image-overlay .buttons.secondary .button:hover,
.image-overlay .buttons.secondary .button:focus {
  color: var(--color-black-0);
  background-color: var(--color-black-70);
}
.image-overlay .buttons.secondary .button:hover::after,
.image-overlay .buttons.secondary .button:focus::after {
  filter: brightness(255);
}
.image-overlay .buttons.secondary .button:active {
  color: var(--color-black-100);
  background-color: transparent;
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
}
.image-overlay .buttons.secondary .button:active::after {
  filter: brightness(0);
}
.image-overlay .buttons.secondary :not(:first-child) .button {
  padding-inline: 0.5rem;
  background-color: transparent;
  text-decoration: underline;
  color: var(--color-black-100);
}
.image-overlay .buttons.secondary :not(:first-child) .button:hover,
.image-overlay .buttons.secondary :not(:first-child) .button:focus {
  text-decoration: none;
}
.image-overlay .buttons.secondary :not(:first-child) .button:active {
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
  text-decoration: underline;
}

.image-overlay .buttons.secondarylight .button {
  color: var(--color-black-0);
  border-color: var(--color-black-0);
  background-color: transparent;
}
.image-overlay .buttons.secondarylight .button::after {
  filter: brightness(0);
}
.image-overlay .buttons.secondarylight .button:hover,
.image-overlay .buttons.secondarylight .button:focus {
  color: var(--color-black-0);
  background-color: var(--color-black-70);
}
.image-overlay .buttons.secondarylight .button:hover::after,
.image-overlay .buttons.secondarylight .button:focus::after {
  filter: brightness(255);
}
.image-overlay .buttons.secondarylight .button:active {
  color: var(--color-black-0);
  background-color: transparent;
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
}
.image-overlay .buttons.secondarylight .button:active::after {
  filter: brightness(0);
}
.image-overlay .buttons.secondarylight :not(:first-child) .button {
  padding-inline: 0.5rem;
  background-color: transparent;
  text-decoration: underline;
  color: var(--color-black-0);
}
.image-overlay .buttons.secondarylight :not(:first-child) .button:hover,
.image-overlay .buttons.secondarylight :not(:first-child) .button:focus {
  text-decoration: none;
}
.image-overlay .buttons.secondarylight :not(:first-child) .button:active {
  box-shadow: 0 0 0 0.25rem var(--color-blue-75);
  text-decoration: underline;
}

.image-overlay .column {
  display: flex;
  flex-direction: column;
}
.image-overlay .column.left  { text-align: left; }
.image-overlay .column.center { text-align: center; }
.image-overlay .column.right { text-align: right; }

.image-overlay ul.columns {
  gap: 2rem;
  list-style: none;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  align-content: stretch;
  overflow-x: scroll;
  width: 100vw;
  max-width: 100vw;
  left: 50%;
  right: 50%;
  margin-inline: -50vw;
  scrollbar-width: none;
  --spacing-inline: 1rem;
}
@supports not (scrollbar-width: auto) {
  .image-overlay ul.columns::-webkit-scrollbar {
    display: none;
  }
}
.image-overlay ul.columns::after {
  content: "";
  padding-right: 0.02px;
}
.image-overlay ul.columns[data-drag=true] {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.image-overlay ul.columns[data-drag=true]:active > * {
  cursor: inherit;
}
.image-overlay ul.columns[data-scroll-snap=snap] {
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}
.image-overlay ul.columns > * {
  flex-shrink: 0;
  margin-inline: 0;
  display: block;
  width: calc(100% - var(--spacing-inline, 0rem) * 2);
  scroll-snap-align: center;
}
.image-overlay ul.columns > *:first-child {
  margin-left: calc(50vw - 50% + max(1rem, env(safe-area-inset-right)));
}
.image-overlay ul.columns > *:last-child:not(:first-child) {
  margin-left: 0;
  margin-right: calc(50vw - 50% + max(1rem, env(safe-area-inset-right)));
}

@media (min-width: 768px) {
  .image-overlay ul.columns {
    overflow: none;
    --spacing-inline: 1rem;
    padding-inline: 1rem;
    max-width: var(--content-wrapper-max-width, 100vw);
    margin: 0 auto;
    left: 0;
    right: 0;
    width: 100%;
    cursor: auto !important;
    -webkit-user-select: auto !important;
    user-select: auto !important;
    padding-bottom: 0.25rem;
  }
  .image-overlay ul.columns > * {
    width: calc((100% - var(--spacing-inline, 0rem) * 2) / var(--columns, 3));
    margin-inline: 0 !important;
  }
  .image-overlay ul.columns::after {
    display: none;
  }
}
@media (min-width: 768px) {
  .image-overlay ul.columns { --spacing-inline: 2rem; padding-inline: 2rem; }
}
@media (min-width: 992px) {
  .image-overlay ul.columns { --spacing-inline: 3rem; padding-inline: 3rem; }
}

.image-overlay .scroll-visual {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}
.image-overlay .scroll-visual .scroll-item {
  height: 0.625rem;
  width: 1.5rem;
  flex: 0 1 auto;
  border-radius: 1em;
  background-color: var(--color-black-10);
}
.image-overlay .scroll-visual .scroll-item.active {
  background-color: var(--color-orange-75);
}
@media (min-width: 768px) {
  .image-overlay .scroll-visual {
    display: none;
  }
}

@media (min-width: 768px) {
  .image-overlay {
    --spacing-inline: 1rem;
    padding-inline: 1rem;
  }
}
@media (min-width: 768px) and (min-width: 768px) {
  .image-overlay { --spacing-inline: 2rem; }
}
@media (min-width: 768px) and (min-width: 992px) {
  .image-overlay { --spacing-inline: 3rem; }
}
@media (min-width: 768px) and (min-width: 768px) {
  .image-overlay { padding-inline: 2rem; }
}
@media (min-width: 768px) and (min-width: 992px) {
  .image-overlay { padding-inline: 3rem; }
}

/* Base overlay */
.image-overlay > .overlay {
  position: absolute;
  left: calc(-50vw + 50%);
  height: 750px;
  width: 100vw;
  overflow: hidden;
  aspect-ratio: 1 / 1.4;

  background-image: var(--img);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

@media (min-width: 768px) {
  .image-overlay > .overlay { aspect-ratio: 44 / 21; }
}

/* Corner variants: border-radius clip */
.image-overlay > .overlay.top_right {
  border-radius: 0 var(--corner-radius-huge) 0 0;
}
.image-overlay > .overlay.top_left {
  border-radius: var(--corner-radius-huge) 0 0 0;
}
.image-overlay > .overlay.bottom_right {
  border-radius: 0 0 var(--corner-radius-huge) 0;
}
.image-overlay > .overlay.bottom_left {
  border-radius: 0 0 0 var(--corner-radius-huge);
}

/* -------------------------
   Fallback GRID (only if masks aren't supported)
------------------------- */

.image-overlay > .overlay .grid {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 0.5rem;
  overflow: hidden;
}

.image-overlay > .overlay .grid .square::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  background: black;
}

/* four_square + four_squares fallback layout */
.image-overlay > .overlay.four_square .grid,
.image-overlay > .overlay.four_squares .grid {
  grid-template-rows: repeat(2, 1fr);
  grid-template-columns: repeat(4, 1fr);
}
.image-overlay > .overlay.four_square .square:nth-child(1),
.image-overlay > .overlay.four_squares .square:nth-child(1) { grid-column: 1/3; }

.image-overlay > .overlay.four_square .square:nth-child(2),
.image-overlay > .overlay.four_squares .square:nth-child(2) { grid-column: 3/5; }

.image-overlay > .overlay.four_square .square:nth-child(2)::before,
.image-overlay > .overlay.four_squares .square:nth-child(2)::before { border-top-right-radius: 4rem; }

.image-overlay > .overlay.four_square .square:nth-child(3),
.image-overlay > .overlay.four_squares .square:nth-child(3) { grid-column: 1/3; }

.image-overlay > .overlay.four_square .square:nth-child(3)::before,
.image-overlay > .overlay.four_squares .square:nth-child(3)::before { border-bottom-left-radius: 4rem; }

.image-overlay > .overlay.four_square .square:nth-child(4),
.image-overlay > .overlay.four_squares .square:nth-child(4) { grid-column: 3/5; }

@media (min-width: 768px) {
  .image-overlay > .overlay.four_square .square:nth-child(1),
  .image-overlay > .overlay.four_squares .square:nth-child(1) { grid-column: 1/2; }

  .image-overlay > .overlay.four_square .square:nth-child(2),
  .image-overlay > .overlay.four_squares .square:nth-child(2) { grid-column: 2/5; }

  .image-overlay > .overlay.four_square .square:nth-child(2)::before,
  .image-overlay > .overlay.four_squares .square:nth-child(2)::before { border-top-right-radius: 8rem; }

  .image-overlay > .overlay.four_square .square:nth-child(3)::before,
  .image-overlay > .overlay.four_squares .square:nth-child(3)::before { border-bottom-left-radius: 8rem; }
}

/* three_square + three_squares fallback layout */
.image-overlay > .overlay.three_square .grid,
.image-overlay > .overlay.three_squares .grid {
  grid-template-rows: repeat(2, 1fr);
  grid-template-columns: repeat(2, 1fr);
}
.image-overlay > .overlay.three_square .square:nth-child(1),
.image-overlay > .overlay.three_squares .square:nth-child(1) { grid-column: 1/2; grid-row: 1/2; }

.image-overlay > .overlay.three_square .square:nth-child(1)::before,
.image-overlay > .overlay.three_squares .square:nth-child(1)::before { border-bottom-right-radius: 4rem; }

.image-overlay > .overlay.three_square .square:nth-child(2),
.image-overlay > .overlay.three_squares .square:nth-child(2) { grid-column: 2/2; grid-row: 1/3; }

.image-overlay > .overlay.three_square .square:nth-child(2)::before,
.image-overlay > .overlay.three_squares .square:nth-child(2)::before { border-top-left-radius: 4rem; }

.image-overlay > .overlay.three_square .square:nth-child(3),
.image-overlay > .overlay.three_squares .square:nth-child(3) { grid-column: 1/2; grid-row: 2/3; }

.image-overlay > .overlay.three_square .square:nth-child(3)::before,
.image-overlay > .overlay.three_squares .square:nth-child(3)::before { border-top-left-radius: 4rem; }

.image-overlay > .overlay.three_square .square:nth-child(4),
.image-overlay > .overlay.three_squares .square:nth-child(4) { display: none; }

/* two_square + two_squares fallback layout */
.image-overlay > .overlay.two_square .grid,
.image-overlay > .overlay.two_squares .grid { grid-template-columns: repeat(2, 1fr); }

.image-overlay > .overlay.two_square .square:nth-child(1),
.image-overlay > .overlay.two_squares .square:nth-child(1) { grid-column: 1/2; }

.image-overlay > .overlay.two_square .square:nth-child(1)::before,
.image-overlay > .overlay.two_squares .square:nth-child(1)::before { border-top-left-radius: 4rem; }

.image-overlay > .overlay.two_square .square:nth-child(2),
.image-overlay > .overlay.two_squares .square:nth-child(2) { grid-column: 2/2; }

.image-overlay > .overlay.two_square .square:nth-child(2)::before,
.image-overlay > .overlay.two_squares .square:nth-child(2)::before { border-bottom-right-radius: 4rem; }

.image-overlay > .overlay.two_square .square:nth-child(3),
.image-overlay > .overlay.two_square .square:nth-child(4),
.image-overlay > .overlay.two_squares .square:nth-child(3),
.image-overlay > .overlay.two_squares .square:nth-child(4) { display: none; }

/* -------------------------
   Modern path: CSS masks
------------------------- */

@supports (-webkit-mask: url("")) or (mask: url("")) {

  .image-overlay > .overlay.two_square,
  .image-overlay > .overlay.two_squares,
  .image-overlay > .overlay.three_square,
  .image-overlay > .overlay.three_squares,
  .image-overlay > .overlay.four_square,
  .image-overlay > .overlay.four_squares {
    -webkit-mask: var(--mask) 0 0 / 100% 100% no-repeat;
    mask: var(--mask) 0 0 / 100% 100% no-repeat;
    
        -webkit-mask-size: cover;
    mask-size: cover;
    -webkit-mask-position: center;
    mask-position: center;
    
    -webkit-mask-mode: alpha;
    mask-mode: alpha;
  }

  @media (min-width: 768px) {
    .image-overlay > .overlay.four_square,
    .image-overlay > .overlay.four_squares {
      --mask: var(--mask-desktop, var(--mask-mobile));
    }
  }

  /* Hide fallback grid when masking is active */
  .image-overlay > .overlay.two_square .grid,
  .image-overlay > .overlay.two_squares .grid,
  .image-overlay > .overlay.three_square .grid,
  .image-overlay > .overlay.three_squares .grid,
  .image-overlay > .overlay.four_square .grid,
  .image-overlay > .overlay.four_squares .grid {
    display: none;
  }
}
.image-overlay > .overlay:not(.two_square):not(.two_squares):not(.three_square):not(.three_squares):not(.four_square):not(.four_squares) .grid {
  display: none;
}
