/* The Wall. Cardo (SIL OFL, bundled in /fonts) is the only typeface. */
@font-face { font-family: "Cardo"; src: url("../fonts/cardo-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cardo"; src: url("../fonts/cardo-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cardo"; src: url("../fonts/cardo-bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --wall: #d8d9d3;      /* plaster */
  --paper: #f3f3ef;     /* placards, versos */
  --ink: #1e1f21;
  --graphite: #585a60;  /* pencil */
  --dot: #c3281c;       /* gallery reserved-dot red */
  --skirt: #25262a;     /* skirting board: the tray */
  --rule: rgba(30, 31, 33, .26);
  --serif: "Cardo", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  /* One scale for the whole wall: 1 cm of print = --cm of screen. */
  --cm: clamp(5px, .62vw, 8.5px);
  /* On phones, 40 cm of print = the screen width. Bigger prints are capped to fit. */
  --mcm: min(calc((100vw - 2.5rem) / 40), 9px);
  --u: var(--cm);
  --tray-h: 3.6rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--wall); color: var(--ink); font-family: var(--serif); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-size: 1.0625rem; line-height: 1.5; font-kerning: normal;
  padding-bottom: calc(var(--tray-h) + 2.5rem);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
h1, h2, p { margin-top: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--graphite); }
.empty { max-width: 28rem; }

/* ---------------------------------------------------------------- the wall */
.wall {
  display: flex; flex-wrap: wrap;
  align-items: center;                 /* every row hangs on a shared eye-line */
  justify-content: center;
  gap: 5.5rem calc(14 * var(--cm));
  max-width: 112rem; margin-inline: auto;
  padding: 4.5rem 4vw 3rem;
}
.item { display: flex; align-items: center; gap: 1.1rem; }

.placard {
  flex: none; width: 16rem; padding: 1.4rem 1.4rem 1.5rem;
  background: var(--paper); font-size: .98rem; line-height: 1.45;
  box-shadow: 0 .5rem .7rem -.5rem rgba(20, 20, 20, .4);
}
.placard h1 { margin: 0 0 .5rem; font-size: 1.65rem; line-height: 1.1; font-weight: 700; }
.placard p { margin: 0 0 .75rem; }
.placard p:last-child { margin-bottom: 0; }

.wall-end { flex-basis: 100%; text-align: center; margin: 1rem 0 0; font-size: .9rem; color: var(--graphite); }

/* ---------------------------------------------------------------- a print, at true relative size */
.print {
  position: relative; flex: none;
  width: calc(var(--w) * var(--u));
  aspect-ratio: var(--w) / var(--h);
  perspective: 1500px;
}
.print::before {                          /* the print's own shadow on the wall */
  content: ""; position: absolute; inset: 0;
  box-shadow: 0 .7rem .9rem -.7rem rgba(20, 20, 20, .5);
}
.flip {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.3, .7, .2, 1);
}
.is-turned .flip { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.front img { width: 100%; height: 100%; object-fit: cover; background: #b9bab5; }

.turn {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  padding: 0; border: 0; background: none; cursor: pointer;
}

/* The back of the print: the photographer's pencil. Sized from the print's own width. */
.back { transform: rotateY(180deg); background: var(--paper); container-type: inline-size; }
.back-in {
  position: absolute; inset: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 3.6cqw;
  padding: 7cqw 8cqw;
  font-style: italic; color: var(--graphite);
  font-size: clamp(.72rem, 4.7cqw, 1.12rem); line-height: 1.28;
}
.pencil { margin: 0; transform: rotate(-1.2deg); transform-origin: left top; }
.pencil.meta { font-size: .86em; transform: rotate(.6deg); }
.back-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .4em .8em; }
.stamp {
  margin: 0; padding: .12em .55em; font-style: normal; font-size: .8em;
  border: 1.5px solid var(--graphite); transform: rotate(1.8deg); opacity: .8;
}
.refno { margin: 0; font-size: .85em; }

/* ---------------------------------------------------------------- wall labels */
.label { align-self: flex-end; width: 10.75rem; font-size: .97rem; line-height: 1.35; }
.label h2 { margin: 0 0 .2rem; font-size: 1.12rem; line-height: 1.2; font-weight: 700; }
.label h2 a { text-decoration: none; }
.label h2 a:hover { text-decoration: underline; }
.spec { margin: 0; color: var(--graphite); }
.price { margin: .55rem 0 .35rem; font-size: 1.4rem; line-height: 1.1; font-variant-numeric: oldstyle-nums; }
.more { display: block; width: fit-content; margin-top: .3rem; color: var(--graphite); font-size: .92rem; }

/* The red dot: what a gallery puts beside a work that is spoken for. */
.reserve {
  display: inline-flex; align-items: center; gap: .6rem;
  margin: 0; padding: .2rem 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.dot { flex: none; width: 1.2rem; height: 1.2rem; border: 1.5px solid var(--ink); border-radius: 50%; transition: background-color .12s, border-color .12s; }
.reserve:hover .dot { border-color: var(--dot); background: rgba(195, 40, 28, .16); }
.reserve[data-state="on"] .dot { background: var(--dot); border-color: var(--dot); animation: stick .22s ease-out; }
.reserve[data-state="on"] .reserve-text { font-weight: 700; }
@keyframes stick { from { transform: scale(1.7); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.reserve:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* ---------------------------------------------------------------- print page: the wall, continued sideways */
.hang { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x proximity; min-height: 100vh; }
.page-detail { padding-bottom: 0; }
.track {
  position: relative; display: flex; align-items: center;
  gap: calc(14 * var(--cm));
  width: max-content; min-width: 100%; min-height: 100vh;
  padding: 3rem 8vw calc(var(--tray-h) + 3rem) max(6vw, 7.5rem);
}
.track::before {                           /* the eye-line the prints are centred on */
  content: ""; position: absolute; left: 0; right: 0;
  top: calc(50% - var(--tray-h) / 2); height: 1px; background: var(--rule);
}
.track::after {
  content: "eye-line 145 cm"; position: absolute; left: .7rem;
  top: calc(50% - var(--tray-h) / 2 - 1.5em);
  font-size: .8rem; font-style: italic; color: var(--graphite);
}
.placard.detail { width: 21rem; position: relative; z-index: 1; }
.placard.detail .price { font-size: 1.7rem; margin-top: .3rem; }
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--graphite); font-size: .92rem; }
.placard.detail .desc { margin-top: 1rem; }
.hint { color: var(--graphite); font-style: italic; }
.item.solo, .view { scroll-snap-align: center; }
.view {
  position: relative; flex: none; margin: 0;
  height: calc(var(--h) * var(--cm) * var(--k));
  aspect-ratio: var(--ar);
}
.view::before { content: ""; position: absolute; inset: 0; box-shadow: 0 .7rem .9rem -.7rem rgba(20, 20, 20, .5); }
.view img { position: relative; width: 100%; height: 100%; object-fit: cover; background: #b9bab5; }
.notfound { max-width: 28rem; margin: 20vh auto 0; padding: 0 1.25rem; }

/* ---------------------------------------------------------------- the tray: skirting board along the bottom */
.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 1.1rem;
  min-height: var(--tray-h);
  padding: .55rem 1.25rem calc(.55rem + env(safe-area-inset-bottom, 0px));
  background: var(--skirt); color: #e9e9e4; border-top: 4px solid #3a3b40;
}
.tray-tally { flex: none; display: flex; align-items: center; color: #d8d8d2; }
.tray-text { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1rem; line-height: 1.3; }
.tray-thumbs { display: flex; align-items: center; padding-left: .5rem; }
.tray-thumbs img { height: 2.2rem; width: auto; margin-left: -.55rem; background: #777; box-shadow: 0 0 0 2px var(--skirt); }
.tray-total { font-size: 1.2rem; font-weight: 700; font-variant-numeric: oldstyle-nums; white-space: nowrap; }
.tray-go { flex: none; padding: .45rem 1rem; border: 1.5px solid currentColor; color: inherit; text-decoration: none; white-space: nowrap; }
.tray-go:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.tray :focus-visible { outline-color: #fff; }

/* ---------------------------------------------------------------- reserved prints page */
.slip { max-width: 46rem; margin: 0 auto; padding: 3.5rem 1.25rem 2rem; }
.slip h1 { margin: 0 0 1.5rem; font-size: 2rem; line-height: 1.15; }
.lines { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.line {
  display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center;
  gap: 0 1.25rem; padding: 1rem 0; border-bottom: 1px solid var(--rule);
}
.line-thumb { display: block; width: min(calc(var(--w) * var(--u) * .35), 9rem); min-width: 2.75rem; box-shadow: 0 .5rem .6rem -.5rem rgba(20, 20, 20, .5); }
.line-thumb img { width: 100%; height: auto; }
.line-info { display: flex; flex-direction: column; font-size: 1.1rem; line-height: 1.3; }
.line-info .muted { font-size: .92rem; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--ink); }
.qty button { width: 2.2rem; height: 2.2rem; border: 0; background: none; font: inherit; font-size: 1.2rem; cursor: pointer; color: inherit; }
.qty button:hover { background: var(--ink); color: var(--paper); }
.qty output { min-width: 2rem; text-align: center; font-variant-numeric: lining-nums; }
.line-total { min-width: 4.5rem; text-align: right; font-size: 1.15rem; font-variant-numeric: oldstyle-nums; }
.remove { border: 0; background: none; padding: .3rem 0; font: inherit; font-size: .95rem; color: var(--graphite); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.remove:hover { color: var(--dot); }
.subtotal { display: flex; justify-content: space-between; margin: 0; padding: 1rem 0; font-size: 1.35rem; border-bottom: 4px double var(--ink); font-variant-numeric: oldstyle-nums; }

.request { margin-top: 2.5rem; padding: 1.6rem 1.6rem 1.8rem; background: var(--paper); box-shadow: 0 .6rem .8rem -.6rem rgba(20, 20, 20, .4); }
.request h2 { margin: 0 0 .3rem; font-size: 1.45rem; }
.note { margin: 0 0 .5rem; color: var(--graphite); }
.request label, .login label { display: block; margin-top: 1.1rem; font-size: .95rem; color: var(--graphite); }
.opt { font-style: italic; }
.request input, .request textarea, .login input {
  display: block; width: 100%; margin-top: .15rem; padding: .35rem 0;
  font: inherit; font-size: 1.12rem; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0;
}
.request textarea {                       /* a ruled slip */
  resize: vertical; line-height: 1.75rem; padding: 0; border-bottom: 0;
  background: repeating-linear-gradient(transparent 0, transparent calc(1.75rem - 1px), var(--rule) calc(1.75rem - 1px), var(--rule) 1.75rem);
}
.request input:focus-visible, .request textarea:focus-visible, .login input:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { margin: 1rem 0 0; padding: .6rem .8rem; border-left: 4px solid var(--dot); background: rgba(195, 40, 28, .09); }
.send {
  display: flex; justify-content: space-between; align-items: baseline; width: 100%;
  margin-top: 1.4rem; padding: .95rem 1.15rem;
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  font: inherit; font-size: 1.15rem; cursor: pointer; font-variant-numeric: oldstyle-nums;
}
.send:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.send:disabled { opacity: .55; cursor: progress; }

.received { margin-top: 1rem; padding: 2.5rem 1.6rem; background: var(--paper); box-shadow: 0 .6rem .8rem -.6rem rgba(20, 20, 20, .4); outline: none; }
.received h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.stamp-big {
  display: inline-block; margin: 0 0 1.2rem; padding: .1rem .8rem;
  border: 3px solid var(--dot); color: var(--dot); font-size: 1.6rem; font-weight: 700;
  transform: rotate(-5deg); animation: thud .25s ease-out;
}
@keyframes thud { from { transform: rotate(-5deg) scale(1.6); opacity: 0; } to { transform: rotate(-5deg) scale(1); opacity: 1; } }

/* ---------------------------------------------------------------- admin (plain, same paper and ink) */
.admin { padding-bottom: 0; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; padding: 1rem 1.5rem; background: var(--skirt); color: #eee; }
.admin-bar nav { display: flex; gap: 1.25rem; flex: 1; flex-wrap: wrap; }
.admin-bar a[aria-current] { font-weight: 700; }
.admin-main { max-width: 70rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.admin-main h1 { font-size: 1.8rem; }
.count { font-size: .6em; color: var(--graphite); }
.flash { padding: .6rem .9rem; background: var(--paper); border-left: 4px solid var(--ink); }
.errors { padding: .8rem 1rem; margin-bottom: 1.25rem; background: rgba(195, 40, 28, .09); border-left: 4px solid var(--dot); }
.errors p, .errors ul { margin: 0 0 .3rem; }
.scroll-x { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; background: var(--paper); font-size: .98rem; }
.ledger th, .ledger td { padding: .65rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.ledger th { font-weight: 700; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.ledger .msg { min-width: 14rem; max-width: 26rem; }
.mini { width: 48px; height: auto; }
.row-actions { white-space: nowrap; }
.inline { display: inline; }
.btn {
  display: inline-block; padding: .45rem .95rem; border: 1.5px solid var(--ink); background: none; color: var(--ink);
  font: inherit; font-size: .98rem; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--paper); color: var(--ink); }
.btn.danger { border-color: var(--dot); color: var(--dot); }
.btn.danger:hover { background: var(--dot); color: #fff; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

.edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .25rem 1.25rem; }
.edit .wide { grid-column: 1 / -1; }
.edit label { display: block; margin-top: .75rem; font-size: .95rem; color: var(--graphite); }
.edit input[type="text"], .edit textarea {
  display: block; width: 100%; margin-top: .2rem; padding: .5rem .6rem;
  font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 0;
}
.edit .hint { margin: 0; font-size: .92rem; }
.images { margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--rule); }
.images legend { padding: 0 .4rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.thumbs img { width: 7.5rem; height: auto; margin-bottom: .4rem; }
.check { margin: 0 !important; font-size: .9rem !important; }
.actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.login { max-width: 22rem; margin: 18vh auto 0; padding: 1.75rem; background: var(--paper); }
.login h1 { font-size: 1.6rem; }

/* ---------------------------------------------------------------- phones: a different hang, not a collapsed menu
   One column. Each print keeps its relative size (40 cm = the screen width) and
   hangs alternately on the left and right, so a big print and a small one still
   read as big and small. Labels sit underneath. */
@media (max-width: 52rem) {
  :root { --u: var(--mcm); --tray-h: 3.3rem; }

  .wall { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 3.25rem; padding: 1.5rem 1.25rem 2rem; }
  .placard, .placard.detail { width: auto; }
  .item { flex-direction: column; align-items: flex-start; gap: .85rem; width: max(11.5rem, min(100%, calc(var(--w) * var(--u)))); }
  .print { width: min(100%, calc(var(--w) * var(--u))); }
  .label { width: 100%; align-self: stretch; }
  .wall > .item:nth-child(odd) { align-self: flex-end; }
  .wall > .item:nth-child(odd) .print { margin-left: auto; }
  .wall > .item:nth-child(odd) .label { text-align: right; }
  .wall > .item:nth-child(odd) .more { margin-left: auto; }

  .hang { overflow: visible; min-height: 0; }
  .track { flex-direction: column; align-items: stretch; gap: 2.75rem; width: auto; min-width: 0; min-height: 0; padding: 1.25rem 1.25rem calc(var(--tray-h) + 2.5rem); }
  .track::before, .track::after { display: none; }
  .view { height: auto; width: min(100%, calc(var(--h) * var(--u) * var(--k) * var(--ar))); }
  .view:nth-child(odd) { align-self: flex-end; }

  .tray { gap: .7rem; padding-inline: .9rem; }
  .tray-thumbs { display: none; }
  .tray-text { font-size: .92rem; }
  .tray-go { padding: .4rem .7rem; }

  .slip { padding-top: 2rem; }
  .line { grid-template-columns: 5.5rem 1fr auto; gap: .5rem 1rem; }
  .line-thumb { grid-column: 1; grid-row: 1 / span 3; width: 100%; min-width: 0; align-self: start; }
  .line-info { grid-column: 2 / -1; }
  .qty { grid-column: 2; grid-row: 2; justify-self: start; }
  .line-total { grid-column: 3; grid-row: 2; }
  .remove { grid-column: 2 / -1; grid-row: 3; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .flip { transition: none; }
  .reserve[data-state="on"] .dot, .stamp-big { animation: none; }
  .hang { scroll-behavior: auto; }
}
