#app-gallery.app-case-gallery {
  position: static;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: clamp(56px, 7vw, 122px) clamp(12px, 1.2vw, 24px);
  padding: clamp(18px, 3vw, 50px) 0 0;
}

.app-case-card {
  grid-column: 1 / 6;
  min-width: 0;
  --case-background: #dedbd4;
  --case-rim: #e9e6de;
}

.app-case-card.app-case-feature {
  grid-column: 5 / -1;
}

.app-case-card.app-case-offset {
  grid-column: 7 / 12;
  margin-top: clamp(40px, 7vw, 108px);
}

.app-case-card[data-appearance="midyear"] {
  --case-background: #2f115d;
  --case-rim: #523094;
}

.app-case-card[data-appearance="dark"] {
  --case-background: #122326;
  --case-rim: #254747;
}

.app-case-card[data-appearance="floral"] {
  --case-background: #efd5db;
  --case-rim: #fae8e9;
}

.app-case-button {
  display: block;
  width: 100%;
  text-align: start;
  padding: 0;
}

.app-case-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 1.55;
  background: var(--case-background);
}

.app-case-feature .app-case-art {
  aspect-ratio: 1.92;
}

.app-case-frames {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  transition: transform .65s cubic-bezier(.22, 1, .36, 1);
}

.app-case-button:is(:hover, :focus-visible) .app-case-frames {
  transform: scale(1.035);
}

.app-case-frames img {
  display: block;
  position: relative;
  flex: none;
  width: auto;
  height: 81%;
  max-width: 31%;
  object-fit: contain;
  filter: drop-shadow(0 13px 18px #0004);
  transform: translateY(3%);
}

.app-case-frames img:first-child {
  z-index: 1;
  transform: translateY(-4%);
}

.app-case-card:not(.app-case-feature) .app-case-frames img {
  margin: 0 2.5%;
  height: 85%;
}

.app-case-feature .app-case-frames img {
  margin: 0 2.4%;
  height: 85%;
}

.app-case-feature .app-case-frames img:last-child {
  align-self: flex-start;
  margin-top: 7%;
  height: 109%;
  clip-path: inset(0 round 12px);
}

.app-case-tag {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 0;
  padding: 3px 6px;
  color: #0b0c05;
  background: var(--accent, #c0fe04);
  font: 11px/1.15 var(--mono, monospace);
  white-space: nowrap;
}

.app-case-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 11px;
}

.app-case-title {
  font-size: clamp(13px, 1.1vw, 17px);
  font-weight: 500;
}

.app-case-year {
  flex: none;
  font: 12px/1.25 var(--mono, monospace);
}

.app-case-dialog {
  width: min(1220px, calc(100vw - 72px));
  max-width: none;
  max-height: calc(100vh - 60px);
  border: 1px solid var(--line, #0003);
  background: var(--paper, #efede7);
  color: var(--ink, #121212);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.app-case-dialog::backdrop {
  background: #25241e66;
  backdrop-filter: blur(8px);
}

.app-case-dialog[open] {
  animation: app-case-enter .32s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes app-case-enter {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-case-dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px clamp(22px, 4vw, 52px) 16px;
  background: var(--paper, #efede7);
  border-bottom: 1px solid var(--line, #0003);
}

.app-case-meta {
  font: 11px/1.4 var(--mono, monospace);
}

.app-case-dialog-title {
  margin-top: 5px;
  font-size: clamp(25px, 3vw, 42px);
  font-weight: 630;
  letter-spacing: -.045em;
}

.app-case-close,
.app-case-tab {
  padding: 5px 7px;
  white-space: nowrap;
  font: 12px/1.35 var(--mono, monospace);
}

.app-case-close:hover,
.app-case-tab:hover {
  outline: 1px dotted currentColor;
}

.app-case-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  padding: 16px clamp(22px, 4vw, 52px);
}

.app-case-tab[aria-pressed="true"] {
  background: var(--accent, #c0fe04);
  color: #0b0c05;
}

.app-case-content {
  display: grid;
  grid-template-columns: repeat(var(--app-case-columns, 3), minmax(0, 1fr));
  justify-content: center;
  gap: clamp(12px, 2.3vw, 36px);
  padding: 0 clamp(22px, 4vw, 52px) 26px;
}

.app-case-figure {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  margin: 0;
}

.app-case-figure img {
  display: block;
  width: 100%;
  height: min(55vh, 580px);
  object-fit: contain;
}

.app-case-content[data-expanded] .app-case-figure img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
}

.app-case-figure-label {
  text-align: center;
  font: 12px/1.35 var(--mono, monospace);
}

@media (max-width: 840px) {
  .app-case-card { grid-column: 1 / 7; }
  .app-case-card.app-case-feature { grid-column: 3 / -1; }
  .app-case-card.app-case-offset { grid-column: 7 / -1; }
}

@media (max-width: 560px) {
  #app-gallery.app-case-gallery { gap: 34px; }
  .app-case-card,
  .app-case-card.app-case-feature,
  .app-case-card.app-case-offset { grid-column: 1 / -1; margin: 0; }
  .app-case-dialog { width: calc(100vw - 24px); }
  .app-case-content { grid-template-columns: 1fr; }
  .app-case-figure img { height: min(65vh, 500px); }
}

@media (prefers-reduced-motion: reduce) {
  .app-case-art .app-case-frames { transition: none; }
  .app-case-dialog[open] { animation: none; }
}
