:root {
  --light-gray: #F5F5F5;
  --white: #ffffff;
  --black: #3D3D3D;
  --link-blue: #0507CF;
  --body-font: "Figtree", sans-serif;
  --gallery-items-per-row: 4;
  --gallery-gap: 30px;
}

body {
    background-color: var(--light-gray);
    color: var(--black);
    font-family: var(--body-font);
    padding: 0;
    margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--link-blue);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

.header {
  align-items: baseline;
  background-color: var(--white);
  box-shadow: 0 0 30px 0 #E9E9E9;
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 30px;
}

@media only screen and (width < 768px) {
  .header {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }
}

.header_link, .header_h2 {
  font-size: 20px;
}

.header_h1 {
  font-size: 24px;
  margin: 0;
}

.header_h2 {
  font-weight: normal;
  margin: 0;
}

.figure_frame {
  background-color: var(--white);
  box-shadow: 0 0 30px 0 #E9E9E9;
  padding: 10px;
}

.figure {
  margin: 0;
  flex: 0 0
    calc(
      100% / var(--gallery-items-per-row) - var(--gallery-gap) *
        (var(--gallery-items-per-row) - 1) / var(--gallery-items-per-row)
    );
}

.figure_image {
  aspect-ratio: 3 / 2;
  object-fit: contain;
  max-width: 100%;
  vertical-align: middle;
  height: auto;
}

.figure_caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 5px 0;
}

/* gallery */

.gallery {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gallery-gap);
  justify-content: center;
  padding: 30px;
}

@media only screen and (width >= 1200px) {
  .gallery {
    --gallery-items-per-row: 4;
  }
}
@media only screen and (768px < width < 1200px) {
  .gallery {
    --gallery-items-per-row: 3;
  }
}
@media only screen and (540px < width < 768px) {
  .gallery {
    --gallery-items-per-row: 2;
  }
}
@media only screen and (width < 540px) {
  .gallery {
    --gallery-items-per-row: 1;
  }
}