/* The museum menu with the hanging artwork that changes in its frame.
   The wall is one element whose box the script reshapes every frame (a plaster bar closed, the whole frame open); the
   body inside it keeps the size of the whole frame and is moved the other way, so nothing reflows while it grows.
   The frame, the wires, the light pool and the brass corners are placed in pixels by the script, read again on
   resize. */
:root {
  --page: #ffffff;                 /* the page */
  --plaster: #ebe5da;              /* the gallery wall */
  --plaster-hi: #f5f1ea;           /* the wall where the light falls */
  --ink: #1c1915;                  /* the words */
  --muted: #8d8579;                /* the quiet words */
  --brass: #b0874c;                /* the brass of the lamp and the corners */
  --brass-hi: #ecd3a0;             /* the light on the brass */
  --wood: #2a2019;                 /* the frame */
  --mat: #f8f4ec;                  /* the mat around the painting */
  --button: #1c1915;               /* the button */
  --button-ink: #f5f1ea;           /* the words on the button */
  --warm: 255, 214, 156;           /* the colour of the picture light (r, g, b) */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.orrin {
  --w: min(820px, calc(100vw - 24px));
  --h: min(540px, calc(100vh - 24px));
  --bar: clamp(48px, calc(var(--h) * 0.115), 60px);
  --pad: clamp(10px, calc(var(--w) * 0.03), 24px);
  position: relative;
  width: var(--w);
  height: var(--h);
}

/* ---- the wall: a plaster bar when closed, the whole frame when open (its box is set by the script) ---- */
.wall {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(90% 70% at 70% 0%, var(--plaster-hi), transparent 70%),
    linear-gradient(180deg, #efe9df, var(--plaster) 55%, #e4ddd1);
  box-shadow:
    inset 0 0 0 1px rgba(28, 25, 21, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 1px 2px rgba(40, 30, 18, 0.08),
    0 12px 28px -12px rgba(40, 30, 18, 0.22),
    0 40px 70px -40px rgba(40, 30, 18, 0.3);
}

.wall__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.5 0 0 0 0 0.42 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the body keeps the size of the whole frame and is moved against the wall's box */
.wall__body {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--h);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  column-gap: calc(var(--pad) * 1.2);
  padding: calc(var(--bar) + var(--pad) * 0.9) var(--pad) var(--pad) calc(var(--pad) * 1.5);
}

/* ---- the bar: the name and the button (placed by the script) ---- */
.bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 7px 0 clamp(14px, 3.4vw, 22px);
  z-index: 3;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.brand__name {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-style: italic;
  font-size: clamp(20px, calc(var(--bar) * 0.42), 25px);
  font-variation-settings: 'opsz' 48;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: 12px;
  font-weight: 520;
  font-stretch: 108%;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.toggle {
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--button-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 999px;
}

.toggle:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.toggle__face {
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--bar) - 14px);
  padding: 0 14px 0 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2c2822, var(--button));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 1px rgba(0, 0, 0, 0.2),
    0 6px 14px -6px rgba(28, 25, 21, 0.55);
}

.toggle__words {
  position: relative;
  display: block;
  height: 1.2em;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
}

.toggle__roll {
  display: flex;
  flex-direction: column;
  font-stretch: var(--tw, 100%);
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle__roll span {
  display: block;
  height: 1.2em;
}

.toggle__icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

@media (hover: hover) {
  .toggle:hover .toggle__roll {
    --tw: 122%;
  }
}

/* ---- the entries ---- */
.nav {
  position: relative;
  align-self: center;
  min-width: 0;
}

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(2px, 1.2vh, 10px);
}

.entry__link {
  position: relative;
  display: block;
  padding: clamp(3px, 0.8vh, 6px) 12px clamp(4px, 0.9vh, 7px);
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.entry__mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}

.entry__in {
  display: block;
}

.entry__word {
  display: inline-block;
  font-size: clamp(26px, min(5.4vw, 7.6vh), 48px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: var(--wg, 470);
  font-stretch: var(--wd, 100%);
  color: var(--ink);
  white-space: nowrap;
  transition:
    font-weight 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
    font-stretch 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
    color 0.35s ease;
}

.entry__note {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.35s ease;
}

.nav__list.has-on .entry__word {
  color: #a59d91;
}

.entry.is-on .entry__word {
  --wd: 122%;
  --wg: var(--wg-on, 640);
  color: var(--ink);
}

.nav__list.has-on .entry.is-on .entry__word {
  color: var(--ink);
}

.entry.is-on .entry__note {
  color: #6f5a3a;
}

.entry__link:focus-visible .entry__word {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
  border-radius: 4px;
}

/* the four brass corners that frame the entry under the pointer */
.marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  pointer-events: none;
  opacity: 0;
}

.marker i {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 0 solid var(--brass);
}

.marker i:nth-child(1) { left: 0; top: 0; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 2px; }
.marker i:nth-child(2) { right: 0; top: 0; border-width: 1.5px 1.5px 0 0; border-top-right-radius: 2px; }
.marker i:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 1.5px 1.5px; border-bottom-left-radius: 2px; }
.marker i:nth-child(4) { right: 0; bottom: 0; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 2px; }

.nav__foot {
  margin: clamp(10px, 3vh, 26px) 0 0 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(28, 25, 21, 0.1);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.nav__sep {
  margin: 0 4px;
}

/* ---- the hanging work ---- */
.hang {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.hang__rail {
  position: absolute;
  left: -6px;
  right: calc(var(--pad) * -1);
  top: 0;
  height: 3px;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(180deg, #fbf8f2, #cfc6b8 60%, #b9ae9d);
  box-shadow: 0 1px 2px rgba(40, 30, 18, 0.18);
  transform-origin: 100% 50%;
}

/* the warm pool of the picture light on the wall (placed by the script) */
.hang__pool {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--warm), 0.75), rgba(var(--warm), 0.26) 55%, rgba(var(--warm), 0) 100%);
  mix-blend-mode: soft-light;
  opacity: 0;
}

.hang__wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.hang__wire {
  fill: none;
  stroke: #6e6458;
  stroke-width: 0.9;
  stroke-linejoin: round;
}

.hang__hook {
  fill: #8d8172;
}

.frame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  --mold: 6px;
  --matp: 12px;
}

.frame__shadow {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  box-shadow:
    0 1px 1px rgba(30, 20, 10, 0.18),
    0 8px 14px -6px rgba(30, 20, 10, 0.3),
    0 26px 40px -16px rgba(30, 20, 10, 0.36),
    0 50px 60px -40px rgba(30, 20, 10, 0.3);
}

.frame__mold {
  position: absolute;
  inset: 0;
  padding: var(--mold);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(255, 238, 214, 0.22), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.35)),
    linear-gradient(90deg, rgba(255, 238, 214, 0.1), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.28)),
    linear-gradient(135deg, #3d3027, var(--wood) 45%, #1a140f);
  box-shadow: inset 0 1px 0 rgba(255, 236, 210, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.frame__mat {
  position: relative;
  width: 100%;
  height: 100%;
  padding: var(--matp);
  background: linear-gradient(180deg, #fbf8f2, var(--mat) 40%, #efe9de);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.frame__art {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #d9d2c4;
}

/* the bevel of the mat casting a hair of shadow into the painting */
.frame__art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.14), inset 0 2px 4px rgba(0, 0, 0, 0.18);
  z-index: 20;
}

.frame__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  --a: 120%;
  -webkit-mask-image: linear-gradient(100deg, #000 0, #000 calc(var(--a) - 22%), transparent var(--a));
  mask-image: linear-gradient(100deg, #000 0, #000 calc(var(--a) - 22%), transparent var(--a));
}

.frame__art img:first-child {
  opacity: 1;
}

/* a thin band of light that runs with the curtain */
.frame__sheen {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 26%;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  background: linear-gradient(100deg, transparent, rgba(var(--warm), 0.35) 45%, rgba(255, 255, 255, 0.45) 55%, transparent);
  mix-blend-mode: soft-light;
}

/* the picture light: a brass hood over the top of the frame, on a short arm */
.lamp {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 38%;
  height: 18px;
  transform: translateX(-50%);
  pointer-events: none;
}

.lamp__arm {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 3px;
  height: 15px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7a5c30, var(--brass-hi) 45%, #8a6a3a);
}

.lamp__hood {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, #6e5229);
  box-shadow: 0 2px 3px rgba(40, 28, 10, 0.35), inset 0 -1px 0 rgba(255, 240, 200, 0.4);
}

/* the warm light it pours over the painting */
.frame__glow {
  position: absolute;
  left: -14%;
  right: -14%;
  top: -10px;
  height: 78%;
  pointer-events: none;
  background: radial-gradient(60% 75% at 50% 0%, rgba(var(--warm), 0.5), rgba(var(--warm), 0.16) 55%, transparent 80%);
  mix-blend-mode: soft-light;
  opacity: 0;
}

/* ---- the wall label ---- */
.label {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  gap: 1px;
  padding: 9px 12px 9px;
  min-width: 150px;
  border-radius: 3px;
  background: linear-gradient(180deg, #fdfbf7, #f6f2ea);
  box-shadow:
    inset 0 0 0 1px rgba(28, 25, 21, 0.08),
    0 1px 1px rgba(40, 30, 18, 0.1),
    0 6px 12px -8px rgba(40, 30, 18, 0.3);
}

.label__line {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 620;
}

.label__line--title {
  font-weight: 420;
  color: #3b352d;
}

.label__line--title em {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-size: 1.1em;
  font-variation-settings: 'opsz' 24;
}

.label__line--small {
  font-size: 11px;
  font-weight: 460;
  color: var(--muted);
}

.label__roll {
  display: block;
}

/* ---- the narrow frame: the work on top, the entries under it two by two ---- */
@media (max-width: 600px) {
  .wall__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    row-gap: calc(var(--pad) * 0.6);
    padding: calc(var(--bar) + var(--pad) * 0.7) var(--pad) var(--pad);
  }
  .hang { grid-row: 1; }
  .nav { grid-row: 2; align-self: end; }
  .nav__list {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .entry__link { padding: 5px 10px 6px; }
  .entry__word { font-size: clamp(19px, min(6.4vw, 5.4vh), 28px); }
  .entry__note,
  .nav__foot { display: none; }
  .hang__rail { right: calc(var(--pad) * -1); left: calc(var(--pad) * -1); border-radius: 0; }
  .label { padding: 6px 9px 7px; min-width: 0; }
  .label__line { font-size: 11px; }
  .label__line--small { font-size: 10px; }
}

@media (max-height: 470px) and (min-width: 601px) {
  .entry__note { display: none; }
  .nav__foot { display: none; }
}
