.project-cover > .case-cover-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.project-figure > a, .case-panel-open {
  display: block;
  position: relative;
  border-radius: 12px;
}
.case-panel-open { border-radius: 7px; }
:is(.case-cover-open, .project-figure > a, .case-panel-open) { cursor: zoom-in; }
:is(.case-cover-open, .project-figure > a, .case-panel-open):focus-visible {
  outline: 3px solid currentColor;
  outline-offset: -4px;
}
:is(.case-cover-open, .project-figure > a, .case-panel-open)::after {
  content: '放大';
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(22 27 24 / 86%);
  color: #fafaf6;
  font: 500 12px/1.5 var(--default-font-family, system-ui);
  opacity: 0;
  pointer-events: none;
}
:is(.case-cover-open, .project-figure > a, .case-panel-open):focus-visible::after { opacity: 1; }
@media (hover: hover) {
  :is(.case-cover-open, .project-figure > a, .case-panel-open):hover::after { opacity: 1; }
}
@media (hover: none) {
  :is(.case-cover-open, .project-figure > a)::after { opacity: 1; }
}

html:has(.case-viewer[open]) { overflow: hidden; }
html:has(.case-viewer[open]) .cursor-layer { visibility: hidden; }
.case-viewer {
  --cv-muted: #c1c7c0;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  color: #f6f7f3;
  background: rgb(22 27 25 / 96%);
  color-scheme: dark;
  overflow: hidden;
  overscroll-behavior: contain;
}
.case-viewer::backdrop { background: rgb(17 21 19 / 75%); }
.case-viewer[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}
.cv-bar, .cv-foot, .cv-meta, .cv-actions { display: flex; align-items: center; gap: 12px; }
.cv-bar, .cv-foot { justify-content: space-between; }
.cv-meta { min-width: 0; }
.cv-title { font-size: .9375rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.cv-count { color: var(--cv-muted); font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-actions { flex: none; gap: 6px; }
.case-viewer button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.case-viewer .cv-close { font-size: 24px; }
.case-viewer .cv-zoom { font-size: .8125rem; white-space: nowrap; }
.case-viewer .cv-prev, .case-viewer .cv-next { font-size: 20px; }
.case-viewer button:disabled { opacity: .33; cursor: default; }
@media (hover: hover) {
  .case-viewer button:enabled:hover { background: rgb(255 255 255 / 17%); }
}
.case-viewer :focus-visible { outline: 2px solid #d2e9d5; outline-offset: 2px; }
.cv-stage {
  display: flex;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
.cv-stage img {
  display: block;
  flex: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}
.cv-stage[data-zoomed] {
  --cv-panel-scale: 2;
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
}
.cv-stage[data-zoomed] img { max-width: none; max-height: none; cursor: grab; }
.cv-stage[data-zoomed] img:active { cursor: grabbing; }
.cv-stage[aria-busy]::after {
  content: '正在载入图片…';
  position: absolute;
  margin: auto;
  inset: 0;
  width: max-content;
  height: max-content;
  color: var(--cv-muted);
  font-size: .875rem;
  pointer-events: none;
}
.cv-caption {
  flex: 1;
  min-width: 0;
  max-width: 68ch;
  max-height: 5.5em;
  overflow: auto;
  text-align: center;
  color: var(--cv-muted);
  font-size: .875rem;
  line-height: 1.5;
}
@media (min-width: 720px) {
  .case-viewer { padding: 20px 32px; }
  .cv-foot { justify-content: center; gap: 24px; }
}
