/* The site behaves like what it is called: the works break out over the screen as windows,
   over a wall of falling tamga. On a phone they stack, one under the other, and you scroll. */
:root {
  --black: #000;
  --line: #e8e6df;
  --type: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --bar: 23px;
  --gutter: 14px;
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--black); color: var(--line); color-scheme: dark; -webkit-text-size-adjust: 100%; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
html.open { overflow: hidden; }
body { background: var(--black); font-family: var(--type); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }

#rain, #trail {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  display: block;
  pointer-events: none;
}

/* ---------- a window ---------- */
.win {
  display: block;
  background: var(--black);
  border: 1px solid var(--line);
}
.bar {
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 7px;
  background: var(--black);
  color: var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: .1em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
}
.bar span { overflow: hidden; text-overflow: ellipsis; }
.win.top .bar { background: var(--line); color: var(--black); }
.win video { display: block; width: 100%; height: auto; aspect-ratio: var(--ar); object-fit: cover; background: #050505; }
.js .win[data-i] { visibility: hidden; }
.js .win.up { visibility: visible; }

#top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  font-size: 12px;
  line-height: 1;
}
#top h1 { font: inherit; font-weight: 500; font-stretch: 125%; letter-spacing: .12em; }

address { padding: 14px 14px 16px; font-style: normal; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
address a { display: block; }
address a:hover { text-decoration: underline; }

/* ---------- phone and tablet: a column you scroll, each window lying a little over the last ---------- */
#desk {
  position: relative;
  z-index: 2;
  padding-bottom: 28px;
}
#desk .win {
  --w: min(86vw, calc((92svh - var(--bar)) * var(--ar)));
  position: relative;
  width: var(--w);
  margin-left: calc((100vw - var(--w)) * var(--f, .3));
  margin-top: -22px;
}
#desk .win:first-child { margin-top: 0; }
#desk .win:nth-child(6n+1) { --f: .15; }
#desk .win:nth-child(6n+2) { --f: .85; }
#desk .win:nth-child(6n+3) { --f: .35; }
#desk .win:nth-child(6n+4) { --f: 1; }
#desk .win:nth-child(6n+5) { --f: 0; }
#desk .win:nth-child(6n) { --f: .65; }
#note {
  position: relative;
  z-index: 2;
  width: min(280px, calc(100vw - 2 * var(--gutter)));
  margin: 0 var(--gutter) calc(28px + env(safe-area-inset-bottom)) auto;
}

/* ---------- computer: they float, and you can drag them ---------- */
html.float #top { position: fixed; left: 0; right: 0; top: 0; z-index: 1; pointer-events: none; }
html.float #top a { display: none; }
html.float #desk { padding: 0; }
html.float #desk .win {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  width: auto;
  will-change: transform;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
html.float #desk .win.drag { cursor: grabbing; }
html.float #desk .win video { height: calc(100% - var(--bar) - 1px); pointer-events: none; aspect-ratio: auto; }
html.float #note {
  position: fixed;
  z-index: 900;
  right: 18px;
  bottom: 18px;
  margin: 0;
  width: 250px;
}

/* ---------- the big window: full height, with sound ---------- */
#viewer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, .84);
}
#viewer[hidden] { display: none; }
#reel {
  position: absolute;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  /* Sideways is native scrolling; an up or down swipe is read by the script. */
  touch-action: pan-x;
}
#reel::-webkit-scrollbar { display: none; }
.frame {
  flex: 0 0 100%;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.box {
  --h: calc(100vh - 20px);
  --h: calc(100dvh - 20px);
  --b: 29px;
  height: var(--h);
  width: calc((var(--h) - var(--b)) * var(--ar) + 2px);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--black);
  border: 1px solid var(--line);
}
.box .bar { flex: 0 0 var(--b); height: var(--b); background: var(--line); color: var(--black); font-size: 11px; padding-right: 0; }
.bar button {
  all: unset;
  flex: 0 0 auto;
  width: 34px;
  height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.bar button:hover { background: var(--black); color: var(--line); }
.bar button:focus-visible { outline: 1px solid var(--black); outline-offset: -3px; }
.bar .quiet { display: none; margin-left: auto; }
.box.mute .bar .quiet { display: block; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; cursor: pointer; background: #000; }
.stage img, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage video { visibility: hidden; }
.stage video.on { visibility: visible; }

/* On a phone the big window is the whole screen. */
html:not(.float) .frame { padding: 0; }
html:not(.float) .box { --h: 100vh; --h: 100dvh; --b: calc(44px + env(safe-area-inset-top)); width: 100%; border: 0; }
html:not(.float) .box .bar { align-items: flex-end; padding: env(safe-area-inset-top) 0 0 12px; font-size: 11px; }
html:not(.float) .box .bar span { align-self: center; padding-top: env(safe-area-inset-top); }
html:not(.float) .bar button { height: 44px; width: 48px; }
html:not(.float) .frame.tall .stage img, html:not(.float) .frame.tall .stage video { object-fit: cover; }

/* Next and previous: the full height of each side on a computer, up in the title bar on a phone. */
.nav {
  all: unset;
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 88px;
  display: grid;
  place-items: center;
  color: var(--line);
  cursor: pointer;
  opacity: .6;
}
.nav:hover { opacity: 1; }
.nav:focus-visible { opacity: 1; outline: 1px solid var(--line); outline-offset: -8px; }
#prev { left: 0; }
#next { right: 0; }
html:not(.float) .nav {
  top: env(safe-area-inset-top);
  bottom: auto;
  width: 44px;
  height: 44px;
  color: var(--black);
  opacity: 1;
}
html:not(.float) #next { right: 48px; }
html:not(.float) #prev { left: auto; right: 92px; }
html:not(.float) .box .bar span { max-width: calc(100% - 150px); }

.zoom { position: fixed; z-index: 1100; border: 1px solid var(--line); pointer-events: none; }
