/* Oscar's own handwriting font. */
@font-face {
  font-family: "Booby";
  src: url("/fonts/booby.woff2") format("woff2");
  font-display: swap;
  /* Booby's "|" is an empty glyph: leave U+7C out so the bar in a title ("ALFIE | REDUX") is
     drawn by the next font in the stack instead of vanishing. */
  unicode-range: U+0-7B, U+7D-10FFFF;
}

:root {
  --wall: #1b1814;
  --wall-deep: #110f0c;
  --wall-texture: url("/wall-limewash.jpg");   /* made by tools/wall.py from Oscar's brushwork */
  --light: rgba(255, 236, 205, 0.2);
  --ink: #d8cfc3;
  --ink-quiet: #7d7468;
  --gap: 20vw;
  --hang: 58vh;          /* height a painting hangs at */
  --eye: 46%;            /* where the centre of each painting sits */
}

* { box-sizing: border-box; margin: 0; }

html { background: var(--wall-deep); }

body {
  background: var(--wall);
  color: var(--ink);
  font-family: Georgia, serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* The wall's plaster: faint grain over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 5;
}

.name {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 40;           /* above the menu, like the MENU button */
  color: var(--ink);
  text-decoration: none;
  font-family: "Booby", Georgia, serif;
  font-size: 18px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ---------- The corridor (wide screens): scroll down, walk sideways ---------- */

.corridor { overflow-x: clip; }

/* The walk replaces the scrollbar; a faint line along the floor shows how far along you are. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

.progress {
  height: 1px;
  background: rgba(255, 236, 205, 0.16);
  transform: scaleX(0);
  transform-origin: 0 0;
}

.viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14vh;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), var(--wall-deep) 40%);
  border-top: 1px solid rgba(255, 236, 205, 0.04);
  z-index: 1;            /* in front of the wall, which slides with the paintings */
}

.track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: 0 calc(50vw - 15vh);
  background: var(--wall) var(--wall-texture) repeat;
  background-size: 1024px;
  will-change: transform;
  transition: opacity 0.55s ease;            /* a room fading in as you walk into it */
}
.track.passing { opacity: 0; transition: opacity 0.26s ease; }   /* ...and the one you leave, fading out */

.work {
  position: relative;
  flex: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(100vh - var(--eye) * 2);
  cursor: zoom-in;
}

/* The opening wall: just the show's title, lit like a painting. */
.intro {
  position: relative;
  flex: none;
  width: 60vw;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(100vh - var(--eye) * 2);
  font-family: "Booby", Georgia, serif;
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.intro h1 { margin: 0; font: inherit; letter-spacing: inherit; }
.intro-title { position: relative; }      /* the title stays where it hung; the label hangs below */

/* A wall label beside the title, as a gallery puts up while a show is still being hung. */
.placard {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 80vw;
  margin: 46px 0 0;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  white-space: normal;
  color: var(--ink-quiet);
}
.placard::before {               /* a short rule above it */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 28px;
  border-top: 1px solid currentColor;
  opacity: 0.5;
  transform: translateX(-50%);
}
.placard-head { font-size: 11px; letter-spacing: 0.24em; }
.placard-note { font-size: 12px; letter-spacing: 0.04em; text-transform: none; opacity: 0.8; }
.about-placard { margin-top: 2.2em !important; font-size: 0.8em; color: var(--ink-quiet); }

/* ---------- Rooms ----------
   A period room is named by its years: information, so Futura (titles keep Oscar's hand). */
.intro[data-kind="period"] h1,
.door[data-kind="period"] .door-title {
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;
  letter-spacing: 0.3em;
}
.intro[data-kind="period"] .placard-head {      /* "14 works": a count, so Futura too */
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;
  letter-spacing: 0.2em;
}
/* The doorway at the far end of a room: the next room's name, as lettering on the wall. */
.door {
  position: relative;
  flex: none;
  width: 60vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink);
  font-family: "Booby", Georgia, serif;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.door[hidden] { display: none; }
/* The way back, low on a room's opening wall: an arrow and the name of the room before it. */
.back {
  position: absolute;
  left: 32px;
  bottom: calc(14vh + 16px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-quiet);
  font-family: "Booby", Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s ease;
}
.back[hidden] { display: none; }
.back:hover { color: var(--ink); }
.back[data-kind="period"] .back-title { font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif; letter-spacing: 0.2em; }
.back-arrow { font-family: Georgia, serif; font-size: 20px; letter-spacing: 0; transition: transform 0.4s ease; }
.back:hover .back-arrow { transform: translateX(-6px); }
[data-layout="column"] .back { position: static; padding: 28px 0 0; }
[data-layout="swipe"] .back { left: max(20px, env(safe-area-inset-left)); }
.door-head { font-size: 11px; letter-spacing: 0.24em; color: var(--ink-quiet); }
.door-title { font-size: 18px; letter-spacing: 0.22em; }
.door-arrow { font-family: Georgia, serif; font-size: 26px; margin-top: 4px; color: var(--ink-quiet); transition: transform 0.4s ease, color 0.3s ease; }
.door:hover .door-arrow { transform: translateX(8px); color: var(--ink); }

/* A soft spotlight from above. */
.intro::before,
.work::before {
  content: "";
  position: absolute;
  top: -10vh;
  left: 50%;
  width: 180%;
  height: 95vh;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 62% at 50% 36%, var(--light), transparent 72%);
  pointer-events: none;
}

.work img {
  position: relative;
  display: block;
  /* The frame goes round the painting, not into it, until the whole would crowd the floor.
     Every painting is centred in the same slot, so the captions all sit on one line. */
  --slot: 64vh;
  height: min(calc(var(--h) + 2 * var(--fw)), var(--slot));
  margin-block: calc((var(--slot) - min(calc(var(--h) + 2 * var(--fw)), var(--slot))) / 2);
  width: auto;
  background: #2a251f;
  /* Framed (see below), and two shadows: a tight one where it stands a finger's width off
     the wall, and a long one the spotlight above casts down behind it. */
  border: var(--fw) solid transparent;
  border-image: var(--frame) var(--slice, 64) var(--frame-repeat, stretch);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 5px 12px rgba(0, 0, 0, 0.45),
    0 34px 44px -14px rgba(0, 0, 0, 0.75),
    0 70px 90px -30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.9s ease, transform 0.6s ease;
}

.work img.ready { opacity: 1; }

/* Frames, drawn by tools/frames.py and lit from above like the room. Each painting's frame
   is chosen in tools/frames.txt; the rest hang in the black float. */
.work[data-frame="float"] { --fw: 17px; --frame: url("/frames/float.webp"); }
.work[data-frame="gilt"] { --fw: 26px; --frame: url("/frames/gilt.webp"); }
/* Wide, carved and gilded; its ornament repeats round the painting instead of stretching. */
/* Rococo: carved and gilded, drawn whole for its painting (tools/rococo.py). Its outline isn't
   square, so its shadow follows the carving instead of a box. */
.work[data-frame="rococo"] img,
.work[data-frame="rococo"] img.ready { box-shadow: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45)); }
.work[data-frame="gilt-ornate"] { --fw: 48px; --frame: url("/frames/gilt-ornate.webp"); --frame-repeat: round; }
.work[data-frame="silver"] { --fw: 26px; --frame: url("/frames/silver.webp"); }
.work[data-frame="wood"] { --fw: 76px; --frame: url("/frames/wood.webp?v=2"); }
.work[data-frame="wood-narrow"] { --fw: 57px; --frame: url("/frames/wood.webp?v=2"); }   /* 3/4 of the wide barnwood */
.work[data-frame="float-thick"] { --fw: 76px; --frame: url("/frames/float-thick.webp"); }
.work[data-frame="steel"] { --fw: 26px; --frame: url("/frames/steel.webp"); }

/* Its own frame: the frame is in the picture, which is shaped like it (transparent around the
   carving). No drawn frame, no backing, and the shadow follows the carving instead of a box. */
.work[data-frame="own"] { --fw: 0px; --frame: none; }
.work[data-frame="own"] img,
.work[data-frame="own"] img.ready { background: none; box-shadow: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45)); }
.closer[data-frame="own"] img { box-shadow: none; filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.6)); }
.index-row img.own { background: none; box-shadow: none; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }

/* No frame: a gallery-wrapped canvas. Its top edge catches the light, its painted side shows
   in shade below, and standing deeper off the wall it throws a heavier shadow. */
.work[data-frame="wrap"] { --fw: 0px; --frame: none; }
.work[data-frame="wrap"] img {
  box-shadow:
    0 -1px 0 rgba(255, 236, 205, 0.3),
    0 6px 0 color-mix(in srgb, var(--edge, #2a251f) 45%, black),
    2px 6px 0 color-mix(in srgb, var(--edge, #2a251f) 30%, black),
    -2px 6px 0 color-mix(in srgb, var(--edge, #2a251f) 30%, black),
    0 9px 6px rgba(0, 0, 0, 0.7),
    0 42px 50px -14px rgba(0, 0, 0, 0.8),
    0 80px 100px -30px rgba(0, 0, 0, 0.5);
}
.work:hover img { transform: translateY(-4px); }

.caption {
  position: relative;
  margin-top: 22px;
  font-family: "Booby", Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  white-space: nowrap;
}

/* Titles are in Oscar's hand (Booby); the year is information, in small Futura (as ABOUT). */
.caption { text-align: center; }
.work .caption { margin-bottom: 26px; }   /* lifts each painting and its two-line label clear of the floor */
.caption .year {                  /* on its own line, centred under the title */
  display: block;
  margin-top: 0.55em;
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 0.8em;
  letter-spacing: 0.12em;
  opacity: 0.75;
}

.hint {
  position: fixed;
  right: 40px;
  bottom: 7vh;
  z-index: 10;
  font-size: 20px;
  color: var(--ink-quiet);
  animation: nudge 2.4s ease-in-out infinite;
  transition: opacity 0.8s ease;
}

.hint.gone { opacity: 0; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

/* ---------- Stepping closer ---------- */

.closer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 8, 0);
  cursor: zoom-out;
  transition: background 0.5s ease;
}

.closer[hidden] { display: none; }
.closer.open { background: rgba(12, 10, 8, 0.97); }

.closer img {
  max-width: 94vw;
  max-height: calc(100vh - 90px);
  width: auto;
  height: auto;
  transform-origin: 0 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* Zooming: the close-up takes every touch (no page zoom), and the image can't be dragged out. */
.closer { touch-action: none; }
.closer img { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.closer.zoomed { cursor: grab; }
.name, .menu-button { transition: opacity 0.3s ease; }
body:has(.closer.zoomed) .name, body:has(.closer.zoomed) .menu-button { opacity: 0; pointer-events: none; }
.closer.zoomed .caption { opacity: 0; }

.closer .caption {
  margin-top: 18px;
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
}

.closer.open .caption { opacity: 1; }
.closer.open.zoomed .caption { opacity: 0; }

/* On the wall a pinch opens the painting and zooms it, instead of zooming the whole page. */
.corridor { touch-action: pan-x pan-y; }

/* ---------- The menu: INDEX, ABOUT, CONTACT ---------- */

.menu-button {
  position: fixed;
  top: 28px;
  right: 32px;
  z-index: 40;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: "Booby", Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
}

.panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 104px 32px 80px;
  background: rgb(12, 10, 8);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.panel[hidden] { display: none; }
.panel.open { opacity: 1; }

.panel-nav {
  display: flex;
  gap: 2.4em;
  margin-bottom: 56px;
  font-family: "Booby", Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.panel-nav a { color: var(--ink-quiet); text-decoration: none; transition: color 0.3s ease; }
.panel-nav a:hover, .panel-nav a[aria-current="page"] { color: var(--ink); }

/* ROOMS: the map of the site. Each room's name and count on the left, every painting in it
   on the right (the same thumbnails the INDEX used to show, now sorted by room). */
.rooms { display: flex; flex-direction: column; gap: 56px; }
.room-block {
  display: grid;
  grid-template-columns: 190px 1fr;
  column-gap: 32px;
  align-items: start;
}
.room-head {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 2px;
  color: var(--ink-quiet);
  text-decoration: none;
}
.room-name {
  color: var(--ink);
  font-family: "Booby", Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}
.room-head:hover .room-name { opacity: 0.6; }
.room-block[data-kind="period"] .room-name { font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif; letter-spacing: 0.24em; }
.room-count {
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.room-head[aria-current] .room-count::after { content: "  \00b7  you are here"; }
.room-block .index-row { grid-column: 2; margin-bottom: 0; }

.panel-section { display: none; }
.panel-section.shown { display: block; }

/* INDEX: every painting, newest first, a row per year with the year beside it. */
.index {
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 32px;
  align-items: start;
}

.index-year {
  margin: 0;
  padding-top: 2px;
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;   /* years: Futura */
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0.14em;
  color: var(--ink-quiet);
}

.index-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 28px 24px;
  margin-bottom: 52px;
}

.index-row a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--ink-quiet);
  text-decoration: none;
}

.index-row img {
  display: block;
  height: 132px;
  width: auto;
  background: #2a251f;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}

.index-row a:hover img { transform: translateY(-3px); }
.index-row a:hover { color: var(--ink); }

.index-row span {
  max-width: 220px;
  margin-top: 10px;
  font-family: "Booby", Georgia, serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ABOUT and CONTACT */
.about {
  max-width: 34em;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
}

.about p + p { margin-top: 1.1em; }
/* The artist's portrait: an oval cut from SELF-PORTRAIT, hung with a shadow like the works on
   the wall, with no label; the bio stands beside it like a wall text. */
.about { display: flex; align-items: center; gap: 64px; max-width: none; }
.about-text { max-width: 30em; }
.about-portrait {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: zoom-in;
}
.about-portrait img {
  display: block;
  height: min(46vh, 430px);
  width: auto;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45));
  transition: transform 0.6s ease;
}
.about-portrait:hover img { transform: translateY(-4px); }
/* Futura: built into every Mac, iPhone and iPad, so it's shown without hosting a font file
   (Futura's licence doesn't allow serving it). Elsewhere the nearest geometric sans stands in. */
.about { font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif; letter-spacing: 0.02em; }

.contact a {
  color: var(--ink);
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;   /* as ABOUT */
  font-size: 18px;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 236, 205, 0.2);
  padding-bottom: 4px;
}

.contact a:hover { border-bottom-color: var(--ink); }

/* The copyright line: small print, at the end of the corridor and under each menu page. */
.colophon {
  margin-top: 72px;
  font-family: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif;   /* as ABOUT */
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-quiet);
  opacity: 0.75;
}
.colophon-wall {                  /* low on the wall after the last painting, just above the floor */
  position: absolute;
  right: 28px;
  bottom: calc(14vh + 16px);
  margin: 0;
  white-space: nowrap;
  z-index: 2;
}
[data-layout="column"] .colophon-wall { position: static; order: 999; padding: 8px 0 32px; }
/* Phones: the closing stop (gallery.js adds a screen of wall after the last painting). */
.track[data-closing] .colophon-wall { right: 50vw; transform: translateX(50%); scroll-snap-align: center; }

/* ---------- Phones: the corridor runs top to bottom ---------- */

/* ---------- Touch screens: swipe along the wall ----------
   iPhone, the iPhone Duo folded or open, iPad. The wall itself scrolls sideways under the
   finger and comes to rest with a painting centred; nothing moves the page up or down. */

html[data-layout="swipe"],
html[data-layout="swipe"] body { height: 100%; overflow: hidden; }

[data-layout="swipe"] .corridor { height: 100svh !important; }

[data-layout="swipe"] .viewport {
  position: relative;
  height: 100svh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
[data-layout="swipe"] .viewport::-webkit-scrollbar { display: none; }

[data-layout="swipe"] .track {
  position: relative;
  width: max-content;
  transform: none !important;
}

[data-layout="swipe"] .floor { position: fixed; }   /* the floor stays; the wall moves */

/* Touch screens: the wall is one very wide layer in a native scroller. Don't make it a layer of
   its own or fade it (iPhone Safari left stale strips of the paintings' shadows); a room change
   fades the veil over it instead (gallery.js walkThrough). */
.veil { display: none; }
[data-layout="swipe"] .track,
[data-layout="swipe"] .track.passing { will-change: auto; opacity: 1; transition: none; }
[data-layout="swipe"] .veil {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1;                 /* over the wall, under the floor that follows it in the page */
  background: var(--wall);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
[data-layout="swipe"] .veil.on { opacity: 1; transition: opacity 0.26s ease; }
/* ...and each painting, with its blurred shadow, is a layer of its own for good. Otherwise Safari
   lifts a picture into a layer only while it fades in (pictures load as you swipe) and then paints
   it back into the wall, and on iPhone that could leave stale strips of shadow behind. */
[data-layout="swipe"] .work img { will-change: transform; }

[data-layout="swipe"] .intro { width: 100vw; scroll-snap-align: center; }
[data-layout="swipe"] .door { width: 100vw; scroll-snap-align: center; }
[data-layout="swipe"] .work { scroll-snap-align: center; scroll-snap-stop: always; }
[data-layout="swipe"] .work img { --slot: 64svh; }
[data-layout="swipe"] .work:hover img { transform: none; }
[data-layout="swipe"] .caption { max-width: 84vw; white-space: normal; text-align: center; }

/* Half-folded (iPhone Duo; gallery.js readFold measures the two halves). Nothing sits on
   the fold: the painting has one half of the screen, its title the other. */
[data-layout="swipe"][data-fold] .track { gap: 0; }

[data-layout="swipe"][data-fold] .work,
[data-layout="swipe"][data-fold] .intro {
  width: 100vw;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0;
}
[data-layout="swipe"][data-fold] .intro-title { display: contents; }
[data-layout="swipe"][data-fold] .placard { position: static; transform: none; margin: 0; }
[data-layout="swipe"][data-fold] .caption { margin: 0; font-size: 18px; letter-spacing: 0.2em; }
[data-layout="swipe"][data-fold] .work img { margin-block: 0; }

/* The hinge down the middle, like a book: painting on the left page, title on the right. */
[data-layout="swipe"][data-fold="book"] .work,
[data-layout="swipe"][data-fold="book"] .intro {
  grid-template-columns: var(--seg-a-w) var(--seg-b-w);
  column-gap: var(--seg-gap);
}
[data-layout="swipe"][data-fold="book"] .work img { grid-column: 1; --slot: 80svh; }
[data-layout="swipe"][data-fold="book"] .work .caption { grid-column: 2; max-width: calc(var(--seg-b-w) * 0.8); }
[data-layout="swipe"][data-fold="book"] .intro h1 { grid-column: 1; }
[data-layout="swipe"][data-fold="book"] .placard { grid-column: 2; grid-row: 1; }

/* The hinge across, like a laptop: painting on the top half, title on the bottom. */
[data-layout="swipe"][data-fold="laptop"] .work,
[data-layout="swipe"][data-fold="laptop"] .intro {
  height: 100%;
  grid-template-rows: var(--seg-a-h) var(--seg-b-h);
  row-gap: var(--seg-gap);
  align-content: start;
}
[data-layout="swipe"][data-fold="laptop"] .work img {
  grid-row: 1;
  align-self: end;                           /* low in the top half, clear of the name above */
  margin-bottom: 3vh;
  --slot: calc(var(--seg-a-h) - 3vh - 64px);
}
[data-layout="swipe"][data-fold="laptop"] .work .caption { grid-row: 2; align-self: start; margin-top: 8vh; max-width: 80vw; }
[data-layout="swipe"][data-fold="laptop"] .intro h1 { grid-row: 1; }
[data-layout="swipe"][data-fold="laptop"] .placard { grid-row: 2; align-self: start; margin-top: 8vh; }

/* ---------- A narrow window with a mouse: one painting per screen, scrolling down ---------- */

html[data-layout="column"] { scroll-snap-type: y mandatory; }
[data-layout="column"] .corridor { height: auto !important; }
[data-layout="column"] .viewport { position: static; height: auto; overflow: visible; }
[data-layout="column"] .floor,
[data-layout="column"] .hint { display: none; }
[data-layout="column"] .track {
  position: static;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  transform: none !important;
}
[data-layout="column"] .work {
  height: 100svh;
  width: 100%;
  padding: 56px 20px 40px;
  scroll-snap-align: center;
}
[data-layout="column"] .intro {
  width: 100%;
  height: 100svh;
  padding: 0;
  scroll-snap-align: center;
}
[data-layout="column"] .door { width: 100%; height: 70svh; scroll-snap-align: center; }
[data-layout="column"] .intro::before,
[data-layout="column"] .work::before { top: 0; width: 140%; height: 80svh; }
[data-layout="column"] .work img {
  height: auto;
  width: auto;
  max-width: 100%;
  max-height: calc(100svh - 170px);
  margin-block: 0;
}
[data-layout="column"] .work:hover img { transform: none; }
[data-layout="column"] .caption { white-space: normal; text-align: center; }

/* ---------- Small screens, however they're walked ---------- */

@media (max-width: 760px) {
  /* Phones and small tablets (iPhone Duo folded or open): wide spacing, so each painting has
     the screen to itself - one painting per screen. */
  [data-layout="swipe"] .track { gap: 32vw; }

  .name { top: 18px; left: 20px; font-size: 15px; }
  .intro { font-size: 15px; }
  .door-title { font-size: 15px; }
  .room-block { grid-template-columns: 1fr; row-gap: 20px; }
  .room-block .index-row { grid-column: 1; }
  .rooms { gap: 44px; }

  .placard { margin-top: 36px; max-width: 78vw; }
  .placard-head { font-size: 10px; }
  .placard-note { font-size: 11px; }

  .work img { border-width: calc(var(--fw) * 0.6); }
  .work[data-frame="rococo"] img { border-width: var(--fw); }   /* already sized with the painting */

  .caption { margin-top: 18px; font-size: 12px; }

  .closer img { max-width: 100vw; max-height: calc(100svh - 70px); }

  .menu-button { top: 18px; right: 20px; font-size: 13px; }
  .panel { padding: 72px 20px 56px; }
  .panel-nav { gap: 0.9em 1.3em; flex-wrap: wrap; margin-bottom: 40px; font-size: 12px; letter-spacing: 0.18em; }   /* four items on a phone */
  .index { display: block; }
  .index-year { margin-bottom: 14px; }
  .index-row { gap: 22px 16px; margin-bottom: 40px; }
  .index-row img { height: 96px; }
  .index-row span { max-width: 150px; font-size: 10px; }
  .about { font-size: 16px; flex-direction: column; align-items: flex-start; gap: 34px; }
  .about-portrait { align-self: center; }
  .about-portrait img { height: auto; width: min(58vw, 300px); }
  .contact a { font-size: 15px; }
}

/* Short screens (a phone or the iPhone Duo held sideways): a smaller slot and a closer title,
   so the title stays clear of the floor. gallery.js sizes paintings to match. */
@media (max-height: 700px) {
  .work img { --slot: 56vh; }
  [data-layout="swipe"] .work img { --slot: 56svh; }
  .caption { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: none; }
  .work img, .closer, .closer .caption, .panel { transition: none; }
}

/* ---------- A phone on its side (touch, short and wide; gallery.js sets data-short) ----------
   One painting per screen, as tall as the band between the header and the floor allows, with
   its label on the wall to the right of it, as in a gallery. */
[data-layout="swipe"][data-short] .name { top: 16px; font-size: 15px; }
[data-layout="swipe"][data-short] .menu-button { top: 16px; font-size: 13px; }
[data-layout="swipe"][data-short] .track { gap: 36vw; }
[data-layout="swipe"][data-short] .work {
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  padding: 46px 0 calc(14svh + 18px);
}
[data-layout="swipe"][data-short] .work img { --slot: calc(100svh - 46px - 14svh - 18px); margin-block: 0; }
[data-layout="swipe"][data-short] .work .caption {
  margin: 0 0 2px 24px;
  max-width: 24vw;
  text-align: left;
  white-space: normal;
}
/* Turned sideways, an iPhone's notch or Dynamic Island sits on the left or right edge: keep the
   name, MENU and the small print inside the safe area (no change on screens without one). */
[data-layout="swipe"][data-short] .name { left: max(20px, env(safe-area-inset-left)); }
[data-layout="swipe"][data-short] .menu-button { right: max(20px, env(safe-area-inset-right)); }
[data-layout="swipe"][data-short] .colophon-wall { right: max(28px, env(safe-area-inset-right)); }

/* ---------- Museum white (html data-wall="white"; remove the attribute for the dark wall) ----------
   A flat white wall: no plaster texture, no grain, no spotlight pools. The hanging shadows stay -
   softer than on the dark wall, as they fall on white. Text turns dark. */
html[data-wall="white"] {
  --wall: #f3f2ef;
  --wall-deep: #e4e1dc;
  --wall-texture: none;
  --light: transparent;
  --ink: #2a2622;
  --ink-quiet: #857e75;
}
html[data-wall="white"] body::after { display: none; }
html[data-wall="white"] .track { background: var(--wall); }
html[data-wall="white"] .floor {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.07), #dcd8d1 40%);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
html[data-wall="white"] .progress { background: rgba(0, 0, 0, 0.18); }
html[data-wall="white"] .work img,
html[data-wall="white"] .index-row img { background-color: #e2dfd9; }
html[data-wall="white"] .work img {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 5px 12px rgba(0, 0, 0, 0.2),
    0 34px 44px -14px rgba(0, 0, 0, 0.38),
    0 70px 90px -30px rgba(0, 0, 0, 0.2);
}
html[data-wall="white"] .work[data-frame="own"] img,
html[data-wall="white"] .work[data-frame="own"] img.ready,
html[data-wall="white"] .work[data-frame="rococo"] img,
html[data-wall="white"] .work[data-frame="rococo"] img.ready {
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3)) drop-shadow(0 26px 34px rgba(0, 0, 0, 0.26));
}
html[data-wall="white"] .work[data-frame="wrap"] img {
  box-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.6),
    0 6px 0 color-mix(in srgb, var(--edge, #2a251f) 45%, black),
    2px 6px 0 color-mix(in srgb, var(--edge, #2a251f) 30%, black),
    -2px 6px 0 color-mix(in srgb, var(--edge, #2a251f) 30%, black),
    0 9px 6px rgba(0, 0, 0, 0.35),
    0 42px 50px -14px rgba(0, 0, 0, 0.4),
    0 80px 100px -30px rgba(0, 0, 0, 0.22);
}
html[data-wall="white"] .closer.open { background: rgb(243, 242, 239); }   /* opaque: dark wall text would show through */
html[data-wall="white"] .closer img { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); }
html[data-wall="white"] .closer[data-frame="own"] img { box-shadow: none; filter: drop-shadow(0 24px 50px rgba(0, 0, 0, 0.3)); }
html[data-wall="white"] .closer[data-frame="painting"] img { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); }
html[data-wall="white"] .panel { background: var(--wall); }
html[data-wall="white"] .index-row img { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22); }
html[data-wall="white"] .index-row img.own { box-shadow: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25)); }
html[data-wall="white"] .contact a { border-bottom-color: rgba(0, 0, 0, 0.2); }
html[data-wall="white"] .about-portrait img { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3)) drop-shadow(0 26px 34px rgba(0, 0, 0, 0.26)); }
