/* Library: shelves of covers standing on a ledge, each shelf scrolling sideways. */

.library{--book-w:112px;--book-h:168px;--ledge:8px}
.library-head .eyebrow{margin-bottom:var(--space-8)}
.library-head h1{font-family:var(--font);font-size:var(--text-large);line-height:var(--leading-large);letter-spacing:var(--tracking-large);color:var(--ink)}
.library-head .draft-label{margin-top:var(--space-8)}

.shelf{margin-top:var(--space-40)}
.shelf-head{display:flex;align-items:center;gap:var(--space-8);margin-bottom:var(--space-16)}
.shelf-head h2{font-family:var(--font);font-size:var(--text-body);line-height:var(--leading-body);font-weight:500;letter-spacing:var(--tracking);color:var(--ink)}
.shelf-count{display:grid;place-items:center;min-width:24px;height:24px;padding:0 var(--space-8);border-radius:var(--radius-pill);background:var(--tint-neutral);font-family:var(--font);font-size:var(--text-caption);line-height:var(--leading-caption);font-weight:500;color:var(--copy)}
.shelf-steps{display:flex;gap:var(--space-8);margin-left:auto}
@media(pointer:coarse){.shelf-steps{display:none}}

/* The row bleeds to the paper's edges so the next cover peeks past them.
   The ledge is painted on the row itself, so it stays put while books slide. */
.shelf-row{position:relative;display:flex;gap:var(--space-24);margin-inline:calc(var(--content-gutter) * -1);padding:var(--space-8) var(--content-gutter) var(--space-4);overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:var(--content-gutter);scrollbar-width:none;outline-offset:-4px;
  background:linear-gradient(transparent calc(var(--space-8) + var(--book-h)),#ece6dc calc(var(--space-8) + var(--book-h)),#ddd5c8 calc(var(--space-8) + var(--book-h) + var(--ledge)),#141d3414 calc(var(--space-8) + var(--book-h) + var(--ledge)),transparent calc(var(--space-8) + var(--book-h) + var(--ledge) + 2px))}
.shelf-row::-webkit-scrollbar{display:none}

.book{flex:none;display:flex;flex-direction:column;gap:var(--space-24);width:var(--book-w);padding:0;border:0;background:none;color:inherit;text-align:left;scroll-snap-align:start}
.book-cover{position:relative;display:block;width:100%;height:var(--book-h);overflow:hidden;border-radius:2px var(--radius-xs) var(--radius-xs) 2px;box-shadow:0 1px 1px #141d341f,0 8px 16px -8px #141d3459;transform-origin:50% 100%;transition:transform var(--dur-base) var(--ease-soft),box-shadow var(--dur-base) var(--ease-soft)}
/* A soft spine down the left edge makes each cover read as a book */
.book-cover::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,#00000024 0,#ffffff2e 2px,#ffffff00 6px,#00000010 8px,transparent 12px);pointer-events:none}
.book-cover img{display:block;width:100%;height:100%;object-fit:cover}
.book:focus-visible .book-cover{transform:translateY(-4px);box-shadow:0 2px 2px #141d341a,0 16px 24px -12px #141d3466}
@media (hover:hover){.book:hover .book-cover{transform:translateY(-4px);box-shadow:0 2px 2px #141d341a,0 16px 24px -12px #141d3466}}
.book:active .book-cover{transform:translateY(-2px) scale(.98)}
.book-caption{display:flex;flex-direction:column;min-width:0}
.book-title{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-family:var(--font);font-size:var(--text-label);line-height:var(--leading-label);font-weight:500;letter-spacing:var(--tracking);color:var(--ink)}
.book-meta{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-family:var(--font);font-size:var(--text-caption);line-height:var(--leading-caption);font-weight:400;letter-spacing:var(--tracking);color:var(--muted)}

/* Typographic covers for entries without a designed one */
.book-cover-type{display:flex;flex-direction:column;padding:var(--space-12) var(--space-12) var(--space-12) var(--space-16);background:var(--cover-bg);color:var(--cover-ink)}
.book-cover-type[data-tone=sand]{--cover-bg:#efe7da;--cover-ink:#3a3125}
.book-cover-type[data-tone=sage]{--cover-bg:#dfe6dc;--cover-ink:#2d3a2e}
.book-cover-type[data-tone=dusk]{--cover-bg:#dcdbe6;--cover-ink:#2e2d40}
.book-cover-type[data-tone=clay]{--cover-bg:#ecd9cf;--cover-ink:#4a2c22}
.book-cover-type[data-tone=sea]{--cover-bg:#d7e3e8;--cover-ink:#20343c}
.book-cover-type[data-tone=moss]{--cover-bg:#dfe3cf;--cover-ink:#343a22}
.book-cover-title{font-family:var(--font);font-size:var(--text-label);line-height:var(--leading-label);font-weight:600;letter-spacing:0}
.book-cover-author{margin-top:var(--space-4);font-family:var(--font);font-size:var(--text-caption);line-height:var(--leading-caption);opacity:.8}
.book-cover-kind{margin-top:auto;font-family:var(--font);font-size:var(--text-caption);line-height:var(--leading-caption);font-weight:500;letter-spacing:.6px;text-transform:uppercase;opacity:.64}
/* Notes are unfinished: ruled paper with a handwritten title */
.book-cover-type[data-kind=note]{--cover-bg:#fbfaf6;--cover-ink:#3c4a63;background-image:repeating-linear-gradient(transparent 0 23px,#c9d6e3 23px 24px);background-position:0 32px}
.book-cover-type[data-kind=note] .book-cover-title{font-family:var(--font-hand);font-size:var(--text-body);line-height:var(--leading-body);font-weight:400}
/* Reviews: a dark sleeve */
.book-cover-type[data-kind=review]{--cover-bg:#22252a;--cover-ink:#f2efe9}

/* Imported essays: the writing in the reading view, in the note's own voice */
.essay-subtitle{max-width:var(--reading-measure);margin-top:var(--space-16);color:var(--copy)}
.essay-body h2{margin:var(--space-48) 0 var(--space-16)}
.essay-body h3{margin:var(--space-32) 0 var(--space-8);font-family:var(--font);font-size:var(--text-body);line-height:var(--leading-body);font-weight:500;letter-spacing:var(--tracking);color:var(--ink)}
.essay-body figure{margin:var(--space-32) 0 var(--space-40)}
.essay-body figure:first-child{margin-top:0}
.essay-body img{display:block;width:100%;height:auto;border:var(--space-4) solid #fff;border-radius:var(--radius-lg);background:#fff;box-shadow:0 1px 2px #5c514614,0 4px 12px -4px #5c514626}
.essay-body figcaption{margin-top:var(--space-8);font-family:var(--font);font-size:var(--text-caption);line-height:var(--leading-caption);color:var(--muted)}
.essay-body blockquote{margin:var(--space-32) 0;padding-left:var(--space-16);border-left:2px solid var(--accent)}
.essay-body blockquote p{color:var(--ink)}
.essay-body ul,.essay-body ol{margin:0 0 var(--space-24);padding-left:var(--space-24)}
.essay-body li{margin-bottom:var(--space-8)}
.essay-body a{color:var(--ink);text-decoration:underline;text-decoration-color:var(--hairline);text-underline-offset:4px}
@media (hover:hover){.essay-body a:hover{text-decoration-color:var(--ink)}}
.essay-body hr{margin:var(--space-40) 0;border:0;border-top:1px solid var(--hairline)}
.essay-body strong{font-weight:500;color:var(--ink)}
.essay-source{margin-top:var(--space-40)!important;font-family:var(--font)!important;font-size:var(--text-caption)!important;line-height:var(--leading-caption)!important;color:var(--muted)}
.essay-source a{color:var(--copy)}

/* Entry card: a book, or writing that lives elsewhere */
.library-card-body{display:grid;grid-template-columns:176px minmax(0,1fr);align-items:start;gap:var(--space-48);max-width:672px}
.library-card .book-cover{width:176px;height:264px}
.library-card-copy p:not(.eyebrow):not(.draft-label):not(.project-role){max-width:var(--reading-measure);margin:0 0 var(--space-24)}
.library-card .detail-header{margin-bottom:var(--space-16)}
.button.is-pending{opacity:.4;cursor:default}
.article-detail.is-note .detail-header h1{font-family:var(--font-hand);font-weight:400;letter-spacing:0}

@media(max-width:700px){
  .library{--book-w:96px;--book-h:144px}
  .library-head h1{font-size:var(--text-title);line-height:var(--leading-title);letter-spacing:var(--tracking-title)}
  .shelf{margin-top:var(--space-32)}
  .shelf-row{gap:var(--space-16)}
  .library-card-body{grid-template-columns:minmax(0,1fr);gap:var(--space-24)}
  .library-card .book-cover{width:128px;height:192px}
}

@media(prefers-reduced-motion:reduce){
  .book-cover{transition:none}
}
