:root {
  --wall: #e6e8e3;
  --wall-2: #d8dcd5;
  --ink: #15191b;
  --ink-2: #4b5458;
  --line: #bfc6bf;
  --card: #f8f8f5;
  --accent: #002fa7; /* Klein blue */
  --on-accent: #fff;
  --shadow: rgb(18 24 28 / 0.24);
  --shadow-light: rgb(18 24 28 / 0.1);

  --serif: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --small: 0.8125rem;
  --big: clamp(1.9rem, 1.2rem + 2.4vw, 2.85rem);
  --huge: clamp(2.7rem, 1.2rem + 5.4vw, 5.9rem);
}

/* evening: the wall goes dark and the links turn brass */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #13181a; --wall-2: #0c1012; --ink: #ece7dc; --ink-2: #a3aaa6; --line: #2c3437;
    --card: #1d2326; --accent: #d1b26c; --on-accent: #12100a;
    --shadow: rgb(0 0 0 / 0.62); --shadow-light: rgb(0 0 0 / 0.36);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #13181a; --wall-2: #0c1012; --ink: #ece7dc; --ink-2: #a3aaa6; --line: #2c3437;
  --card: #1d2326; --accent: #d1b26c; --on-accent: #12100a;
  --shadow: rgb(0 0 0 / 0.62); --shadow-light: rgb(0 0 0 / 0.36);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s, color 0.5s;
}

h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 500; line-height: 1.05; text-wrap: balance; }
p, dl, dd, figure { margin: 0; }
a { color: var(--accent); text-underline-offset: 0.18em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.top, .entrance, .inner, .exit {
  max-width: 1240px;
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
@media (min-width: 720px) {
  .top, .entrance, .inner, .exit { padding-left: 40px; padding-right: 40px; }
}

/* header */

.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; padding-block: 24px; }
.name { font: italic 500 1.4rem var(--serif); color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 24px; align-items: baseline; font-size: var(--small); font-weight: 500; }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover, #lights:hover { text-decoration: underline; }
#lights { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 500; }

/* entrance */

.entrance {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "hero" "code";
  gap: clamp(32px, 5vw, 64px);
  padding-block: clamp(20px, 5vw, 56px) clamp(64px, 9vw, 120px);
}
@media (min-width: 960px) {
  .entrance {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr);
    grid-template-areas: "intro hero" "code hero";
    column-gap: clamp(48px, 6vw, 96px);
  }
}
.intro { grid-area: intro; display: grid; gap: 24px; align-content: start; }
.hero { grid-area: hero; justify-self: center; width: min(100%, 520px); }
@media (min-width: 960px) { .hero { justify-self: end; } }
.hero-code { grid-area: code; display: grid; gap: 12px; align-content: start; min-width: 0; }

h1 { font-size: var(--huge); line-height: 0.98; letter-spacing: -0.02em; }
.intro-text { font-size: 1.1875rem; line-height: 1.6; color: var(--ink-2); max-width: 34rem; }

/* the information line from an exhibition poster */
.poster { display: grid; gap: 6px; font-size: var(--small); border-top: 1px solid var(--line); padding-top: 16px; max-width: 34rem; }
.poster div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 12px; }
.poster dt { color: var(--ink-2); }

.code-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--small); color: var(--ink-2); }
.code-head b { color: var(--ink); font-weight: 600; }
.hint { font-size: var(--small); color: var(--ink-2); }
.touch-only { display: none; }
@media (hover: none) {
  .mouse-only { display: none; }
  .touch-only { display: inline; }
}

.link {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--accent); font-size: var(--small); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.link:hover { text-decoration-thickness: 2px; }

.button {
  min-height: 44px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--ink); border-radius: 2px; background: none;
  font-size: var(--small); font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center;
}
.button:hover { background: var(--ink); color: var(--wall); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--wall); }
.button:disabled { opacity: 0.5; cursor: default; }

/* frames */

.frame { position: relative; padding: var(--frame, 16px); width: var(--frame-width, 100%); margin-inline: auto; }
.slip { position: relative; padding: var(--slip, 0); background: var(--slip-color, none); }
.canvas-box { position: relative; aspect-ratio: var(--ar, 4 / 5); max-width: 100%; overflow: hidden; background: #1a1a1a; touch-action: pan-y; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (hover: hover) and (pointer: fine) { .canvas-box { cursor: none; } }

/* the gilt moulding is all inset shadows on one box */
.gilt {
  --frame: clamp(16px, 2.4vw, 28px);
  --slip: clamp(4px, 0.55vw, 7px);
  --slip-color: linear-gradient(135deg, #3a2a12, #1c1308);
  background:
    linear-gradient(135deg, rgb(255 244 214 / 0.38), transparent 34% 62%, rgb(40 24 4 / 0.42)),
    repeating-linear-gradient(45deg, rgb(255 236 180 / 0.06) 0 2px, rgb(60 40 10 / 0.06) 2px 4px),
    linear-gradient(90deg, #7f5f26, #b8954d 16%, #9a7a39 34%, #cdb06a 50%, #977536 66%, #b4914b 84%, #73561f);
  box-shadow:
    inset 0 0 0 1px #33240b, inset 0 0 0 2px #b9985a, inset 0 0 0 4px #6e5220,
    inset 0 0 0 5px #d9bd78, inset 0 0 0 7px #85642a,
    inset 5px 5px 10px rgb(255 238 196 / 0.32), inset -7px -7px 12px rgb(28 16 2 / 0.55),
    0 26px 36px -20px var(--shadow), 0 8px 14px -8px var(--shadow);
}
.gilt .slip { box-shadow: inset 0 0 0 1px rgb(232 200 120 / 0.45), inset 0 0 0 2px rgb(20 12 2 / 0.6); }
.gilt .canvas-box { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.35); }

.walnut {
  --frame: clamp(12px, 1.8vw, 20px);
  --slip: 3px;
  --slip-color: linear-gradient(135deg, #e0c47b, #a8833a);
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.1), transparent 45%, rgb(0 0 0 / 0.25)),
    repeating-linear-gradient(93deg, #4b2f1d 0 2px, #5d3c25 2px 6px, #42281a 6px 7px, #63412a 7px 11px);
  box-shadow: inset 2px 2px 3px rgb(255 230 200 / 0.25), inset -3px -3px 6px rgb(0 0 0 / 0.45),
    0 26px 36px -20px var(--shadow), 0 8px 14px -8px var(--shadow);
}

.float {
  --frame: 9px;
  --slip: clamp(8px, 1.4vw, 14px);
  --slip-color: #08090a;
  background: linear-gradient(135deg, #2a2c2e, #0f1011);
  box-shadow: inset 0 0 0 1px #3a3d40, 0 26px 36px -20px var(--shadow), 0 8px 14px -8px var(--shadow);
}
.float .canvas-box { box-shadow: 0 8px 16px rgb(0 0 0 / 0.7); }

.mat {
  --frame: 7px;
  --slip: clamp(18px, 4vw, 38px);
  --slip-color: #fbfaf6;
  background: linear-gradient(135deg, #2b2b2c, #121213);
  box-shadow: 0 26px 36px -20px var(--shadow), 0 8px 14px -8px var(--shadow);
}
.mat .slip { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08), inset 0 2px 6px rgb(0 0 0 / 0.08); }
.mat .canvas-box { box-shadow: -1px -1px 0 1px #fff, 1px 1px 0 1px #e3dfd4, 0 0 0 3px #f1eee6; }

.metal {
  --frame: 9px;
  --slip: 6px;
  --slip-color: #111214;
  background: linear-gradient(135deg, #8d959c, #e8ecef 28%, #8a9299 50%, #d4d9dd 72%, #7a8289);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.25), 0 26px 36px -20px var(--shadow), 0 8px 14px -8px var(--shadow);
}

/* wall labels */

.placard {
  display: flex; flex-direction: column; gap: 2px;
  width: min(100%, 25rem); margin: 24px auto 0; padding: 16px;
  background: var(--card); font-size: var(--small); line-height: 1.5;
  box-shadow: 0 1px 1px var(--shadow-light), 0 4px 10px -6px var(--shadow-light);
}
.placard .artist { font-weight: 650; }
.placard .muted { color: var(--ink-2); }
.placard .title { margin-top: 8px; }
.placard cite { font-family: var(--serif); font-size: 1.14em; }
.placard .note { margin-top: 8px; }
.placard details { margin-top: 10px; }
.placard summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.placard details[open] summary { margin-bottom: 10px; }
.placard .foot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; }
.placard .acc { font-size: 0.75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* code, in the colours of the painting it belongs to */

.code {
  margin: 0; padding: 12px 0; overflow-x: auto; tab-size: 4;
  background: var(--p-bg); color: var(--p-fg);
  font: 12.5px/1.65 var(--mono); border-radius: 2px;
  box-shadow: 0 10px 24px -16px var(--shadow);
}
.code code { display: block; min-width: max-content; font: inherit; }
.code .ln { display: block; position: relative; padding: 0 16px 0 calc(3.2ch + 16px); white-space: pre; transition: background-color 0.25s; }
.code .ln::before { content: attr(data-n); position: absolute; left: 10px; width: 2.4ch; text-align: right; color: var(--p-com); opacity: 0.75; }
.ln.live { background: var(--p-sel); box-shadow: inset 3px 0 0 var(--p-kw); }
.t-kw { color: var(--p-kw); }
.t-fn { color: var(--p-fn); }
.t-type { color: var(--p-type); }
.t-str { color: var(--p-str); }
.t-num { color: var(--p-num); }
.t-com { color: var(--p-com); font-style: italic; }
.t-id { color: var(--p-id); }
.t-op { color: var(--p-op); }
.t-pun { color: var(--p-pun); }

/* sections */

section .inner { padding-block: clamp(64px, 9vw, 128px); }
.band { background: var(--wall-2); }
h2 { font-size: var(--big); letter-spacing: -0.012em; max-width: 40rem; }
.section-text { margin: 16px 0 clamp(40px, 6vw, 64px); font-size: 1.1875rem; color: var(--ink-2); max-width: 36rem; }

.glossary { display: grid; column-gap: clamp(32px, 6vw, 88px); }
@media (min-width: 920px) { .glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.glossary div { display: flex; align-items: baseline; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.glossary dt { font: italic 500 clamp(1.35rem, 1.1rem + 0.9vw, 1.65rem) var(--serif); white-space: nowrap; }
.glossary span { flex: 1; min-width: 16px; border-bottom: 1px dotted var(--ink-2); opacity: 0.55; transform: translateY(-0.28em); }
.glossary dd { font: var(--small) var(--mono); color: var(--ink-2); text-align: right; }

/* the hang */

.hang { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(72px, 9vw, 120px); }
@media (min-width: 860px) { .hang { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(48px, 6vw, 96px); } }
.hang > li { display: grid; gap: 20px; align-content: start; min-width: 0; }
.year { font-family: var(--serif); font-size: var(--big); line-height: 1; text-align: center; }
.year small { font-size: 0.5em; font-style: italic; }
.portrait .frame { --frame-width: 84%; }
.square .frame { --frame-width: 90%; }

.vacant { grid-column: 1 / -1; }
.vacant > div { display: grid; gap: 32px; justify-items: center; text-align: center; }
@media (min-width: 860px) {
  .vacant > div { grid-template-columns: minmax(0, 360px) minmax(0, 26rem); justify-content: center; justify-items: start; text-align: left; gap: 56px; align-items: center; }
}
.vacant .canvas-box { display: grid; place-items: center; background: var(--wall); box-shadow: inset 0 10px 18px -8px var(--shadow); }
.vacant .canvas-box span { font: italic 1.1875rem var(--serif); color: var(--ink-2); padding: 16px; }
.vacant .placard { margin: 0; }
.vacant p { font-size: 1.1875rem; color: var(--ink-2); }
.vacant-text { display: grid; gap: 16px; justify-items: inherit; }

/* studio */

.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(36px, 5vw, 64px); }
@media (min-width: 1000px) { .bench { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: start; } }
.tools, .easel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.easel .work { width: min(100%, 500px); justify-self: center; }
.easel .placard { margin-top: 0; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: var(--small); }
.row label { font-weight: 600; }
select {
  flex: 1 1 14rem; min-width: 0; max-width: 100%; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 2px; background-color: var(--card);
}

.editor {
  position: relative; height: clamp(260px, 42vh, 400px); overflow: hidden; border-radius: 3px;
  background: var(--p-bg); color: var(--p-fg);
  box-shadow: 0 18px 40px -24px var(--shadow);
}
.editor:focus-within { box-shadow: 0 18px 40px -24px var(--shadow), 0 0 0 2px var(--accent); }
/* a transparent textarea on top of a highlighted <pre>; both must lay out identically */
.editor pre, .editor textarea {
  position: absolute; inset: 0; margin: 0; border: 0;
  padding: 14px 16px 14px calc(3.2ch + 18px);
  font: 13.5px/1.65 var(--mono); tab-size: 4; white-space: pre; overflow: auto;
}
.editor pre { pointer-events: none; overflow: hidden; }
.editor pre code { display: block; min-width: max-content; font: inherit; }
.editor .ln { display: block; position: relative; min-height: 1.65em; }
.editor .ln::before { content: attr(data-n); position: absolute; left: calc(-3.2ch - 8px); width: 3ch; text-align: right; color: var(--p-com); opacity: 0.7; }
.editor .ln.live { box-shadow: -3.6ch 0 0 var(--p-sel), inset 3px 0 0 var(--p-kw); }
.editor textarea {
  resize: none; outline: none; background: none;
  color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--p-fg);
  scrollbar-width: none; /* hidden so it can't push the two layers out of line */
}
.editor textarea::-webkit-scrollbar { display: none; }
.editor textarea::selection { background: var(--p-sel); }
.editor-foot { justify-content: space-between; color: var(--ink-2); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
legend { padding: 0; margin-bottom: 8px; font-size: var(--small); font-weight: 600; }
.group-name { font-size: 0.75rem; color: var(--ink-2); }
.note { font-size: var(--small); color: var(--ink-2); min-height: 1.5em; }

/* palettes look like paint-shop colour cards */
.paints { display: flex; flex-wrap: wrap; gap: 16px 12px; }
.paint {
  display: grid; justify-items: start; gap: 5px; padding: 0; border: 0; background: none;
  cursor: pointer; font-size: 0.75rem; color: var(--ink-2);
}
.paint i {
  width: 56px; height: 34px; border: 3px solid var(--c0);
  background: linear-gradient(var(--c1) 0 25%, var(--c2) 25% 50%, var(--c3) 50% 75%, var(--c4) 75%);
  box-shadow: 0 0 0 1px var(--line);
}
.paint[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.paint[aria-checked="true"] i { box-shadow: 0 0 0 1px var(--wall), 0 0 0 3px var(--ink); }

.modes { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.mode {
  padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: italic 1.25rem var(--serif); color: var(--ink-2);
}
.mode:hover { color: var(--ink); }
.mode[aria-checked="true"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }

.placard.editable input {
  width: 100%; padding: 2px 0; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; background: none;
}
.placard.editable input:focus { outline: none; border-bottom-color: var(--accent); }
.placard.editable .artist { font-weight: 650; }
.placard.editable .title { display: flex; align-items: baseline; }
.placard.editable #title { width: auto; max-width: calc(100% - 3.5em); min-width: 4ch; field-sizing: content; font: italic 1.2em var(--serif); }
.status { min-height: 1.5em; text-align: center; font-size: var(--small); color: var(--ink-2); }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.shared-note { text-align: center; font: italic 1.1rem var(--serif); }
.share-links { display: grid; gap: 8px; justify-items: center; font-size: var(--small); color: var(--ink-2); }
.share-links input {
  width: 100%; max-width: 30rem; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 2px; background: var(--card);
  font: 12px var(--mono); color: var(--ink-2);
}

.legend { display: grid; gap: 10px; }
.legend h3 { font: 600 var(--small) var(--sans); }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 8px 16px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: var(--small); color: var(--ink-2); }
.legend b { color: var(--ink); font-weight: 600; }
.legend li i { flex: none; width: 26px; height: 10px; border-radius: 6px 2px; background: var(--c); }

/* footer */

.exit { display: grid; gap: 32px; justify-items: center; text-align: center; padding-block: clamp(72px, 10vw, 136px) clamp(48px, 7vw, 88px); }
.exit blockquote { margin: 0; display: grid; gap: 16px; max-width: 46rem; }
.exit blockquote p { font: italic 500 var(--big)/1.15 var(--serif); text-wrap: balance; }
.exit blockquote footer { font-size: var(--small); color: var(--ink-2); }
.farewell { font-size: 1.1875rem; max-width: 34rem; }
/* the exhibition is signed the way the paintings are */
.maker { display: grid; gap: 8px; justify-items: center; }
.signed { font: 3.4rem/1.1 "Herr Von Muellerhoff", "Snell Roundhand", cursive; color: var(--accent); transform: rotate(-4deg); }
.maker > span:last-child { font-size: var(--small); color: var(--ink-2); }
.colophon { max-width: 40rem; padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--small); color: var(--ink-2); }

/* the magnifier */

.loupe {
  position: fixed; left: 0; top: 0; z-index: 40; width: 196px; height: 196px;
  border-radius: 50%; overflow: hidden; pointer-events: none; background: #111;
  box-shadow: 0 0 0 2px #e9e2cf, 0 0 0 5px #6f6650, 0 0 0 6px rgb(0 0 0 / 0.4), 0 18px 34px rgb(0 0 0 / 0.45);
}
.loupe canvas { display: block; width: 100%; height: 100%; }
.loupe::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(70% 60% at 30% 22%, rgb(255 255 255 / 0.16), transparent 60%); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { transition: none; }
}
