/* Brag Book: a dad's wallet on the kitchen table, and the photo accordion that keeps going. */
:root {
  --leather: #4a2a17;
  --leather-hi: #6b3f22;
  --thread: #d2a868;
  --ink: #1f3f93;
  --paper: #f4eee1;
  --hand: 'Nothing You Could Do', 'Bradley Hand', 'Segoe Print', cursive;
  --sans: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}
html { background: #24160c; scrollbar-width: none; overscroll-behavior: none; }
html::-webkit-scrollbar { display: none; }
body { margin: 0; color: #f3e9d6; font-family: var(--sans); -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
#spacer { width: 1px; }
button { font: inherit; }

/* ---------- the room */
#stage {
  position: fixed; inset: 0; overflow: hidden; perspective: 1500px; perspective-origin: 50% 50%;
  background: radial-gradient(120% 90% at 50% 45%, #3a2414 0%, #1b0f07 100%);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
}
#stage.dragging { cursor: grabbing; }
#stage::after {   /* the kitchen lamp: warm in the middle, falling off at the edges */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(90% 85% at 46% 44%, rgba(255, 214, 150, 0) 45%, rgba(30, 14, 4, .42) 100%);
}
#cam { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
#cam > * { position: absolute; left: 0; top: 0; transform-origin: 0 0; backface-visibility: hidden; }

.tile { background-repeat: repeat; }
.tile.table { background-image: url(art/table.webp); }
.tile.floor { background-image: url(art/floor.webp); filter: brightness(.74) saturate(.9); }
.edge { background: linear-gradient(#5a3415, #2a1607 70%), url(art/table.webp); background-blend-mode: multiply; }
.lip { background: linear-gradient(90deg, rgba(255, 226, 170, .0), rgba(255, 226, 170, .55), rgba(255, 226, 170, .0)); }
.under { background: linear-gradient(90deg, rgba(8, 4, 1, .92), rgba(8, 4, 1, .55) 55%, rgba(8, 4, 1, 0)); }
.under.v { background: linear-gradient(180deg, rgba(8, 4, 1, .92), rgba(8, 4, 1, .55) 55%, rgba(8, 4, 1, 0)); }
.wallet { width: 100%; height: 100%; }
.wallet img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.shadow { background: rgba(26, 12, 2, .5); border-radius: 6px; filter: blur(5px); }

/* ---------- a sleeve: clear vinyl, leather edging, tan stitches, a photo trimmed to fit */
.sl { transform-style: flat; }
.face {
  all: unset; position: absolute; inset: 0; display: block; cursor: pointer; border-radius: 3px;
  -webkit-tap-highlight-color: transparent;
}
.face:focus-visible { outline: 2px solid #ffd27a; outline-offset: 3px; }
.vinyl {
  position: absolute; inset: 0; border-radius: 3px;
  background: linear-gradient(160deg, rgba(255, 248, 228, .16), rgba(255, 244, 214, .07) 55%, rgba(255, 248, 228, .14));
  box-shadow: inset 0 0 0 1px rgba(255, 250, 235, .32), inset 0 0 10px rgba(255, 250, 235, .12);
}
.bind {
  position: absolute; background: linear-gradient(var(--leather-hi), var(--leather) 60%, #3a1f0f);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 210, 160, .18);
}
.bind::after { content: ''; position: absolute; border: 0 dashed var(--thread); opacity: .85; }
.h .bind { left: 0; right: 0; height: var(--b); }
.h .bind.a { top: 0; border-radius: 3px 3px 1px 1px; }
.h .bind.b { bottom: 0; border-radius: 1px 1px 3px 3px; }
.h .bind::after { left: 4px; right: 4px; top: 50%; border-top-width: 1.5px; }
.v .bind { top: 0; bottom: 0; width: var(--b); }
.v .bind.a { left: 0; border-radius: 3px 1px 1px 3px; }
.v .bind.b { right: 0; border-radius: 1px 3px 3px 1px; }
.v .bind::after { top: 4px; bottom: 4px; left: 50%; border-left-width: 1.5px; }
.seam { position: absolute; background: rgba(255, 252, 240, .5); box-shadow: 0 0 2px rgba(255, 255, 255, .4); }
.h .seam { top: var(--b); bottom: var(--b); width: 2px; }
.h .seam.a { left: 0; } .h .seam.b { right: 0; }
.v .seam { left: var(--b); right: var(--b); height: 2px; }
.v .seam.a { top: 0; } .v .seam.b { bottom: 0; }
.pocket { position: absolute; }
.snap {   /* a print, white border trimmed unevenly with scissors */
  position: absolute; background: #f7f3ea; box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: transform .25s cubic-bezier(.3, .7, .4, 1);
}
.snap img { position: absolute; display: block; object-fit: contain; background: #222; }
.snap.out { visibility: hidden; }
.wear { position: absolute; pointer-events: none; }
.glare { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 3px; }
.glare i {
  position: absolute; top: -10%; left: -100%; width: 300%; height: 120%;
  background: linear-gradient(104deg, transparent 38%, rgba(255, 252, 240, .5) 46%, rgba(255, 252, 240, .12) 49%, transparent 52%, transparent 58%, rgba(255, 252, 240, .18) 61%, transparent 64%);
}
.shade { position: absolute; inset: 0; background: #140a03; opacity: 0; pointer-events: none; border-radius: 3px; }
@media (hover: hover) { .face:hover .snap:not(.out) { transform: translateY(-5%) rotate(var(--r, 0deg)); } }

/* his business card, in the last sleeve */
.bcard {
  position: absolute; background: #fbfaf6; color: #1d1c1a; box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .5em;
  padding: 0 12%; box-sizing: border-box; font-family: var(--sans); line-height: 1.2; overflow: hidden;
}
.bcard b { font-weight: 700; font-size: 1.32em; letter-spacing: -.01em; }
.bcard .t { font-size: .78em; font-weight: 500; color: #555; }
.bcard .rule { width: 26%; height: 2px; background: #b5462b; margin: .2em 0; }
.bcard .c { font-size: .7em; color: #333; }

/* ---------- the tab buttons */
.tab {
  position: fixed; z-index: 30; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  padding: 9px 15px 9px; border: 0; border-radius: 7px; cursor: pointer;
  background: linear-gradient(var(--leather-hi), var(--leather)); color: #f6e6c8;
  font: 600 13px/1.1 var(--sans); letter-spacing: .02em;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .45), inset 0 0 0 3px var(--leather), inset 0 0 0 4px rgba(210, 168, 104, .0);
  outline: 1.5px dashed rgba(210, 168, 104, .8); outline-offset: -5px;
}
.tab:focus-visible { box-shadow: 0 0 0 3px #ffd27a, 0 3px 10px rgba(0, 0, 0, .45); }
.tab:active { transform: translateY(1px); }

/* ---------- laid out flat on the table */
#spread {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  background: linear-gradient(rgba(36, 18, 6, .38), rgba(20, 9, 2, .55)), url(art/table.webp) center / 900px auto repeat;
  -webkit-overflow-scrolling: touch;
}
#spread[hidden] { display: none; }
.spread-grid { display: grid; justify-content: center; padding: 64px 16px 28px; box-sizing: border-box; }
.spread-grid .sl { position: relative; justify-self: center; animation: deal .5s cubic-bezier(.2, .8, .3, 1.15) both; filter: drop-shadow(0 4px 6px rgba(20, 8, 0, .45)); }
@keyframes deal { from { transform: translate3d(0, -40px, 0) rotate(-6deg) scale(.86); opacity: 0; } }

/* ---------- the back of the photo: the case study */
#back { position: fixed; inset: 0; z-index: 50; background: rgba(16, 8, 2, .74); }
#back[hidden] { display: none; }
.backside {
  position: absolute; top: 24px; bottom: 24px; left: 50%; width: min(960px, calc(100vw - 48px)); transform: translateX(-50%);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 60%),
    repeating-linear-gradient(0deg, rgba(120, 100, 60, .025) 0 1px, transparent 1px 3px),
    var(--paper);
  color: #2a2620; border-radius: 3px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  padding: 30px 40px 40px; box-sizing: border-box; outline: none;
  --ab-fg: #2a2620; --ab-muted: #6d6556; --ab-accent: var(--ink); --ab-chrome: 150px;
  font: 400 15.5px/1.55 var(--sans);
}
@media (min-width: 701px) { .backside.short { bottom: auto; max-height: calc(100% - 48px); } }
.bs-head { padding-right: 130px; margin-bottom: 18px; }
.bs-name { margin: 0; font: 400 clamp(30px, 4.6vw, 48px)/1.1 var(--hand); color: var(--ink); transform: rotate(-1.2deg); transform-origin: 0 50%; }
.bs-client { margin: 6px 0 0 4px; font: 400 18px/1.2 var(--hand); color: #4a5a8a; }
.bs-body .ab-heading { font: 400 24px/1.2 var(--hand); color: var(--ink); margin-top: 10px; }
.bs-body .ab-lede { font-size: 17px; max-width: 46em; }
.bs-body .ab-text, .bs-body .ab-credits { max-width: 52em; }
.bs-body .ab-film figcaption, .bs-body .ab-audio figcaption { font: 400 17px/1.2 var(--hand); color: #4a5a8a; }
.bs-body .ab-image img { box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.bs-body a { color: var(--ink); }
.about p { margin: 0 0 12px; max-width: 40em; }
.about .role { font-weight: 600; font-size: 17px; }
.about .links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; font-weight: 500; }
#back .putback { z-index: 52; top: max(30px, env(safe-area-inset-top)); right: max(calc(50vw - min(480px, 50vw - 24px) + 12px), 12px); }

/* the photo on its way out of the sleeve */
.flyer { position: fixed; z-index: 60; left: 0; top: 0; pointer-events: none; transform-origin: 50% 50%; background: #f7f3ea; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); backface-visibility: hidden; }
.flyer img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; display: block; }
.flyer.card { background: #fbfaf6; }

/* ---------- loading: the stitching goes in */
#loader { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: #24150b; transition: opacity .6s ease, visibility 0s linear .6s; }
#loader.gone { opacity: 0; visibility: hidden; }
.ld-leather {
  width: min(420px, 78vw); height: 120px; border-radius: 14px; position: relative;
  background: radial-gradient(120% 140% at 30% 20%, #74462a, #4a2a17 55%, #2f190c);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 200, 150, .08), inset 0 -8px 18px rgba(0, 0, 0, .35);
}
.ld-seam { position: absolute; left: 22px; right: 22px; top: 50%; height: 2px; margin-top: -1px; border-top: 1.5px dashed rgba(210, 168, 104, .16); }
.ld-seam i { position: absolute; left: 0; top: -1.5px; height: 0; width: 0; border-top: 1.5px dashed var(--thread); transition: width .25s linear; }

@media (max-width: 700px) {
  .tab { font-size: 12px; padding: 8px 12px; }
  .backside { top: 0; bottom: 0; width: 100vw; border-radius: 0; padding: 22px 18px 32px; --ab-chrome: 110px; font-size: 15px; }
  @media (min-width: 701px) { .backside.short { bottom: auto; max-height: calc(100% - 48px); } }
.bs-head { padding-right: 104px; }
  #back .putback { top: max(12px, env(safe-area-inset-top)); right: 12px; }
}
@media (prefers-reduced-motion: reduce) { .spread-grid .sl { animation: none; } }
