/* Ensure the figure element and its contents adapt to various screen sizes */
figure {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw; /* Make sure the figure takes the full width of the viewport */
  height: 80vh; /* Make sure the figure takes the full height of the viewport */
  margin: 0; /* Remove margin to avoid any unwanted spacing */
  padding: 0; /* Remove padding to avoid any unwanted spacing */
  overflow: hidden;
}

figure img {
  height: 80%; /* Make the image take the full height of its container */
  width: auto; /* Adjust the width automatically to maintain aspect ratio */
  transition: .4s;
}

figure figcaption {
  display: grid;
  align-items: end;
  font-family: sans-serif;
  font-size: 2.3rem;
  font-weight: bold;
  color: #0000;
  padding: .75rem;
  background: var(--c, #0009);
  clip-path: inset(0 var(--_i, 100%) 0 0);
  -webkit-mask:
    linear-gradient(#000 0 0),
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  -webkit-mask-clip: text, padding-box;
  margin: -1px;
}

figure:hover figcaption {
  --_i: 0%;
}

figure:hover img {
  transform: scale(1.2);
}

@supports not (-webkit-mask-clip: text) {
  figure figcaption {
   -webkit-mask: none;
   color: #fff;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #425a52;
}
