/* The cord (v/b2). A lamp pull hangs from the top of the screen beside the corner tab, on computers only.
   Pull it: the wall's light goes out and the city comes on. Pull it again: the wall is back where you left it.
   Phones never see any of this (cord.js doesn't run there), so the phone wall is exactly v/b. */
/* it hangs from the bottom of the List tab (--T is the tab's height), behind the tab so it slides out from under it; in the city it runs to the top */
#cord { --s0: var(--T, 0px); position: fixed; z-index: 29; top: 0; right: var(--cordR, 24px); width: 0; height: 0; pointer-events: none; }
.night-on #cord { --s0: 0px; z-index: 95; }
#cord .rig { position: absolute; left: 0; top: 0; width: 1px; height: calc(var(--T, 0px) + var(--len) + var(--bh) + 40px); transform-origin: 0 0; translate: 0 -110%; transition: translate .5s cubic-bezier(.2, .9, .25, 1.12); }
#cord.down .rig { translate: 0 0; }
#cord.down.swing .rig { animation: cord-swing 1.9s cubic-bezier(.3, .2, .3, 1) both; }
@keyframes cord-swing {
  0% { rotate: 7deg; } 18% { rotate: -5deg; } 36% { rotate: 3.2deg; } 54% { rotate: -1.8deg; } 72% { rotate: .9deg; } 88% { rotate: -.3deg; } 100% { rotate: 0deg; }
}
/* the string: paper with an ink edge, so it reads on the dark wall and on white paper */
#cord .string { position: absolute; left: -1.5px; top: var(--s0); width: 3px; height: calc(var(--T, 0px) - var(--s0) + var(--len) + var(--pull, 0px)); background: var(--paper, #f2f1ed); box-shadow: 0 0 0 1px var(--ink, #0b0b0c); }
/* the pull: a small paper bead with an ink rim and the wall's hard grey shadow */
#pull { position: absolute; left: calc(var(--bw) / -2 - 14px); top: calc(var(--T, 0px) + var(--len) + var(--pull, 0px) - 6px); width: calc(var(--bw) + 28px); height: calc(var(--bh) + 26px); padding: 0; pointer-events: auto; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent; background: none; }
#pull .bead { position: absolute; left: 14px; top: 6px; width: var(--bw); height: var(--bh); border-radius: 45% 45% 40% 40% / 30% 30% 36% 36%; background: var(--paper, #f2f1ed); border: 2px solid var(--ink, #0b0b0c); box-shadow: 4px 4px 0 var(--plate, #4b4b4f); transition: box-shadow .12s, translate .12s; }
#pull .bead::after { content: ""; position: absolute; left: 22%; right: 22%; top: 34%; height: 2px; background: var(--ink, #0b0b0c); opacity: .55; }
#pull:hover .bead { translate: 0 2px; box-shadow: 3px 3px 0 var(--plate, #4b4b4f); }
#pull:focus-visible { outline: none; }
#pull:focus-visible .bead { outline: 3px solid var(--paper, #f2f1ed); outline-offset: 3px; }
#cord.held #pull { cursor: grabbing; }
#cord.held .bead { box-shadow: 1px 1px 0 var(--plate, #4b4b4f); }
#cord.tight .string { box-shadow: 0 0 0 1px var(--ink, #0b0b0c), 0 0 0 2.5px var(--paper, #f2f1ed); }
#cord.back .string, #cord.back #pull { transition: height .42s cubic-bezier(.3, 1.7, .45, 1), top .42s cubic-bezier(.3, 1.7, .45, 1); }
#cord.auto .string, #cord.auto #pull { transition: height .16s cubic-bezier(.5, 0, .8, .4), top .16s cubic-bezier(.5, 0, .8, .4); }
.open-now #cord { opacity: 0; pointer-events: none; }
.open-now #cord #pull { pointer-events: none; }
/* the word beside the bead, like the corner tab's words: ink tag, paper type */
#cord .tip { position: absolute; right: calc(var(--bw) / 2 + 16px); top: calc(var(--T, 0px) + var(--len) + var(--pull, 0px) + var(--bh) / 2 - .9em); white-space: nowrap; padding: .44em .7em .48em; background: var(--ink, #0b0b0c); color: var(--paper, #f2f1ed); font: 700 max(14px, calc(24 * var(--t)))/1 var(--b); letter-spacing: -.02em; box-shadow: 0 0 0 max(1.5px, calc(3 * var(--t))) var(--paper, #f2f1ed); opacity: 0; translate: 6px 0; transition: opacity .16s, translate .16s; pointer-events: none; }
#cord.hint .tip, #cord:has(#pull:hover) .tip, #cord:has(#pull:focus-visible) .tip { opacity: 1; translate: 0 0; }
#cord.held .tip, #cord.firing .tip { opacity: 0; }

/* the night: black first, then the city on top */
#night { position: fixed; z-index: 90; inset: 0; background: #0a0a0a; opacity: 0; visibility: hidden; transition: opacity .26s linear, visibility 0s linear .26s; }
.night-on #night { opacity: 1; visibility: visible; transition: opacity .09s linear, visibility 0s; }
#night iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #0a0a0a; opacity: 0; transition: opacity .12s linear; }
#night.city iframe { opacity: 1; transition: opacity .2s linear; }
.night-on #corner { opacity: 0 !important; pointer-events: none !important; }
.night-on #stage { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  #cord .rig, #cord.back .string, #cord.back #pull, #night, .night-on #night, #night iframe, #night.city iframe { transition: none; }
  #cord.down.swing .rig { animation: none; }
}
