/* Progressive screenshot inspection layer. The page thumbnails remain the visual source. */
html.mh-viewer-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.image-viewer-link {
  display: block;
  color: inherit;
  cursor: zoom-in;
}

.image-viewer-link img {
  display: block;
}

.image-viewer-link:focus-visible,
.mh-image-viewer button:focus-visible,
.mh-viewer-scroll:focus-visible,
.mh-viewer-error a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -3px;
}

.ledger-enhanced-link {
  display: none;
}

.ledger-flow-links {
  display: grid;
  gap: 18px;
}

.ledger-flow-link {
  background: #151a1c;
}

.ledger-flow-link img {
  width: 100%;
  height: auto;
}

.mh-enhanced .ledger-enhanced-link {
  display: block;
}

.mh-enhanced .ledger-flow-links {
  display: none;
}

.budget-shot .image-viewer-link {
  display: block;
}

.mh-enhanced .budget-shot .image-viewer-link {
  display: none;
}

.mh-enhanced .budget-shot[data-month="june"] .image-viewer-link,
.mh-enhanced[data-mh-month="june"] .budget-shot[data-month="june"] .image-viewer-link,
.mh-enhanced[data-mh-month="july"] .budget-shot[data-month="july"] .image-viewer-link {
  display: block;
}

.mh-image-viewer {
  width: min(1440px, calc(100vw - 24px));
  height: min(1000px, calc(100vh - 24px));
  height: min(1000px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--frame);
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
}

.mh-image-viewer::backdrop {
  background: rgba(21, 26, 28, .78);
}

.mh-image-viewer[open] {
  display: grid;
}

.mh-viewer-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.mh-viewer-header,
.mh-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.mh-viewer-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.mh-viewer-title {
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mh-viewer-toolbar {
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mh-viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mh-viewer-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--control);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.mh-viewer-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--control);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.mh-viewer-toolbar button:hover,
.mh-viewer-toolbar button[aria-pressed="true"],
.mh-viewer-close:hover {
  background: var(--soft);
}

.mh-viewer-toolbar button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.mh-viewer-toolbar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mh-viewer-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mh-viewer-status {
  min-width: 12rem;
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
  text-align: right;
}

.mh-viewer-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  background: #151a1c;
}

.mh-viewer-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-width: 100%;
  margin: auto;
  padding: 16px;
}

.mh-viewer-image {
  display: block;
  flex: 0 0 auto;
  max-width: none;
  height: auto;
  user-select: none;
}

.mh-viewer-placeholder,
.mh-viewer-error {
  max-width: 42rem;
  padding: 28px;
  color: #edf2f4;
  font-size: .95rem;
  text-align: center;
}

.mh-viewer-error {
  border: 1px solid rgba(240, 177, 152, .6);
  background: rgba(32, 39, 42, .94);
}

.mh-viewer-error a {
  color: #83d0b4;
  font-weight: 600;
}

.mh-viewer-error button {
  min-width: 44px;
  min-height: 44px;
  margin-top: 16px;
  padding: 9px 14px;
  border: 1px solid #83d0b4;
  border-radius: var(--control);
  background: transparent;
  color: #edf2f4;
  cursor: pointer;
}

.mh-image-viewer [hidden] {
  display: none !important;
}

@media (max-width: 620px) {
  .mh-image-viewer {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
  }

  .mh-viewer-header,
  .mh-viewer-toolbar {
    padding: 8px;
  }

  .mh-viewer-status {
    flex: 1 0 100%;
    min-width: 0;
    margin-left: 0;
    text-align: left;
  }

  .mh-viewer-canvas {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mh-viewer-scroll {
    scroll-behavior: auto;
  }
}
