.hdnd-gallery {
  width: min(1020px, calc(100vw - 2rem));
  height: calc(100dvh - 2rem);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  color: var(--color-dtl-ink);
  background: var(--color-dtl-bg);
  border: 1px solid var(--color-dtl-primary-2);
  border-radius: var(--radius-lg);
  font-family: var(--font-base);
  font-size: var(--text-md);
}

.hdnd-gallery::backdrop { background: var(--alpha-black-67); }

.hdnd-gallery-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-width: 0;
}

.hdnd-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hdnd-gallery-head { padding: 1rem 1.25rem; background: var(--color-white); }
.hdnd-gallery-head h2 { margin: 0; font-size: var(--text-xl); }
.hdnd-gallery-head p { margin: 0.3rem 0 0; }
.hdnd-gallery-head button { flex-shrink: 0; }

.hdnd-gallery button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  color: var(--color-dtl-ink);
  background: var(--color-white);
  border: 1px solid var(--color-dtl-primary-2);
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.hdnd-gallery button:hover { background: var(--color-dtl-info-bg); }
.hdnd-gallery button:focus-visible { outline: 3px solid var(--color-dtl-primary-2); outline-offset: 2px; }
.hdnd-gallery-scroll:focus-visible { outline: 2px solid var(--color-dtl-primary); outline-offset: -2px; }

.hdnd-gallery-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem; }
.hdnd-gallery-unit { width: 100%; max-width: 940px; margin: 0 auto 1.5rem; }
.hdnd-gallery-unit:last-child { margin-bottom: 0; }
.hdnd-gallery-unit img { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }
.hdnd-gallery-unit [hidden] { display: none; }

@media (max-width: 700px) {
  .hdnd-gallery { width: calc(100vw - 1rem); height: calc(100dvh - 1rem); }
  .hdnd-gallery-head,
  .hdnd-gallery-scroll { padding: 0.75rem; }
  .hdnd-gallery-head h2 { font-size: var(--text-lg); }
}
