.gd-figure {
  --gd-polaroid-side: 12px;
  --gd-polaroid-top: 12px;
  --gd-polaroid-caption: 48px;
  --gd-paper-tint: #fffdf6;
  isolation: isolate;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 242, 229, 0.98)),
    color-mix(in srgb, var(--gd-paper-tint) 8%, #fffaf0);
  border: 1px solid rgba(204, 196, 177, 0.58);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 12px 20px rgba(72, 63, 48, 0.18),
    0 34px 46px rgba(72, 63, 48, 0.1);
  cursor: pointer;
  transition:
    box-shadow 220ms ease,
    filter 220ms ease,
    transform 220ms ease;
}

.gd-figure::before,
.gd-figure::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.gd-figure::before {
  left: var(--gd-polaroid-side);
  right: var(--gd-polaroid-side);
  top: var(--gd-polaroid-top);
  bottom: var(--gd-polaroid-caption);
  z-index: 2;
  box-shadow:
    0 0 0 1px rgba(50, 42, 31, 0.2),
    0 0 16px rgba(255, 255, 255, 0.18) inset;
}

.gd-figure::after {
  width: 38%;
  height: 16px;
  left: 31%;
  top: -8px;
  z-index: 4;
  background: rgba(235, 225, 197, 0.72);
  border: 1px solid rgba(180, 165, 128, 0.34);
  box-shadow: 0 1px 5px rgba(60, 50, 34, 0.12);
  transform: rotate(calc(var(--gd-tilt, 0deg) * -0.45));
}

.gd-figure:hover {
  filter: saturate(1.04) brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 16px 26px rgba(72, 63, 48, 0.22),
    0 42px 56px rgba(72, 63, 48, 0.13);
}

.gd-figure img {
  z-index: 1;
  background: #191714;
  box-shadow:
    0 0 0 1px rgba(49, 38, 24, 0.24),
    0 2px 10px rgba(65, 54, 38, 0.16);
}

.gd-label {
  position: absolute;
  z-index: 3;
  left: var(--gd-polaroid-side);
  right: var(--gd-polaroid-side);
  bottom: 7px;
  height: calc(var(--gd-polaroid-caption) - 14px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: #2c2923;
  font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  text-align: center;
  pointer-events: none;
}

.gd-label-title,
.gd-label-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gd-label-title {
  font-size: clamp(10px, 1.05vw, 14px);
  line-height: 1.05;
  font-weight: 600;
  white-space: nowrap;
}

.gd-label-meta {
  font-size: clamp(8px, 0.78vw, 11px);
  line-height: 1.12;
  color: #5d574f;
  white-space: nowrap;
}

.gd-modal-target {
  width: 300px;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.gd-modal-target:hover {
  opacity: 0.7;
}

.gd-modal {
  display: none;
  position: fixed;
  z-index: 5;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(16, 14, 12);
  background-color: rgba(16, 14, 12, 0.88);
}

@media only screen and (max-width: 760px) {
  .gd-label-meta {
    display: none;
  }
}

.gd-modal-content-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Modal Content (image) */
.gd-modal-content {
  max-width: 100%;
  max-height: 100%;
  bottom: 0;
  left: 0;
  margin: auto;
  overflow: auto;
  position: fixed;
  right: 0;
  top: 0;
  object-fit: contain;
}

.gd-modal-content.gd-modal-thumbnail {
  backdrop-filter: none;
  transition: opacity 0.75s ease;
  z-index: 10;
  opacity: 1;
}

.gd-modal-content.gd-modal-loaded.gd-modal-thumbnail {
  opacity: 0;
  pointer-events: none;
}

.gd-modal-exif {
  position: absolute;
  z-index: 20;
  bottom: 10px;
  right: 10px;
  color: #fff;
  background-color: #8a8a8a;
  padding: 0.5rem 0.75rem; /* Reduced top and bottom padding */
  opacity: 0.75;
  filter: drop-shadow(-1px -1px 2px #ccc);
}

.gd-modal-exif-ontimeout {
  transition: opacity 2s ease-out;
  opacity: 0;
}

.gd-modal-exif:hover {
  opacity: 1;
  cursor: pointer;
}

.gd-modal-exif dl {
  display: grid;
  grid-template-columns: minmax(100px, auto) 1fr;
  gap: 0.15rem 0.25rem; /* Reduced vertical gap */
  margin: 0; /* Remove default margin */
}

.gd-modal-exif dl dd {
  display: block;
  margin: 0;
  text-align: right;
}

.gd-modal-exif dl dd:after {
  content: none;
}

.gd-modal-exif dl dt {
  display: block;
  min-width: 0;
  white-space: nowrap;
}

.gd-modal-close,
.gd-modal-button {
  position: absolute;
  z-index: 20;
  right: 10px;
  color: #8a8a8a;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  width: 40px;
  text-align: center;
}

.gd-modal-close {
  top: 0px;
}

#gd-modal-download-original {
  top: 40px; /* Position it below the close button */
  font-size: 34px;
}

.gd-modal-close:hover,
.gd-modal-close:focus,
.gd-modal-button:hover,
.gd-modal-button:focus {
  color: #bbb;
  text-decoration: none;
}

@media only screen and (max-device-width: 800px) {
  .gd-modal-close,
  .gd-modal-button {
    font-size: 45px;
    width: 45px;
  }

  #gd-modal-download-original {
    top: 45px; /* Adjust for larger font size on mobile */
  }
}

#gd-modal-map {
    width: 100%;
    height: 200px;
    margin-top: 10px;
}
