.gallery-card[hidden],
.gallery-toggle[hidden] {
  display: none;
}

.gallery-toggle {
  display: block;
  margin: 2.5rem auto 0;
  padding: 0.8rem 2rem;
  min-height: 44px;
  border: 1px solid var(--accent-deep, #a65d16);
  border-radius: 3px;
  background: transparent;
  color: var(--accent-deep, #a65d16);
  font: inherit;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.gallery-toggle:hover {
  background: var(--accent-deep, #a65d16);
  color: #fff;
}

.gallery-toggle:focus-visible {
  outline: 2px solid var(--accent-deep, #a65d16);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-toggle { transition: none; }
}

.gallery-card__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gallery-card__open:focus-visible {
  outline: 3px solid var(--accent, #c8781f);
  outline-offset: -3px;
}

body.gallery-viewer-open {
  overflow: hidden;
}

.gallery-viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1200px, 100vw);
  max-width: 100vw;
  max-height: 100dvh;
  padding: 64px 72px 52px;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: auto;
}

.gallery-viewer::backdrop {
  background: rgba(12, 14, 16, 0.94);
  backdrop-filter: blur(8px);
}

.gallery-viewer[open] {
  animation: viewer-enter 240ms ease-out both;
}

.gallery-viewer[open]::backdrop {
  animation: viewer-fade-in 240ms ease-out both;
}

.gallery-viewer.is-closing {
  animation: viewer-exit 180ms ease-in both;
  pointer-events: none;
}

.gallery-viewer.is-closing::backdrop {
  animation: viewer-fade-out 180ms ease-in both;
}

.gallery-viewer__image {
  display: block;
  width: 100%;
  height: min(76dvh, 800px);
  object-fit: contain;
}

.gallery-viewer button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.gallery-viewer button[hidden] {
  display: none;
}

.gallery-viewer button:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.gallery-viewer button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-viewer button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.gallery-viewer__close {
  position: absolute;
  top: 10px;
  right: 16px;
}

.gallery-viewer__previous,
.gallery-viewer__next {
  position: absolute;
  top: calc(50% - 22px);
}

.gallery-viewer__previous { left: 14px; }
.gallery-viewer__next { right: 14px; }

.gallery-viewer__caption {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
  text-align: center;
}

@keyframes viewer-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes viewer-exit {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.98); }
}

@keyframes viewer-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes viewer-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (max-width: 600px) {
  .gallery-viewer { padding: 64px 12px 20px; }
  .gallery-viewer__image { height: 65dvh; }
  .gallery-viewer__navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
  }
  .gallery-viewer__previous,
  .gallery-viewer__next { position: static; }
  .gallery-viewer__caption { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-viewer[open],
  .gallery-viewer[open]::backdrop { animation: none; }
  .gallery-viewer button { transition: none; }
}
.gallery-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  display: block;
  opacity: 0;
  transition: opacity 650ms ease, transform 650ms ease;
  pointer-events: none;
}

.gallery-card__media img.is-active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card__media img { transition: none; }
}

.gallery-card__controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px 16px 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

.gallery-card__bar {
  flex: 0 1 40px;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-card__bar::before {
  content: "";
  display: block;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
}

.gallery-card__bar[aria-pressed="true"]::before,
.gallery-card__bar:hover::before {
  background: #fff;
}

.gallery-card__bar:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

