/* The library: the titles laid on the nine spines and the time on the clock */
/* the titles printed on the nine spines (laid over the 3D books, placed from the camera every frame) and the time on the clock */
  .titres { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
  .spine { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden;
    container-type: inline-size; padding: calc(var(--u, 60px) * .14) 0 calc(var(--u, 60px) * .1); gap: calc(var(--u, 60px) * .06); text-transform: uppercase; }
  .spine.dk > * { color: #d9d9d9; mix-blend-mode: screen; }       /* pale foil on the dark books */
  .spine.lt > * { color: #1c1c1c; mix-blend-mode: multiply; }     /* ink on the light ones */
  .spine > * { filter: url(#encre); opacity: 0; translate: 0 6cqw; transition: opacity .6s cubic-bezier(.333,0,.667,1), translate .8s cubic-bezier(.333,0,.667,1); }
  /* --rev (js): very pale as the books come into view, the ink rises with the scroll and is sharp only once we have arrived (a little suspense);
     the opacity follows the scroll closely, only the slide in keeps its stagger */
  .fin .spine > * { opacity: calc(.9 * var(--rev, 1)); translate: 0 0; transition-duration: .25s, .6s; transition-delay: 0s, calc(120ms + var(--i) * 40ms + var(--j) * 25ms); }
  .fin .spine > .k { opacity: calc(.55 * var(--rev, 1)); }
  .fin .spine.venir > * { opacity: calc(.32 * var(--rev, 1)); }   /* still to come: greyed */
  .spine .n { font-size: 20cqw; letter-spacing: .2em; }
  .spine .rule { flex: none; align-self: stretch; height: 5cqw; border-block: 1px solid currentColor; }
  .fin .spine > .rule { opacity: calc(.35 * var(--rev, 1)); }
  .spine .lg { flex: none; width: 58%; aspect-ratio: 1; background: currentColor;
    -webkit-mask: var(--lg) center / contain no-repeat; mask: var(--lg) center / contain no-repeat; }
  .spine .t, .spine .k { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; min-height: 0; overflow: hidden; }
  .spine .t { font-weight: 600; letter-spacing: .06em; font-size: 40cqw; }
  .spine .k { font-size: 15cqw; letter-spacing: .28em; }
  .heure { position: absolute; display: grid; place-items: center; color: #1c1c1c; mix-blend-mode: multiply; filter: url(#encre);
    font-family: "Times New Roman", Times, Georgia, serif; font-size: calc(var(--h, 20px) * .82); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
    -webkit-mask: linear-gradient(#000 calc(50% - 1px), transparent calc(50% - 1px), transparent calc(50% + 1px), #000 calc(50% + 1px));
    mask: linear-gradient(#000 calc(50% - 1px), transparent calc(50% - 1px), transparent calc(50% + 1px), #000 calc(50% + 1px));
    opacity: 0; transition: opacity .6s cubic-bezier(.333,0,.667,1); }
  .fin .heure { opacity: calc(.92 * var(--rev, 1)); transition-duration: .25s; }
  @media (prefers-reduced-motion: reduce) { .spine > *, .heure { transition: none; } }
/* the walk to the books: 218vh of scroll (index.html sets the same for the chained page) */
@media not (prefers-reduced-motion: reduce) { [data-scene="bibliotheque"].studio-scroll { height: 318vh; } }
/* the book opened over the library (a frame on the projects' book, js/bibliotheque.js) */
.livre { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; border: 0; background: #070707; animation: livre-in .45s cubic-bezier(.16,1,.3,1) both; }
.livre.out { opacity: 0; transition: opacity .4s; }
@keyframes livre-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .livre { animation: none; } }
/* a spine reached with the keyboard: outlined at once */
.spine:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Phone (and an upright tablet): the books standing on a shelf (js/bibliotheque-mobile.js) take the place of the 3D library */
.biblio-pile { display: none; }
@media (max-width: 760px), (max-width: 1024px) and (orientation: portrait) {
  #bibliotheque.studio-scroll { height: auto; position: relative; background: radial-gradient(ellipse 90% 45% at 50% 45%, #6e6e6c, #0b0b0b 75%); }
  /* the site's grain over the whole room, as on the other parts */
  #bibliotheque.studio-scroll::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: url(../assets/grain.png); opacity: .22; }
  #bibliotheque .stage { display: none; }
  .biblio-pile { display: block; max-width: 560px; margin-inline: auto; padding: 110px 20px 150px; font-family: var(--f-text, "Barlow Condensed", "Arial Narrow", sans-serif); text-transform: uppercase; }
  .bp-head { margin-bottom: 34px; color: #f2f2f0; }
  .bp-head p { margin: 0; font-size: 12px; letter-spacing: .3em; color: #b4b4b4; }
  .bp-head h2 { margin: .2em 0 0; font-weight: 600; font-size: 40px; line-height: .9; }
  .bp-head .bp-hint { margin-top: 12px; font-size: 15px; letter-spacing: .02em; text-transform: none; color: #b4b4b4; }
  /* the shelf: the books stand on it, side by side, each a little different */
  /* seen a little from above, as on the computer: the tops of the books and the shelf's board show, drawn flat so they stay smooth */
  .bp-etagere { position: relative; z-index: 0; display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: min(62svh, 460px); padding: 0 12px;
    border-bottom: 9px solid #cfcfcc; border-radius: 0 0 4px 4px; box-shadow: 0 16px 26px -12px rgba(0,0,0,.85); }
  .bp-etagere::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 46px;
    clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%); background: linear-gradient(#8f8f8c, #c4c4c1); }
  /* the top of a book: the two boards and the edge of the pages between them, going back */
  .bp-dessus { position: absolute; left: 0; right: 0; bottom: 100%; height: 17px; clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
    /* the boards rise above the pages: full height on each side, the pages set lower between them */
    background: linear-gradient(90deg, currentColor 0 10%, transparent 10% 90%, currentColor 90%),
                linear-gradient(#bdb8ad, #f2efe7) 0 6px / 100% calc(100% - 6px) no-repeat; }
  .bp-livre.dk .bp-dessus { color: #4a4a4a; } .bp-livre.lt .bp-dessus { color: #cfcfcc; }
  .bp-livre { all: unset; box-sizing: border-box; position: relative; width: var(--w); height: var(--h); display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 18px 0 16px; border-radius: 6px 6px 2px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: translate .4s cubic-bezier(.16,1,.3,1);
    box-shadow: inset 4px 0 6px -4px rgba(255,255,255,.25), inset -6px 0 8px -4px rgba(0,0,0,.45); }
  /* the bands across the spine, as on a bound book */
  .bp-livre::before, .bp-livre::after { content: ""; position: absolute; left: 0; right: 0; height: 7px; border-block: 1px solid currentColor; opacity: .45; }
  .bp-livre::before { top: 10px; } .bp-livre::after { bottom: 10px; }
  /* each spine rounded by the light (darker at its edges) and grained like paper and cloth */
  .bp-livre { background-image: linear-gradient(90deg, rgba(0,0,0,.32), transparent 22%, rgba(255,255,255,.08) 45%, transparent 70%, rgba(0,0,0,.38)), url(../assets/grain.png);
    background-blend-mode: normal, soft-light; }
  .bp-livre.dk { background-color: #1a1a1a; color: #d9d9d9; }
  .bp-livre.lt { background-color: #e4e4e1; color: #1c1c1c; }
  .bp-livre:active { translate: 0 -14px; }          /* touched: it comes out of the row */
  .bp-livre:focus-visible { outline: 1px solid #f2f2f0; outline-offset: 4px; }
  .bp-n { margin-top: 12px; font-size: 13px; letter-spacing: .2em; }
  .bp-lg { width: 58%; aspect-ratio: 1; background: currentColor; -webkit-mask: var(--lg) center / contain no-repeat; mask: var(--lg) center / contain no-repeat; }
  .bp-t, .bp-k { writing-mode: vertical-rl; rotate: 180deg; white-space: nowrap; }
  .bp-t { flex: 1; min-height: 0; overflow: hidden; font-weight: 600; font-size: clamp(17px, 5.4vw, 24px); letter-spacing: .06em; line-height: 1; }
  .bp-k { margin-bottom: 14px; font-size: 10px; letter-spacing: .24em; opacity: .6; }
  @media (prefers-reduced-motion: reduce) { .bp-livre { transition: none; } }
}
