:root { --bg: #f5f3eb; --ink: #1a1a18; --dim: #76746c; --ease: cubic-bezier(.22,.8,.18,1); color-scheme: light; }
:root[data-theme="dark"] { --bg: #141413; --ink: #ecebe4; --dim: #8d8b83; color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--bg); color: var(--ink); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.5; font-weight: 400; transition: background-color .3s, color .3s; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.stage { position: fixed; inset: 0; height: 100dvh; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.stage.dragging { cursor: grabbing; }

/* ---------- Bar ---------- */
.bar { position: absolute; inset: 0 0 auto 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 0; pointer-events: none; }
.bar > * { pointer-events: auto; }
.back { font-size: 15px; line-height: 1; width: max-content; }
.title { display: block; text-align: center; }
.sigmark { display: block; width: 104px; margin: 0 auto; }
.sigmark .signature { display: block; width: 100%; height: auto; overflow: visible; color: var(--ink); }
.signature :is(path, rect, polygon, circle) { fill: currentColor; stroke: none; }
.signature mask polyline { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; }
.title small { display: block; margin-top: 8px; color: var(--dim); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
@media (min-width: 900px) { .sigmark { width: 128px; } }
.mode-ico { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mode-ico.i-sun { display: none; }
:root[data-theme="dark"] .mode-ico.i-sun { display: block; }
:root[data-theme="dark"] .mode-ico.i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mode-ico.i-sun { display: block; } :root:not([data-theme="light"]) .mode-ico.i-moon { display: none; } }
.mode { justify-self: end; padding: 4px 0; margin: -4px 0; }

/* ---------- The field: paintings hang in 3D space ---------- */
.field { position: absolute; inset: 0; perspective: 900px; perspective-origin: 50% 50%; }
.piece { position: absolute; left: 50%; top: 50%; margin: 0; transform-style: preserve-3d; will-change: transform, opacity; visibility: hidden; cursor: pointer; backface-visibility: hidden; }
.piece img { display: block; width: 100%; height: auto; pointer-events: none; box-shadow: 0 18px 50px -18px rgba(0,0,0,.7); }
.piece.on { visibility: visible; }

/* title that appears when a painting drifts to the middle */
.center-label { position: absolute; left: 0; right: 0; top: 50%; z-index: 10; transform: translateY(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity .5s var(--ease); padding: 0 24px; mix-blend-mode: difference; color: #fff; }
.center-label.show { opacity: 1; }
.center-label b { display: block; font-weight: 500; letter-spacing: -.005em; font-size: clamp(16px, 4.6vw, 24px); }
.center-label span { display: block; margin-top: 6px; font-size: 12px; opacity: .7; }


.hint { position: absolute; left: 0; right: 0; bottom: 64px; z-index: 9; margin: 0; text-align: center; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; pointer-events: none; transition: opacity .8s; }
.hint.gone { opacity: 0; }

/* ---------- Footer ---------- */
.foot { position: absolute; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: space-between; align-items: baseline; padding: 0 18px calc(18px + env(safe-area-inset-bottom, 0px)); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; color: var(--dim); pointer-events: none; }
.foot > * { pointer-events: auto; }
.foot button { text-transform: inherit; letter-spacing: inherit; font-size: inherit; color: var(--ink); padding: 8px 0; margin: -8px 0; }
.foot .more { position: absolute; left: 50%; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity .5s; }
.foot .more.show { opacity: 1; pointer-events: auto; }
.foot .count { min-width: 3em; text-align: right; }

/* ---------- Index ---------- */
.index { position: absolute; inset: 0; z-index: 15; overflow-y: auto; background: var(--bg); padding: calc(80px + env(safe-area-inset-top, 0px)) 18px 90px; touch-action: pan-y; cursor: default; opacity: 0; transition: opacity .45s var(--ease); }
.index.open { opacity: 1; }
.index ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 14px; max-width: 1200px; }
@media (min-width: 800px) { .index ul { grid-template-columns: repeat(4, 1fr); } }
.index button { display: block; width: 100%; text-align: left; }
.index img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #111; transition: opacity .3s; }
.index button:hover img { opacity: .75; }
.index span { display: block; margin-top: 8px; font-weight: 500; font-size: 12px; }
.index em { font-style: normal; color: var(--dim); }

/* ---------- Detail ---------- */
.detail { position: absolute; inset: 0; z-index: 30; display: grid; grid-template-rows: 1fr auto; padding: calc(64px + env(safe-area-inset-top, 0px)) 18px calc(20px + env(safe-area-inset-bottom, 0px)); cursor: default; touch-action: pan-y; overflow: hidden; visibility: hidden; transition: visibility 0s .65s; }
.detail.open { visibility: visible; transition-delay: 0s; }
.detail::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--bg); opacity: 0; transition: opacity .6s var(--ease); }
.detail.open::before { opacity: 1; }
.detail .caption, .detail .close { opacity: 0; transition: opacity .35s var(--ease); }
.detail.open .caption, .detail.open .close { opacity: 1; transition: opacity .6s var(--ease) .35s; }
.detail img { cursor: zoom-out; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.detail.open img { transform: none; }
.detail .caption { padding-top: 16px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--dim); }
.detail .caption b { display: block; color: var(--ink); font-weight: 500; font-size: clamp(16px, 4.4vw, 22px); margin-bottom: 4px; }
.detail .caption p { max-width: 56ch; margin: 10px auto 0; font-size: 13px; line-height: 1.6; color: var(--ink); }
.close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 18px; font-size: 26px; line-height: 1; z-index: 2; }
.empty { position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: var(--dim); text-transform: uppercase; letter-spacing: .26em; font-size: 9px; margin: 0; }
@media (prefers-reduced-motion: reduce) { .center-label, .index, .detail, .detail img { transition-duration: .01s; } }
.index[hidden], .detail[hidden] { display: none; }

.sq { width: 100%; aspect-ratio: 1; box-shadow: 0 18px 50px -18px rgba(0,0,0,.7); }
.index .sq { aspect-ratio: 4/5; box-shadow: none; }
.detail #detailPh { width: min(100%, calc(100dvh - 200px)); height: auto; justify-self: center; align-self: center; aspect-ratio: 1; }

.stage.index-open .foot { background: linear-gradient(transparent, var(--bg) 45%); padding-top: 36px; }
.stage.index-open .more, .stage.index-open .count { opacity: 0 !important; pointer-events: none; }
.stage.index-open .bar { background: linear-gradient(var(--bg) 55%, transparent); padding-bottom: 22px; }

/* ---------- Statement: shows when the page is idle, fades away while you explore ---------- */
.statement { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; justify-content: center; box-sizing: border-box;
  padding: 104px 18px 62px; pointer-events: none; opacity: 1; transition: opacity .9s var(--ease); overflow: hidden; }
.statement.away, .veil.away { opacity: 0; transition-duration: .45s; }
.veil { position: absolute; inset: 0; z-index: 11; pointer-events: none; background: color-mix(in srgb, var(--bg) 48%, transparent); transition: opacity .9s var(--ease); }
.field { transition: filter .9s var(--ease); }
.stage.quiet .field { filter: blur(15px); }
.statement p { margin: 0 0 .6em; font-size: clamp(9px, min(2.6vw, 1.35dvh), 13px); line-height: 1.36; }
.st-h { margin: 0; font-size: clamp(22px, min(6.4vw, 4.2dvh), 50px); line-height: 1.02; font-weight: 500; letter-spacing: -.02em; color: var(--ink); }
.statement .st-sub { margin: 6px 0 clamp(12px, 2.4dvh, 26px); font-size: clamp(11px, 1.8dvh, 14px); opacity: .75; }
.st-row { display: grid; grid-template-columns: 24% 1fr; gap: 12px; align-items: start; margin-bottom: clamp(12px, 2.2dvh, 24px); }
.st-row h3 { margin: 0; font-size: 10px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.st-desc p:last-child { margin-bottom: 0; }
.st-info { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; justify-content: start; }
.st-info dt { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; opacity: .6; margin-bottom: 1px; }
.st-info dd { margin: 0; font-size: clamp(10px, 1.6dvh, 12.5px); }
@media (max-height: 700px) { .statement { padding-top: 92px; padding-bottom: 50px; } .statement .st-sub { display: none; } .st-h { margin-bottom: 12px; } html[data-type="grotesk"] .statement p { font-size: 9px; } .st-info { grid-template-columns: repeat(3, 1fr); } .st-info dd { font-size: 10px; } }
@media (min-width: 900px) { .st-info { grid-template-columns: repeat(3, auto); } .statement { padding-left: 6vw; padding-right: 6vw; } .st-row { grid-template-columns: 22% 1fr; } .st-desc { max-width: 62ch; } }
.stage.quiet .center-label, .stage.quiet .hint, .stage.quiet .foot .more { opacity: 0 !important; pointer-events: none; }

/* text fades in when the page loads */
@keyframes art-fade { from { opacity: 0; } to { opacity: 1; } }
.title small, .hint, .foot { animation: art-fade 1.4s var(--ease) .35s backwards; }
@media (prefers-reduced-motion: reduce) { .title small, .hint, .foot { animation: none; } }
