@font-face {
  font-family: 'Iosevka Charon';
  src: url('assets/fonts/iosevka-charon/IosevkaCharon-Regular-Latin.woff') format('woff');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0020-00FF;
}

#galerie {
  --gallery-card: clamp(13rem, 27.7vw, 22.5rem);
  --gallery-gap: clamp(1.25rem, 4vw, 4rem);
}

#galerie > .section-index {
  max-width: none;
  display: block;
  margin: 0 auto 2.15rem;
  font-size: 12px;
  text-align: center;
}

html[data-typography] #gallery-title {
  margin: 0 auto;
  color: var(--ink);
  font-family: 'Iosevka Charon', monospace;
  font-size: clamp(1.075rem, 5.05vw, 4.7rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: .054em;
  text-align: center;
  text-transform: uppercase !important;
}

#gallery-title span {
  display: block;
}

@supports (background-clip: text) {
  #gallery-title span {
    width: fit-content;
    max-width: 100%;
    margin: auto;
    padding: .04em .06em;
    background-image:
      linear-gradient(108deg, transparent 40%, #f5ecff 49%, #baa4df 51%, transparent 60%),
      linear-gradient(180deg, var(--ink) 9%, #503779 31%, #73599a 43%, var(--ink) 55%, #2b174d 72%, #4c3277 88%, var(--ink));
    background-size: 275% 100%, 100% 100%;
    background-position: 99% 50%, 0 50%;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 0 #291743) drop-shadow(.5px 1px 0 #8a76a8)
      drop-shadow(0 .045em .028em #38226745);
    animation: gallery-sunlight 8s ease-in-out infinite;
    animation-play-state: paused;
  }

  #gallery-title span + span { animation-delay: -.32s; }

  #galerie.title-in-view #gallery-title span { animation-play-state: running; }

  @keyframes gallery-sunlight {
    0%, 33% { background-position: 99% 50%, 0 50%; }
    65%, 100% { background-position: -22% 50%, 0 50%; }
  }
}

#galerie .gallery-controls {
  justify-content: flex-end;
  gap: 14px;
  max-width: 1230px;
  margin: 2rem auto .9rem;
}

#galerie .gallery-controls .circle-button:hover { transform: none; }

#galerie .gallery-track {
  position: relative;
  max-width: 1230px;
  margin: 0 auto;
  padding: .75rem 1.25rem .65rem;
  align-items: flex-start;
  gap: var(--gallery-gap);
  scroll-padding-inline: 0;
}

#galerie .gallery-track:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

#galerie .gallery-item {
  --hang: -.85deg;
  flex: 0 0 var(--gallery-card);
  min-width: 0;
  margin: 0;
  padding: 0;
}

#galerie .gallery-item:nth-child(even) { --hang: .85deg; }
#galerie .gallery-item:nth-child(5n) { --hang: -.3deg; }

.museum-frame {
  container-type: size;
  display: grid;
  place-items: center;
  height: clamp(13.5rem, 25vw, 23rem);
  padding: .4rem .55rem 0;
}

.museum-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.museum-frame > * {
  filter: drop-shadow(1px 4px 3px #38226727);
  transform: rotate(var(--hang));
  transition: transform .32s ease-out;
}

.museum-color-definitions {
  position: absolute;
  pointer-events: none;
}

.museum-picture {
  position: relative;
  width: min(100%, calc(100cqh * var(--picture-ratio)));
  aspect-ratio: var(--picture-ratio);
}

.museum-picture img {
  display: block;
  width: 100%;
  height: 100%;
}

.museum-frame-ink { filter: var(--frame-tone, brightness(1)) url(#museum-violet) var(--frame-finish, brightness(1)); }

.museum-motif,
.museum-icon-crack { position: absolute; inset: 0; }
.museum-motif { clip-path: var(--picture-opening); }

.museum-inset { position: absolute; inset: var(--paint-inset); overflow: hidden; }
.museum-inset img { object-fit: cover; }

.museum-icon-crack {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.museum-round-print {
  position: absolute;
  inset: var(--round-opening, 10%);
  border-radius: 50%;
  overflow: hidden;
  background: #21162e;
}

.museum-round-print img { object-fit: cover; }

.museum-tondo .museum-frame-ink { position: relative; pointer-events: none; }

#galerie figcaption {
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: 7.75rem;
  max-width: none;
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
  background: none;
}

.gallery-plaque {
  width: min(100%, 19.5rem);
  min-height: 6.4rem;
  padding: .8rem .85rem;
  color: var(--ink);
  background: #f7f0e2;
  border: 1px solid #7c5c3c;
  border-radius: 1px;
  box-shadow: inset 0 0 0 2px #f7f0e2, inset 0 0 0 3px #b49772, 1px 3px 3px #38226725;
  font-family: 'Iosevka Charon', monospace;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.36;
  text-align: left;
  cursor: zoom-in;
  transform: scale(.44);
  transform-origin: center top;
  transition: transform .25s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease-out;
}

.gallery-plaque:is(:focus-visible, [aria-pressed="true"]) {
  transform: scale(1);
  box-shadow: inset 0 0 0 2px #f7f0e2, inset 0 0 0 3px #b49772, 2px 5px 6px #38226730;
}

.gallery-plaque:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.gallery-plaque[aria-pressed="true"] { cursor: zoom-out; }

@media (hover: hover) and (pointer: fine) {
  .museum-frame:hover > * {
    transform: rotate(0deg) scale(1.028);
    animation: gallery-settle .62s ease-out;
  }

  @keyframes gallery-settle {
    0% { transform: rotate(var(--hang)); }
    40% { transform: rotate(.8deg) scale(1.018); }
    72% { transform: rotate(-.5deg) scale(1.028); }
    100% { transform: rotate(0deg) scale(1.028); }
  }

  .gallery-plaque:hover {
    transform: scale(1);
    box-shadow: inset 0 0 0 2px #f7f0e2, inset 0 0 0 3px #b49772, 2px 5px 6px #38226730;
  }
}

.gallery-plaque.is-dismissed { transform: scale(.44); }

@media (max-width: 760px) {
  #galerie { --gallery-card: clamp(12rem, 68vw, 18rem); }
  #galerie > .section-index { margin-bottom: 1.25rem; }
  html[data-typography] #gallery-title { font-size: clamp(1.24rem, 6.05vw, 2.9rem); }
  #galerie .gallery-controls { margin-top: 1.25rem; }
  #galerie .gallery-track {
    margin-inline: -12px;
    padding-inline: max(.65rem, calc((100% - var(--gallery-card)) / 2 + 12px));
  }
  .museum-frame { height: clamp(12rem, 64vw, 18rem); }
  #galerie figcaption { min-height: 8.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  #galerie #gallery-title span,
  #galerie .museum-frame > *,
  #galerie .gallery-plaque {
    animation: none;
    transition: none;
  }
  #galerie .museum-frame:hover > * { transform: rotate(var(--hang)); }
  #galerie .gallery-track { scroll-behavior: auto; }
}
