.main-gallery {
  display: flex;
  padding: 2rem;
  background-color: var(--color-panel);
  border: 1px solid var(--color-border);
}
.left-panel {
  flex: 1;
  flex-direction: column;
}

.viewer-title {
  margin: 0;
  font-size: 3rem;
  text-align: center;
}
.viewer-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* author title */
.viewer-author {
  margin: 0 0 2rem;
  font-size: 1.5rem;
  color: #666;
  text-align: center;
  font-style: italic;
}

.viewer-image {
  /* fluid between 100px and 300px wide, or 40% of its container */
  width: clamp(200px, 90%, 500px);

  /* center it whenever it ends up narrower than its parent */
  margin: 0 auto 0.5rem;

  /* remove flex properties—this isn’t a flex container */
  justify-content: unset;
  align-items: unset;
  align-self: unset;
}

.viewer-image img {
  display: block;
  max-width: 100%;
  height: auto;
  justify-content: center;
  align-items: center;
}

.right-panel {
  display: flex;
  flex-direction: column;
}

.gallery-pagination {
  margin: 0.25rem;
  align-items: center;
  justify-items: center;
  justify-content: center;
  text-align: center;
}

/* keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* base overlay */
.overlay {
  position: fixed;
  inset: 0; /* shorthand for top/left/right/bottom = 0 */
  /* use a CSS var for opacity so you can override inline or via data-opaque */
  --overlay-bg: rgba(0, 0, 0, 0.5);
  background-color: var(--overlay-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white; /* fix from text-color */
  animation: fadeIn 0.3s ease-out forwards;
  z-index: 999;
}

/* spinner via ::after */
.overlay::after {
  content: "";
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* full-block mode: no peek-through */
.overlay[data-opaque] {
  --overlay-bg: rgba(0, 0, 0, 1);
}

.gallery-title {
  margin: 0;
  font-size: 3rem;
  text-align: center;
}
