@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/InstrumentSans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --well: #151515;
  --ink: #e8e6e3;
  --muted: #6b6966;
  --line: #2a2928;
  --line-focus: #77746f;
  --scrim: rgba(6, 6, 6, .94);
  --inset: 20px;
  color-scheme: dark;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  height: 100dvh;
  font: 500 12px/1 "Instrument Sans", ui-sans-serif, sans-serif;
  letter-spacing: .02em;
  color: var(--muted);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- table */

#table {
  position: fixed;
  inset: 0;
  overflow: clip;
  touch-action: none;
  overscroll-behavior: none;
  cursor: grab;
  contain: strict;
}
#table.grabbing { cursor: grabbing; }

#world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}
#world.wait { opacity: 0; }

.it {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--well);
  cursor: inherit;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.it:focus { outline: none; }
.it:focus-visible {
  outline: calc(1px * var(--iz, 1)) solid var(--line-focus);
  outline-offset: calc(2px * var(--iz, 1));
}

.it img, .it video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.it img.on, .it video.on {
  opacity: 1;
  transition: opacity 240ms ease;
}
#world.developing .it img.on { transition: none; }

/* Live Photo mark: 12px on screen at every zoom (--iz = 1 / zoom) */
.it .live {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  transform-origin: 0 0;
  transform: translate(calc(8px * var(--iz, 1)), calc(8px * var(--iz, 1))) scale(var(--iz, 1));
  pointer-events: none;
}
.it.is-live .live { display: block; }
.it.lifted { visibility: hidden; } /* the print is in the lightbox */

/* ---------- lightbox */

#lb {
  position: fixed;
  inset: 0;
  z-index: 4;
  touch-action: none;
  overscroll-behavior: none;
}
#lb[hidden] { display: none; }

.lb-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.lb-frame {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  background: var(--well);
  transform-origin: 0 0;
}
.lb-frame img, .lb-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
.lb-frame .hi { opacity: 0; transition: opacity 180ms ease; }
.lb-frame .mv { opacity: 0; transition: opacity 200ms ease; }
.lb-frame .hi.on, .lb-frame .mv.on { opacity: 1; }

.lb-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  transition: color 160ms ease, transform 160ms cubic-bezier(.23, 1, .32, 1);
}
.lb-btn[hidden] { display: none; }
.lb-btn:active { transform: scale(.97); }
.lb-btn:focus { outline: none; }
.lb-btn:focus-visible { outline: 1px solid var(--line-focus); outline-offset: -6px; }
@media (hover: hover) and (pointer: fine) {
  .lb-btn:hover { color: var(--ink); }
}
.lb-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* the 18px glyph sits on the 20px inset line; the 44px hit area extends around it */
.lb-close {
  top: calc(var(--inset) - 13px + env(safe-area-inset-top));
  right: calc(var(--inset) - 13px + env(safe-area-inset-right));
}
.lb-mute {
  bottom: calc(var(--inset) - 13px + env(safe-area-inset-bottom));
  right: calc(var(--inset) - 13px + env(safe-area-inset-right));
}
.lb-mute svg { display: none; }
.lb-mute[aria-pressed="false"] svg.on, .lb-mute[aria-pressed="true"] svg.off { display: block; }

/* ---------- labels */

.label {
  position: fixed;
  z-index: 3;
  margin: 0;
  pointer-events: none;
  color: #b9b6b1;
  text-shadow: 0 0 1px rgba(0, 0, 0, .55), 0 0 8px rgba(0, 0, 0, .45);
  white-space: nowrap;
}
.wordmark {
  top: calc(var(--inset) + env(safe-area-inset-top));
  left: calc(var(--inset) + env(safe-area-inset-left));
}
.date {
  right: calc(var(--inset) + env(safe-area-inset-right));
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  font-variant-numeric: tabular-nums;
  opacity: 0;
}
html[data-state="collage"] .date { opacity: 1; transition: opacity 400ms ease; }
html:not([data-state="collage"]) .wordmark { color: var(--muted); text-shadow: none; }

/* ---------- gate */

#gate {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
}
.pending #gate { visibility: hidden; }
html[data-state="collage"] #gate { display: none; }

.field {
  display: block;
  width: 200px;
  border-bottom: 1px solid var(--line);
  transition: border-color 160ms ease;
}
.field:focus-within { border-bottom-color: var(--line-focus); }
#gate.deriving .field { border-bottom-color: var(--ink); }

#pw {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 0 9px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--muted);
  font: 500 16px/20px "Instrument Sans", ui-sans-serif, sans-serif;
  letter-spacing: .2em;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  user-select: text;
  -webkit-user-select: text;
}
#pw::placeholder {
  color: var(--muted);
  opacity: 1;
  font-size: 12px;
  letter-spacing: .02em;
}
