.photo-open {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  line-height: 0;
  width: 100%;
  text-align: inherit;
  cursor: zoom-in;
}
.photo-open:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.photo-viewer.sheet[open] {
  --gallery-bg: #211c20;
  --gallery-ink: #fff8f3;
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  border: 0;
  border-radius: 0;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
  overflow: hidden;
  overscroll-behavior: contain;
}
.photo-viewer::backdrop {
  background: #211c20;
}
.photo-viewer .sheet-head {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 54px;
  flex: none;
  margin: 0;
  padding: calc(5px + env(safe-area-inset-top)) clamp(10px, 3vw, 24px) 5px;
  background: none;
  color: inherit;
}
.photo-viewer .sheet-head h2 {
  flex: 1;
  margin: 0;
  font: 500 1.13rem/1.3 var(--sans);
  color: inherit;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.photo-pager .icon-btn,
.photo-viewer .sheet-head .icon-btn,
.photo-download {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gallery-ink);
  text-decoration: none;
}
.photo-viewer .sheet-head .icon-btn {
  background: #ffffff14;
}
.photo-download:not([href]) {
  visibility: hidden;
}
.photo-count {
  font: 500 0.79rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  color: #e1d4da;
  padding: 0 4px;
  white-space: nowrap;
}
.photo-viewer .dialog-feedback:empty,
.photo-stage canvas[hidden],
.photo-pager[hidden],
.photo-status:empty {
  display: none;
}
.photo-content {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  flex: 1;
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.photo-stage {
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.photo-stage img,
.photo-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  transform: translateX(var(--photo-drag, 0px));
  -webkit-user-select: none;
  user-select: none;
}
.photo-stage .photo-full {
  background-color: var(--gallery-bg);
  animation: photo-resolve 140ms ease-out both;
}
@keyframes photo-resolve {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}
.photo-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0px, 1.4vw, 12px);
  min-width: 0;
  padding: 7px clamp(4px, 2vw, 18px) 12px;
}
.photo-pager .icon-btn:disabled {
  opacity: 0.28;
}
.photo-rail {
  position: relative;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 3px;
}
.photo-rail::-webkit-scrollbar {
  display: none;
}
.photo-thumb {
  flex: 0 0 53px;
  width: 53px;
  height: 58px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
  opacity: 0.72;
}
.photo-thumb[aria-current="true"] {
  border-color: #ffddca;
}
.photo-thumb[aria-current="true"] img,
.photo-thumb:hover img {
  opacity: 1;
}
.photo-viewer :focus-visible {
  outline: 2px solid #ffddca;
  outline-offset: -2px;
}
.photo-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  width: max-content;
  color: white;
  background: #2b2429e8;
  border-radius: 14px;
  padding: 7px 13px;
  text-align: center;
  font-size: 0.85rem;
  pointer-events: none;
}
@media (max-height: 480px) {
  .photo-viewer .sheet-head {
    min-height: 44px;
    padding-block: 0;
  }
  .photo-pager {
    padding-block: 2px;
  }
  .photo-thumb {
    height: 44px;
    flex-basis: 48px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .photo-stage .photo-full {
    animation: none;
  }
}
.j-memory-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 19px;
}
.j-memory-tile .j-photo-count {
  pointer-events: none;
}
.j-photo-surface {
  position: relative;
  display: block;
}
.j-photo-surface img {
  display: block;
  width: 100%;
  aspect-ratio: 1.35;
  object-fit: cover;
}
.j-memory-tile .j-caption-button {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.j-memory-tile .j-caption-button:not(.has-photo) {
  background: transparent;
}
.lib-entry.list:has(> .lib-entry-photo) {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}
.lib-entry.list .lib-entry-photo {
  width: 46px;
}
.lib-entry:has(> .lib-entry-photo) > .lib-entry-button {
  height: auto;
}
.photo-open.lib-photo-link {
  line-height: 1.35;
}
