.featured-gallery {
  margin: 5rem auto 0;
  padding: 2rem;
  background-color: var(--color-bg-primary);
  border-radius: 12px;
  max-width: var(--content-max-width);
}

.featured-gallery h2.gallery-title {
  font-family: var(--font-serif);
  font-weight: 500;
  text-align: center;
  font-size: 3.5em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
.featured-gallery h2.gallery-title a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.featured-gallery h2.gallery-title a:hover {
  color: var(--color-accent-default);
}

.featured-gallery h3.gallery-preface,
.featured-gallery h3.gallery-description {
  font-weight: 300;
  font-style: italic;
  text-align: center;
  font-size: 1.4em;
  color: var(--color-text-metadata);
}

.featured-gallery h3.gallery-description {
  font-style: normal;
  margin-bottom: 4em;
}

.random-viewer-header-content {
  max-width: var(--content-max-width);
  padding: 1.5rem;
  margin: 0 auto;
}

.random-viewer-header {
  background-color: var(--color-bg-primary);
  margin: 0 auto;
  text-align: center;
}

.random-viewer-header h2 {
  font-family: var(--font-serif);
  color: var(--color-text-tertiary);
}

.random-viewer-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin: 0;
}

.random-viewer-title sup {
  font-size: 0.6em;
  opacity: 0.8;
  margin-left: 0.1em;
}

.random-viewer-footnote {
  font-style: italic;
  opacity: 0.8;
  font-size: 0.9rem;
}

.random-viewer {
  background-color: var(--color-bg-viewer);
}

/* Mobile optimizations for random-viewer */
@media (max-width: 480px) {
  .random-viewer {
    min-height: 300px; /* Consistent with image viewer min-height */
    max-height: 80vh; /* Limit maximum height on mobile */
  }
}

/* Handle very tall/narrow mobile screens */
@media (max-height: 600px) and (max-width: 480px) {
  .random-viewer {
    min-height: 250px;
    max-height: 70vh;
  }
}

.gallery-view-more {
  text-align: center;
  margin: 3rem 0 1rem;
}

.view-more-link {
  display: inline-block;
  padding: 0.8rem 2rem;
  background-color: var(--color-bg-surface-dark);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 30px;
  font-size: 1.1rem;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.view-more-link:hover {
  transform: var(--hover-lift);
  background-color: var(--color-bg-secondary);
}

@media (max-width: 768px) {
  .featured-gallery {
    padding: 1.5rem;
    margin: 3rem auto 0;
  }

  .featured-gallery h2.gallery-title {
    font-size: 2.5em;
  }

  .featured-gallery h3.gallery-preface,
  .featured-gallery h3.gallery-description {
    font-size: 1.2em;
  }

  .random-viewer-title {
    font-size: 1.5rem;
  }
  
  .random-viewer-footnote {
    font-size: 0.8rem;
  }

  .view-more-link {
    padding: 0.7rem 1.8rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .featured-gallery h2.gallery-title {
    font-size: 1.5em;
  }

  .featured-gallery h3.gallery-preface,
  .featured-gallery h3.gallery-description {
    font-size: 1.0em;
  }
}