.gallery {
  --mat: #e9e1d6;
  padding-block: clamp(30px, 5vw, 58px) 56px;
}

.gallery-intro h1 {
  margin: 0;
  font: 700 clamp(2.55rem, 7vw, 5rem)/1.1 var(--serif);
  letter-spacing: -.045em;
}

.gallery-intro p { margin: 12px 0 0; color: var(--muted); }

.gallery-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 22px;
  padding-block: 7px;
  border-block: 1px solid var(--line);
}

.gallery-jumps a, .gallery-group-header a, .gallery-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 5px;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 650;
}

.gallery-jumps a:hover, .gallery-group-header a:hover, .gallery-back:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.gallery-group { margin-top: clamp(30px, 5vw, 51px); scroll-margin-top: 16px; }
.gallery-group-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.gallery-group-header h2 { margin: 0; font: 700 clamp(1.45rem, 3vw, 2rem)/1.35 var(--serif); }
.gallery-group-header a { flex: 0 0 auto; }

.outcome-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.outcome-card {
  height: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--card);
}

.outcome-card h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 1.025rem;
  line-height: 1.4;
}

.outcome-card h3 span { flex: 0 0 10px; height: 10px; border: 1px solid #6e574453; border-radius: 50%; }
.outcome-pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; }

.outcome-tile {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.outcome-tile:hover { border-color: var(--accent); }
.outcome-picture, .poster-frame { min-width: 0; display: grid; align-items: center; background: var(--mat); border-radius: 3px 3px 0 0; overflow: hidden; }
.outcome-picture img { width: 100%; height: auto; }
.poster-frame { aspect-ratio: 4 / 5; place-items: center; color: var(--muted); font-size: .8rem; }
.poster-frame canvas { display: block; width: 100%; height: auto; }

.outcome-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  gap: 4px;
  padding-inline: 7px;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 650;
}

.gallery-preview {
  box-sizing: border-box;
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: clamp(12px, 3vw, 20px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}

.gallery-preview[data-kind="art"] { width: min(830px, calc(100% - 24px)); }
.gallery-preview::backdrop { background: #161f2dd1; }
.gallery-preview [hidden] { display: none; }
.preview-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.preview-header h2 { margin: 0; font-size: clamp(1.05rem, 3vw, 1.35rem); line-height: 1.4; }
.preview-status { color: var(--muted); font-size: .9rem; margin-block: 14px; }
.preview-image { width: auto; height: auto; max-width: 100%; max-height: max(230px, calc(100dvh - 168px)); margin: 0 auto; object-fit: contain; }
.preview-close, .preview-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 48px;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--paper);
  font: 650 .9rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}

.preview-download { margin-top: 12px; color: var(--card); background: var(--ink); }
.preview-download:hover { opacity: .88; }
.preview-close:hover { border-color: var(--accent); }
.preview-close:focus-visible, .outcome-tile:focus-visible { outline: 3px solid #ad593f; outline-offset: 3px; }

@media (max-width: 920px) {
  .outcome-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .outcome-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .gallery-jumps { gap: 0 12px; }
}
