/* Knudzich, v0.

   TWO WORLDS, ONE SEAM
   1.0 is white with black type, 2.0 is black with white type. The white world lies under the black one,
   and the black one is cut off at the seam. Every move on the site is the seam moving: the front page
   has it in the middle, 1.0 has it at the right edge, 2.0 at the left edge.

   THE FURNITURE
   The two numbers and the name sit in one layer over both worlds and always show as the inverse of
   what is behind them (mix-blend-mode: difference). The same three things are the front page, the logo,
   the switch in the top right corner and the first line of the list: they fly between those places.

   THE GRID
   Type is fixed in size, so the text columns are fixed in width and only the picture's room stretches.
   unit 20 px: every line of text is on a 20 px row · margins 40 px · one top line at 100 px
   wide    (1100 px and up)  series 80 | pictures 100 | record 300 | the picture, hung from the top right
   medium  (700 to 1099)     series 80 | pictures 100 | the picture, then the record under it
   narrow  (under 700)       one column: numbers, picture, record
*/
/* The typeface is served from this site (fonts/, SIL Open Font License): no visitor is sent to a third party. */
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype"); }

:root { --u: 20px; --m: 40px; --top: 100px; --t: 820ms; --ease: cubic-bezier(.7, 0, .2, 1); --track: .2em; --front: clamp(15px, 1.8vw, 26px); color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fff; }
body { font: 400 14px/20px "IBM Plex Mono", ui-monospace, Menlo, monospace; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; border-radius: 0; text-align: left; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }

/* ---------- the two worlds ---------- */
.world { position: fixed; inset: 0; --fg: #000; --bg: #fff; --dim: rgba(0, 0, 0, .62); --dimmer: rgba(0, 0, 0, .5); background: var(--bg); color: var(--fg); }
.world.two { --fg: #fff; --bg: #000; --dim: rgba(255, 255, 255, .7); --dimmer: rgba(255, 255, 255, .55); z-index: 1;
             transition: clip-path var(--t) var(--ease), -webkit-clip-path var(--t) var(--ease); }
.world.two.still, .world.two.nudge.still { transition: none; }
.world.two.nudge { transition-duration: 500ms; transition-timing-function: ease-out; }

.inside { position: absolute; inset: 0; padding: var(--top) var(--m) var(--m);
          display: grid; grid-template-columns: 80px 100px 300px minmax(0, 1fr); column-gap: var(--u); grid-template-rows: minmax(0, 1fr);
          opacity: 0; visibility: hidden; transition: opacity .22s linear, visibility 0s linear .22s; }
.live .inside { opacity: 1; visibility: visible; transition: opacity .22s linear; }
.main { display: contents; }

/* the numbers: the series in full black, the pictures of a series smaller and grey under them */
.col { position: relative; min-height: 0; min-width: 0; }
.nums { height: 100%; display: flex; flex-direction: column; align-items: flex-start; overflow-y: auto; scrollbar-width: none; margin: 0 -6px; padding: 0 6px; }
.nums::-webkit-scrollbar { display: none; }
.nums button { flex: none; height: var(--u); padding: 0 6px; margin-left: -6px; white-space: nowrap; }
.nums button.on { background: var(--fg); color: var(--bg); }
.nums button.await { color: transparent; }
.nums.pics button { font-size: 12px; color: var(--dim); }
.nums.pics button.on { background: none; color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }   /* one box on the page: the series. The picture is underlined. */
@media (hover: hover) {
  .nums.series button:not(.on):hover { box-shadow: inset 0 0 0 1px currentColor; }
  .nums.pics button:not(.on):hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
}
/* an arrow where a list goes on beyond what is shown */
.more { position: absolute; left: 0; bottom: 0; width: 100%; height: var(--u); background: var(--bg); display: none; }
.more::before { content: "\2193"; }
.has-more > .more { display: block; }

/* the record: smaller and grey, so it does not compete with the numbers */
.rec { margin: 0; align-self: start; display: grid; grid-template-columns: 80px minmax(0, 1fr); font-size: 12px; color: var(--dim); }
.rec dt { color: var(--dimmer); text-transform: uppercase; font-size: 10px; letter-spacing: .08em; }
.rec dd { margin: 0; overflow-wrap: break-word; }

/* the stage: the picture, or the opening text. It scrolls when what it holds is taller than it. */
.stage { min-height: 0; overflow-y: auto; display: flex; justify-content: flex-end; align-items: flex-start; scrollbar-width: thin; }
.stage.is-tall { margin-bottom: calc(var(--m) * -1); }     /* a tall picture runs off the bottom of the window, so it is seen to go on */
.stage.is-text { justify-content: flex-start; }
.no-rec .rec { display: none; }
.no-rec .stage { grid-column: 3 / span 2; }               /* the opening text starts where a record would */
.pic { display: block; flex: none; cursor: zoom-in; }
.pic img { display: block; width: 100%; height: auto; }
.text { max-width: 62ch; padding-bottom: var(--u); }
.text p { margin: 0 0 var(--u); }
.text p:last-child { margin-bottom: 0; }

/* ---------- the furniture ---------- */
#ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; mix-blend-mode: difference; color: #fff; }
#ui button { pointer-events: auto; position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; line-height: 1.4286; }
#ui .num::before, #logo::before { content: ""; position: absolute; inset: -14px; }
#ui.front .num, #ui.front #logo { font-size: var(--front); }
#ui.front .num, #ui.front #logo { pointer-events: none; }               /* on the front page the whole half is the button */
#logo { letter-spacing: var(--track); }
#ui:not(.front) #logo { font-size: 20px; }          /* the typed name in 2.0 is as large as the old logo in 1.0: the same cap height, the same width */
#logo .word { display: block; transition: opacity .3s linear; }
#logo img { position: absolute; left: 0; top: 50%; height: 15px; width: auto; max-width: none; transform: translateY(-50%); opacity: 0; transition: opacity .3s linear; pointer-events: none; }
#ui.at1 #logo .word { opacity: 0; }
#ui.at1 #logo img { opacity: 1; }
#ui .ch { opacity: 0; }
#ui .num { opacity: 0; }
#ui.lit .ch { opacity: 1; transition: opacity .7s ease calc(var(--i) * 80ms); }
#ui.lit .num { opacity: 1; transition: opacity .7s ease 400ms; }
#ui.lit.settled .num, #ui.lit.settled .ch { transition: opacity .3s linear; }
#ui .num.gone { opacity: 0; pointer-events: none; transition: none; }
.pickarea { width: 50%; height: 100%; }
#ui #pick2 { left: 50%; }
#ui:not(.front) .pickarea { display: none; }
#ui.hide { opacity: 0; visibility: hidden; }

/* ---------- a picture, large ---------- */
#lb { position: fixed; inset: 0; z-index: 8; overflow: auto; display: none; cursor: zoom-out; background: #fff; color: #000; -webkit-overflow-scrolling: touch; }
#lb.two { background: #000; color: #fff; }
#lb.open { display: block; }
#lb .bar { position: fixed; z-index: 1; top: 0; left: 0; right: 0; height: calc(var(--m) + 40px); padding: var(--m) var(--m) 0; display: flex; justify-content: space-between; align-items: flex-start; background: inherit; }
#lb .close { position: relative; }
#lb .close::before { content: ""; position: absolute; inset: -14px; }
#lb .wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: calc(var(--m) + 40px) var(--m) var(--m); }
#lb.tall .wrap { align-items: flex-start; }
#lb img { display: block; flex: none; }

/* ---------- medium: the record goes under the picture ---------- */
@media (max-width: 1099px) {
  :root { --m: 30px; --top: 90px; }
  .inside { grid-template-columns: 80px 100px minmax(0, 1fr); }
  .main { display: flex; flex-direction: column; align-items: flex-start; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
  .stage { order: 1; flex: none; width: 100%; overflow: visible; justify-content: flex-start; }
  .stage.is-tall { margin-bottom: 0; }
  .rec { order: 2; flex: none; margin-top: var(--u); width: min(100%, 420px); padding-bottom: var(--u); }
  .rec-first .rec { order: 0; margin-top: 0; }
  .rec-first .stage { margin-top: 0; }
}

/* ---------- narrow: one column ---------- */
@media (max-width: 699px) {
  :root { --m: 20px; --top: 60px; }
  .inside { display: block; top: var(--top); padding: 4px var(--m) 60px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  /* both lists are strips you slide sideways; an arrow at the right edge says there is more */
  .col { margin: 0 calc(var(--m) * -1); }
  .nums { height: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 0 var(--m); }
  .nums button { height: 30px; line-height: 30px; margin: 0 8px 0 0; }
  .nums.pics button { margin-right: 6px; }
  .nums::after { content: ""; flex: none; width: 30px; }                 /* room at the end, so the last number clears the arrow */
  .more { left: auto; right: 0; top: 0; bottom: auto; width: auto; height: 30px; line-height: 30px; padding: 0 var(--m) 0 12px; }
  .more::before { content: "\2192"; }
  .main { display: flex; overflow: visible; margin-top: var(--u); }
  .text { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --t: 1ms; }
  #ui.lit .ch, #ui.lit .num, .world.two.nudge { transition: none; }
}
