/* Ex Libris. Warm gallery walls, large quiet type, real bookplates from five centuries, and three scenes
   that move with the scroll: the bookplates passing by, Manet's raven leaving and coming home, and a card
   catalogue turning. */

@font-face { font-family: "DM Sans Lab"; src: url(assets/fonts/dmsans-lab.woff2) format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Ink"; src: url(assets/fonts/newsreader-lab-italic-400-500.woff2) format("woff2"); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Red Hat Mono Lab"; src: url(assets/fonts/redhatmono-lab.woff2) format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  --ground: #f7f4ef; --frame: #f4f1eb; --ink: #1f1b17; --text: #3b342d; --muted: #766c60;
  --night: #17130f; --night-text: #efe8dc; --night-muted: #a59a8b;
  --red: #c0573a; --oxblood: #7f2f25;
  --rule: rgba(31, 27, 23, .13); --rule-soft: rgba(31, 27, 23, .07);
  --sans: "DM Sans Lab", "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Ink", "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Red Hat Mono Lab", "Red Hat Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --section: clamp(110px, 14vw, 220px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 18px/1.55 var(--sans); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
a { color: inherit; }
img, canvas, svg { display: block; }
::selection { background: rgba(192, 87, 58, .22); color: var(--ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 12px; z-index: 50; background: var(--ink); color: var(--ground); padding: 8px 12px; border-radius: 999px; font: 500 14px var(--sans); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 var(--gutter); }
.pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* ---------------------------------------------------------------- type */
.kicker { margin: 0 0 22px; font: 400 12.5px/1 var(--mono); letter-spacing: .02em; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.kicker::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.display { margin: 0; color: var(--ink); font-weight: 400; font-size: clamp(42px, 6.2vw, 100px); line-height: 1; letter-spacing: -.045em; }
.display .br { display: block; color: var(--muted); }
.lead { margin: 26px 0 0; max-width: 30em; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; letter-spacing: -.01em; color: var(--text); }
.h2 { margin: 0; color: var(--ink); font-weight: 400; font-size: clamp(34px, 4.6vw, 68px); line-height: 1.03; letter-spacing: -.035em; text-wrap: balance; }
.h2 .soft { color: var(--muted); }
.body { margin: 22px 0 0; max-width: 32em; font-size: clamp(17px, 1.3vw, 19px); line-height: 1.55; color: var(--text); }

/* ---------------------------------------------------------------- nav */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20; height: 64px; display: flex; align-items: center; gap: 24px;
  padding: 0 var(--gutter); padding-top: env(safe-area-inset-top); color: var(--ink);
  transition: background .5s var(--ease), box-shadow .5s var(--ease), color .5s var(--ease);
}
.nav.scrolled { background: rgba(247, 244, 239, .8); -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px); box-shadow: 0 1px 0 var(--rule-soft); }
.nav.night { background: rgba(23, 19, 15, .55); color: var(--night-text); box-shadow: 0 1px 0 rgba(239, 232, 220, .06); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-weight: 500; font-size: 17px; letter-spacing: -.02em; }
.mark { width: 22px; height: 22px; }
.mark rect:nth-child(1) { fill: var(--oxblood); } .mark rect:nth-child(2) { fill: var(--red); } .mark rect:nth-child(3) { fill: #d9a05b; }
.links { display: flex; gap: 30px; margin: 0 auto; }
.links a { font-size: 15px; color: inherit; opacity: .62; text-decoration: none; transition: opacity .3s; }
.links a:hover { opacity: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--ground); font: 500 15px/1 var(--sans); letter-spacing: -.01em; text-decoration: none;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.pill:hover { background: var(--oxblood); }
.nav.night .pill { background: var(--night-text); color: var(--night); }
.pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.pill:hover svg { transform: translateX(3px); }
#save:hover svg { transform: translateY(2px); }

/* ---------------------------------------------------------------- 0. hero */
.hero { padding-top: 72px; }
.hero-stage { position: relative; margin: 0 var(--gutter); }
.hero-plate {   /* a bookplate laid on the painted endpaper */
  position: absolute; left: 50%; top: 50%; z-index: 1; transform: translate(-50%, -50%) rotate(-.6deg);
  width: min(740px, calc(100% - 48px)); padding: clamp(40px, 5vw, 68px) clamp(28px, 4.4vw, 60px) clamp(36px, 4.4vw, 56px);
  text-align: center; background: #f6f1e6;
  box-shadow: 0 1px 2px rgba(31, 27, 23, .14), 0 44px 80px -36px rgba(31, 27, 23, .6);
}
.hero-plate::before, .hero-plate::after { content: ""; position: absolute; pointer-events: none; border: 2px solid var(--ink); inset: 12px; }
.hero-plate::after { inset: 19px; border-width: 1px; }
.plate-head { display: block; margin-bottom: clamp(20px, 2.6vw, 30px); font: 500 12.5px/1 var(--sans); letter-spacing: .42em; text-transform: uppercase; color: var(--ink); padding-left: .42em; }
.hero-plate .display { font-size: clamp(32px, 4.7vw, 72px); line-height: 1.02; letter-spacing: -.042em; text-wrap: balance; }
.plate-rule { position: relative; display: block; width: 150px; height: 1px; margin: clamp(22px, 2.6vw, 30px) auto; background: linear-gradient(90deg, var(--ink) 0 40%, transparent 40% 60%, var(--ink) 60%); }
.plate-rule::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--red); }
.hero-plate .lead { margin: 0 auto; max-width: 22em; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.5; color: var(--text); }
.hero-caption { justify-content: center; text-align: center; margin: 14px var(--gutter) 0; }
.js .hero-plate { animation: paste 1.5s var(--ease) .45s both; }
@keyframes paste { from { opacity: 0; transform: translate(-50%, -46%) rotate(-2deg) scale(1.03); } }
.frame { position: relative; overflow: hidden; background: var(--frame); border-radius: 6px; }
.frame canvas { width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease); }
.frame canvas.painted { opacity: 1; }
.frame::after {   /* a fine paper grain */
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .32;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .3  0 0 0 .55 0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
.hero-frame { height: calc(100vh - 72px - 52px); height: calc(100svh - 72px - 52px); min-height: 520px; }
.caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-top: 14px; font: 400 12.5px/1.4 var(--mono); color: var(--muted); }
.caption .title { font: italic 400 17px/1.2 var(--serif); color: var(--ink); }

/* ---------------------------------------------------------------- 1. history: bookplates landing on a pile */
.history { margin-top: var(--section); }
.js .history { height: 760vh; }
.history .pin { display: flex; }
.history-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; padding-top: 120px; padding-bottom: clamp(36px, 6vh, 64px); }
.history-text { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; min-height: 0; }
.latin { margin: 0; color: var(--ink); font: italic 400 clamp(76px, 9.4vw, 152px)/.92 var(--serif); letter-spacing: -.035em; }
.gloss { margin: 14px 0 0; font-size: clamp(19px, 1.6vw, 23px); color: var(--muted); letter-spacing: -.01em; }
.gloss i { font: italic 400 1.12em var(--serif); color: var(--ink); }
.intro .body { margin-top: 24px; max-width: 25em; }
.era-year { margin: 0; height: 1em; overflow: hidden; color: var(--ink); font-size: clamp(64px, 7.4vw, 124px); line-height: 1; letter-spacing: -.05em; }
.era-year span { display: block; }
.era-year .up { animation: era-up .75s var(--ease) both; }
.era-year .down { animation: era-down .75s var(--ease) both; }
@keyframes era-up { from { transform: translateY(.7em); opacity: 0; } }
@keyframes era-down { from { transform: translateY(-.7em); opacity: 0; } }
.era-cap { min-height: 5.4em; margin-top: 14px; }
.era-cap > div { display: grid; gap: 3px; animation: fade .6s var(--ease) both; }
.era-cap .when, .era-cap .who, .bp .when, .bp .who { font: 400 12px/1.5 var(--mono); color: var(--muted); text-decoration: none; }
.era-cap .owner { color: var(--ink); font-size: 19px; letter-spacing: -.01em; }
.era-cap .owner i, .era-cap .note i { font: italic 400 1.08em var(--serif); }
.era-cap a.who { color: var(--red); pointer-events: auto; }
.era-cap .note { margin-top: 4px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.table { position: relative; min-height: 0; }
.bp { position: absolute; left: 50%; top: 50%; margin: 0; will-change: transform, opacity; }
.bp img, .bp canvas {
  display: block; width: auto; height: auto; max-height: min(60vh, 560px); max-width: min(34vw, 500px); border-radius: 2px;
  box-shadow: 0 1px 1px rgba(31, 27, 23, .08), 0 26px 50px -24px rgba(31, 27, 23, .5);
}
.js .bp figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html:not(.js) .table { display: flex; flex-wrap: wrap; gap: 32px; }
html:not(.js) .bp { position: static; }
html:not(.js) .bp figcaption { display: grid; gap: 2px; margin-top: 12px; max-width: 320px; }

/* ---------------------------------------------------------------- 2. the flight */
.flight { margin-top: calc(var(--section) * .6); }
.js .flight { height: 560vh; }
.flight .pin { background: var(--flight-bg, var(--ground)); }
.flight-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.flight-still { display: none; }
.no-gl .flight-still, html:not(.js) .flight-still { display: block; position: absolute; left: 50%; top: 34%; width: min(64vw, 900px); transform: translate(-50%, -50%); mix-blend-mode: multiply; }
.beats { position: absolute; inset: 0; margin: 0 auto; pointer-events: none; }
.beat { position: absolute; left: var(--gutter); bottom: clamp(56px, 11vh, 120px); max-width: 640px; opacity: 0; transform: translate3d(0, 24px, 0); transition: opacity .8s var(--ease), transform 1s var(--ease); }
.beat.on { opacity: 1; transform: none; pointer-events: auto; }
.beat .body { max-width: 30em; }
.beat.dark .h2 { color: var(--night-text); }
.beat.dark .body { color: rgba(239, 232, 220, .74); }
.beat.dark .kicker { color: var(--night-muted); }
.beat.centre { left: var(--gutter); right: var(--gutter); bottom: auto; top: 50%; max-width: none; text-align: center; transform: translate3d(0, calc(-50% + 24px), 0); }
.beat.centre.on { transform: translate3d(0, -50%, 0); }
.question { margin: 0 auto; max-width: 17em; color: var(--night-text); font: italic 400 clamp(34px, 4.8vw, 74px)/1.08 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
html:not(.js) .beat { position: static; opacity: 1; transform: none; margin: 40px 0; }
html:not(.js) .beats { position: static; }

/* ---------------------------------------------------------------- 3. why now */
.now { padding-top: var(--section); }
.now-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px 80px; align-items: start; }
.now .h2 { font-size: clamp(32px, 3.8vw, 58px); }
.now-list { list-style: none; margin: 0; padding: 0; }
.now-list li { display: grid; grid-template-columns: 3.2em 1fr; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--rule); color: var(--ink); font-size: clamp(21px, 1.9vw, 28px); line-height: 1.25; letter-spacing: -.02em; }
.now-list .n { font: 400 12px/1 var(--mono); color: var(--muted); }
.now-list .last { border-bottom: 1px solid var(--rule); }
.now-list .last span:last-child { font: italic 400 1.1em/1.2 var(--serif); letter-spacing: -.01em; color: var(--oxblood); }

/* ---------------------------------------------------------------- 4. the library of you: a card catalogue */
.library { margin-top: var(--section); }
.js .library { height: 620vh; }
.library .pin { display: flex; align-items: center; }
.library-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 40px 72px; align-items: center; }
.stack { position: relative; height: min(66vh, 580px); perspective: 1500px; perspective-origin: 50% -10%; }
.stack::after {   /* the stack's shadow on the page */
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: calc(24% - 30px); width: min(580px, 100%); height: 40px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(31, 27, 23, .2), rgba(31, 27, 23, 0)); pointer-events: none;
}
.cards { position: absolute; inset: 0; transform-style: preserve-3d; }
.card {
  position: absolute; left: 0; right: 0; bottom: 24%; margin: 0 auto; width: min(540px, 94%); aspect-ratio: 5 / 3;
  display: flex; flex-direction: column; padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px); border-radius: 5px;
  background: #fbf8f1 repeating-linear-gradient(to bottom, transparent 0 25px, rgba(79, 109, 138, .14) 25px 26px) 0 100% / 100% 34% no-repeat;
  box-shadow: 0 1px 0 rgba(31, 27, 23, .05), 0 -1px 0 rgba(255, 255, 255, .7) inset, 0 16px 34px -18px rgba(31, 27, 23, .45);
  transform-origin: 50% 100%; backface-visibility: hidden; will-change: transform, opacity;
}
.card header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1.5px solid rgba(192, 87, 58, .65); font: 400 11.5px/1 var(--mono); letter-spacing: .03em; color: var(--muted); }
.card .call { color: var(--red); }
.card h3 { margin: clamp(14px, 2.2vw, 26px) 0 0; color: var(--ink); font-weight: 400; font-size: clamp(25px, 2.7vw, 40px); line-height: 1.08; letter-spacing: -.035em; }
.card .see { margin: 12px 0 0; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.card.blank h3 { color: var(--muted); }
.card::after {   /* the punched hole every catalogue card has, for the rod */
  content: ""; position: absolute; left: 50%; bottom: 7%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--ground); box-shadow: inset 0 1px 2px rgba(31, 27, 23, .35);
}
html:not(.js) .card { position: relative; bottom: auto; margin: 0 auto 16px; }
html:not(.js) .stack { height: auto; }
html:not(.js) .stack::after { display: none; }
html:not(.js) .cards { position: static; }

/* ---------------------------------------------------------------- 5. it grows with you */
.grows { padding-top: var(--section); }
.grows-lines { margin: 0; color: var(--ink); font-size: clamp(32px, 4.6vw, 70px); line-height: 1.1; letter-spacing: -.038em; }
.grows-lines span { display: block; max-width: 18em; }
.grows-lines span + span { margin-top: .22em; }
.grows-lines em { font: italic 400 1.05em/1 var(--serif); letter-spacing: -.015em; color: var(--red); }

/* ---------------------------------------------------------------- 6. your plate */
.make { padding-top: var(--section); }
.make-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px 80px; align-items: center; }
.name-field { display: block; margin-top: 36px; max-width: 460px; }
.name-field input {
  width: 100%; padding: 6px 0 10px; border: 0; border-bottom: 1.5px solid var(--rule); border-radius: 0; background: transparent; outline: none;
  color: var(--ink); font: italic 400 clamp(34px, 3.6vw, 52px)/1.1 var(--serif); letter-spacing: -.01em; transition: border-color .3s;
}
.name-field input::placeholder { color: var(--muted); opacity: .55; }
.name-field input:focus { border-bottom-color: var(--red); }
.make-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.make-plate { margin: 0; display: flex; justify-content: center; }
.plate-object { width: min(460px, 100%); transform: rotate(-1.2deg); transition: transform 1.2s var(--ease); }
.plate-object:hover { transform: rotate(0); }
.plate-object canvas { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 2px; box-shadow: 0 1px 2px rgba(31, 27, 23, .08), 0 40px 70px -34px rgba(31, 27, 23, .55); transition: opacity .35s; }
.plate-object canvas.busy { opacity: .55; }

/* ---------------------------------------------------------------- 7. close and footer */
.close { display: flex; align-items: center; min-height: 92vh; min-height: 92svh; padding: var(--section) 0; }
.close .wrap { display: flex; flex-direction: column; align-items: center; text-align: center; }
.statement { margin: 0 0 clamp(36px, 4vw, 56px); max-width: 14em; color: var(--ink); font-size: clamp(40px, 7vw, 118px); line-height: 1; letter-spacing: -.045em; text-wrap: balance; }
.statement em { font: italic 400 1.04em/1 var(--serif); letter-spacing: -.02em; color: var(--red); }
.pill.large { height: 52px; padding: 0 24px; font-size: 16px; }
.foot { border-top: 1px solid var(--rule); }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding-top: 26px; padding-bottom: calc(30px + env(safe-area-inset-bottom)); font: 400 12.5px/1.4 var(--mono); color: var(--muted); }
.foot-row a { margin-left: auto; text-decoration: none; transition: color .3s; }
.foot-row a:hover { color: var(--ink); }
.brand.small { color: var(--ink); font: 500 15px/1 var(--sans); }
.brand.small .mark { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- reveals */
.js .rv { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity 1.1s var(--ease), transform 1.3s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
.js .now-list .rv:nth-child(2), .js .grows-lines .rv:nth-child(2) { transition-delay: .1s; }
.js .now-list .rv:nth-child(3), .js .grows-lines .rv:nth-child(3) { transition-delay: .2s; }
.js .now-list .rv:nth-child(4) { transition-delay: .3s; }

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 960px) {
  .links { display: none; }
  .links + .pill { margin-left: auto; }
  .now-grid, .make-grid { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; padding-top: 84px; padding-bottom: 28px; }
  .history-text { display: contents; }
  .intro { order: 1; } .table { order: 2; } .era { order: 3; }
  .bp img, .bp canvas { max-height: 40vh; max-height: 40svh; max-width: 62vw; }
  .era { display: flex; align-items: flex-end; gap: 18px; }
  .era-cap { min-height: 0; margin: 0 0 4px; }
  .library-grid { grid-template-columns: 1fr; gap: 20px; }
  .library-text .body { display: none; }
  .library-text .kicker { margin-bottom: 14px; }
  .stack { height: min(52vh, 460px); height: min(52svh, 460px); }
  .library-grid { gap: 8px; }
}
@media (min-width: 961px) { .nav .pill { margin-left: 0; } }
@media (max-width: 640px) {
  body { font-size: 17px; }
  .nav { height: 58px; }
  .pill { height: 38px; padding: 0 15px; font-size: 14px; }
  .pill.large { height: 48px; padding: 0 20px; }
  .hero { padding-top: 64px; }
  .hero-stage { margin: 0 12px; }
  .hero-frame { height: calc(100vh - 64px - 48px); height: calc(100svh - 64px - 48px); min-height: 480px; border-radius: 4px; }
  .hero-plate { width: calc(100% - 32px); padding: 44px 26px 36px; }
  .hero-plate::before { inset: 9px; } .hero-plate::after { inset: 14px; }
  .plate-head { font-size: 11px; }
  .hero-caption { margin: 12px 12px 0; }
  .latin { font-size: 58px; }
  .gloss { font-size: 17px; margin-top: 8px; }
  .intro .body { margin-top: 12px; font-size: 15px; line-height: 1.5; }
  .bp img, .bp canvas { max-height: 34vh; max-height: 34svh; max-width: 66vw; }
  .era-year { font-size: 52px; }
  .era-cap .owner { font-size: 16px; }
  .era-cap .note { display: none; }
  .beat { bottom: 48px; right: var(--gutter); }
  .beat .h2 { font-size: 34px; }
  .beat .body { font-size: 16.5px; }
  .card h3 { font-size: 24px; }
  .stack { height: 40vh; height: 40svh; }
  .card { bottom: 20%; }
  .stack::after { bottom: calc(20% - 24px); height: 32px; }
  .plate-object { transform: none; }
  .foot-row a { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .js .rv { transform: none; transition: opacity .4s linear; }
  .beat, .beat.centre { transition: opacity .4s linear; }
  .js .hero-plate { animation: fade .6s linear both; }
}
@keyframes fade { from { opacity: 0; } }
