.gallery-page {
  --gallery-accent: var(--site-accent);
  --gallery-accent-wash: rgb(50 255 171 / 12%);
}

.gallery-page.ftpk-project {
  --home-pop: var(--ftpk-accent);
  --home-pop-wash: rgb(255 50 50 / 12%);
  --gallery-accent: var(--ftpk-accent);
  --gallery-accent-wash: rgb(255 50 50 / 12%);
}

.gallery-shell {
  width: min(100%, 61rem);
}

.gallery-main {
  display: grid;
  gap: 0.7rem;
  padding: 0.7rem;
}

.gallery-panel {
  border: 1px solid var(--home-border);
  background: var(--home-panel);
  box-shadow: 2px 2px 0 var(--home-shadow);
}

.gallery-panel > h1,
.gallery-panel > h2 {
  margin: 0;
  padding: 0.58rem 0.75rem;
  border-bottom: 2px solid var(--gallery-accent);
  color: var(--home-text);
  background: var(--home-charcoal-deep);
  letter-spacing: 0.08em;
}

.gallery-panel > h1 {
  font-size: 1.2rem;
}

.gallery-panel > h2 {
  font-size: 0.82rem;
}

.gallery-intro-copy {
  padding: 0.9rem 1rem;
}

.gallery-intro-copy p {
  margin: 0.25rem 0 0.7rem;
}

.gallery-intro-copy p:last-child {
  margin-bottom: 0;
}

.gallery-lead {
  color: var(--gallery-accent);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 1.35rem;
  font-weight: bold;
}

.project-gallery-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1px;
  background: var(--home-border);
}

.project-gallery-link:link,
.project-gallery-link:visited {
  --project-gallery-color: var(--gallery-accent);
  --project-gallery-wash: var(--gallery-accent-wash);

  display: flex;
  min-height: 5.75rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.8rem;
  color: var(--home-text);
  background:
    linear-gradient(145deg, transparent 0 58%, var(--project-gallery-wash) 58% 100%),
    var(--home-green-deep);
  text-decoration: none;
}

.project-gallery-link.ftpk-gallery-link {
  --project-gallery-color: var(--ftpk-accent);
  --project-gallery-wash: rgb(255 50 50 / 12%);
}

.project-gallery-link strong {
  color: var(--project-gallery-color);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 1.1rem;
}

.project-gallery-link span {
  color: var(--home-muted);
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.06em;
}

.project-gallery-link:hover,
.project-gallery-link:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--project-gallery-color);
  outline-offset: -2px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem;
  padding: 0.75rem;
}

.gallery-card {
  display: grid;
  grid-template-rows: auto 1fr;
  margin: 0;
  border: 1px solid var(--home-border);
  background: var(--home-green-deep);
  box-shadow: 2px 2px 0 var(--home-shadow);
}

.gallery-thumb {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--home-border);
  color: inherit;
  background: var(--home-charcoal-deep);
  cursor: zoom-in;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 140ms ease;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  outline: 2px solid var(--gallery-accent);
  outline-offset: -2px;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
  transform: scale(1.025);
}

.gallery-card figcaption {
  align-self: center;
  padding: 0.48rem 0.55rem;
  color: var(--home-muted);
  font-size: 0.72rem;
  font-weight: bold;
  text-align: center;
}

.gallery-card figcaption a {
  color: var(--gallery-accent);
}

.gallery-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.2rem 0 0.05rem;
}

.gallery-nav a {
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--gallery-accent);
  color: var(--gallery-accent);
  background: var(--home-charcoal-deep);
  font-size: 0.73rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.gallery-nav a:hover,
.gallery-nav a:focus-visible {
  color: var(--home-charcoal-deep);
  background: var(--gallery-accent);
}

.art-lightbox {
  width: min(94vw, 76rem);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 2px solid var(--gallery-accent);
  color: var(--home-text);
  background: var(--home-charcoal-deep);
  box-shadow: 8px 8px 0 rgb(0 0 0 / 45%);
}

.art-lightbox::backdrop {
  background: rgb(0 0 0 / 82%);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 2px solid var(--gallery-accent);
  background: repeating-linear-gradient(
    135deg,
    var(--home-charcoal) 0 0.55rem,
    var(--home-green-light) 0.55rem 1.1rem
  );
}

.lightbox-title {
  min-width: 0;
  overflow: hidden;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gallery-accent);
  color: var(--gallery-accent);
  background: var(--home-charcoal-deep);
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-close {
  flex: none;
  position: relative;
  z-index: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gallery-accent);
  color: var(--gallery-accent);
  background: var(--home-charcoal-deep);
  font: inherit;
  font-size: 0.7rem;
  font-weight: bold;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: var(--home-charcoal-deep);
  background: var(--gallery-accent);
}

.lightbox-image-wrap {
  display: grid;
  max-height: calc(94vh - 3rem);
  place-items: center;
  overflow: auto;
  margin: 0;
  padding: 0.7rem;
}

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

@media (max-width: 580px) {
  .gallery-main {
    padding: 0.45rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    padding: 0.45rem;
  }

  .gallery-card figcaption {
    padding: 0.4rem 0.3rem;
    font-size: 0.66rem;
  }

  .art-lightbox {
    width: 100vw;
    max-height: 100vh;
    border-right: 0;
    border-left: 0;
  }
}
