/* Abyss Gallery: a museum's manners. The picture fills the room; what is
   written about it sits on paper labels, small and quiet: titles in Baskerville,
   everything else in a plain sans. */
:root {
  --wall: #f8f7f4;
  --paper: #ffffff;
  --ink: #1d1c19;
  --muted: #6f6a61;
  --faint: #a29c91;
  --rule: rgba(29, 28, 25, 0.14);
  --shadow: 0 1px 1px rgba(29, 28, 25, 0.08), 0 6px 22px rgba(29, 28, 25, 0.14);
  --serif: "Times New Roman", Times, Tinos, "Liberation Serif", "Nimbus Roman", serif;
  --sans: "Helvetica Neue", "HelveticaNeue-Light", Helvetica, Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --caps: 0.09em;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--wall);
  color: var(--ink);
  font: 13px/1.5 var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* the picture; the pointer over it is the dot below (museum/cursor.js) */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
body.has-dot, body.has-dot * { cursor: none !important; }

/* the dot: the negative of what is under it (white, blended by difference) */
.cursor {
  position: fixed;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.6s ease, width 0.15s ease, height 0.15s ease, left 0.15s ease, top 0.15s ease;
  will-change: transform;
}
.cursor.on { opacity: 1; }
.cursor.down { width: 10px; height: 10px; left: -5px; top: -5px; }
body.ui-hidden:not(.ui-awake) .cursor { opacity: 0; }

/* a paper label (the wall labels let a little of the picture through; the card stays white) */
.views, .readout, .controls, .debug, .show-ui, .title {
  background: var(--paper);
  box-shadow: var(--shadow);
  border-radius: 1px;
}
.readout, .controls, .show-ui {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* the ways of viewing the mosaic, top right: small capitals, the current one underlined */
.views {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 18px;
  padding: 9px 16px 8px;
  z-index: 2;
}
.views a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: var(--caps);
  text-transform: uppercase;
  white-space: nowrap;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
}
.views a:hover { color: var(--ink); }
.views a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* the room's name, top left; its introduction fades after a while */
.title {
  position: fixed;
  top: 16px;
  left: 16px;
  max-width: min(380px, calc(100% - 32px));
  padding: 12px 16px 13px;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.title p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.title.quiet { opacity: 0; }

.hud {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

/* the wall label: maker in small capitals, the title in italics, then where you are */
.readout {
  padding: 13px 18px 12px;
  min-width: 0;
  font-variant-numeric: lining-nums tabular-nums;
}
.readout .big { font-family: var(--serif); font-size: 21px; font-weight: 400; font-style: italic; line-height: 1.3; min-height: 1.3em; }
.readout .big .year { font-style: normal; font-weight: 400; font-size: 17px; }
.readout .small { color: var(--muted); max-width: 62ch; }
.readout.fixed { width: min(440px, 100%); flex: none; }
.readout.fixed .big, .readout.fixed .small div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout .maker {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  min-height: 1.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readout .where { margin-top: 5px; font-size: 11.5px; color: var(--muted); min-height: 1.5em; }

/* the controls: a few icons and the speed */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 5px 8px;
  pointer-events: auto;
}
.hud > * { pointer-events: auto; }

button, .button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: var(--caps);
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 1px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .button:hover { background: rgba(29, 28, 25, 0.05); }
button:focus-visible { outline: 1px solid var(--ink); outline-offset: 1px; }
button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }
kbd {
  font: 10px/1 var(--sans);
  color: var(--faint);
  margin-left: 6px;
  letter-spacing: 0;
  text-transform: none;
}

.speed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}
.speed:hover { background: transparent; }
.speed input {
  width: 84px;
  height: 14px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
.speed input::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
.speed input::-moz-range-track { height: 1px; background: var(--ink); }
.speed input::-webkit-slider-thumb { -webkit-appearance: none; width: 9px; height: 9px; margin-top: -4px; border-radius: 50%; background: var(--ink); }
.speed input::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--ink); }
.speed output {
  min-width: 3.4ch;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

.debug {
  position: fixed;
  top: 64px;
  right: 16px;
  margin: 0;
  padding: 10px 12px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
  pointer-events: none;
}

.drop {
  position: fixed;
  inset: 12px;
  border: 1px dashed var(--muted);
  display: grid;
  place-items: center;
  font-size: 15px;
  background: rgba(250, 248, 243, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.drop.on { opacity: 1; }

.toast {
  position: fixed;
  top: 66px;
  right: 22px;
  color: var(--muted);
}

/* full screen / hide the labels (H): only the picture stays; a small label brings the rest back */
.views, .collection, .hud, .debug, .toast { transition: opacity 0.35s ease; }
body.ui-hidden .views, body.ui-hidden .collection, body.ui-hidden .title, body.ui-hidden .hud,
body.ui-hidden .debug, body.ui-hidden .toast { opacity: 0; pointer-events: none; }
body.ui-hidden .hud * { pointer-events: none; }
body.ui-hidden:not(.ui-awake) #stage { cursor: none; }
.show-ui {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.show-ui:hover { background: var(--paper); }
body.ui-hidden.ui-awake .show-ui, body.ui-hidden .show-ui:focus-visible { opacity: 1; pointer-events: auto; }

/* the first visit: the room's name while the paintings come in */
.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--wall);
  transition: opacity 0.9s ease;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-plate { width: min(420px, calc(100% - 48px)); text-align: center; }
.loading-plate h2 { margin: 0 0 28px; font-family: var(--serif); font-size: 34px; font-weight: 400; letter-spacing: 0.02em; }
.loading-plate .what { margin: -18px 0 26px; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 15px; }
.loading-plate .what[hidden] { display: none; }
.loading-bar { height: 1px; background: var(--rule); overflow: hidden; }
.loading-bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.4s ease; }

@media (max-width: 640px) {
  .views { left: 16px; right: 16px; justify-content: space-between; gap: 0; padding: 9px 12px 8px; overflow-x: auto; }
  .views a { font-size: 10px; }
  .title { top: 64px; }
  .hud { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; gap: 8px; }
  .readout.fixed { width: 100%; padding: 11px 14px 10px; }
  .readout .big { font-size: 16px; }
  /* the controls in one row: play, the speed across what is left, full screen */
  .controls { flex-wrap: nowrap; justify-content: space-between; gap: 6px; padding: 6px 8px; }
  .controls .speed { flex: 1; min-width: 0; padding: 8px 6px; }
  .speed input { flex: 1; width: auto; min-width: 0; height: 28px; }
  .speed input::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -6.5px; }
  .speed input::-moz-range-thumb { width: 14px; height: 14px; }
  .icon-button { padding: 10px 10px; }
  kbd { display: none; }
}

/* icon buttons: play / pause, full screen, close */
.icon-button { padding: 7px 8px; line-height: 0; }
.icon { display: inline-block; line-height: 0; }
.icon svg { display: block; }
.controls .icon-button + .speed, .controls .speed + .icon-button { margin-left: 2px; }

/* for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* a little smaller everywhere: the pictures first, the labels still easy to read */
.hud { left: 12px; right: 12px; bottom: 12px; }
.readout { padding: 10px 14px 9px; }
.readout.fixed { width: min(380px, 100%); }
.readout .maker { font-size: 10px; margin-bottom: 2px; }
.readout .big { font-size: 18px; }
.readout .big .year { font-size: 15px; }
.readout .where { font-size: 11px; margin-top: 3px; }
.controls { padding: 3px 6px; }
.icon-button { padding: 6px 7px; }
.icon svg { width: 16px; height: 16px; }
.speed { font-size: 10px; }
.speed input { width: 72px; }
.speed output { font-size: 11px; }

/* lighter: the sans at its light weight everywhere (Helvetica Neue Light; the
   serif has one weight, the regular, and nothing is ever bold) */
html, body, button, .button, .readout .maker, .readout .where, .collection-kicker, .index-count, .index-group-name,
.learn-card, .learn-card dl, .learn-text, .learn-links, .learn-kicker, .learn-byline, .speed, .speed output { font-weight: 300; }
b, strong { font-weight: 400; }

/* phones: two thin strips at the foot, full width, each one line:
   the label (maker · title, year · where) and the controls */
@media (max-width: 640px) {
  .hud { left: 0; right: 0; bottom: 0; gap: 0; padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 -1px 0 var(--rule); }
  .readout, .controls { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .readout.fixed { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 7px 12px 5px; white-space: nowrap; overflow: hidden; }
  .readout .maker, .readout .big, .readout .where { margin: 0; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .readout .maker { flex: 0 1 auto; max-width: 30%; font-size: 9.5px; }
  .readout .big { flex: 1 1 auto; font-size: 14px; line-height: 1.2; }
  .readout .big .year { font-size: 12px; }
  .readout .where { flex: 0 1 auto; max-width: 30%; font-size: 10px; }
  .controls { padding: 0 6px 2px; border-top: 1px solid var(--rule); }
  .controls .speed { padding: 4px 6px; }
  .speed input { height: 22px; }
  .icon-button { padding: 7px 8px; }
}

/* phones: two separate strips, a gap between them; the label strip thicker, its text larger */
@media (max-width: 640px) {
  .hud { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; gap: 6px; padding: 0 0 env(safe-area-inset-bottom); }
  .readout, .controls { background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: var(--shadow); }
  .controls { border-top: 0; }
  .readout.fixed { padding: 12px 14px 10px; gap: 8px; }
  .readout .maker { font-size: 11px; }
  .readout .big { font-size: 17px; }
  .readout .big .year { font-size: 14px; }
  .readout .where { font-size: 11.5px; }
}
/* phones: the strips held in from the edges, with room inside them */
@media (max-width: 640px) {
  .hud { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); padding: 0; }
  .readout.fixed { padding: 13px 16px 11px; }
  .controls { padding: 4px 10px; }
}
/* phones: the label is the work and its maker, nothing more */
@media (max-width: 640px) {
  .readout .where, .readout .big .year { display: none; }
  .readout .maker { max-width: 40%; }
}
/* phones: the label as a small wall label: the maker in small capitals above,
   the title large in italics below, each on its own line */
@media (max-width: 640px) {
  .readout.fixed { display: block; padding: 12px 16px 13px; }
  .readout .maker { max-width: none; font-size: 11px; letter-spacing: 0.14em; margin: 0 0 4px; }
  .readout .big { font-size: 21px; line-height: 1.2; }
}
@media (max-width: 640px) { .readout .big, .readout .maker { display: block; width: 100%; white-space: nowrap; } }
.loading-plate .by { margin: 18px 0 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--muted); }
/* phones: the title first, whole (wrapping, never cut), at a calm size; the maker under it */
@media (max-width: 640px) {
  .readout.fixed { display: flex; flex-direction: column; gap: 3px; padding: 11px 16px 12px; }
  .readout .big { order: 1; width: 100%; font-size: 19px; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; }
  .readout .maker { order: 2; width: 100%; margin: 0; font-size: 10.5px; letter-spacing: 0.12em; }
}
/* phones: the title on one line after all, cut with … only when it is very long */
@media (max-width: 640px) { .readout .big { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }

/* nothing on the gallery is text to pick up: no selection, no long-press menu */
html, body, body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* phones: the speed bar easy to take hold of: a tall touch area, a larger knob */
@media (hover: none) {
  .speed { touch-action: none; }
  .speed input { touch-action: none; height: 44px; margin: -8px 0; }
  .speed input::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -10.5px; }
  .speed input::-moz-range-thumb { width: 22px; height: 22px; }
}
