/* Layout: one fixed screen. A drifting field of points; a work opens in place over it,
   image at true scale inside a 2-inch frame, the artist's note beside it. */
:root {
  --paper: #EFEEE8;
  --ink: #121212;
  --mute: #5F5E58;
  --hair: rgba(18, 18, 18, .18);
  --veil: rgba(239, 238, 232, .9);
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --gut: 24px;
  --frame: 2in;
  color-scheme: light;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 12px/1.5 var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 1px dashed var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
p { margin: 0; }
.mute { color: var(--mute); }
.small { font-size: 11px; }

* { scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 2px; }

.app { position: relative; height: 100%; overflow: hidden; }

/* ---------- bars ---------- */
.bar { position: absolute; left: 0; right: 0; z-index: 40; padding: 0 var(--gut); }
.top {
  top: 0; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
}
.id { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.wordmark { font-weight: 700; font-size: 14px; }
.tools { position: relative; display: flex; align-items: center; gap: 22px; }
.bottom {
  bottom: 0; min-height: 48px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.bottom .l { justify-self: start; }
.bottom .r { justify-self: end; text-align: right; }
.t { min-height: 44px; padding: 0 2px; }
.t:hover { text-decoration: underline; }
.t[aria-expanded="true"] { text-decoration: underline; }

/* ---------- find ---------- */
.find {
  position: absolute; top: 48px; right: 0; width: 280px; box-sizing: border-box;
  background: var(--paper); border: 1px solid var(--ink); padding: 12px; z-index: 45;
}
.find label { display: block; margin-bottom: 6px; }
.find input {
  width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0;
  background: transparent; font: inherit; font-size: 13px; color: var(--ink); padding: 6px 0; outline: none;
}
.list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(320px, 55vh); overflow-y: auto; }
.list button { display: flex; gap: 10px; width: 100%; text-align: left; padding: 7px 4px; }
.list button:hover, .list button:focus-visible, .list li.on button { background: var(--ink); color: var(--paper); outline: none; }
.list .n { color: inherit; opacity: .55; font-variant-numeric: tabular-nums; }
.list .empty { padding: 8px 4px; color: var(--mute); }

/* ---------- field ---------- */
.field { position: absolute; top: 72px; bottom: 72px; left: 40px; right: 40px; transition: opacity .6s ease; }
body.is-open .field { opacity: .12; pointer-events: none; }
.status { position: absolute; top: 50%; left: 0; right: 0; text-align: center; }

.pt {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  display: flex; align-items: center; justify-content: center;
  animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate;
}
.w0 { animation-name: wa; } .w1 { animation-name: wb; } .w2 { animation-name: wc; }
@keyframes wa { 0% { transform: translate(0, 0); } 33% { transform: translate(14px, -9px); } 66% { transform: translate(-6px, -17px); } 100% { transform: translate(-15px, 6px); } }
@keyframes wb { 0% { transform: translate(0, 0); } 33% { transform: translate(-11px, 12px); } 66% { transform: translate(9px, 18px); } 100% { transform: translate(16px, -5px); } }
@keyframes wc { 0% { transform: translate(0, 0); } 33% { transform: translate(8px, 15px); } 66% { transform: translate(-13px, 5px); } 100% { transform: translate(-3px, -14px); } }
.br { display: flex; animation: br ease-in-out infinite alternate; }
@keyframes br { from { transform: scale(.6); } to { transform: scale(1.4); } }
.dot { display: block; border-radius: 50%; background: var(--ink); transition: transform .25s ease; }
.pt:hover .dot, .pt:focus-visible .dot { transform: scale(2.2); }
.pt:hover, .pt:hover .br, .pt:focus-visible, .pt:focus-visible .br { animation-play-state: paused; }
.pt:focus-visible { outline: none; }
.lbl {
  position: absolute; left: 22px; top: 4px; white-space: nowrap; font-size: 11px;
  pointer-events: none; opacity: 0; transition: opacity .15s ease;
}
.pt.flip .lbl { left: auto; right: 22px; }
.pt:hover .lbl, .pt:focus-visible .lbl { opacity: 1; }
@media (hover: none) { .lbl { display: none; } }

/* ---------- open work ---------- */
.work {
  position: absolute; top: 56px; bottom: 56px; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px;
  padding: 0 64px; align-items: center;
}
.close { position: absolute; top: 0; right: var(--gut); z-index: 2; }
.fig { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.stage { display: flex; align-items: center; gap: 44px; }
.arw { width: 48px; height: 48px; font-size: 28px; line-height: 1; transition: transform .2s ease; }
.arw:hover { transform: scale(1.25); }
.ob { position: relative; width: var(--frame); height: var(--frame); flex: none; }
.ob img {
  position: absolute; left: 50%; top: 50%; max-width: none;
  width: calc(var(--s, 1) * 100%); height: auto; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: pop .6s cubic-bezier(.2, .8, .2, 1);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.5); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.pr, .cm { position: absolute; background: var(--ink); z-index: 1; display: none; }
body[data-frame="prongs"] .pr, body[data-frame="crop"] .cm { display: block; }
.pr-t { top: -14px; left: 50%; width: 1px; height: 22px; }
.pr-b { bottom: -14px; left: 50%; width: 1px; height: 22px; }
.pr-l { left: -14px; top: 50%; width: 22px; height: 1px; }
.pr-r { right: -14px; top: 50%; width: 22px; height: 1px; }
.cm-tl-h { top: 0; left: -22px; width: 14px; height: 1px; } .cm-tl-v { top: -22px; left: 0; width: 1px; height: 14px; }
.cm-tr-h { top: 0; right: -22px; width: 14px; height: 1px; } .cm-tr-v { top: -22px; right: 0; width: 1px; height: 14px; }
.cm-bl-h { bottom: 0; left: -22px; width: 14px; height: 1px; } .cm-bl-v { bottom: -22px; left: 0; width: 1px; height: 14px; }
.cm-br-h { bottom: 0; right: -22px; width: 14px; height: 1px; } .cm-br-v { bottom: -22px; right: 0; width: 1px; height: 14px; }

.views { display: flex; gap: 14px; }
.views button { min-width: 28px; min-height: 28px; color: var(--mute); }
.views button[aria-current="true"] { color: var(--ink); text-decoration: underline; }

.text { display: flex; flex-direction: column; gap: 12px; min-height: 0; max-height: 100%; padding-top: 40px; box-sizing: border-box; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; max-width: 54ch; }
.head h1 { margin: 0; font-size: 14px; font-weight: 700; text-wrap: balance; }
#count { font-variant-numeric: tabular-nums; white-space: nowrap; }
#meta { max-width: 54ch; }
.note {
  overflow-y: auto; min-height: 0; white-space: pre-line; overflow-wrap: anywhere;
  font-size: 13px; line-height: 1.7; max-width: 54ch; padding-right: 12px;
}
.note.one { font-size: 22px; line-height: 1.3; }
.foot { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.foot a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- about ---------- */
.about { position: absolute; inset: 0; z-index: 35; background: var(--veil); }
.about .x { position: absolute; top: 6px; right: var(--gut); z-index: 2; font-size: 14px; }
.about .scroll { position: absolute; inset: 0; overflow-y: auto; }
.about article {
  max-width: 62ch; margin: 0 auto; padding: 96px var(--gut) 120px;
  font-size: 13px; line-height: 1.75; display: flex; flex-direction: column; gap: 18px;
}
.about .ttl { font-weight: 700; font-size: 14px; }
.about .facts { margin-bottom: 18px; }

.toast {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--paper); padding: 6px 10px; font-size: 11px;
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --gut: 16px; }
  .top { min-height: 52px; }
  .id .mute { display: none; }
  .tools { gap: 16px; }
  .find { position: fixed; top: 52px; left: 16px; right: 16px; width: auto; }
  .field { top: 64px; bottom: 64px; left: 20px; right: 20px; }
  body.is-open .field { opacity: 0; }
  .bar { background: var(--paper); }
  .work {
    grid-template-columns: 1fr; align-items: start; gap: 24px;
    padding: 44px 16px 24px; overflow-y: auto;
  }
  .close { top: 0; right: 16px; }
  .stage { gap: 8px; }
  .ob { width: min(64vw, 300px); height: min(64vw, 300px); }
  .text { padding-top: 0; max-height: none; }
  .note { overflow: visible; padding-right: 0; }
  .about article { padding-top: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .pt, .br, .ob img { animation: none; }
  .field { transition: none; }
}
