:root {
  --ink: #1d1c1a;
  --ink-2: #4f4c47;
  --ink-3: #85817a;
  --paper: #fbfaf7;
  --air: #cdcac4;
  --light: #f1efe9;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --pad: clamp(16px, 2.4vw, 32px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--air); color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  overflow: hidden; -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; gap: 12px;
  background: var(--air); font-size: 13px; color: var(--ink-2);
  transition: opacity 1.2s var(--ease) .2s, visibility 0s 1.4s;
}
#loader b { display: block; width: 160px; height: 1px; background: rgba(29, 28, 26, .15); }
#loader i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .4s var(--ease); }
.ready #loader { opacity: 0; visibility: hidden; }

/* ---------- chrome: plain type over the room ---------- */
.bar, .pager, .label { position: fixed; z-index: 10; transition: opacity .6s var(--ease), transform .6s var(--ease); }
.bar {
  top: 0; left: 0; right: 0; padding: calc(var(--pad) - 4px) var(--pad);
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--light); text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { font-weight: 500; font-size: 15px; text-decoration: none; }
#index-btn { font-size: 15px; }
#index-btn:hover, .brand:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- wall label ---------- */
.label {
  left: var(--pad); bottom: var(--pad); width: min(330px, calc(100vw - 2 * var(--pad)));
  max-height: calc(100vh - 120px); overflow: auto;
  background: var(--paper); padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  font-size: 13.5px; line-height: 1.5;
}
.label > * { transition: opacity .26s; }
.label.out > * { opacity: 0; }
.label:empty { display: none; }
.label .artist { font-weight: 500; }
.label h2 { font: 400 19px/1.25 var(--serif); margin-top: 2px; }
.label .medium { color: var(--ink-2); margin-top: 2px; }
.label .text { color: var(--ink-2); margin-top: 12px; }
.label > .text:first-child { margin-top: 0; color: var(--ink); font: 400 16px/1.45 var(--serif); }
.label .more, .label .links a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.label .more { display: inline-block; margin-top: 12px; font-weight: 500; }
.label .links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.label .hint { margin-top: 12px; color: var(--ink-3); }

/* ---------- pager ---------- */
.pager {
  right: var(--pad); bottom: calc(var(--pad) - 6px);
  display: flex; align-items: center; gap: 2px;
  color: var(--light); text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.pager button { width: 36px; height: 36px; font-size: 17px; }
.pager button:disabled { opacity: .3; cursor: default; }
#count { font-size: 14px; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- hover tag by the cursor ---------- */
.tip {
  position: fixed; left: 0; top: 0; z-index: 12; pointer-events: none; white-space: nowrap;
  background: var(--paper); padding: 4px 9px; font-size: 13px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.tip[hidden] { display: none; }

/* ---------- zoom into a project ---------- */
.zooming .bar, .zooming .label, .zooming .pager { opacity: 0; pointer-events: none; }
.zooming #scene { cursor: default; }
.page-layer {
  position: fixed; inset: 0; z-index: 25; overflow-y: auto; overscroll-behavior: contain;
  visibility: hidden; opacity: 0;
  transition: opacity .55s var(--ease), visibility 0s linear .55s;
}
.page-layer.open { visibility: visible; opacity: 1; transition: opacity .55s var(--ease); }

/* ---------- index ---------- */
.index {
  position: fixed; inset: 0; z-index: 20; overflow: auto;
  background: #ecebe6; padding: var(--pad); display: flex; flex-direction: column;
}
.index[hidden] { display: none; }
.index-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.index-head p { font-weight: 500; }
#index-close:hover { text-decoration: underline; text-underline-offset: 3px; }
.index ol { list-style: none; margin: auto 0; padding: 48px 0; max-width: 980px; }
.index li a {
  display: grid; grid-template-columns: 120px 1fr; align-items: baseline; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid rgba(29, 28, 26, .14); text-decoration: none;
  font: 400 clamp(24px, 3.4vw, 40px)/1.15 var(--serif);
}
.index li .room { font: 400 14px var(--sans); color: var(--ink-3); }
.index li a:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.index li a[aria-current] .room { color: var(--ink); }
.index-about { max-width: 640px; margin-bottom: 12px; font-size: 15px; color: var(--ink-2); }
.index-foot { display: flex; gap: 20px; font-size: 15px; }

/* no WebGL: the index is the site */
.no-webgl #scene, .no-webgl #loader, .no-webgl .pager, .no-webgl #index-close { display: none; }
.no-webgl body { overflow: auto; }
.noscript { position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; padding: 24px; background: var(--air); z-index: 40; max-width: 640px; margin: 0 auto; }

/* ---------- phones: the label sits along the bottom ---------- */
@media (max-width: 900px) {
  .label { left: 0; right: 0; bottom: 0; width: auto; max-height: 42vh; padding: 16px var(--pad) calc(56px + env(safe-area-inset-bottom)); }
  .label .text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .pager { right: 50%; transform: translateX(50%); bottom: calc(8px + env(safe-area-inset-bottom)); color: var(--ink); text-shadow: none; }
  .index li a { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01s !important; animation: none !important; }
}
