/* Colours and type taken from the exhibition poster. */
:root {
  --wall: #525252;
  --wall-deep: #464646;
  --ink: #f1ece4;
  --ink-soft: #d9d3ca;
  --muted: #b3aca2;
  --rule: rgba(241, 236, 228, 0.18);
  --sold: #c4553f;
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  --gutter: clamp(20px, 6vw, 96px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 300 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.locked { overflow: hidden; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.label {
  margin: 0;
  font: 500 12px/1.4 var(--sans);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.serif { font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.3; margin: 0; }

/* Masthead */

.masthead {
  padding: clamp(48px, 10vw, 112px) var(--gutter) 8px;
  max-width: 1440px;
  margin: 0 auto;
}

h1 {
  margin: 0 0 14px;
  font: 300 clamp(44px, 9vw, 96px)/1 var(--serif);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.when {
  margin: 28px 0 0;
  max-width: 38em;
  color: var(--ink-soft);
  font-size: 15px;
}

.intro { margin-top: 28px; border-top: 1px solid var(--rule); }

.intro summary {
  list-style: none;
  padding: 18px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
}
.intro summary::-webkit-details-marker { display: none; }
.intro summary::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.3s var(--ease);
}
.intro[open] summary::after { transform: translateY(1px) rotate(-135deg); }

.intro-body { max-width: 40em; padding-bottom: 12px; }
.intro-body p { margin: 0 0 1em; }
.intro-body .sig { font-family: var(--serif); font-size: 22px; }

/* Toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--wall) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.filters { display: flex; gap: 22px; }
.filters button {
  font-size: 15px;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.filters button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }

.count { letter-spacing: 0.2em; white-space: nowrap; }

/* Grid — hung like a wall: each painting centred in an equal bay, label beneath. */

main { max-width: 1440px; margin: 0 auto; padding: clamp(32px, 5vw, 64px) var(--gutter) 40px; }

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(36px, 5vw, 64px) clamp(18px, 4vw, 56px);
}
@media (min-width: 720px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.work[hidden] { display: none; }

.work button { display: block; width: 100%; text-align: left; }

.bay {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bay img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), 0 10px 28px -8px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), box-shadow 0.4s var(--ease);
}
.bay img.loaded { opacity: 1; transform: none; }
.work button:hover .bay img.loaded { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(0,0,0,0.25), 0 18px 36px -10px rgba(0,0,0,0.55); }

.placeholder {
  width: 78%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  color: var(--muted);
  font: italic 300 17px/1.3 var(--serif);
  text-align: center;
  padding: 12px;
}

.caption { margin-top: 14px; }
.caption .num { font-size: 11px; letter-spacing: 0.28em; }
.caption .title {
  margin: 4px 0 2px;
  font: 400 clamp(18px, 2.2vw, 21px)/1.25 var(--serif);
  color: var(--ink);
}
.caption .meta { margin: 0; font-size: 14px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }

.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--sold);
  flex: none;
}

.empty { grid-column: 1 / -1; color: var(--muted); font-family: var(--serif); font-size: 22px; font-style: italic; }

/* Footer */

.footer {
  max-width: 1440px;
  margin: 40px auto 0;
  padding: 32px var(--gutter) 64px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
}
.footer .label { margin-bottom: 10px; }

/* Viewer — full-screen, swipe between paintings (native scroll-snap). */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--wall-deep);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.viewer.open { opacity: 1; }
.viewer[hidden] { display: none; }

.track {
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: max(64px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

/* Phones held upright: the painting takes all the height the details below don't
   need (no fixed allowance), so the details and Enquire button never need scrolling. */
.slide .stage {
  flex: 1 1 0;
  min-height: 30vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide .stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), 0 24px 60px -18px rgba(0,0,0,0.6);
}
/* Wider screens (laptops, desktops, tablets): the landscapes (config.js sideBySide,
   class "large") have the details beside the painting, so it can use nearly the full
   height. The other works keep the original stacked layout, painting above details. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 560px) {
  .slide.large {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 3vw, 56px);
    padding: 28px 80px;
  }
  .slide.large .stage { flex: 0 1 auto; min-width: 0; min-height: 0; height: 100%; }
  .slide.large .stage img {
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
  }
  .slide.large .info { flex: 0 0 clamp(220px, 22vw, 300px); margin: 0; }
  .slide.large .info .title { font-size: clamp(26px, 2.4vw, 34px); text-wrap: balance; hyphens: none; }
}
/* Original stacked sizing for the other works on wider screens (not short ones). */
@media (min-width: 900px), (orientation: landscape) and (min-width: 560px) and (min-height: 500.02px) {
  .slide:not(.large) .stage { flex: 1 1 auto; min-height: 46vh; }
  .slide:not(.large) .stage img {
    max-height: calc(100vh - 380px);
    max-height: calc(100dvh - 380px);
  }
}
/* Touch screens have no arrow buttons (you swipe), so the side margins can be slim. */
@media (hover: none) and (orientation: landscape) and (min-width: 560px) {
  .slide.large { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(56px, env(safe-area-inset-right)); gap: 24px; }
}
/* Phones turned sideways are too short for anything stacked, so every work goes
   side by side there (otherwise the painting would be tiny and Enquire off screen). */
@media (orientation: landscape) and (min-width: 560px) and (max-height: 500px) {
  .slide {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px max(56px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left));
  }
  .slide .stage { flex: 0 1 auto; min-width: 0; min-height: 0; height: 100%; }
  .slide .stage img { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  .slide .info { flex: 0 0 200px; margin: 0; }
  .slide .info .title { font-size: clamp(26px, 2.4vw, 34px); text-wrap: balance; hyphens: none; }
}
.slide .stage .placeholder { width: min(78%, 520px); }

.info {
  flex: none;
  width: 100%;
  max-width: 640px;
  margin: 24px auto 0;
  text-align: center;
}
.info .title { margin: 6px 0 4px; font: 300 clamp(28px, 5vw, 40px)/1.1 var(--serif); }
.info .meta { margin: 0; color: var(--ink-soft); font-size: 15px; }
.info .price { margin: 14px 0 0; font: 400 24px/1.2 var(--serif); display: flex; align-items: center; justify-content: center; gap: 10px; }

.enquire {
  display: inline-block;
  margin-top: 18px;
  padding: 13px 28px;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s;
}
.enquire:hover { background: var(--ink); color: var(--wall-deep); }

.alt {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.alt button { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.alt button:hover { text-decoration-color: currentColor; }

/* Phones held upright: tighter spacing so the painting gets as much room as possible
   while the details (and the Enquire button) still fit on screen without scrolling. */
@media (max-width: 899.98px) and (orientation: portrait), (max-width: 559.98px) {
  .slide { padding: max(52px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)); }
  .info { margin-top: 14px; }
  .info .title { font-size: 26px; margin: 4px 0 2px; }
  .info .meta { font-size: 14px; }
  .info .price { margin-top: 8px; font-size: 21px; }
  .enquire { margin-top: 10px; padding: 11px 24px; }
  .alt { margin-top: 8px; }
}

.v-close, .v-nav {
  position: absolute;
  z-index: 2;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  color: var(--ink);
  opacity: 0.75;
  transition: opacity 0.2s;
}
.v-close:hover, .v-nav:hover { opacity: 1; }
.v-close svg, .v-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.v-close { top: max(10px, env(safe-area-inset-top)); right: 10px; }
.v-nav { top: 50%; transform: translateY(-50%); display: none; }
.v-prev { left: 12px; }
.v-next { right: 12px; }
.v-nav[disabled] { opacity: 0.15; cursor: default; }

@media (hover: hover) and (min-width: 720px) {
  .v-nav { display: grid; }
  .slide { padding-left: 84px; padding-right: 84px; }
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 30;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  background: var(--ink);
  color: var(--wall-deep);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .bay img { opacity: 1; transform: none; }
}

.viewer:focus { outline: none; }
