/* The top of the home page: projects as records in a row. Only the home page loads this. */
:root { --row: clamp(190px, 30vh, 290px); }
/* Tall, so scrolling drives the opening while .jb stays pinned to the screen. */
.jb-scroll { position: relative; height: 340vh; }
/* "Work" links land here, where the reel has settled and the row is up. */
.jb-anchor { position: absolute; left: 0; bottom: 100vh; bottom: 100svh; }
.jb {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; height: 100svh; padding-top: 58px; overflow: hidden; --p: 0;
  perspective: 2200px; perspective-origin: 50% 40%;
}

/* The reel, above everything during the opening and behind the row once it's flipped away. */
.jb-reel {
  position: absolute; left: 0; top: 0; z-index: 4; width: 100%; height: 100%; transform-origin: 50% 50%; transform-style: preserve-3d; will-change: transform;
}
.jb-reel.flying { transition: transform .8s cubic-bezier(.5, 0, .2, 1), visibility 0s .8s; }
.played .jb-reel { z-index: 1; visibility: hidden; }
.jb-row { pointer-events: none; }
.landed .jb-row { pointer-events: auto; }

/* The opening: giant logo and corner labels over the reel. */
.hero-mark {
  position: absolute; z-index: 5; left: var(--pad); right: var(--pad); top: 50%;
  transform: translateY(calc(-50% - 34vh * var(--p))) scale(calc(1 - .12 * var(--p)));
  opacity: calc(1 - 1.5 * var(--p)); mix-blend-mode: difference; will-change: transform, opacity; pointer-events: none;
}
.hero-mark img { width: 100%; }
.mark { position: absolute; z-index: 5; display: flex; align-items: center; gap: .9em; opacity: calc(1 - 2.5 * var(--p)); pointer-events: none; }
.mark i { position: relative; width: 9px; height: 9px; flex: none; }
.mark i::before, .mark i::after { content: ""; position: absolute; background: var(--fg); }
.mark i::before { left: 4px; top: 0; width: 1px; height: 9px; }
.mark i::after { left: 0; top: 4px; width: 9px; height: 1px; }
.mark.tl { left: var(--pad); top: 22vh; }
.mark.tr { right: var(--pad); top: 22vh; }
.mark.bl { left: var(--pad); bottom: 8vh; }
.mark.br { right: var(--pad); bottom: 8vh; }

.jb-body { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.jb-stage { position: relative; flex: 1; min-height: 200px; perspective: 2200px; perspective-origin: 50% 50%; }

/* Records: put away behind the row, turned over. A click flips one out at full size. */
.jb-card {
  position: absolute; left: 0; top: 0; z-index: 1; width: var(--w); height: var(--h);
  transform: var(--hide); transform-origin: 50% 50%; transform-style: preserve-3d; will-change: transform;
  visibility: hidden; pointer-events: none; transition: transform .8s cubic-bezier(.5, 0, .2, 1), visibility 0s .8s;
}
.jb-card.open { z-index: 2; transform: var(--open); visibility: visible; pointer-events: auto; transition: transform 1.05s cubic-bezier(.5, 0, .2, 1), visibility 0s; }
.jb-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #0e0f10; }
.jb-back { transform: rotateY(180deg); background: #3a3b3e; outline: 1px solid rgba(239, 239, 239, .3); outline-offset: -1px; }
.jb-front img, .jb-front video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.jb-front video { opacity: 0; transition: opacity .35s; }
.jb-front video.on, .jb-reel .jb-front video { opacity: 1; }
.jb-info {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 2em;
  padding: 5em clamp(14px, 1.6vw, 24px) clamp(14px, 1.6vw, 24px); background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  font-size: 11px; line-height: 1.3; letter-spacing: .01em; text-transform: uppercase; font-weight: 400;
}
.jb-info dl { display: grid; grid-template-columns: auto auto; gap: .35em 1.4em; justify-content: start; }
.jb-info dl div { display: contents; }
.jb-info dt { opacity: .6; }
.jb-open { flex: none; border-bottom: 1px solid var(--fg); }

/* The row of spines */
.jb-row { position: relative; z-index: 3; flex: none; display: flex; height: var(--row); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.jb-spine { position: relative; flex: 1 1 0; min-width: 0; text-align: left; }
/* Taller than the row: rises above it, with the extra hidden below. */
.jb-plate { position: absolute; left: 0; right: 0; top: 0; bottom: -44px; display: block; overflow: hidden; background: #111112; box-shadow: inset 1px 0 rgba(239, 239, 239, .1); will-change: transform; }
.jb-plate img { position: absolute; left: 50%; top: 0; width: 26vw; max-width: none; height: 100%; object-fit: cover; transform: translateX(-50%); opacity: .22; will-change: opacity; }
.jb-plate b { position: absolute; left: 0; right: 0; top: .9em; text-align: center; font-size: 11px; line-height: 1; font-weight: 400; letter-spacing: .01em; opacity: .6; }
.jb-text {
  position: absolute; left: 50%; top: 2.6em; display: block; transform: translateX(-50%); transform-origin: 50% 0; white-space: nowrap;
  writing-mode: vertical-rl; color: var(--fg); text-transform: uppercase; text-shadow: 0 0 10px rgba(0, 0, 0, .55);
}
.jb-text i, .jb-text strong { display: block; }
.jb-text i { font-size: 10px; line-height: 1.5; font-style: normal; font-weight: 400; letter-spacing: .01em; opacity: .7; }
.jb-text strong { font-size: 13.5px; line-height: 1.25; }
.jb-spine.on .jb-plate { background: var(--fg); color: var(--bg); }
.jb-spine.on img { visibility: hidden; }
.jb-spine.on .jb-text { color: var(--bg); text-shadow: none; }
.jb-spine:focus-visible { outline-offset: -3px; }

.jb-now { text-shadow: 0 0 18px rgba(0, 0, 0, .5); display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5em; padding: 1.8vh var(--pad) 2.4vh; }
.jb-title { font-size: clamp(22px, 3.2vw, 52px); line-height: 1; }
@media (max-width: 1100px) {
  /* Room for two lines always, so a long title can't shift the row. */
  .jb-title { min-height: 2em; }
}

/* Wide, short windows: the title moves beside the record so the record can be bigger. */
@media (min-aspect-ratio: 19 / 10) and (min-width: 721px) {
  .jb-now {
    position: absolute; z-index: 1; left: 0; bottom: calc(var(--row) + 56px); align-items: flex-start; text-align: left;
    width: calc((100vw - (100vh - 58px - var(--row) - 20px) * 16 / 9) / 2); padding: 0 var(--pad);
  }
  .jb-title { font-size: clamp(20px, 2.8vw, 44px); min-height: 0; }
}

@media (max-width: 720px) {
  .jb-scroll { height: 280vh; }
  .jb { padding-top: 70px; justify-content: center; }
  .jb-body { flex: none; }
  .jb-stage { flex: none; height: 62vw; }
  :root { --row: 200px; }
  .jb-row { overflow-x: auto; overflow-y: hidden; }
  .jb-spine { flex: 0 0 64px; }
  .jb-plate { bottom: 0; }
  .jb-info { padding-top: 3em; font-size: 9px; }
  .jb-info dl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .jb-scroll { height: 100vh; height: 100svh; }
  .jb-card, .jb-card.open, .jb-reel.flying { transition: none; }
}
