.fragment {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.fragment-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: auto;
  padding: 1.35rem 0 .65rem;
  border: 0;
  border-bottom: 1px solid var(--gold);
  background: transparent;
  color: #ddd4c9;
  font: 500 .7rem var(--sans);
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
}

.fragment-action span { color: var(--gold); }
.fragment-action:hover, .fragment-action:focus-visible { color: var(--gold); }
.fragment-action:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; }

.gallery-modal[hidden] { display: none; }
.gallery-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 4vh 4vw; }
.gallery-backdrop { position: absolute; inset: 0; background: rgba(4, 3, 2, .9); backdrop-filter: blur(8px); }
.gallery-panel { position: relative; z-index: 1; width: min(1120px, 100%); max-height: 92vh; overflow: auto; padding: clamp(2rem, 5vw, 4.5rem); background: #0d0b09; border: 1px solid rgba(189, 151, 97, .28); box-shadow: 0 30px 90px #000; }
.gallery-panel h2 { max-width: 760px; font: 400 clamp(2.4rem, 5vw, 4.6rem)/1.08 var(--serif); margin: 1rem 0 3rem; }
.gallery-panel h2 em { color: var(--gold); font-weight: 400; }
.gallery-close { position: absolute; top: 1.25rem; right: 1.5rem; width: 42px; height: 42px; border: 1px solid rgba(189, 151, 97, .45); border-radius: 50%; background: transparent; color: var(--gold); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.gallery-thumbnails { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.gallery-thumbnail { padding: 0; border: 0; background: #080706; color: inherit; text-align: left; cursor: zoom-in; }
.gallery-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.gallery-thumbnail span, .gallery-preview figcaption { display: block; padding: 1rem 0; color: #958b80; font-size: .68rem; letter-spacing: .13em; text-transform: uppercase; }
.gallery-preview { margin: 0; }
.gallery-preview img { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; background: #080706; }
body.gallery-open { overflow: hidden; }

@media (max-width: 800px) {
  .fragment-action { width: 100%; justify-content: space-between; }
  .gallery-modal { padding: 0; }
  .gallery-panel { width: 100%; height: 100%; max-height: none; padding: 5rem 6vw 2rem; }
  .gallery-thumbnails { grid-template-columns: 1fr; }
  .gallery-preview img { max-height: 72vh; }
}
