/* Shared gallery details inherit each theme's palette and typography. */
.gallery-toolbar-tagline {
  display: none;
}
.gallery-toolbar-tagline em,
.browse-panel-heading em { color: inherit; }
@media (min-width: 1100px) {
  .gallery-toolbar-tagline {
    display: block;
    position: absolute;
    left: 20px;
    max-width: calc(50% - 175px);
    margin: 0;
    color: var(--ink);
    font: 18px/1.2 var(--serif);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.gallery-flavour {
  display: none;
}
@media (min-width: 2400px) {
  .gallery-flavour {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    user-select: none;
  }
  .gallery-flavour span,
  .gallery-flavour em {
    position: absolute;
    width: min(190px, calc((100vw - min(84vw, 1840px)) / 2 - 48px));
    font-family: var(--serif);
    font-size: clamp(36px, 3.1vw, 64px);
    line-height: 1.15;
    color: var(--rose);
    opacity: .14;
  }
  .gallery-flavour span {
    top: 28vh;
    left: 24px;
    transform: rotate(-8deg);
  }
  .gallery-flavour em {
    top: 53vh;
    right: 24px;
    transform: rotate(8deg);
  }
}
@media (min-width: 1301px) {
  body.site-page > .gallery-main,
  body:not(.site-page) > .gallery-main {
    width: 84vw;
    max-width: 1840px;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
  }
  body:has(> .gallery-main) > .site-header,
  body:has(> .gallery-main) > footer {
    width: calc(84vw + 128px);
    max-width: 1968px;
  }
}
@media (min-width: 1800px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.gallery-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  margin: 0 auto;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--ink) 10%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
}
.gallery-dock {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 6px auto 14px;
}
.gallery-dock-panels {
  position: static;
  order: 2;
  align-self: center;
  width: 100%;
  margin-top: 8px;
}
.gallery-dock-panel,
.gallery-dock .gallery-control-panel {
  max-height: min(68dvh, 590px);
  margin: 0;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 96%, var(--pink));
  box-shadow: 0 16px 42px color-mix(in srgb, var(--ink) 18%, transparent);
}
.gallery-dock .gallery-toolbar { order: 1; }
.gallery-dock-button {
  position: relative;
  display: grid;
  grid-template-columns: 19px auto;
  min-width: 94px;
  min-height: 44px;
  padding: 7px 14px;
  place-items: center;
  gap: 7px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.gallery-dock-button::before {
  width: 18px;
  height: 18px;
  grid-column: 1;
  grid-row: 1;
  background: currentColor;
  content: "";
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}
.gallery-dock-button > span:not(.filter-count):not(.sr-only):not([aria-hidden]),
.gallery-dock-button > strong {
  grid-column: 2;
  grid-row: 1;
  font-weight: 500;
}
.browse-tool::before { display: none; }
.browse-tool > span[aria-hidden] {
  grid-column: 1;
  grid-row: 1;
  color: var(--rose);
  font-family: var(--serif);
  font-size: 21px;
}
.gallery-dock-button:hover,
.gallery-dock-button[aria-expanded="true"],
.gallery-dock-button.has-active-filters {
  background: var(--pink);
  color: var(--rose);
}
.browse-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.browse-panel-heading p {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.1;
}
.browse-panel-heading span { color: var(--muted); font-size: 11px; }
.browse-panel-heading .browse-panel-tagline {
  display: block;
  color: var(--ink);
  font: 16px/1.3 var(--serif);
}
@media (max-width: 1099px) {
  .browse-panel-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
.gallery-browse-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.artwork-views {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.artwork-views button {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.artwork-views button.active {
  border-color: var(--rose);
  background: var(--pink);
  color: var(--ink);
}
.artwork-views button:hover {
  border-color: var(--rose);
}
.gallery-toolbar-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.gallery-tool-button {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.gallery-tool-button::before {
  width: 15px;
  height: 15px;
  background: currentColor;
  content: "";
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}
.search-tool::before {
  mask-image: url("/assets/gallery-search.e1788ee1360854e2b6350b5f499891a85c604ba59f6d234953afbd51ddd90df3.svg");
}
.filter-tool::before {
  mask-image: url("/assets/gallery-filter.0c145bc79735012d2d1bcfe9ba616c9809bd1517fa32405e9fe2407984cfc195.svg");
}
.gallery-tool-button:hover,
.gallery-tool-button[aria-expanded="true"],
.gallery-tool-button.has-active-filters {
  border-color: var(--rose);
  background: var(--pink);
  color: var(--rose);
}
.ranking-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ranking-controls[hidden] {
  display: none;
}
#ranking-view {
  width: 220px;
  max-width: 220px;
  min-height: 34px;
  padding-block: 6px;
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--paper) 88%, var(--pink));
}
.ranking-week-control {
  display: block;
}
.ranking-week-control select {
  max-width: 230px;
  min-height: 34px;
  padding-block: 6px;
}
.ranking-help-toggle {
  font-size: 13px;
  font-weight: 600;
}
.ranking-help-toggle::before {
  display: none;
}
.ranking-help-panel {
  max-width: 720px;
  margin: 10px 0 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 94%, var(--pink));
}
.ranking-help-panel[hidden] {
  display: none;
}
.ranking-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.5;
}
.ranking-help-panel .engagement-order-note {
  margin: 5px 0 0;
  font-size: 12px;
}
.ranking-status {
  margin: 0 2px 10px;
  color: var(--rose);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.5;
}
.ranking-status[hidden] {
  display: none;
}
.filter-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: none;
  min-width: 15px;
  height: 15px;
  padding-inline: 3px;
  border-radius: 999px;
  background: var(--rose);
  color: var(--paper);
  font-size: 8px;
  line-height: 15px;
  text-align: center;
}
.has-active-filters .filter-count {
  display: block;
}
.collection-browse {
  margin: 12px 0 0;
}
.collection-cards {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.collection-card {
  display: flex;
  text-align: left;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  max-width: min(220px, calc(100vw - 50px));
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 85%, var(--pink));
  scroll-snap-align: start;
  min-width: 0;
}
.collection-thumbnail-frame {
  width: 28px;
  aspect-ratio: 4 / 5;
  border-radius: 36px 36px 4px 4px;
  flex-shrink: 0;
  background: var(--paper);
}
.collection-card-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.collection-card-info strong {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collection-card-info > span {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--muted);
}
.collection-arrow {
  display: none;
  color: var(--rose);
}
.collection-card[aria-pressed="true"] {
  border-color: var(--rose);
  background: var(--pink);
}
.collection-card:hover {
  border-color: var(--rose);
}
.gallery-controls {
  border: 0;
}
.gallery-control-panel {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 94%, var(--pink));
}
.gallery-control-panel[hidden] {
  display: none;
}
.search-panel .search-label {
  min-height: 34px;
}
.search-panel input[type="search"] {
  border: 1px solid var(--line);
  padding-inline: 10px;
}
.filter-panel .filter-tabs {
  padding-top: 0;
}
.filter-panel .filter-row {
  padding-bottom: 0;
}
.engagement-order-note {
  max-width: 620px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.55;
}
.gallery-status {
  padding-block: 10px 8px;
}
.gallery-status:has(#clear[hidden]) { padding: 0; }

/* The gallery is a continuous, artwork-first feed. Portrait and panoramic
   extremes use their authored focal crop so every stage remains immersive. */
#grid.gallery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: 6px 0 clamp(48px, 8vw, 100px);
}
.feed-card-shell {
  width: min(100%, 1280px, var(--feed-max-width));
  min-width: 0;
  scroll-margin-top: 16px;
}
.feed-card-stage {
  position: relative;
}
.feed-card-shell .piece-card {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: clamp(8px, 1.1vw, 16px);
  color: #fff;
  text-align: left;
  filter: drop-shadow(0 18px 34px color-mix(in srgb, var(--ink) 16%, transparent));
}
.feed-card-shell .piece-card .image-wrap {
  position: relative;
  width: 100%;
  max-height: 88dvh;
  aspect-ratio: var(--feed-aspect);
  overflow: hidden;
  border-radius: inherit;
  background: color-mix(in srgb, var(--paper) 88%, var(--purple));
}
.feed-card-shell[data-orientation="landscape"] .piece-card .image-wrap {
  max-height: 86dvh;
}
@media (min-width: 951px) {
  .feed-card-shell[data-orientation="landscape"] {
    width: min(100%, 1760px);
  }
  .feed-card-shell[data-orientation="square"] {
    width: min(100%, 1280px, var(--feed-max-width));
  }
  .feed-card-shell[data-orientation="portrait"] {
    width: min(100%, 1040px, var(--feed-max-width));
  }
}
.feed-card-shell .piece-card img,
.feed-card-shell .piece-card:hover img {
  transform: none;
  transition: filter .35s ease;
}
.feed-card-shell .piece-card:hover img {
  filter: brightness(.97);
}
.feed-card-shell .piece-card:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 4px;
}
.feed-card-heading,
.feed-card-description {
  position: absolute;
  z-index: 2;
  right: 0;
  left: 0;
  pointer-events: none;
}
.feed-card-heading {
  top: 0;
  box-sizing: border-box;
  max-height: 50%;
  overflow: hidden;
  padding: clamp(18px, 3.3vw, 38px) clamp(20px, 4vw, 48px) clamp(42px, 8vw, 96px);
  background: linear-gradient(to bottom, rgba(18, 10, 24, .72), rgba(18, 10, 24, 0));
}
.feed-card-heading h3,
.feed-card-shell .piece-card h3 {
  height: auto;
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.25;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
  -webkit-line-clamp: 2;
}
.feed-card-shell .piece-card .card-meta {
  display: flex;
  justify-content: flex-start;
  gap: 9px;
  margin-top: 9px;
  color: rgba(255, 255, 255, .88);
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .7);
}
.feed-card-shell .piece-card .card-meta span + span::before {
  margin-right: 9px;
  content: "·";
}
.feed-card-description {
  top: 50%;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: none;
  padding: clamp(52px, 8vw, 96px) clamp(78px, 8vw, 108px) clamp(18px, 3.2vw, 38px) clamp(20px, 4vw, 48px);
  overflow: hidden;
  background: linear-gradient(to top, rgba(18, 10, 24, .78) 0%, rgba(18, 10, 24, .42) 46%, rgba(18, 10, 24, 0) 100%);
  color: rgba(255, 255, 255, .94);
  font-family: var(--serif);
  font-size: clamp(16px, 2vw, 23px);
  line-height: 1.35;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .75);
}
.feed-card-description > span {
  display: -webkit-box;
  width: min(100%, 760px);
  overflow: hidden;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.feed-card-actions {
  position: absolute;
  z-index: 3;
  right: clamp(10px, 2vw, 24px);
  bottom: clamp(14px, 2.5vw, 30px);
  display: grid;
  gap: 10px;
}
.feed-action {
  position: relative;
  display: grid;
  box-sizing: border-box;
  width: clamp(44px, 4.2vw, 54px);
  height: clamp(44px, 4.2vw, 54px);
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 50%;
  background: rgba(20, 13, 28, .62);
  color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .32);
  backdrop-filter: blur(8px);
  line-height: 1;
}
.feed-action-like[aria-pressed="mixed"] svg {
  opacity: .72;
}
.feed-action-like[aria-pressed="mixed"]::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(20, 13, 28, .5);
  border-radius: 50%;
  background: #fff;
  content: "";
}
.feed-action svg {
  display: block;
  width: clamp(19px, 2vw, 23px);
  height: clamp(19px, 2vw, 23px);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feed-action:hover,
.feed-action:focus-visible {
  border-color: #fff;
  background: color-mix(in srgb, var(--rose) 78%, rgba(20, 13, 28, .8));
}
.feed-action-like[aria-pressed="true"] {
  background: color-mix(in srgb, var(--rose) 86%, rgba(20, 13, 28, .8));
}
.feed-action:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.feed-card-shell .commission-badge {
  z-index: 3;
  top: auto;
  right: clamp(68px, 8vw, 100px);
  bottom: clamp(18px, 3.2vw, 38px);
}
.feed-card-shell .preview-badge {
  z-index: 3;
  top: auto;
  bottom: clamp(18px, 3.2vw, 38px);
  left: clamp(20px, 4vw, 48px);
}
.feed-card-shell .owner-gallery-stats {
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--paper);
  color: var(--muted);
}
.feed-engagement-runtime {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
.feed-engagement-runtime[data-public-feed-runtime="true"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}
.feed-engagement-runtime .artwork-engagement {
  width: 100%;
  margin: 0;
}
.feed-engagement-runtime .engagement-like {
  display: none;
}
.feed-engagement-runtime :is(.engagement-comments, .engagement-comment-form) {
  display: none !important;
}
@media (max-width: 650px) {
  .gallery-dock {
    width: 100vw;
    margin: 0 calc(50% - 50vw) 14px;
  }
  .gallery-dock .gallery-toolbar {
    display: flex;
    grid-template-columns: none;
    width: 100%;
    min-height: 58px;
    margin: 0;
    padding-inline: 8px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .gallery-dock-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
  }
  .gallery-dock-panels {
    align-self: center;
    width: 100vw;
  }
  .gallery-dock-panel,
  .gallery-dock .gallery-control-panel {
    max-height: min(70dvh, 520px);
    padding: 14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
  .browse-panel-heading span { display: none; }
  .gallery-browse-options,
  .ranking-controls { align-items: stretch; }
  .artwork-views,
  .ranking-controls { width: 100%; }
  .artwork-views button { flex: 1; min-height: 44px; padding: 8px 10px; }
  #ranking-view,
  .ranking-week-control,
  .ranking-week-control select { width: 100%; max-width: none; min-height: 44px; }
  .ranking-controls { flex-wrap: wrap; }
  .ranking-controls #ranking-view { flex: 1 1 210px; }
  .ranking-controls .ranking-week-control { flex: 1 1 210px; }
  .ranking-help-toggle { flex: 0 0 44px; width: 44px; height: 44px; }
  .collection-card { min-height: 44px; }
  .gallery-dock .filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .gallery-dock .filter-tabs button {
    min-height: 44px;
    padding: 8px;
  }
  .gallery-dock .filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .gallery-dock .filter-row label,
  .gallery-dock .filter-row select,
  .gallery-dock .surprise { width: 100%; max-width: none; min-height: 44px; }
  .gallery-dock .search-label,
  .gallery-dock .search-label input { min-height: 44px; }
  .gallery-dock :is(input, select, textarea) { font-size: 16px; }
  .gallery-status { padding-block: 6px; }
  #grid.gallery-grid {
    gap: 30px;
    margin-inline: calc(50% - 50vw);
  }
  .feed-card-shell {
    width: min(100vw, var(--feed-max-width));
  }
  .feed-card-shell .piece-card,
  .feed-card-shell .piece-card .image-wrap {
    border-radius: 0;
  }
  .feed-card-heading {
    padding: 14px 18px 26px;
  }
  .feed-card-heading h3,
  .feed-card-shell .piece-card h3 {
    font-size: clamp(25px, 8vw, 36px);
  }
  .feed-card-description {
    padding: 38px 72px 14px 18px;
    font-size: 16px;
  }
  .feed-card-description > span {
    -webkit-line-clamp: 2;
  }
  .feed-card-shell[data-orientation="landscape"] .feed-card-heading h3 {
    font-size: 24px;
    -webkit-line-clamp: 1;
  }
  .feed-card-shell[data-orientation="landscape"] .feed-card-heading {
    padding-block: 12px 20px;
  }
  .feed-card-shell[data-orientation="landscape"] .feed-card-description {
    padding-top: 26px;
    font-size: 14px;
  }
  .feed-card-shell[data-orientation="landscape"] .feed-card-description > span {
    -webkit-line-clamp: 2;
  }
  .feed-card-actions {
    right: 10px;
    bottom: 14px;
    gap: 8px;
  }
  .feed-card-shell .commission-badge {
    right: 62px;
    bottom: 16px;
  }
  .feed-card-shell .preview-badge {
    bottom: 16px;
    left: 18px;
  }
}
@media (max-width: 350px) {
  .gallery-dock .ranking-controls #ranking-view { flex-basis: 100%; }
  .gallery-dock .ranking-help-toggle { margin-left: auto; }
}
.owner-gallery-stats{display:flex;flex-wrap:wrap;gap:5px 10px;margin-top:7px;color:var(--muted);font-size:10px;line-height:1.4}
.owner-gallery-stats{padding-top:7px;border-top:1px solid var(--line)}
.owner-stat-score{color:var(--ink);font-weight:600}
.owner-stat-pending{color:var(--rose);font-weight:600}
.owner-artwork-stats {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 94%, var(--pink));
}
.owner-artwork .owner-artwork-stats h4 { margin: 0 0 8px; font-size: 1.2rem; }
.owner-artwork-stats-status,
.owner-artwork-stats-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.owner-artwork-stats-values { margin: 10px 0; }
.owner-artwork-stats-values > div {
  display: grid;
  grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr);
  gap: 10px 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.owner-artwork-stats-values dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.owner-artwork-stats-values dd {
  min-width: 0;
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.feed-action-count,
.viewer-action-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  box-sizing: border-box;
  min-width: 19px;
  height: 19px;
  margin: 0;
  padding: 0 4px;
  place-items: center;
  border: 1.5px solid #fff;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rose) 88%, #241527);
  color: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .42);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  pointer-events: none;
}
.public-comment-count[hidden],
.feed-action-count[hidden],
.viewer-action-count[hidden] { display: none; }
.piece-collections {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 18px 0;
  font-size: 12px;
}
.collection-caption {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.piece-collections a,
.piece-permalink {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--rose);
}
.piece-permalink {
  font-size: 11px;
  align-self: flex-start;
  margin-block: 8px 12px;
}
.artwork-sharing {
  margin-block: 18px;
  padding-block: 16px;
  border-block: 1px solid var(--line);
}
.artwork-sharing[hidden] { display: none; }
.sharing-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sharing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sharing-actions button,
.sharing-actions a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.sharing-actions [hidden] { display: none; }
.sharing-actions :is(button, a):hover,
.sharing-actions :is(button, a):focus-visible {
  border-color: var(--rose);
  background: var(--pink);
}
.sharing-url-label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}
.sharing-url {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 5px;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper) 88%, var(--pink));
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}
.sharing-status {
  min-height: 1.4em;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

body > .artwork-share-dialog {
  --share-dialog-top-gap: max(24px, min(12dvh, 120px), env(safe-area-inset-top));
  position: fixed;
  top: calc(var(--panel-visible-top, 0px) + var(--share-dialog-top-gap));
  right: auto;
  bottom: auto;
  left: 50%;
  z-index: 30;
  display: none;
  flex-direction: column;
  width: min(420px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(var(--panel-visible-height, 100dvh) - var(--share-dialog-top-gap) - max(12px, env(safe-area-inset-bottom)));
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 16px 54px color-mix(in srgb, var(--ink) 30%, transparent);
}
body > .artwork-share-dialog[open] { display: flex; }
body > .artwork-share-dialog::backdrop {
  background: rgba(12, 8, 16, .42);
  backdrop-filter: blur(2px);
}
.artwork-share-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.artwork-share-toolbar h2 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}
.artwork-share-close {
  display: grid;
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}
.artwork-share-close:hover {
  border-color: var(--rose);
  background: var(--pink);
}
.artwork-share-close:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 2px;
}
.artwork-share-content {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  scroll-padding-block: 16px;
  touch-action: pan-y pinch-zoom;
}
.artwork-share-content .sharing-label { display: none; }

@media (max-width: 650px) {
  body > .artwork-share-dialog {
    top: calc(var(--panel-visible-top, 0px) + var(--panel-visible-height, 100dvh) - max(8px, env(safe-area-inset-bottom)));
    width: calc(100vw - 16px);
    max-height: calc(var(--panel-visible-height, 100dvh) - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    transform: translate(-50%, -100%);
    border-radius: 16px;
  }
  .artwork-share-toolbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .artwork-share-content {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }
}
.piece-sources {
  margin-block: 18px 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.commission-badge {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ink) 15%, transparent);
}
.piece-commission {
  display: grid;
  gap: 9px;
  margin-block: 14px 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 85%, var(--pink));
  overflow-wrap: anywhere;
}
.piece-commission[hidden] {
  display: none;
}
#piece-commission-label {
  margin: 0;
  color: var(--rose);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
#piece-creator h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 500;
}
#piece-creator-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 7px;
  font-size: 11px;
}
#piece-creator-links a {
  color: var(--rose);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.piece-character,
.piece-commission-notes {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.piece-character {
  color: var(--muted);
}
.piece-sources h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.piece-sources ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.piece-sources p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}
.piece-sources a {
  color: var(--rose);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.source-credit-note {
  color: var(--muted);
  white-space: pre-wrap;
}
.camera-settings {
  margin-block: 18px 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.camera-settings h2,
.camera-settings h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.camera-settings dl { margin: 0; }
.camera-settings dl > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, .8fr) minmax(0, 1.2fr);
  gap: 8px 16px;
  padding-block: 7px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.camera-settings dl > div:first-child { border-top: 0; }
.camera-settings dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.camera-settings dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
}
#piece-title,
.piece-card h3 {
  overflow-wrap: anywhere;
}
#piece-position {
  white-space: nowrap;
}
#lightbox .piece-info {
  min-width: 0;
}
#lightbox .lightbox-image {
  background: color-mix(in srgb, var(--paper) 78%, var(--purple));
}
#lightbox .piece-info .tags:empty {
  display: none;
}
@media (max-width: 650px) {
  .gallery-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: 24px;
  }
  .artwork-views {
    order: 0;
    gap: 4px;
  }
  .artwork-views button {
    min-height: 44px;
    padding: 4px 7px;
    font-size: 10px;
    letter-spacing: 0;
  }
  .gallery-toolbar-actions {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .gallery-tool-button,
  #ranking-view,
  .ranking-week-control select {
    min-height: 44px;
  }
  .gallery-tool-button {
    width: 44px;
    height: 44px;
  }
  .ranking-controls {
    grid-column: 1 / -1;
    margin-left: 0;
    flex-wrap: wrap;
    min-width: 0;
  }
  #ranking-view {
    order: 1;
    width: 0;
    min-width: 0;
    max-width: none;
    flex: 1 1 calc(100% - 50px);
  }
  .ranking-week-control {
    order: 3;
    flex: 1 0 100%;
    min-width: 0;
  }
  .ranking-week-control select {
    width: 100%;
    max-width: none;
  }
  .ranking-help-toggle {
    order: 2;
  }
  .filter-panel .filter-tabs {
    overflow-x: auto;
    justify-content: flex-start;
  }
  .filter-panel .filter-tabs button {
    flex: 0 0 auto;
  }
  .filter-panel .filter-row label {
    flex: 1 1 calc(50% - 5px);
  }
  .filter-panel .filter-row select {
    width: 100%;
    max-width: none;
  }
  #lightbox .piece-info {
    padding: 24px 20px;
  }
  #lightbox .lightbox-image {
    min-height: 180px;
  }
}
.artwork-index {
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-wrap: anywhere;
}
.artwork-index summary {
  cursor: pointer;
}
.artwork-index ul,
.artwork-index nav {
  margin-top: 1rem;
}
.artwork-index li {
  margin: .65rem 0;
}
.artwork-index a {
  text-decoration: underline;
  text-underline-offset: .2em;
}

/* Fullscreen artwork keeps the image as the stage and layers the same quiet
   caption and action treatment used by the feed around it. */
#lightbox {
  inset: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  background: #100c16;
  color: #fff;
}
#lightbox[open] { display: block; }
.artwork-viewer {
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  background: #100c16;
}
.viewer-toolbar {
  position: absolute;
  z-index: 8;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  left: max(10px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font-size: 13px;
  pointer-events: none;
}
.viewer-toolbar button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: rgba(20, 13, 28, .64);
  color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.viewer-toolbar button:hover { background: rgba(70, 29, 62, .88); }
.viewer-toolbar button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.viewer-toolbar button:disabled { opacity: .4; cursor: default; }
.viewer-toolbar #piece-position {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(20, 13, 28, .54);
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 1px 6px #000;
  backdrop-filter: blur(8px);
}
.viewer-spacer { flex: 1; }
#lightbox .viewer-close {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  background: rgba(20, 13, 28, .64);
  color: #fff;
}
#lightbox .viewer-close:hover {
  border-color: #fff;
  background: rgba(70, 29, 62, .88);
}
#lightbox .viewer-close:focus-visible { outline-offset: 1px; }
#lightbox .viewer-close svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}
#lightbox .artwork-viewer #image-viewport {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  min-height: 0;
  touch-action: none;
  user-select: none;
  cursor: default;
}
#image-viewport[data-zoomed="true"] { cursor: grab; }
#image-viewport[data-dragging="true"] { cursor: grabbing; }
#lightbox #piece-image {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: center;
  pointer-events: none;
  user-select: none;
}
#lightbox .piece-info { padding: 20px; }
body:has(#lightbox[open]) { overflow: hidden; }

#lightbox .viewer-description {
  position: absolute;
  z-index: 5;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: min(46dvh, 34rem);
  box-sizing: border-box;
  padding: clamp(66px, 10vh, 132px) max(150px, 10vw) max(24px, env(safe-area-inset-bottom)) clamp(24px, 4vw, 58px);
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(to top, rgba(13, 8, 18, .86) 0%, rgba(13, 8, 18, .62) 44%, rgba(13, 8, 18, 0) 100%);
  scrollbar-color: rgba(255, 255, 255, .42) transparent;
  pointer-events: none;
}
#lightbox .viewer-description[hidden] { display: none; }
#lightbox #viewer-description-text {
  display: block;
  min-width: 0;
  max-width: 720px;
  margin: 0;
  overflow: visible;
  color: rgba(255, 255, 255, .94);
  font-family: var(--serif);
  font-size: clamp(16px, 1.4vw, 21px);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .82);
  -webkit-line-clamp: initial;
  pointer-events: auto;
}
#lightbox #viewer-description-details {
  display: none !important;
}

/* Also available when the public engagement stylesheet is absent (owner view). */
#lightbox #piece-engagement-overlay {
  position: absolute;
  z-index: 7;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: min(340px, calc(100% - 32px));
  min-width: 0;
  max-height: calc(100dvh - 96px);
  box-sizing: border-box;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  pointer-events: none;
}
.viewer-action-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.viewer-action {
  position: relative;
  display: grid;
  box-sizing: border-box;
  width: clamp(46px, 4.2vw, 54px);
  height: clamp(46px, 4.2vw, 54px);
  min-height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 50%;
  background: rgba(20, 13, 28, .64);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
  backdrop-filter: blur(9px);
  cursor: pointer;
  pointer-events: auto;
}
.viewer-action-row > .viewer-action {
  padding: 0;
  place-items: center;
  line-height: 1;
}
.viewer-action svg {
  display: block;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viewer-action:hover { border-color: #fff; background: rgba(70, 29, 62, .92); }
.viewer-action:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.viewer-action:disabled { cursor: wait; opacity: .68; }
.viewer-action[data-action="like"][aria-pressed="true"] { background: color-mix(in srgb, var(--rose) 86%, rgba(20, 13, 28, .8)); }
.viewer-action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#lightbox .viewer-action-row .engagement-overlay-status,
#lightbox .viewer-action-row .engagement-like-challenge:not(:empty) {
  align-self: flex-end;
  box-sizing: border-box;
  width: min(100%, 320px);
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 8px;
  background: rgba(20, 13, 28, .94);
  color: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .34);
  text-align: left;
  pointer-events: none;
}
#lightbox .viewer-action-row .engagement-overlay-status:empty { display: none; }
#lightbox #piece-engagement-overlay :is(button, a, input, textarea, select, iframe),
#lightbox .viewer-action-row .engagement-like-challenge:not(:empty) {
  pointer-events: auto;
}

body > #artwork-panel {
  position: fixed;
  top: calc(var(--panel-visible-top, 0px) + max(12px, env(safe-area-inset-top)));
  right: max(12px, env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  z-index: 20;
  width: min(480px, calc(100vw - 24px));
  max-width: none;
  height: calc(var(--panel-visible-height, 100dvh) - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  max-height: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 48px color-mix(in srgb, var(--ink) 25%, transparent);
}
body > #artwork-panel[open] { display: flex; }
body > #artwork-panel::backdrop {
  background: rgba(12, 8, 16, .5);
  backdrop-filter: blur(2px);
}
body > #artwork-panel [hidden] { display: none; }
.artwork-panel-heading {
  flex: 0 0 auto;
  margin: 0;
  padding: 16px 16px 8px;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artwork-panel-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.artwork-panel-switcher { display: flex; gap: 4px; }
.artwork-panel-toolbar button { min-height: 44px; padding: 8px; border-radius: 8px; }
.artwork-panel-toolbar button[aria-pressed="true"] { background: var(--pink); color: var(--ink); }
.artwork-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  scroll-padding-block: 16px;
  touch-action: pan-y pinch-zoom;
}
body > #artwork-panel #back-to-artwork { margin: 0; }
#piece-comments h3 { margin-top: 0; }
@media (max-width: 650px) {
  #lightbox .artwork-viewer #image-viewport { background: #100c16; }
  #lightbox .viewer-description {
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    width: auto;
    max-height: none;
    gap: 4px;
    padding: 9px max(76px, calc(env(safe-area-inset-right) + 68px)) max(9px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, .18);
    background: #100c16;
  }
  #lightbox .viewer-description[hidden] { display: none; }
  #lightbox #viewer-description-text {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  #lightbox #viewer-description-details {
    display: block !important;
    justify-self: start;
    min-height: 28px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .94);
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    pointer-events: auto;
  }
  #lightbox #viewer-description-details[hidden] { display: none !important; }
  #lightbox[data-zoomed="true"] .viewer-description {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
  #lightbox #piece-engagement-overlay {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: min(280px, calc(100% - 20px));
  }
  #lightbox .viewer-action-row { gap: 8px; }
  .viewer-action { width: 46px; height: 46px; }
  body > #artwork-panel {
    --panel-sheet-height: min(82dvh, 760px, var(--panel-visible-height, 100dvh));
    top: calc(var(--panel-visible-top, 0px) + var(--panel-visible-height, 100dvh) - var(--panel-sheet-height));
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: var(--panel-sheet-height);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .artwork-panel-toolbar { padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  body > #artwork-panel .piece-info { padding: 16px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left)); }
  .owner-artwork-stats-values > div { grid-template-columns: 1fr; gap: 3px; }
  .viewer-toolbar { gap: 4px; padding-inline: 4px; }
}
@media (max-width: 650px) and (max-height: 650px) {
  #lightbox #viewer-description-text { -webkit-line-clamp: 1; }
  #lightbox #piece-engagement-overlay {
    top: calc(42dvh + 4px);
    bottom: max(10px, env(safe-area-inset-bottom));
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}
@media (max-height: 450px) {
  .viewer-caption { max-height: 46dvh; }
  .viewer-caption #zoom-detail-help { display: none; }
  #lightbox #viewer-description-text { font-size: 14px; line-height: 1.35; }
  .viewer-action { width: 42px; height: 42px; min-height: 42px; }
}
@media (min-width: 651px) and (max-height: 450px) and (pointer: fine) {
  #lightbox .viewer-description {
    width: 100%;
    max-height: 44dvh;
    padding-top: 38px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}
@media (min-width: 651px) and (max-height: 450px) and (pointer: coarse) {
  #lightbox .artwork-viewer #image-viewport { background: #100c16; }
  #lightbox .viewer-description {
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    width: auto;
    max-height: none;
    gap: 2px;
    padding: 6px max(72px, calc(env(safe-area-inset-right) + 64px)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, .18);
    background: #100c16;
  }
  #lightbox .viewer-description[hidden] { display: none; }
  #lightbox #viewer-description-text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }
  #lightbox #viewer-description-details {
    display: block !important;
    justify-self: start;
    min-height: 26px;
    padding: 1px 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .94);
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    pointer-events: auto;
  }
  #lightbox #viewer-description-details[hidden] { display: none !important; }
  #lightbox[data-zoomed="true"] .viewer-description {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

.viewer-caption {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  left: 0;
  max-height: 42dvh;
  box-sizing: border-box;
  padding: max(68px, calc(env(safe-area-inset-top) + 58px)) clamp(24px, 4vw, 58px) clamp(56px, 8vh, 110px);
  overflow: auto;
  text-align: left;
  background: linear-gradient(to bottom, rgba(13, 8, 18, .8) 0%, rgba(13, 8, 18, .5) 52%, rgba(13, 8, 18, 0) 100%);
  scrollbar-color: rgba(255, 255, 255, .42) transparent;
  pointer-events: none;
}
.viewer-caption h2 {
  margin: 0;
  max-width: min(1050px, calc(100% - 120px));
  color: #fff;
  font-size: clamp(27px, 3vw, 42px);
  line-height: 1.05;
  font-weight: 600;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .64);
  pointer-events: auto;
}
.viewer-caption p {
  margin: 3px 0 0;
  max-width: min(1050px, calc(100% - 120px));
  color: rgba(255, 255, 255, .86);
  font-size: clamp(11px, 1.1vw, 14px);
  line-height: 1.4;
  letter-spacing: .04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .78);
  pointer-events: auto;
}
.viewer-caption #zoom-detail-help {
  margin-top: 6px;
  color: rgba(255, 255, 255, .9);
  font-size: 12px;
  letter-spacing: 0;
}

#deepzoom-viewport {
  position: absolute;
  inset: 0;
  transition: opacity 220ms ease;
}
#deepzoom-viewport[data-ready="false"] { opacity: 0; }
#deepzoom-viewport[data-ready="true"] { opacity: 1; }
#deepzoom-viewport[hidden], #deepzoom-status[hidden], #image-status[hidden] { display: none; }
#deepzoom-status, #image-status {
  position: absolute; bottom: 8px; left: 8px; right: 8px; z-index: 2;
  margin: 0; padding: 8px 12px; border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 13px;
  pointer-events: none;
}

#image-status { bottom: auto; top: 8px; }

@media (prefers-reduced-motion: reduce) {
  #deepzoom-viewport { transition: none; }
}

.artwork-fallback {
  width: min(100%, 920px);
  margin: 24px auto 48px;
  padding: clamp(18px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--ink) 10%, transparent);
  box-sizing: border-box;
  overflow-wrap: anywhere;
}
.artwork-fallback > h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.1;
}
.artwork-fallback > h1 + p { margin-top: 0; color: var(--muted); }
.artwork-fallback > img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(72vh, 900px);
  margin: 24px auto;
  border-radius: 12px;
  object-fit: contain;
}
.artwork-fallback #artwork-page-details,
.artwork-fallback #artwork-public-comments {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.artwork-fallback h2 { margin-top: 0; font-family: var(--serif); }
.artwork-fallback ol,
.artwork-fallback ul { padding-left: 1.35rem; }
.artwork-fallback li + li { margin-top: 18px; }
.artwork-fallback li p { margin-block: 5px; white-space: pre-wrap; }
.artwork-fallback a { overflow-wrap: anywhere; }
@media (max-width: 650px) {
  .artwork-fallback {
    margin-block: 16px 32px;
    border-radius: 12px;
  }
  .artwork-fallback > img { margin-block: 18px; }
  .camera-settings dl > div { grid-template-columns: minmax(6.5rem, .75fr) minmax(0, 1.25fr); }
}

/* Opacity preserves the artwork geometry throughout pinch and pan gestures. */
#lightbox .artwork-viewer > :not(#image-viewport) { transition: opacity 180ms ease; }
#lightbox[data-chrome-hidden="true"] .artwork-viewer > :not(#image-viewport),
#lightbox[data-chrome-hidden="true"] #image-status,
#lightbox[data-chrome-hidden="true"] #deepzoom-status { opacity: 0; pointer-events: none; }
#lightbox[data-chrome-hidden="true"][data-compact-description="true"] #piece-engagement-overlay { opacity: 1; }
#lightbox[data-chrome-hidden="true"][data-compact-description="true"] .viewer-action-row > :not(#show-details) {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  #lightbox .artwork-viewer > :not(#image-viewport) { transition: none; }
}
