body[data-mode=desktop][data-appearance] .window.artist-gallery-window {
  width:min(880px,calc(100% - 24px));
}
.artist-gallery-window .artist-gallery {min-width:0}
.artist-gallery-window .artist-gallery h2 {
  margin:0 0 8px;
  font-size:clamp(16px,3vw,24px);
  line-height:1.15;
}
.artist-gallery-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(min(100%,115px),1fr));
  gap:8px;
}
.artist-gallery-grid button {
  padding:0;
  min-width:0;
  color:var(--theme-ink);
  background:transparent;
  border:1px solid var(--glass-line);
  border-radius:6px;
  overflow:hidden;
  text-align:left;
  cursor:pointer;
}
.artist-gallery-grid img {
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:1;
  object-fit:contain;
  background:color-mix(in srgb,var(--theme-ink) 5%,transparent);
}
body[data-mode][data-appearance] .window.artist-gallery-window .content {
  padding:0;
  container-type:inline-size;
}
.artist-gallery-with-sidebar {
  display:grid;
  grid-template-columns:clamp(130px,25%,174px) minmax(0,1fr);
  align-items:start;
}
.artist-gallery-sidebar {
  position:sticky;
  top:0;
  padding:7px 0;
  border-inline-end:1px solid var(--glass-line);
  background:color-mix(in srgb,var(--theme-ink) 4%,transparent);
}
.artist-gallery-sidebar button {
  display:flex;
  align-items:center;
  gap:7px;
  width:100%;
  min-height:23px;
  border:0;
  border-inline-start:2px solid transparent;
  padding:4px 7px;
  text-align:start;
  background:transparent;
  color:var(--theme-ink);
  font:inherit;
  font-size:12px;
  cursor:pointer;
}
.artist-gallery-sidebar button[aria-pressed=true] {
  border-inline-start-color:currentColor;
  background:color-mix(in srgb,currentColor 12%,transparent);
  font-weight:700;
}
.artist-gallery-sidebar svg {
  flex:none;
  width:16px;
  height:16px;
  fill:none;
  stroke:currentColor;
}
.artist-gallery-main {min-width:0;padding:8px}
.artist-gallery-toolbar,.artist-gallery-toolbar > div {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:5px 9px;
}
.artist-gallery-toolbar {justify-content:space-between;margin-bottom:8px}
.artist-gallery-window .artist-gallery-toolbar h2 {margin:0}
.artist-gallery-window .artist-gallery-toolbar .action {min-height:29px;padding:4px 8px;font-size:11px}
.artist-gallery-pages {justify-content:center;margin:8px 0 0}
body:is([data-mode=desktop],[data-mode=tablet])[data-appearance] .window.artist-gallery-window:has(.artist-gallery-viewer):not(.expanded) {
  height:min(720px,calc(100% - 24px));
  max-height:calc(100% - 24px);
}
body[data-mode][data-appearance] .window.artist-gallery-window .artist-gallery-viewer {
  display:flex;
  flex:1;
  height:auto;
  min-height:0;
  max-height:none;
  padding:0;
  overflow:hidden;
}
.artist-gallery-viewer .artist-gallery {
  flex:1;
  min-height:0;
  align-items:stretch;
}
.artist-gallery-viewer .artist-gallery-sidebar {overflow:auto}
.artist-gallery-viewer .artist-gallery-main {
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  min-height:0;
  padding:0;
}
.artist-gallery-viewer .artist-gallery-toolbar {
  margin:0;
  padding:6px 12px;
  border-bottom:1px solid var(--glass-line);
}
.artist-gallery-window .artist-gallery-toolbar [data-gallery-action="previous"],
.artist-gallery-window .artist-gallery-toolbar [data-gallery-action="next"] {
  min-width:30px;
  font-size:21px;
  line-height:1;
}
.artist-gallery-count {font-size:11px;font-variant-numeric:tabular-nums}
.artist-gallery-photo {
  display:grid;
  grid-template-rows:minmax(0,1fr) 15px;
  gap:6px;
  margin:0;
  padding:12px 14px 5px;
  text-align:center;
  min-height:0;
}
.artist-gallery-stage {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:0;
}
.artist-gallery-stage img {
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:100%;
  border-radius:8px;
}
.artist-gallery-photo figcaption {font-size:11px;color:var(--theme-muted);overflow:hidden}
.artist-gallery-filmstrip {
  position:relative;
  display:flex;
  gap:4px;
  padding:5px 8px;
  border-top:1px solid var(--glass-line);
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scrollbar-width:thin;
}
.artist-gallery-filmstrip button {
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:clamp(48px,11vh,76px);
  height:clamp(48px,11vh,76px);
  padding:4px;
  border:1px solid transparent;
  border-radius:5px;
  background:transparent;
  color:var(--theme-ink);
  cursor:pointer;
}
.artist-gallery-filmstrip button[aria-current] {
  border-color:currentColor;
  background:color-mix(in srgb,currentColor 18%,transparent);
}
.artist-gallery-filmstrip img {
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}
body[data-mode=phone][data-appearance] .window.artist-gallery-window:not(.hidden) {display:flex;flex-direction:column}
body[data-mode=phone] .artist-gallery-window :is(.titlebar,.explorer-bar) {flex-shrink:0}
body[data-mode=phone][data-appearance] .window.artist-gallery-window:has(.artist-gallery-viewer) .explorer-bar {display:none}
body[data-mode=phone][data-appearance] .window.artist-gallery-window .content {flex:1;min-height:0;max-height:none}
@container(max-width:500px) {
  .artist-gallery-with-sidebar {grid-template-columns:minmax(0,1fr)}
  .artist-gallery-sidebar {
    position:static;
    display:flex;
    padding:2px;
    border-inline-end:0;
    border-bottom:1px solid var(--glass-line);
    overflow-x:auto;
    scrollbar-width:thin;
  }
  .artist-gallery-sidebar button {flex:0 0 auto;width:auto;white-space:nowrap}
  .artist-gallery-viewer .artist-gallery {grid-template-rows:auto minmax(0,1fr)}
  .artist-gallery-viewer .artist-gallery-toolbar {flex-wrap:nowrap;padding:4px 7px}
  .artist-gallery-viewer .artist-gallery-toolbar > div {flex-wrap:nowrap;gap:5px}
  .artist-gallery-photo {padding:6px 9px 3px}
  .artist-gallery-window .artist-gallery-toolbar [data-gallery-action="collection"] {min-width:0}
  .artist-gallery-filmstrip button {width:52px;height:52px}
}
body[data-mode=phone] .artist-gallery-grid {grid-template-columns:repeat(2,minmax(0,1fr))}

/* The mobile photo viewer uses the whole screen inside the phone shell. */
body[data-mode=phone]:has(.artist-gallery-window:not(.hidden) .artist-gallery-viewer) .desktop {
  position:static;
}
body[data-mode=phone]:has(.artist-gallery-window:not(.hidden) .artist-gallery-viewer)
  :is(.phone-status,.dock-wrap,.view-switch) {
  visibility:hidden;
  pointer-events:none;
}
body[data-mode=phone][data-appearance] .window.artist-gallery-window:has(.artist-gallery-viewer) {
  inset:0!important;
  width:100%;
  height:100%;
  max-height:none;
  border:0;
  border-radius:0;
  transform:none;
}
body[data-mode=phone] .artist-gallery-window:has(.artist-gallery-viewer) > .titlebar,
body[data-mode=phone] .artist-gallery-viewer :is(.artist-gallery-sidebar,figcaption) {
  display:none;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery {
  display:flex;
  overflow:hidden;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-main {
  flex:1;
  overflow:hidden;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-toolbar {
  padding:calc(4px + env(safe-area-inset-top, 0px)) 8px 4px;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-toolbar .action {
  min-height:36px;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-photo {
  grid-template-rows:minmax(0,1fr);
  padding:4px;
  overflow:hidden;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-stage {
  position:relative;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-stage img {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  border-radius:0;
}
body[data-mode=phone] .artist-gallery-viewer .artist-gallery-filmstrip {
  padding-bottom:calc(5px + env(safe-area-inset-bottom, 0px));
}

.artist-gallery-grid-tools {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 2px 0 5px;
  background: var(--artist-paper, var(--glass-surface));
}
.artist-gallery-view-options { display: inline-flex; gap: 2px; }
.artist-gallery-view-options button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--theme-ink);
}
.artist-gallery-view-options button:is(:hover,[aria-pressed=true]) {
  border-color: var(--glass-line);
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.artist-gallery-view-options svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
@container (max-width: 500px) {
  .artist-gallery-grid-tools { position: static; }
  .artist-gallery-view-options button { width: 34px; height: 34px; }
}

.artist-gallery-grid-tools:has([data-gallery-action=edit-order]),
.artist-gallery-grid-tools:has([data-gallery-action=save-order]){
  display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:6px
}
.artist-gallery-grid-tools [role=status]{font-size:12px;color:var(--theme-ink)}
.artist-gallery-grid[data-gallery-reordering] button{
  cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none
}
.artist-gallery-grid[data-gallery-reordering] img{pointer-events:none;-webkit-user-drag:none}
.artist-gallery-grid[data-gallery-reordering] .gallery-moving{opacity:.55;outline:2px solid currentColor;cursor:grabbing}

.artist-gallery-grid[data-gallery-reordering] button[aria-pressed=true] {
  position:relative;outline:2px solid currentColor;outline-offset:-2px
}
.artist-gallery-grid[data-gallery-reordering] button[aria-pressed=true]::after {
  content:'✓';position:absolute;top:4px;right:4px;display:grid;place-items:center;
  width:20px;height:20px;border-radius:50%;background:var(--theme-ink);
  color:var(--artist-paper,var(--glass-surface));font-size:13px;font-weight:700;pointer-events:none
}
