:root {
  --background: #fafafa;
  --text: #292929;
  --muted: #777;
  --line: #dedede;
  --overlay: rgba(12, 12, 12, 0.96);
  --page-padding: clamp(1.25rem, 4vw, 4.5rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

button,
a {
  color: inherit;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem var(--page-padding);
  border-bottom: 1px solid var(--line);
}

.logo {
  width: fit-content;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.5vw, 2.5rem);
  line-height: 1;
  text-decoration: none;
}

.exhibition-heading {
  justify-self: end;
  text-align: right;
}

.exhibition-heading h1,
.exhibition-heading p {
  margin: 0;
  font-weight: 400;
}

.exhibition-heading h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2vw, 2rem);
  line-height: 1.2;
}

.exhibition-heading p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

main {
  padding-inline: var(--page-padding);
}

.introduction {
  max-width: 47rem;
  margin: clamp(5rem, 12vw, 10rem) auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  line-height: 1.45;
}

.introduction p {
  margin: 0 0 1.4em;
}

.gallery-section {
  margin-bottom: clamp(6rem, 12vw, 12rem);
}

.gallery-section h2 {
  margin: 0 0 2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(3rem, 6vw, 7rem) clamp(1rem, 2.5vw, 2.5rem);
}

.artwork {
  min-width: 0;
  margin: 0;
}

.artwork-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: zoom-in;
}

.image-frame {
  display: grid;
  aspect-ratio: 4 / 5;
  place-items: center;
  overflow: hidden;
  background: #f1f1ef;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 180ms ease;
}

.artwork-button:hover img,
.artwork-button:focus-visible img {
  opacity: 0.82;
}

.artwork-button:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 0.5rem;
}

.artwork figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.missing-image {
  position: relative;
}

.missing-image::after {
  content: "Artwork image";
  position: absolute;
  color: #aaa;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.missing-image img {
  visibility: hidden;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem var(--page-padding);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer p,
.site-footer address {
  margin: 0;
  font-style: normal;
}

.lightbox {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(3rem, 1fr) minmax(0, 12fr) minmax(3rem, 1fr);
  align-items: center;
  background: var(--overlay);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-content {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  place-items: center;
  max-width: 100%;
  margin: 0;
  pointer-events: none;
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  pointer-events: auto;
}

.lightbox-caption {
  margin-top: 0.8rem;
  color: #c7c7c7;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lightbox-close,
.lightbox-arrow {
  position: relative;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #f5f5f5;
  cursor: pointer;
  font-weight: 200;
  opacity: 0.72;
  transition: opacity 180ms ease;
}

.lightbox-close:hover,
.lightbox-arrow:hover,
.lightbox-close:focus-visible,
.lightbox-arrow:focus-visible {
  opacity: 1;
}

.lightbox-close:focus-visible,
.lightbox-arrow:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 0.3rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  padding: 0.5rem;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-arrow {
  padding: 2rem 0.75rem;
  font-size: 1.8rem;
}

.lightbox-previous {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}

.lightbox-next {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
}

body.lightbox-open {
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(1rem, 5vw, 3rem);
  }
}

@media (max-width: 560px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .exhibition-heading {
    justify-self: start;
    text-align: left;
  }

  .introduction {
    margin-block: 5rem 7rem;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 4.5rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .lightbox {
    grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  }

  .lightbox-image {
    max-height: calc(100vh - 8rem);
  }

  .lightbox-arrow {
    padding-inline: 0.35rem;
    font-size: 1.35rem;
  }
}
