/* /wall/: the paintings hung on one long wall at true relative scale.
   wall.js sets --cm (pixels per centimetre, fitted to the screen) on <html>
   and --h-cm / --w-cm on each painting from its stated dimensions. */

html { --cm: 2px; }

body.wall {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #ecebe7;
  background-image: none;
}

body.wall main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

body.wall .wrapper { flex: 1; min-height: 0; }

body.wall .content {
  max-width: none;
  height: 100%;
  padding: 0;
}

@media (min-width: 769px) {
  body.wall .horizontal-list { font-size: 1rem; gap: 1.6em; padding: 1em 0; }
}

/* ---------- the wall ---------- */

body.wall .gallery {
  position: relative;             /* offsetLeft of each work is measured from the wall */
  display: flex;
  align-items: center;            /* shared eye-line */
  gap: 12vw;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /* Half a screen at each end so the first and last works can be centred */
  padding: 0 50vw;
  scrollbar-width: thin;
  outline: none;
}

body.wall .painting {
  flex: none;
  margin: 0;
  scroll-snap-align: center;
}

body.wall .painting::before { display: none; }

body.wall .painting img {
  /* Box sized from the stated dimensions before the image arrives, so the wall never jumps */
  height: calc(var(--h-cm, 120) * var(--cm));
  width: calc(var(--w-cm, 100) * var(--cm));
  max-width: none;
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

body.wall .painting-info {
  text-align: left;
  margin: 1.1em 0 0;
  padding: 0;
  max-width: 22em;
}

body.wall .painting-info .title { text-align: left; font-size: 0.75rem; }
body.wall .painting-info .meta-row { justify-content: flex-start; gap: 1em; font-size: 0.65rem; }
body.wall .year,
body.wall .dimensions { font-weight: normal; }

/* Each work brightens and settles as it reaches the centre of the wall */
@supports (animation-timeline: view()) {
  body.wall .painting {
    animation: wall-arrive linear both;
    animation-timeline: view(inline);
    animation-range: entry 10% cover 50%;
  }
}

@keyframes wall-arrive {
  from { opacity: 0.3; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

/* ---------- scale figure and counter ---------- */

.wall-figure {
  position: fixed;
  left: 2vw;
  bottom: 5vh;
  width: calc(50 * var(--cm));
  height: calc(175 * var(--cm));
  background: no-repeat bottom / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 175'%3E%3Ccircle cx='25' cy='11' r='10' fill='%231a1a1a'/%3E%3Cpath d='M5 30Q5 23 12 23H38Q45 23 45 30L43 92H36L34 175H27L25 104L23 175H16L14 92H7Z' fill='%231a1a1a'/%3E%3C/svg%3E");
  opacity: 0.45;
  pointer-events: none;
}

.wall-figure span {
  position: absolute;
  left: 0;
  bottom: -1.7em;
  font: 10px Menlo, monospace;
  white-space: nowrap;
}

.wall-count {
  position: fixed;
  right: 2vw;
  bottom: 2.2vh;
  font: 11px Menlo, monospace;
  color: #555;
  pointer-events: none;
}

/* On phones the figure stands in front of the work; let the painting read through */
@media (max-width: 768px) {
  .wall-figure { opacity: 0.22; }
}

@media (prefers-reduced-motion: reduce) {
  body.wall .gallery { scroll-behavior: auto; }
  body.wall .painting { animation: none; }
}
