/* Notebook filing cabinet, shared by the homepage and the Notebook page.
   Files stand in an open drawer, each overlapping the one behind it; only the tabs and top edges show
   until a file is lifted (hover) or pulled out (click). */
.lib { --fh: 300px; --step: 62px; --lift: 40px; --pull: 200px; position: relative; color: #f3e6cc; }
.lib-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.lib-tabs button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; border: 1px solid rgba(243, 230, 204, .25); border-radius: 99px; background: none; color: inherit; font: 500 15px var(--sans); cursor: pointer; transition: background .25s, color .25s, border-color .25s; }
.lib-tabs button span { font-size: 12px; opacity: .6; }
.lib-tabs button:hover { border-color: rgba(243, 230, 204, .6); }
.lib-tabs button[aria-pressed="true"] { background: #f3e6cc; color: #22201c; border-color: #f3e6cc; }

.cabinet { position: relative; width: min(100%, 760px); margin: 0 auto; padding-top: 40px; }
.drawer { position: relative; height: calc(var(--n, 5) * var(--step) + 34px); padding: 0 28px; clip-path: inset(-600px -60px 0 -60px); border-radius: 10px 10px 0 0; background: linear-gradient(90deg, #120c08, #2a1d14 6%, #2a1d14 94%, #120c08); box-shadow: inset 0 18px 30px rgba(0, 0, 0, .55); }

.file { position: relative; z-index: var(--i); height: var(--fh); margin-top: calc(var(--step) - var(--fh)); transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .4s, margin .5s cubic-bezier(.2, .8, .2, 1), height .5s; }
.file.first { margin-top: 0; }
.file-back { position: absolute; inset: 14px 0 0; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #e2c58c, #d2b277 30%); box-shadow: 0 -2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
.file-tab { position: absolute; left: var(--tab); top: -22px; max-width: 46%; padding: 4px 16px 6px; border-radius: 8px 8px 0 0; background: #e2c58c; color: #2a1d10; font: 600 13px/1.3 "Courier Prime", "Courier New", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: inset 0 3px 0 var(--c); }
.file-sheet { position: absolute; left: 22px; right: 22px; top: 22px; bottom: 0; display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; background: repeating-linear-gradient(0deg, transparent 0 25px, rgba(70, 90, 130, .1) 25px 26px), #fbf8f1; color: #22201c; box-shadow: 0 -1px 3px rgba(0, 0, 0, .15); pointer-events: none; }
.file-sheet small { font: 600 11px "Courier Prime", "Courier New", monospace; letter-spacing: .12em; text-transform: uppercase; color: #9b3b2a; }
.file-sheet b { font: 400 26px/1.1 var(--serif); }
.file-sheet p { font: 400 15px/1.55 "Courier Prime", "Courier New", monospace; color: #3a3530; }
.file-go { align-self: flex-start; min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 4px; background: #22201c; color: #f6efe0; font: 600 14px var(--sans); text-decoration: none; pointer-events: auto; }
.file-front { position: absolute; left: 0; right: 0; top: 58px; bottom: 0; display: block; padding: 0; border: 0; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0) 8px), repeating-linear-gradient(90deg, rgba(120, 85, 40, .04) 0 2px, transparent 2px 5px), #d9b77a; box-shadow: 0 -3px 8px rgba(0, 0, 0, .28); cursor: pointer; text-align: left; transition: top .5s cubic-bezier(.2, .8, .2, 1); }
.file-label { position: absolute; right: 20px; top: 12px; padding: 2px 8px; border: 1.5px solid rgba(155, 59, 42, .7); border-radius: 3px; color: #9b3b2a; font: 600 10px var(--sans); letter-spacing: .16em; text-transform: uppercase; transform: rotate(-2deg); }
.file-front:focus-visible { outline: 2px solid #ffd9a0; outline-offset: -4px; }

/* Lift on hover, pull out on click: the front of the folder drops so the sheet shows */
.file:hover:not(.open):not(.out), .file:focus-within:not(.open) { transform: translateY(calc(var(--lift) * -1)); }
.file.open { transform: translateY(calc(var(--pull) * -1)); z-index: 50; }
.file.open .file-front { top: calc(var(--fh) - 58px); }
.lib.reading .file:not(.open) { opacity: .55; }
.file.leaving { transform: translateY(calc(var(--pull) * -1 - 60px)); opacity: 0; transition: transform .32s cubic-bezier(.4, 0, .2, 1), opacity .32s; }
.file.out { height: 0; margin-top: 0; opacity: 0; transform: translateY(40px); pointer-events: none; overflow: hidden; }

.drawer-front { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 28px; height: 96px; margin: -10px -14px 0; border-radius: 6px; background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 30%), repeating-linear-gradient(90deg, rgba(255, 220, 170, .03) 0 2px, transparent 2px 9px), linear-gradient(#5a3a24, #3a2416); box-shadow: 0 30px 50px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 220, 170, .2); }
.drawer-plate { padding: 6px 14px; border-radius: 3px; background: linear-gradient(#e2c27a, #9b7838); color: #2a1a10; font: 600 11px var(--sans); letter-spacing: .18em; text-transform: uppercase; box-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
.drawer-handle { width: 120px; height: 16px; border-radius: 99px; background: linear-gradient(#e2c27a, #8d6a2f); box-shadow: 0 4px 8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .4); }
.lib-hint { min-height: 1.4em; margin-top: 16px; text-align: center; font-size: 14px; color: rgba(243, 230, 204, .72); text-shadow: 0 1px 10px rgba(8, 10, 24, .8); }

.notebook.in .file { animation: file-in .7s calc(var(--i) * 70ms) cubic-bezier(.2, .8, .2, 1) both; }
@keyframes file-in { from { opacity: 0; translate: 0 50px; } }

@media (max-width: 820px) {
  .lib { --fh: 310px; --step: 54px; --lift: 30px; --pull: 230px; }
  .drawer { padding: 0 12px; }
  .file-sheet { left: 12px; right: 12px; padding: 18px 16px; }
  .file-sheet b { font-size: 22px; }
  .file-sheet p { font-size: 14px; }
  .file-tab { left: min(var(--tab), 34%); max-width: 62%; font-size: 12px; }
  .file-label { display: none; }
  .drawer-front { height: 80px; gap: 16px; margin: -8px -6px 0; }
  .drawer-handle { width: 80px; }
}
@media (hover: none) { .file:hover:not(.open):not(.out) { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .file, .file-front { transition: none; }
  .notebook.in .file { animation: none; }
}

/* Several drawers, one per subject: the pulled-out file rises over the drawer above it */
.drawer.active { z-index: 70; }
.cabinet.multi { width: min(100%, 820px); padding: 26px 22px 28px; border-radius: 8px; background: repeating-linear-gradient(90deg, rgba(255, 220, 170, .025) 0 2px, transparent 2px 11px), linear-gradient(#3a2416, #24160e); box-shadow: inset 0 0 0 10px #4a2f1d, inset 0 0 0 12px #2a1a10, 0 40px 80px rgba(0, 0, 0, .5); }
.cabinet.multi .drawer-front { margin-bottom: 30px; }
.cabinet.multi .drawer-front:last-child { margin-bottom: 0; }
.cabinet.multi .drawer { margin-top: 24px; }
.cabinet.multi .drawer:first-child { margin-top: 10px; }
@media (max-width: 820px) { .cabinet.multi { padding: 18px 10px 20px; } }

/* Homepage: a hand of typed papers, fanned from one point below */
.hand { position: relative; display: flex; justify-content: center; padding: 40px 0 24px; perspective: 1600px; }
.sheet-card { --w: clamp(220px, 17.5vw, 258px); --push: 0; position: relative; z-index: var(--i); flex: none; width: var(--w); height: calc(var(--w) * 1.414); margin: 0 calc(var(--w) * -.07); display: flex; flex-direction: column; gap: 9px; padding: 26px 20px 16px 34px; color: #24211d; text-decoration: none; filter: drop-shadow(0 18px 26px rgba(8, 10, 24, .42)) drop-shadow(0 2px 3px rgba(8, 10, 24, .25)); transform-origin: 50% 160%; transform: translateX(calc(var(--push) * 46px)) rotate(calc(var(--o) * 6deg)) translateY(calc(var(--o) * var(--o) * 5px)); transition: transform .55s cubic-bezier(.2, .8, .2, 1), filter .4s, opacity .35s; }
/* The page itself, with its top corner folded, and the second page peeking out behind it */
.sheet-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 18%), linear-gradient(225deg, transparent 0 18px, #fbf9f4 18px); }
.sheet-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(225deg, transparent 0 18px, #ebe4d4 18px); transform: translate(6px, 6px) rotate(1.4deg); }
.sheet-fold { position: absolute; right: 0; top: 0; width: 26px; height: 26px; background: linear-gradient(45deg, #d9d0bc, #e9e2d2 48%, transparent 50%); filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, .15)); }
.sheet-holes { position: absolute; left: 11px; top: 22%; width: 9px; height: 9px; border-radius: 50%; background: #14182c; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 calc(var(--w) * .5) 0 #14182c; opacity: .55; }
.sheet-clip { position: absolute; left: 30px; top: -12px; width: 18px; height: 52px; border: 2.5px solid #b9bcc4; border-radius: 9px; border-bottom-color: #9a9ea8; box-shadow: 1px 2px 3px rgba(0, 0, 0, .25); }
.sheet-clip::after { content: ""; position: absolute; left: 3px; right: 3px; top: 6px; bottom: 10px; border: 2px solid #c8cbd2; border-top: 0; border-radius: 0 0 6px 6px; }
.sheet-head { display: flex; justify-content: space-between; padding: 0 0 6px 18px; border-bottom: 1px solid rgba(36, 33, 29, .55); font: 700 10px "Courier Prime", "Courier New", monospace; letter-spacing: .14em; text-transform: uppercase; }
.sheet-re { font: 400 11px "Courier Prime", "Courier New", monospace; letter-spacing: .06em; text-transform: uppercase; color: #6a6358; }
.sheet-re span { font-weight: 700; color: var(--c); }
.sheet-card b { font: 700 16px/1.3 "Courier Prime", "Courier New", monospace; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.sheet-card p { font: 400 12.5px/1.62 "Courier Prime", "Courier New", monospace; color: #3d3831; text-indent: 1.6em; }
.sheet-more { flex: 1; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }
.sheet-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 6px; border-top: 1px dashed rgba(36, 33, 29, .3); font: 400 11px "Courier Prime", "Courier New", monospace; color: #6a6358; }
.sheet-go { display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--sans); color: #24211d; }
.sheet-go::after { content: "→"; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.sheet-card:hover, .sheet-card:focus-visible { z-index: 20; transform: translateY(-34px) rotate(0) scale(1.05); filter: drop-shadow(0 34px 40px rgba(8, 10, 24, .5)) drop-shadow(0 2px 3px rgba(8, 10, 24, .25)); }
.sheet-card:hover .sheet-go::after { transform: translateX(5px); }
.sheet-card:focus-visible { outline: none; } .sheet-card:focus-visible .sheet-head { outline: 2px solid #9b3b2a; outline-offset: 4px; }
.lib.leaving .sheet-card:not(.chosen) { opacity: 0; transform: translateY(60px) rotate(calc(var(--o) * 10deg)); }
.lib.leaving .sheet-card.chosen { z-index: 30; transform: translateY(-80px) scale(1.12); opacity: 0; transition: transform .38s cubic-bezier(.4, 0, .2, 1), opacity .38s .05s; }
/* Dealt in from a single stack the first time the section is seen */
.notebook .sheet-card { opacity: 0; transform: translateY(120px) rotate(0) scale(.9); }
.notebook.in .sheet-card { opacity: 1; transform: translateX(calc(var(--push) * 46px)) rotate(calc(var(--o) * 6deg)) translateY(calc(var(--o) * var(--o) * 5px)); transition: transform .9s calc(var(--i) * 90ms + .15s) cubic-bezier(.2, .9, .25, 1), opacity .5s calc(var(--i) * 90ms + .15s), box-shadow .4s; }
.notebook.settled .sheet-card { transition: transform .55s cubic-bezier(.2, .8, .2, 1), box-shadow .4s, opacity .35s; }
.notebook.in .sheet-card:hover, .notebook.in .sheet-card:focus-visible { transform: translateY(-34px) rotate(0) scale(1.05); }
@media (max-width: 820px) {
  .hand { justify-content: flex-start; gap: 14px; margin: 0 -16px; padding: 30px 16px 26px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: none; perspective: none; }
  .hand::-webkit-scrollbar { display: none; }
  .sheet-card { --w: 70vw; margin: 0 4px 0 0; height: min(calc(var(--w) * 1.3), 56svh); scroll-snap-align: start; }
  .sheet-card::before { transform: translate(4px, 4px) rotate(.8deg); }
  .sheet-card, .notebook.in .sheet-card { transform: none; }
  .notebook .sheet-card { transform: translateY(40px); }
  .notebook.in .sheet-card:hover { transform: none; }
}
@media (hover: none) { .sheet-card:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet-card, .notebook .sheet-card, .notebook.in .sheet-card { opacity: 1; transition: none; } }

/* The Notebook page, light and editorial: a featured note, subject filters, a grid of cards */
.notes-light { --ink: #1d1d1f; --soft: #6e6e73; --line: rgba(29, 29, 31, .12); background: #f5f5f2; color: #1d1d1f; }
.notes-light main.library { width: min(100% - 32px, 1120px); }
.notes-light h1 { font: 700 clamp(52px, 8vw, 96px)/1 var(--sans); letter-spacing: -.045em; color: #1d1d1f; animation: nb-in .8s cubic-bezier(.2, .8, .2, 1) both; }
.notes-light .lede { max-width: 36em; margin-top: 14px; font-size: clamp(18px, 1.8vw, 21px); line-height: 1.45; color: #6e6e73; animation: nb-in .8s .08s cubic-bezier(.2, .8, .2, 1) both; }
.nb-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 24px; }
.nb-filters button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 99px; background: rgba(29, 29, 31, .06); color: #1d1d1f; font: 600 14px var(--sans); cursor: pointer; transition: background .25s, color .25s; }
.nb-filters button span { font-weight: 500; opacity: .55; }
.nb-filters button:hover { background: rgba(29, 29, 31, .1); }
.nb-filters button[aria-pressed="true"] { background: #1d1d1f; color: #fff; }
.nb-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; border-radius: 22px; background: #fff; color: #1d1d1f; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .06); transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s; animation: nb-in .7s calc(var(--k) * 70ms + .15s) cubic-bezier(.2, .8, .2, 1) both; }
.nb-card:hover { transform: translateY(-6px); box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 24px 50px rgba(0, 0, 0, .12); }
.nb-card.hide { display: none; }
.nb-art { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--c); }
.nb-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 80%; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.nb-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--c); }
.nb-card:hover .nb-art img { transform: scale(1.05); }
.nb-text { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 24px; }
.nb-text small { font: 500 13px var(--sans); color: #6e6e73; }
.nb-text small b { font-weight: 600; color: var(--c); filter: saturate(1.3) brightness(.85); }
.nb-text strong { font: 700 24px/1.15 var(--sans); letter-spacing: -.03em; }
.nb-excerpt { font-size: 16px; line-height: 1.5; color: #48484d; }
.nb-go { margin-top: auto; padding-top: 6px; font: 600 15px var(--sans); color: #1d1d1f; }
.nb-go::after { content: " →"; display: inline-block; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.nb-card:hover .nb-go::after { transform: translateX(4px); }
.nb-card.big { grid-template-columns: 1.25fr 1fr; grid-template-rows: auto; margin-bottom: 22px; }
.nb-card.big .nb-art { aspect-ratio: auto; min-height: 360px; }
.nb-card.big .nb-art::after { top: 0; left: auto; width: 5px; height: auto; }
.nb-card.big .nb-text { justify-content: center; padding: 40px; gap: 14px; }
.nb-card.big strong { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.05; letter-spacing: -.04em; }
.nb-card.big .nb-excerpt { font-size: 18px; }
.nb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@keyframes nb-in { from { opacity: 0; transform: translateY(24px); } }
@media (max-width: 820px) {
  .nb-card.big { grid-template-columns: minmax(0, 1fr); }
  .nb-card.big .nb-art { aspect-ratio: 16 / 9; min-height: 0; }
  .nb-card.big .nb-art::after { top: auto; left: 0; width: auto; height: 5px; }
  .nb-card.big .nb-text { padding: 22px 22px 24px; }
  .nb-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (prefers-reduced-motion: reduce) { .nb-card, .notes-light h1, .notes-light .lede { animation: none; } }

/* Short screens: the papers size to the height as well as the width, so they never fall off the bottom */
@media (min-width: 821px) {
  .sheet-card { --w: min(clamp(200px, 17.5vw, 258px), calc((100svh - 440px) / 1.414)); }
}
