:root {
  --ink: #111;
  --soft: #8a8a8a;
  --line: #e6e6e6;
  --fade-in: 4.2s;     /* opening fade: slow, everything at once */
  --fade-out: 700ms;   /* clicking a piece: the others fade away */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: #fff; color: var(--ink); font-family: "Helvetica Neue", Arial, sans-serif; }
body { min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
[hidden] { display: none !important; }

/* logo = home button */
.top { text-align: center; padding: 26px 16px 0; opacity: 0; animation: fadeIn var(--fade-in) ease forwards; }
.logo { display: inline-block; }
.logo img { display: block; width: clamp(200px, 26vw, 340px); height: auto; }

/* ---- the pile ---------------------------------------------------------- */
.pile { position: relative; width: min(1100px, 100%); margin: 0 auto; }
.piece-in-pile {
  position: absolute; left: 0; top: 0; cursor: pointer; opacity: 0;
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transition: opacity var(--fade-out) ease, transform var(--fade-out) ease;
  -webkit-tap-highlight-color: transparent;
}
.piece-in-pile img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
/* the fade starts only once every image in the pile has loaded, so nothing pops in late */
.pile.ready .piece-in-pile { animation: pileIn var(--fade-in) ease-in-out 200ms forwards; }
.floor { position: absolute; z-index: 0; pointer-events: none; border-radius: 50%; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.20) 0%, rgba(0,0,0,.09) 45%, rgba(0,0,0,0) 72%);
  filter: blur(6px); transition: opacity var(--fade-out) ease; }
.pile.ready .floor { animation: pileIn var(--fade-in) ease-in-out 200ms forwards; }
.pile.leaving .floor { animation: none; opacity: 0; }
.pile .piece-in-pile.shown { animation: none; opacity: 1; }
@media (hover: hover) {
  .pile:not(.past):not(.leaving) .piece-in-pile.shown:hover { z-index: 99 !important; transform: translate(var(--x), var(--y)) rotate(0deg) scale(1.05); }
}
.pile.leaving .piece-in-pile { opacity: 0 !important; animation: none; pointer-events: none; }
.pile.leaving .piece-in-pile.chosen { opacity: 1 !important; z-index: 100 !important; transform: translate(var(--x), var(--y)) rotate(0deg) scale(1.12); }

/* past pieces: same kind of pile, upside down, greyed, no labels */
.pile.past { margin-top: 10px; margin-bottom: 60px; }
.pile.past .piece-in-pile { transform: translate(var(--x), var(--y)) rotate(calc(180deg + var(--r))); }
.pile.past .piece-in-pile img { filter: grayscale(1) contrast(.55) brightness(1.3) drop-shadow(0 6px 10px rgba(0,0,0,.10)); transition: filter .4s ease; }
@media (hover: hover) {
  .pile.past .piece-in-pile.shown:hover { z-index: 99 !important; }
  .pile.past .piece-in-pile.shown:hover img { filter: grayscale(0) drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
}
.pile.leaving + .pile.past, .pile.past.leaving { opacity: 0; transition: opacity var(--fade-out) ease; }

/* ---- piece page -------------------------------------------------------- */
.piece-page { width: min(1100px, 100%); margin: 0 auto; padding: 24px 16px 80px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: start; opacity: 0; animation: fadeIn .9s ease forwards; }
.gallery { text-align: center; }
.gallery .main { width: 100%; max-width: 560px; max-height: 68vh; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,.18)); }
.gallery .main.photo { filter: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.thumbs button { width: 58px; height: 58px; border: 1px solid var(--line); background: #fafafa center/cover no-repeat; cursor: pointer; }
.thumbs button.cut { background-size: contain; }
.thumbs button[aria-current="true"] { border-color: var(--ink); }
.back { display: inline-block; font-size: 12px; letter-spacing: .2em; color: var(--soft); text-decoration: none; margin-bottom: 28px; }
.back:hover { color: var(--ink); }
.sold-tag { display: inline-block; font-size: 10px; letter-spacing: .24em; border: 1px solid var(--ink); padding: 5px 9px; margin-bottom: 14px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 28px; letter-spacing: .04em; margin-bottom: 8px; }
.desc { color: #444; font-size: 14px; line-height: 1.65; margin-bottom: 6px; white-space: pre-line; }
.meta { color: var(--soft); font-size: 13px; line-height: 1.6; margin-bottom: 26px; }
.bidbox { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); padding: 20px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bidbox small { display: block; font-size: 10px; letter-spacing: .24em; color: var(--soft); margin-bottom: 6px; text-transform: uppercase; }
.bidbox b { font-size: 26px; font-weight: 400; font-variant-numeric: tabular-nums; }
.soon { margin-top: 22px; font-size: 13px; color: var(--soft); letter-spacing: .04em; }
.bidform { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.bidform .row { display: flex; gap: 10px; }
.bidform input { width: 100%; min-width: 0; padding: 13px 14px; border: 1px solid #cfcfcf; background: #fff; border-radius: 0; outline: none; font-size: 16px; color: var(--ink); -webkit-appearance: none; appearance: none; }
.bidform input:focus { border-color: var(--ink); }
.btn { white-space: nowrap; padding: 14px 22px; border: 1px solid var(--ink); background: var(--ink); color: #fff; letter-spacing: .2em; font-size: 12px; cursor: pointer; transition: background .25s, color .25s; border-radius: 0; }
.btn:hover { background: #fff; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.wide { width: 100%; margin-top: 6px; }
.hint { font-size: 12px; color: var(--soft); }
.who { font-size: 12px; color: var(--soft); line-height: 1.6; }
.linklike { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: inherit; }
.setup { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; animation: fadeIn .5s ease forwards; }
.setup-note { font-size: 12px; color: var(--soft); line-height: 1.6; }
.stripe-box { min-height: 40px; }
.ship-line { font-size: 12px; color: var(--ink); min-height: 14px; }
.msg { font-size: 13px; min-height: 18px; }
.msg.ok { color: var(--ink); }
.msg.err { color: #a12a2a; }
.leading { margin-top: 16px; font-size: 13px; letter-spacing: .04em; }
.history { margin-top: 30px; }
.history h3 { font-size: 10px; letter-spacing: .24em; color: var(--soft); font-weight: 400; margin-bottom: 10px; text-transform: uppercase; }
.history ul { list-style: none; }
.history li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.history li span:last-child { color: var(--soft); }
.missing { text-align: center; color: var(--soft); padding: 80px 16px; font-size: 14px; }
.missing a { color: var(--ink); }

@keyframes fadeIn { to { opacity: 1; } }
@keyframes pileIn { to { opacity: 1; } }

@media (max-width: 820px) {
  .piece-page { grid-template-columns: 1fr; gap: 26px; }
  .bidbox b { font-size: 22px; }
  .bidform .row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --fade-in: .01s; --fade-out: .01s; }
}
