:root { --font: Inter, Arial, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: #111; font-family: var(--font); }
#library-loader { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; overflow: hidden; background: #fff; transition: opacity .45s ease, visibility .45s ease; }
#library-loader p { position: relative; z-index: 1; margin: 0; padding: 16px; font-size: clamp(24px, 2.4vw, 32px); text-align: center; animation: loader-pulse 1s ease-in-out infinite alternate; }
#library-loader img { position: absolute; z-index: 2; left: var(--flash-x, 50vw); top: var(--flash-y, 50vh); width: min(32vw, 360px); height: min(32vw, 360px); object-fit: contain; opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.9); }
#library-loader img.is-flashing { animation: artwork-flash .18s steps(1, end) both; }
#library-loader.is-complete { opacity: 0; visibility: hidden; }
@keyframes loader-pulse { from { opacity: .35; } to { opacity: 1; } }
@keyframes artwork-flash { 0%, 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
header { position: sticky; top: 16px; z-index: 10; display: flex; align-items: center; justify-content: center; margin: 16px; padding: 6px; mix-blend-mode: difference; color: #fff; font-size: clamp(24px, 2.4vw, 32px); }
header a { color: inherit; text-decoration: none; }
#collection { display: grid; gap: 20px; padding-bottom: 20px; }
.collection-row { display: grid; grid-template-columns: 86px minmax(0, 1fr); }
.collection-label { margin: 0; padding: 7px 4px; font-family: monospace; font-size: 12px; opacity: .6; }
.collection-artworks { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 25vw); overflow-x: auto; scrollbar-width: none; }
.collection-artworks::-webkit-scrollbar { display: none; }
@media (max-width: 640px) { .collection-row { grid-template-columns: 1fr; } .collection-label { padding: 7px 4px 2px; } .collection-artworks { grid-auto-columns: minmax(180px, 72vw); } }
.card { display: flex; flex-direction: column; width: 100%; max-width: clamp(200px, 25vw, 320px); aspect-ratio: 1; min-width: 0; min-height: 0; overflow: hidden; padding: 4px; font-size: clamp(14px, 1.2vw, 16px); cursor: zoom-in; }
.card:focus-visible { outline: none; background: #eee; }
.card > p { margin: 0; font-weight: 500; opacity: .6; overflow-wrap: anywhere; }
.card-artwork { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.card-hash { position: relative; z-index: 1; display: -webkit-box; width: 16ch; max-width: 100%; max-height: 2.4em; margin: 0; overflow: hidden; overflow-wrap: anywhere; font-family: monospace; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; opacity: .6; }
.card-artwork img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; padding: 14px; object-fit: contain; object-position: left center; }
#empty-state { margin: 32px auto; text-align: center; opacity: .55; }
dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; overflow: hidden; }
dialog::backdrop { background: #fff; }
.viewer-image { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: top left; }
.viewer-copy { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 16px; color: #555; font-size: 14px; line-height: 1.35; }
.viewer-copy p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.viewer-credit { min-width: 0; text-align: right; }
.viewer-hash { font-family: monospace; }
.viewer-close { position: absolute; z-index: 3; top: 18px; right: 20px; border: 0; background: transparent; color: #111; cursor: pointer; font: 400 14px/1 Inter, Arial, sans-serif; }
.viewer-wheel { background: #fff; position: fixed; z-index: 3; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 112px; margin: 0; transform: translateX(-50%); }
.viewer-wheel button { height: 36px; border: 0; background: transparent; color: #111; cursor: pointer; font: 400 14px/1 Inter, Arial, sans-serif; }
.viewer-wheel span { font-family: monospace; font-size: 11px; white-space: nowrap; }

.library-footer { width: 100%; display: grid; justify-items: center; gap: 12px; padding: 32px 16px; font-size: 14px; }
.footer-name { opacity: .55; }
.library-footer nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; }
.library-footer a { color: inherit; text-decoration: none; }
.library-footer a[href^="mailto:"] { padding: 10px 16px; border-radius: 999px; background: #111; color: #fff; }
.library-footer a[href^="mailto:"]:hover, .library-footer a[href^="mailto:"]:focus-visible { background: #444; }
.footer-about:hover, header a:focus-visible, .library-footer a:focus-visible, #artwork-viewer button:focus-visible { outline: none; text-decoration: underline; text-underline-offset: .25em; }
.about-article { max-width: 680px; margin: 0 auto; padding: clamp(56px, 10vw, 128px) 24px 48px; }
.about-article h1 { font-size: clamp(42px, 8vw, 76px); line-height: 1; letter-spacing: -.055em; margin: 0 0 32px; }
.about-article h2 { margin: 36px 0 8px; font-size: 20px; }
.about-article p { margin: 0; font-size: 17px; line-height: 1.65; }

.viewer-scroll { position: absolute; inset: 0; z-index: 2; overflow-y: auto; overscroll-behavior: contain; }
.viewer-scroll:focus-visible { outline: none; }
.viewer-stage { position: sticky; top: 0; height: 100%; overflow: clip; }
.viewer-artwork { position: absolute; top: 7%; left: 50%; width: var(--artwork-width, 80%); height: var(--artwork-height, 67%); transform: translateX(-50%); pointer-events: none; }
.viewer-details { position: absolute; top: var(--details-top, 76%); left: 50%; width: min(560px, calc(100% - 48px)); transform: translateX(-50%); }
.viewer-description { margin: 12px 0 0; color: #111; font-size: clamp(17px, 2vw, 23px); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer-scroll-hint { position: absolute; z-index: 3; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 44px); left: 50%; transform: translateX(-50%); padding: 8px 12px; border: 0; background: #fff; color: #111; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }


@media (min-width: 900px) {
  .viewer-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: clamp(32px, 6vw, 112px); height: auto; min-height: 100%; overflow: visible; padding: 64px 6vw 72px; }
  .viewer-artwork { position: sticky; top: 64px; left: auto; align-self: start; width: 100%; height: calc(100dvh - 136px); transform: none; }
  .viewer-details { position: static; width: 100%; max-width: 560px; transform: none; }
  .viewer-copy { gap: 12px; }
  .viewer-description { margin-top: 24px; }
  .viewer-scroll-space, .viewer-scroll-hint { display: none; }
}
