:root {
  --ink: #2a1c12;
  --ink2: #5a4330;
  --red: #7a2b1c;
  --paper: #f4ecdc;
  --paper2: #ece2cd;
  --room: #1d1611;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--room); color: var(--ink); overflow: hidden; }
body { font: 400 18px/1.5 "Newsreader", Georgia, serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr:focus-within { position: fixed !important; left: 16px; bottom: 16px; width: auto; height: auto; clip: auto; z-index: 20; background: var(--paper); padding: 8px 12px; list-style: none; margin: 0; box-shadow: 0 6px 20px rgba(0,0,0,.4); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 75% 70% at 50% 46%, transparent 52%, rgba(10, 6, 2, .5) 100%); }

/* paper tabs along the top edge */
#tabs { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 22px; pointer-events: none; z-index: 4; }
.tab {
  pointer-events: auto; border: 0; cursor: pointer; background: var(--paper) var(--grain); color: var(--ink);
  font: 600 15px/1 "Fraunces", Georgia, serif; letter-spacing: .01em; padding: 15px 18px 12px; border-radius: 0 0 7px 7px;
  box-shadow: 0 3px 0 -1px rgba(0,0,0,.08) inset, 0 4px 10px rgba(0,0,0,.4), 0 1px 1px rgba(0,0,0,.3);
  transform: translateY(-3px); transition: transform .18s ease, box-shadow .18s ease;
}
.tab:hover, .tab:focus-visible { transform: translateY(0); }
.tab:focus-visible { outline: 2px solid #e2b04a; outline-offset: 2px; }
.tab.small { padding: 10px 14px 9px; font-size: 14px; border-radius: 6px; transform: none; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 5px rgba(0,0,0,.25); }
.tab.small:hover { background-color: #fbf5e8; }
html.reading #tAbout { opacity: 0; pointer-events: none; }
.tabs-r { display: flex; gap: 10px; }
#tSound::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; border: 1.5px solid var(--red); vertical-align: middle; }
#tSound[aria-pressed="true"]::before { background: var(--red); }

/* loading: a little card folding and unfolding */
#boot { position: fixed; inset: 0; z-index: 30; background: var(--room); display: grid; place-items: center; transition: opacity .6s ease; }
#boot.gone { opacity: 0; pointer-events: none; }
#boot.failed { color: var(--paper); font: italic 400 19px/1.4 "Newsreader", Georgia, serif; padding: 0 24px; text-align: center; }
#boot .fold { width: 90px; height: 60px; position: relative; perspective: 300px; }
#boot .fold i { position: absolute; left: 0; width: 90px; height: 30px; background: var(--paper); transform-origin: 50% 100%; }
#boot .fold i:first-child { top: 0; animation: fold 1.6s ease-in-out infinite; }
#boot .fold i:last-child { top: 30px; background: var(--paper2); }
@keyframes fold { 0%, 100% { transform: rotateX(0); } 50% { transform: rotateX(80deg); } }

/* the booklet: the real work on paper, opening out of the page */
#booklet { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 46vw); padding: 70px 22px 22px 0; z-index: 5; perspective: 2200px; pointer-events: none; }
.bk-sheet {
  pointer-events: auto; position: relative; height: 100%; background: var(--paper) var(--grain); border-radius: 3px 4px 4px 3px;
  box-shadow: -2px 0 0 #d9ccb2, -4px 1px 0 #cbbd9f, 0 18px 50px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.35);
  transform-origin: 0 50%; transform: rotateY(-92deg); opacity: 0;
  transition: transform .6s cubic-bezier(.2, .75, .2, 1), opacity .35s ease;
}
#booklet.open .bk-sheet { transform: none; opacity: 1; }
.bk-sheet::before, .bk-sheet::after { content: ""; position: absolute; left: 10px; width: 3px; height: 34px; background: linear-gradient(90deg, #8d8d8d, #e8e8e8 50%, #9a9a9a); border-radius: 1px; box-shadow: 0 1px 1px rgba(0,0,0,.3); }
.bk-sheet::before { top: 22%; }
.bk-sheet::after { top: 72%; }
.bk-bar { position: absolute; top: 14px; right: 16px; display: flex; gap: 8px; z-index: 2; }
.bk-body { height: 100%; overflow: auto; padding: 64px 46px 70px 50px; outline: none; scrollbar-width: thin; scrollbar-color: #bfae8c transparent; }
.bk-head { margin-bottom: 30px; }
.bk-client { margin: 0 0 6px; font: 500 12px/1.2 "Fraunces", serif; letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
.bk-title { margin: 0; font: 600 44px/1.02 "Fraunces", Georgia, serif; letter-spacing: -.01em; color: var(--ink); }
.bk-desc { margin: 16px 0 0; font-size: 19px; line-height: 1.5; color: #3a2a1c; }
.bk-credits { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink2); font-style: italic; }
.bk-contact { margin: 18px 0 0; font-size: 16px; color: var(--ink2); }
.bk-contact a { color: var(--red); }
.bk-roles { list-style: none; padding: 0; margin: 28px 0 0; border-top: 1px solid rgba(90,56,30,.3); }
.bk-roles li { padding: 12px 0; border-bottom: 1px solid rgba(90,56,30,.18); display: grid; gap: 2px; }
.bk-roles b { font: 600 17px "Fraunces", serif; }
.bk-roles span { font-size: 15px; color: var(--ink2); }
.bk-roles i { font-size: 14px; color: var(--ink2); }

.cs-sec { margin-top: 30px; }
.cs-sec:first-child { margin-top: 0; }
.cs-h { margin: 0 0 6px; font: italic 600 21px/1.2 "Fraunces", serif; color: var(--ink); padding-bottom: 6px; border-bottom: 1px solid rgba(90,56,30,.35); }
.cs-p { margin: 4px 0 14px; font-size: 16px; color: #4a3828; }
.cs-films { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px; margin-top: 12px; }
.cs-film { grid-column: span 2; margin: 0; }
.cs-film.is-tall { grid-column: span 1; }
.cs-frame {
  box-sizing: content-box; display: block; position: relative; width: calc(100% - 16px); border: 8px solid #fffdf7; padding: 0; background: #111;
  box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 14px rgba(40,20,5,.22); cursor: pointer;
}
.cs-film:nth-child(odd) .cs-frame { transform: rotate(-.35deg); }
.cs-film:nth-child(even) .cs-frame { transform: rotate(.3deg); }
.cs-frame img, .cs-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border: 0; }
div.cs-frame { cursor: default; }
.cs-frame::before, .cs-frame::after { content: ""; position: absolute; width: 22px; height: 22px; z-index: 1; pointer-events: none; }
.cs-frame::before { left: -12px; top: -12px; background: linear-gradient(135deg, #3b2a1e 50%, transparent 50%); }
.cs-frame::after { right: -12px; bottom: -12px; background: linear-gradient(-45deg, #3b2a1e 50%, transparent 50%); }
.cs-frame.is-playing::before, .cs-frame.is-playing::after { display: none; }
.cs-glyph { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: var(--paper) var(--grain); box-shadow: 0 3px 10px rgba(0,0,0,.45); z-index: 2; transition: transform .2s ease; }
.cs-glyph::after { content: ""; position: absolute; left: 25px; top: 19px; border-style: solid; border-width: 12px 0 12px 19px; border-color: transparent transparent transparent var(--red); }
button.cs-frame:hover .cs-glyph { transform: scale(1.08); }
.cs-cap { margin-top: 10px; display: flex; gap: 10px; align-items: baseline; font-size: 15px; color: var(--ink2); }
.cs-cap b { font: italic 500 16px "Newsreader", serif; color: var(--ink); }
.cs-dur { font-size: 13px; letter-spacing: .04em; }
.cs-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 14px 0; }
.cs-imgs.cs-full { grid-template-columns: 1fr; }
.cs-img { margin: 0; }
.cs-img img { display: block; width: 100%; height: auto; border: 6px solid #fffdf7; box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 5px 12px rgba(40,20,5,.2); cursor: zoom-in; background: #eee; }
.cs-audio { list-style: none; margin: 14px 0; padding: 0; }
.cs-track { display: grid; grid-template-columns: 44px 28px 1fr minmax(60px, 110px); align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px dashed rgba(90,56,30,.3); }
.cs-ap { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; background: var(--paper) var(--grain); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 2px 6px rgba(0,0,0,.35); position: relative; }
.cs-ap::after { content: ""; position: absolute; left: 14px; top: 11px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent var(--red); }
.cs-track.is-on .cs-ap::after { left: 12px; top: 11px; width: 4px; height: 14px; border: 0; background: var(--red); box-shadow: 7px 0 0 var(--red); }
.cs-n { font: 500 12px "Fraunces", serif; color: var(--ink2); letter-spacing: .08em; }
.cs-at { font: italic 400 17px "Newsreader", serif; }
.cs-bar { height: 3px; background: rgba(90,56,30,.18); border-radius: 2px; overflow: hidden; }
.cs-bar i { display: block; height: 100%; width: 0; background: var(--red); }
.cs-track audio { display: none; }

/* contents: each spread as a small paper diorama on the endpapers */
#contents { position: fixed; inset: 0; z-index: 8; overflow: auto; opacity: 0; transition: opacity .3s ease; background: #2a211a; }
#contents::before { content: ""; position: fixed; inset: 0; background: var(--endpaper) center / 900px auto repeat; opacity: .9; }
#contents::after { content: ""; position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(20,12,4,.1), rgba(20,12,4,.55)); pointer-events: none; }
#contents.open { opacity: 1; }
.ct-bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; padding: 16px 22px 0; pointer-events: none; }
.ct-bar .tab { pointer-events: auto; }
.ct-grid { position: relative; z-index: 2; list-style: none; margin: 0 auto; padding: 14px 30px 70px; max-width: 1380px; display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 30px 24px; }
.ct-card {
  display: block; width: 100%; border: 0; cursor: pointer; text-align: left; background: var(--paper) var(--grain); padding: 10px 10px 13px;
  box-shadow: 0 2px 3px rgba(0,0,0,.3), 0 10px 24px rgba(0,0,0,.35); transition: transform .25s ease, box-shadow .25s ease; border-radius: 2px;
}
.ct-card:hover, .ct-card:focus-visible { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 3px 4px rgba(0,0,0,.3), 0 18px 34px rgba(0,0,0,.4); outline: none; }
.ct-card:focus-visible { outline: 2px solid #e2b04a; outline-offset: 3px; }
.mini { display: block; position: relative; aspect-ratio: 3 / 2.15; overflow: hidden; background: #cfc3a8; }
.mini-page { position: absolute; left: 0; top: 0; width: 100%; height: 74%; object-fit: cover; object-position: center bottom; box-shadow: 0 6px 10px -4px rgba(0,0,0,.45); z-index: 1; }
.mini-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 28%; background-size: 100% 380%; background-position: center 100%; transform: scaleY(-1); filter: brightness(.9) saturate(.95); }
.mini-piece { position: absolute; transform: translateX(-50%); filter: drop-shadow(1px 3px 2px rgba(0,0,0,.45)); transition: transform .35s cubic-bezier(.2,.8,.3,1.3); z-index: 2; }
.ct-card:hover .mini-piece, .ct-card:focus-visible .mini-piece { transform: translateX(-50%) translateY(calc(-2px - var(--d) * 10px)); }
.ct-t { display: block; margin-top: 11px; font: 600 18px/1.15 "Fraunces", serif; color: var(--ink); }
.ct-c { display: block; margin-top: 4px; font: 500 10.5px/1.2 "Fraunces", serif; letter-spacing: .2em; text-transform: uppercase; color: var(--red); }

#lightbox { position: fixed; inset: 0; z-index: 12; background: rgba(20,14,8,.93); display: grid; place-items: center; padding: 60px 20px 20px; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 94vw; max-height: 84vh; border: 10px solid #fffdf7; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#lbClose { position: fixed; top: 16px; right: 20px; }

html.nogl #gl, html.nogl #vignette { display: none; }

@media (max-width: 719px) {
  #tabs { padding: 0 12px; }
  .tab { font-size: 14px; padding: 13px 14px 10px; }
  #booklet { top: auto; left: 0; right: 0; width: auto; height: 68vh; padding: 0 8px; perspective: 1600px; }
  .bk-sheet { transform-origin: 50% 100%; transform: rotateX(80deg); border-radius: 6px 6px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
  .bk-sheet::before, .bk-sheet::after { top: 10px; left: auto; width: 34px; height: 3px; background: linear-gradient(180deg, #8d8d8d, #e8e8e8 50%, #9a9a9a); }
  .bk-sheet::before { left: 24%; }
  .bk-sheet::after { left: 72%; }
  .bk-bar { top: 18px; right: 12px; }
  .bk-body { padding: 70px 22px 50px; }
  .bk-title { font-size: 34px; }
  .bk-desc { font-size: 17px; }
  .ct-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; padding: 8px 12px 50px; }
  .ct-card { padding: 6px 6px 9px; }
  .ct-t { font-size: 14.5px; margin-top: 7px; }
  .ct-c { font-size: 9px; letter-spacing: .14em; }
}
@media (prefers-reduced-motion: reduce) {
  .bk-sheet, .ct-card, .mini-piece, #contents, .tab { transition: none !important; }
  #boot .fold i { animation: none; }
}
