.post-media-image-trigger {
  cursor: zoom-in;
}

.post-media-image-trigger:focus-visible {
  outline: 3px solid var(--report-primary, var(--forest-light));
  outline-offset: 4px;
}

.post-media-dialog-open {
  overflow: hidden;
}

.post-media-dialog {
  width: min(calc(100% - 2rem), 1440px);
  height: min(calc(100dvh - 2rem), 960px);
  max-width: none;
  max-height: none;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.post-media-dialog::backdrop {
  background: rgba(10, 27, 22, 0.82);
  backdrop-filter: blur(4px);
}

.post-media-dialog__shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.post-media-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.post-media-dialog__header h2 {
  margin: 0;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.35;
}

.post-media-dialog__close {
  min-height: 44px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.75rem;
  color: var(--forest);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.post-media-dialog__close:hover,
.post-media-dialog__close:focus-visible {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

.post-media-dialog__body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  background: var(--background);
}

.post-media-dialog__image-viewer {
  min-width: min-content;
  min-height: 100%;
  display: grid;
  place-items: center;
}

.post-media-dialog__image {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  touch-action: pan-x pan-y pinch-zoom;
}

@media (max-width: 600px) {
  .post-media-dialog {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .post-media-dialog__header {
    padding: 0.65rem 0.75rem;
  }

  .post-media-dialog__body {
    padding: 0.75rem;
  }

  .post-media-dialog__image-viewer {
    min-width: 0;
  }

  .post-media-dialog .post-media-dialog__image {
    width: auto;
    max-width: 100%;
  }
}

@media print {
  .post-media-dialog {
    display: none !important;
  }
}
