.category-overview {
  padding-block: clamp(2.5rem, 6vw, 6rem) clamp(4rem, 8vw, 8rem);
}

.category-overview h2,
.category-other h2 {
  margin: 0 0 1.6rem;
  font-size: clamp(1.75rem, 3.4vw, 3.2rem);
  letter-spacing: -.04em;
}

.category-grid,
.category-gallery__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 3.5rem);
  padding: 0;
  margin: 0;
  list-style: none;
}

.category-card {
  scroll-margin-top: 2rem;
}

.category-card a {
  display: block;
  text-decoration: none;
}

.category-card__photo,
.category-gallery__list li {
  overflow: hidden;
  margin: 0;
  background: #e5e0d9;
}

.category-card__photo {
  aspect-ratio: var(--portfolio-aspect);
}

.category-card__photo img,
.category-gallery__list img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-card__photo img {
  transition: transform 300ms ease;
}

.category-card a:hover img,
.category-card a:focus-visible img {
  transform: scale(1.035);
}

.category-card__content {
  display: grid;
  gap: .5rem;
  padding-top: 1rem;
}

.category-card__content h3 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: -.045em;
}

.category-card__content p {
  margin: 0;
  color: #465261;
  line-height: 1.5;
}

.category-card__link {
  display: inline-flex;
  gap: .4rem;
  align-items: baseline;
  justify-self: start;
  color: var(--blue);
  font-weight: 700;
}

.category-card a:hover .category-card__link,
.category-card a:focus-visible .category-card__link,
.category-other a:hover {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.category-page {
  padding-block: clamp(2.2rem, 6vw, 6rem) clamp(3rem, 6vw, 6rem);
}

.category-intro {
  margin-bottom: clamp(1.8rem, 5vw, 4.8rem);
}

.category-back {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: clamp(1.4rem, 4vw, 3.5rem);
  color: var(--blue);
  font-weight: 700;
}

.category-intro__content {
  display: grid;
  grid-template-columns: 1fr minmax(16rem, .65fr);
  align-items: end;
  gap: clamp(1rem, 4vw, 3.5rem);
}

.category-intro h1 {
  max-width: 13ch;
  font-family: var(--display);
  font-size: clamp(3rem, 7.6vw, 8rem);
  letter-spacing: -.062em;
  line-height: .94;
}

.category-intro p {
  max-width: 31rem;
  color: #465261;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.6;
}

.category-gallery__list {
  --gallery-aspect: var(--portfolio-aspect);
  gap: clamp(.8rem, 2vw, 1.7rem);
}

.category-gallery__list--square { --gallery-aspect: 1; }
.category-gallery__list--portrait { --gallery-aspect: 3 / 4; }

.category-gallery__list a {
  display: block;
  aspect-ratio: var(--gallery-aspect);
  cursor: zoom-in;
}

.category-gallery__list a:focus-visible {
  outline-offset: -.32rem;
}

.category-gallery__list--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 63rem;
}

.category-gallery__list--single a { aspect-ratio: auto; }

.category-gallery__list--single img {
  height: auto;
}

.category-other {
  margin-top: clamp(3rem, 7vw, 7rem);
}

.category-other ul {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-other a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: .6rem 1rem;
  border: 1px solid #a6acb5;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.gallery-dialog {
  position: fixed;
  inset: 0;
  width: min(97vw, 86rem);
  max-width: none;
  max-height: 96svh;
  margin: auto;
  padding: 0;
  border: 0;
  background: #111d2b;
  color: #fff;
}

.gallery-dialog::backdrop {
  background: rgba(13, 24, 36, .92);
}

.gallery-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem .75rem .5rem 1rem;
}

.gallery-dialog__bar p {
  margin: 0;
  color: #f1f5fa;
  font-size: .88rem;
}

.gallery-dialog__stage {
  display: grid;
  grid-template-columns: min-content minmax(0, 1fr) min-content;
  align-items: center;
  gap: .55rem;
  padding: 0 .75rem .75rem;
}

.gallery-dialog__stage img {
  grid-column: 2;
  display: block;
  width: 100%;
  height: min(78svh, 48rem);
  object-fit: contain;
}

.gallery-dialog button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #b7c5d5;
  background: transparent;
  color: inherit;
  font: 1.65rem / 1 var(--display);
  cursor: pointer;
}

.gallery-dialog button:hover {
  background: #fff;
  color: #111d2b;
}

.gallery-dialog button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 740px) {
  .category-grid,
  .category-gallery__list,
  .category-intro__content {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-card__content h3,
  .category-intro h1 {
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .gallery-dialog__stage {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-dialog__stage img {
    grid-area: 1 / 1 / 2 / -1;
    height: min(65svh, 37rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-card__photo img {
    transition: none;
  }

  .category-card a:hover img,
  .category-card a:focus-visible img {
    transform: none;
  }
}
