:root {
  color-scheme: dark;
  background: #090c10;
  color: #dce5ec;
  font-family: system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 240px;
  background: radial-gradient(ellipse at 50% 42%, #141d26 0%, #090c10 72%);
}

main {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 80px 28px;
}

.collection {
  --gap: clamp(28px, 5vw, 64px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--gap);
  width: 100%;
}

.projects {
  max-width: 848px;
}

.projects .artwork {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-basis: calc((100% - 2 * var(--gap)) / 3);
  aspect-ratio: auto;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.projects .artwork img {
  height: auto;
  aspect-ratio: 1;
  border-radius: 23%;
}

.projects .panorama img {
  border-radius: 50%;
}

.artwork .panorama-icon {
  --icon-crop: 460;
  --icon-left: 33;
  --icon-top: 25;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
}

/* Crop the 512px assets to their visible circles; defaults fit panorama 1. */
.artwork .panorama-icon img {
  position: absolute;
  width: calc(100% * 512 / var(--icon-crop));
  height: auto;
  aspect-ratio: 1;
  left: calc(-100% * var(--icon-left) / var(--icon-crop));
  top: calc(-100% * var(--icon-top) / var(--icon-crop));
}

.project-caption {
  display: block;
  margin-top: 16px;
  min-height: 2.8em;
  font-size: clamp(.875rem, 1.4vw, 1rem);
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.panoramas {
  max-width: 1088px;
}

.artwork {
  display: block;
  flex: 0 0 calc((100% - var(--gap)) / 2);
  max-width: 240px;
  aspect-ratio: 1;
  border-radius: 23%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline-offset: 10px;
}

.artwork img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  transform-origin: 50% 50%;
  transition: transform 650ms ease-in-out, filter 650ms ease-in-out;
}

.panorama {
  border-radius: 50%;
}

.panoramas .artwork {
  flex-basis: calc((100% - 2 * var(--gap)) / 3);
  max-width: 320px;
}

.back {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #34414c;
  border-radius: 50%;
  color: inherit;
  text-decoration: none;
  transition: background-color 220ms ease, border-color 220ms ease;
}

a:focus-visible {
  outline: 2px solid #e0edfa;
}

.back:focus-visible {
  outline-offset: 5px;
}

@media (hover: hover) and (pointer: fine) {
  .artwork:hover img {
    transform: scale(1.02);
    filter: brightness(1.08);
  }

  .back:hover {
    background: #1a2632;
    border-color: #8195a8;
  }
}

.artwork:active img {
  transform: scale(.99);
}

@media (max-width: 680px) {
  main {
    padding: 88px 28px 48px;
  }

  .projects,
  .panoramas {
    max-width: 544px;
  }

  .projects .artwork,
  .panoramas .artwork {
    flex-basis: calc((100% - var(--gap)) / 2);
    max-width: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .artwork img,
  .back {
    transition: none;
  }

  .artwork:hover img,
  .artwork:active img {
    transform: none;
  }
}
