html:has(.incident-modal[open]) { overflow: hidden; }
.record-link[data-pointer-return]:focus-visible { outline: none; }

/* The same snapshot name follows the card into the top layer and back. */
:root:not(:has(.incident-modal[open])) .incident-origin,
:root:has(.incident-origin) .incident-modal[open] { view-transition-name: incident-surface; }
:root:has(.incident-origin)::view-transition { pointer-events: none; }
::view-transition-group(incident-surface) {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(.22, .72, .2, 1);
}
::view-transition-image-pair(incident-surface) { overflow: clip; border-radius: 1rem; background: #fff; }
::view-transition-old(incident-surface), ::view-transition-new(incident-surface) {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: center top;
}
::view-transition-old(incident-surface) { animation: incident-reveal 115ms ease-out reverse both; }
::view-transition-new(incident-surface) { animation: incident-reveal 180ms 45ms ease-out backwards; }
@keyframes incident-reveal { from { opacity: 0; } to { opacity: 1; } }

.incident-modal {
  width: min(52rem, calc(100% - 3rem));
  height: min(56rem, calc(100dvh - 4rem));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--border, #dfe5df);
  border-radius: 1.15rem;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1.5rem 6rem #13241e38;
  overflow: hidden;
}
.incident-modal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.incident-modal::backdrop { background: rgb(19 33 25 / 56%); }
.incident-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem clamp(1rem, 4vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
}
.incident-toolbar p { display: flex; gap: .65rem; align-items: center; }
.incident-toolbar strong { color: var(--ink); font-weight: 500; }
.incident-close {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font: 400 1.6rem/1 sans-serif;
}
.incident-close:is(:hover, :focus-visible) { background: #eff3ed; }
.incident-modal iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 41rem) {
  .incident-modal {
    width: 100%;
    height: calc(100dvh - 1rem);
    margin: auto 0 0;
    border-radius: 1.1rem 1.1rem 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
