/* Refresh galleries: a quiet exhibition around the original live canvases. */
html { color-scheme: dark; scrollbar-color: var(--refresh-line) var(--refresh-ink); }
body.gallery-page, body.study-page { margin: 0; background: var(--refresh-ink); color: var(--refresh-paper); font-family: var(--refresh-text); }
.gallery-page *, .study-page * { box-sizing: border-box; }
.gallery-page ::selection, .study-page ::selection { background: var(--refresh-mint); color: var(--refresh-ink); }
.gallery-page a, .study-page a { color: inherit; text-underline-offset: .3em; }
.gallery-page :focus-visible, .study-page :focus-visible { outline: 2px solid var(--refresh-gold); outline-offset: 5px; }
.gallery-page button, .study-page button { font: inherit; }
.gallery-page button, .study-page button, .gallery-page a, .study-page a { -webkit-tap-highlight-color: transparent; }
.gallery-skip { position: fixed; top: -5rem; left: 1rem; z-index: 30; padding: 1rem; background: var(--refresh-mint); color: var(--refresh-ink) !important; }
.gallery-skip:focus { top: 1rem; }
.gallery-layout { width: min(100% - clamp(2rem, 6vw, 7rem), 88rem); margin-inline: auto; }
.gallery-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-block: 2.5rem 1.1rem; }
.gallery-heading h1 { margin: 0; font: 500 clamp(2.1rem, 4vw, 3.5rem)/1.06 var(--refresh-display); letter-spacing: -.04em; }
.gallery-heading p { color: var(--refresh-muted); font-size: .875rem; margin: 0; }
.gallery-room { --room-accent: var(--refresh-mint); display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, .42fr); grid-template-areas: 'stage notes' 'caption notes' 'strip notes'; gap: 0 clamp(2rem, 5vw, 5rem); padding-block: 1.3rem 3.5rem; }
.gallery-room[data-color=rose] { --room-accent: var(--refresh-rose); }
.gallery-room[data-color=gold] { --room-accent: var(--refresh-gold); }
.gallery-stage { grid-area: stage; position: relative; min-width: 0; height: min(56dvh, 42rem); min-height: 22rem; display: grid; place-items: center; background: var(--refresh-surface); overflow: hidden; }
.gallery-stage::before { content: ''; position: absolute; inset: 0; z-index: 1; border: 1px solid var(--refresh-line); pointer-events: none; }
.gallery-stage iframe { position: relative; display: block; width: min(100% - 3rem, 50dvh); height: auto; aspect-ratio: 1; border: 0; box-shadow: 0 1.6rem 3rem color-mix(in srgb, var(--refresh-ink) 65%, transparent); background: var(--refresh-ink); }
.gallery-stage > img { position: relative; display: block; width: auto; height: auto; max-width: calc(100% - 3rem); max-height: 50dvh; object-fit: contain; box-shadow: 0 1.6rem 3rem color-mix(in srgb, var(--refresh-ink) 65%, transparent); }
.gallery-stage.is-changing iframe, .gallery-stage.is-changing > img { animation: gallery-arrive .65s var(--refresh-ease) both; }
@keyframes gallery-arrive { from { clip-path: inset(0 100% 0 0); transform: translateX(1rem); } to { clip-path: inset(0); transform: translateX(0); } }
.gallery-loading { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: .7rem; color: var(--refresh-muted); background: var(--refresh-surface); padding: 2rem; z-index: 2; }
.gallery-loading[hidden] { display: none; }
.gallery-loading a { color: var(--refresh-mint); }
.gallery-caption { grid-area: caption; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1rem .8rem; }
.gallery-art-title { margin: 0; font: 500 clamp(1.2rem, 2vw, 1.7rem)/1.2 var(--refresh-display); letter-spacing: -.025em; }
.gallery-art-title a { text-decoration: none; }
.gallery-art-title a:hover { color: var(--refresh-mint); }
.gallery-art-meta { margin: .35rem 0 0; color: var(--refresh-muted); font-size: .8rem; }
.gallery-step { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.gallery-button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 44px; padding: .65rem .9rem; color: var(--refresh-paper); border: 1px solid var(--refresh-line); border-radius: 4px; background: transparent; cursor: pointer; text-decoration: none; font-size: .82rem !important; transition: color .2s, background .2s, border-color .2s; }
.gallery-button:hover { border-color: var(--refresh-mint); color: var(--refresh-mint); background: var(--refresh-blue-ink); }
.gallery-button:disabled { opacity: .5; cursor: wait; }
.gallery-position { color: var(--refresh-muted); font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 2.9rem; text-align: center; }
.gallery-notes { grid-area: notes; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding-top: 1rem; }
.gallery-notes h2 { margin: 0; font: 500 clamp(2rem, 3.2vw, 3.5rem)/1.03 var(--refresh-display); letter-spacing: -.04em; text-wrap: balance; }
.gallery-notes > p { max-width: 32ch; margin: 1.3rem 0; color: var(--refresh-muted); line-height: 1.75; font-size: .92rem; }
.gallery-enter { color: var(--refresh-mint) !important; font-size: .9rem; display: inline-flex; align-items: center; min-height: 44px; gap: .8rem; }
.gallery-original-link { color: var(--refresh-muted) !important; font-size: .8rem; display: inline-flex; align-items: center; min-height: 44px; margin-top: .35rem; }
.gallery-collection-nav { display: grid; width: 100%; margin-block: 1rem 0; padding-top: 1rem; }
.gallery-collection-nav a { display: flex; align-items: center; justify-content: space-between; min-height: 49px; padding-block: .75rem; border-bottom: 1px solid var(--refresh-line); color: var(--refresh-muted); text-decoration: none; font: 500 clamp(1.1rem, 1.5vw, 1.4rem)/1.2 var(--refresh-display); }
.gallery-collection-nav a[aria-current], .gallery-collection-nav a:hover { color: var(--refresh-paper); }
.gallery-collection-nav a[aria-current]::after { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--room-accent); margin-inline: .5rem; }
.gallery-strip { grid-area: strip; display: flex; align-items: flex-start; gap: .75rem; padding-block: .6rem; min-width: 0; }
.gallery-catalogue { grid-area: strip; min-width: 0; margin-top: 1rem; }
.gallery-catalogue .gallery-strip { min-height: 9rem; }
.gallery-catalogue-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.gallery-work-search { display: grid; gap: .5rem; width: min(100%, 23rem); font-size: .8rem; color: var(--refresh-muted); }
.gallery-work-search input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--refresh-line); border-radius: 4px; padding: .7rem .8rem; background: var(--refresh-ink); color: var(--refresh-paper); font: inherit; caret-color: var(--refresh-mint); }
.gallery-work-search input::placeholder { color: var(--refresh-muted); opacity: 1; }
.gallery-index-count, .gallery-index-position { margin: 0; color: var(--refresh-muted); font-size: .75rem; line-height: 1.6; font-variant-numeric: tabular-nums; }
.gallery-index-count { flex-shrink: 0; padding-bottom: .75rem; }
.gallery-index-pages { display: flex; align-items: center; gap: .8rem; padding-top: .6rem; }
.gallery-no-results { color: var(--refresh-muted); line-height: 1.7; font-size: .875rem; }
.gallery-thumb { position: relative; width: 5.75rem; flex: 0 1 5.75rem; border: 0; padding: 0 0 .55rem; background: none; color: var(--refresh-muted); cursor: pointer; text-align: left; min-height: 44px; }
.gallery-thumb img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; opacity: .6; transition: opacity .25s; }
.gallery-thumb:hover img, .gallery-thumb[aria-pressed=true] img { opacity: 1; }
.gallery-thumb[aria-pressed=true]::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--refresh-mint); }
.gallery-thumb span { display: block; margin-top: .5rem; font-size: .72rem; line-height: 1.5; }
.gallery-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.gallery-footnote { color: var(--refresh-muted); font-size: .75rem; line-height: 1.7; max-width: 65ch; margin-block: 1rem 2rem; }
.gallery-crosslink { border-top: 1px solid var(--refresh-line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-block: 1.5rem 2.5rem; color: var(--refresh-muted); font-size: .875rem; }
.gallery-crosslink a { color: var(--refresh-mint); }
.gallery-archive { padding-block: 2rem 5rem; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(2rem, 7vw, 8rem); }
.gallery-archive h1 { font: 500 clamp(3rem, 7vw, 6rem)/1.03 var(--refresh-display); letter-spacing: -.04em; margin: 0 0 2rem; }
.gallery-archive p { color: var(--refresh-muted); line-height: 1.8; max-width: 55ch; }
.gallery-archive-mark { display: grid; place-items: center; background: var(--refresh-blue-ink); min-height: 22rem; }
.gallery-archive-mark img { width: min(60%, 18rem); height: auto; }
.gallery-archive h2 { font: 500 1.5rem var(--refresh-display); margin-top: 2.5rem; }
.gallery-archive dl { display: grid; gap: .8rem; line-height: 1.7; }
.gallery-archive dt { font-weight: 700; }
.gallery-archive dd { margin: 0; color: var(--refresh-muted); }
/* The artwork frame adds UI only; its drawing script remains original. */
body.study-page { overflow: auto !important; min-height: 100dvh; }
.study-header, .study-footer { width: min(100% - 3rem, 88rem); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.study-header { min-height: 5rem; border-bottom: 1px solid var(--refresh-line); }
.study-header a { font-size: .875rem; text-decoration: none; color: var(--refresh-muted); min-height: 44px; display: inline-flex; align-items: center; }
.study-header a:hover { color: var(--refresh-mint); }
.study-header .study-home { color: var(--refresh-paper); font: 700 1.1rem var(--refresh-display); }
.study-wall { display: grid; place-items: center; min-height: min(76dvh, 60rem); padding: 2rem; }
.study-wall > div { display: contents; }
.study-page canvas { display: block; width: min(68dvh, 100%) !important; height: auto !important; max-width: 100%; aspect-ratio: 1; box-shadow: 0 1.5rem 3rem color-mix(in srgb, var(--refresh-ink) 65%, transparent); cursor: pointer; }
.study-footer { padding-block: 1.2rem 2rem; border-top: 1px solid var(--refresh-line); align-items: flex-start; }
.study-title { margin: 0; font: 500 clamp(1.4rem, 3vw, 2.2rem)/1.15 var(--refresh-display); letter-spacing: -.03em; }
.study-context { color: var(--refresh-muted); font-size: .8rem; line-height: 1.7; margin-block: .5rem; max-width: 48ch; }
.study-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; max-width: 31rem; }
.study-exit { position: fixed; z-index: 10; right: 1rem; top: 1rem; background: var(--refresh-ink); }
.study-exit[hidden] { display: none; }
.study-page.is-focused .study-header, .study-page.is-focused .study-footer { display: none; }
.study-page.is-focused .study-wall { min-height: 100dvh; padding: 1rem; }
.study-page.is-focused canvas { width: min(94dvh, 100%) !important; }
.study-page.is-embedded { overflow: hidden !important; }
.study-page.is-embedded .study-wall { min-height: 100dvh; padding: 0; }
.study-page.is-embedded canvas { width: 100% !important; height: 100dvh !important; box-shadow: none; object-fit: contain; }
.study-page.is-embedded .study-header, .study-page.is-embedded .study-footer, .study-page.is-embedded .study-exit { display: none; }
.gallery-page [hidden], .study-page [hidden] { display: none !important; }
body.gallery-focus { overflow: hidden; }
.gallery-focus .gallery-stage { position: fixed; inset: 0; z-index: 20; height: 100dvh; min-height: 0; aspect-ratio: auto; background: var(--refresh-ink); }
.gallery-focus .gallery-stage iframe { width: min(94dvh, 96vw); }
.gallery-focus .gallery-stage > img { max-width: 96vw; max-height: 94dvh; }
.gallery-focus-exit { position: fixed; top: 1rem; right: 1rem; z-index: 21; background: var(--refresh-ink); }
.gallery-origin { display: grid; grid-template-columns: minmax(12rem, .6fr) minmax(0, 1fr); align-items: center; gap: clamp(2rem, 6vw, 6rem); max-width: 57rem; margin-block: 1rem 4rem; }
.gallery-origin img { width: 100%; height: auto; display: block; }
.gallery-origin h2 { font: 500 clamp(1.6rem, 3vw, 2.5rem)/1.1 var(--refresh-display); letter-spacing: -.03em; margin: 0; }
.gallery-origin p { color: var(--refresh-muted); font-size: .9rem; line-height: 1.8; }
.gallery-origin a { color: var(--refresh-mint); min-height: 44px; display: inline-flex; align-items: center; }
@media (min-width: 1500px) { .gallery-stage iframe { width: min(100% - 3rem, 50dvh); } }
@media (max-width: 1023px) {
  .gallery-layout { width: min(100% - 3rem, 88rem); }
  .gallery-room { grid-template-columns: minmax(0, 1fr) minmax(13rem, .44fr); column-gap: 1.5rem; }
  .gallery-stage { min-height: 18rem; height: min(56dvh, 34rem); }
  .gallery-stage iframe { width: min(100% - 2rem, 50dvh); }
  .gallery-stage > img { max-width: calc(100% - 2rem); }
  .gallery-notes h2 { font-size: 2.1rem; }
  .gallery-notes > p { font-size: .85rem; }
  .gallery-caption { flex-wrap: wrap; }
  .gallery-collection-nav { padding-top: 1.2rem; }
}
@media (max-width: 767px) {
  .gallery-layout { width: calc(100% - 2rem); }
  .gallery-heading { padding-top: 1.7rem; align-items: flex-start; }
  .gallery-heading p { max-width: 15ch; text-align: right; font-size: .75rem; line-height: 1.5; }
  .gallery-room { display: grid; grid-template-columns: 1fr; grid-template-areas: 'stage' 'caption' 'strip' 'notes'; gap: 0; padding-top: .5rem; padding-bottom: 2rem; }
  .gallery-stage { aspect-ratio: 1; height: auto; min-height: 0; }
  .gallery-stage iframe { width: calc(100% - 2rem); }
  .gallery-caption { gap: .75rem; padding-block: 1rem .5rem; }
  .gallery-art-title { font-size: 1.3rem; }
  .gallery-step { gap: .2rem; }
  .gallery-step .gallery-button { padding: .55rem .65rem; }
  .gallery-position { min-width: 2.5rem; }
  .gallery-strip { gap: .65rem; padding-block: 1rem; }
  .gallery-thumb { flex-basis: 4.7rem; }
  .gallery-notes { border-top: 1px solid var(--refresh-line); padding-top: 1.7rem; margin-top: 1.2rem; }
  .gallery-catalogue .gallery-strip { min-height: 8rem; }
  .gallery-index-pages { gap: .5rem; flex-wrap: wrap; }
  .gallery-notes h2 { font-size: clamp(2rem, 8vw, 3rem); max-width: 15ch; }
  .gallery-notes > p { max-width: 55ch; font-size: .9rem; margin-block: 1rem; }
  .gallery-collection-nav { margin-top: 1rem; }
  .gallery-collection-nav a { font-size: 1.3rem; }
  .gallery-archive { grid-template-columns: 1fr; }
  .gallery-origin { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .gallery-origin img { max-width: 22rem; }
  .gallery-archive-mark { min-height: 18rem; grid-row: 2; }
  .gallery-archive h1 { font-size: clamp(3rem, 13vw, 5rem); }
  .study-header, .study-footer { width: calc(100% - 2rem); }
  .study-header { min-height: 4.5rem; gap: .6rem; }
  .study-header a { font-size: .75rem; }
  .study-header .study-home { font-size: .9rem; }
  .study-wall { min-height: 65dvh; padding: 1rem; }
  .study-page canvas { width: min(62dvh, 100%) !important; }
  .study-footer { flex-direction: column; gap: 1rem; }
  .study-actions { justify-content: flex-start; }
  .study-actions .gallery-button { padding-inline: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-stage.is-changing iframe, .gallery-stage.is-changing > img { animation: none; }
  .gallery-button, .gallery-thumb img { transition: none; }
}
