/* Library (/library and /library/<slug>). Topic tints match the event tags; artwork colours are the pastel brand palette. */
.t-blush { --c-bg: #f4e4db; --c-ink: #7a3f2c; --c-shape: #e3b59f; --c-soft: #efd3c4; }
.t-mist  { --c-bg: #e1eaf1; --c-ink: #34536b; --c-shape: #90aeca; --c-soft: #bccfde; }
.t-sage  { --c-bg: #e2ebe3; --c-ink: #3f5f48; --c-shape: #9dbda4; --c-soft: #c6dac9; }
.t-sand  { --c-bg: #f2e8d4; --c-ink: #6b4f1f; --c-shape: #d6ba82; --c-soft: #ebddbc; }

.lib-intro .t-statement { margin-top: .75rem; }
.lib-intro .lede { margin-top: 1rem; max-width: 38rem; }
.lib-section { padding-top: 0; }

/* filters (shown by library.js) */
.lib-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.lib-chip { min-height: 2.75rem; border: 1.5px solid var(--muted-blue); background: var(--surface); color: var(--deep); border-radius: 999px; padding: .5rem 1.05rem; font: 500 .9375rem/1 var(--sans); cursor: pointer; transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease); }
.lib-chip:hover { border-color: var(--deep); }
.lib-chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.lib-chip-sep { width: 1px; background: var(--line); margin: .35rem .25rem; }
.lib-none { text-align: center; color: #4a4a4a; padding: 1rem 0 2rem; }
[data-filtered-out] { display: none !important; }
.lib-section { padding-top: 0; }
.lib-intro { padding-bottom: clamp(2rem, 4vw, 3rem); }

/* covers */
.lib-cover { position: relative; overflow: hidden; border-radius: var(--r-md); aspect-ratio: 16 / 9; background: var(--soft-blue); }
.lib-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-cover--art { background: var(--c-bg); }
.lib-cover--art span { position: absolute; left: 7%; top: 10%; font: 600 .6875rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--c-ink); }
.lib-cover--art i { position: absolute; border-radius: 50%; width: 40%; aspect-ratio: 1; top: 50%; transform: translateY(-50%); }
.lib-cover--art i:nth-of-type(1) { right: 24%; background: #fffaf6; }
.lib-cover--art i:nth-of-type(2) { right: 8%; background: var(--c-shape); opacity: .92; }

.lib-tag { display: inline-block; border-radius: 999px; padding: .32rem .72rem; font: 600 .8125rem/1 var(--sans); background: var(--c-bg); color: var(--c-ink); }
.lib-meta { color: #4a4a4a; font-size: .9375rem; }
.lib-label { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); font-weight: 600; }

/* featured */
.lib-featured { position: relative; display: grid; gap: clamp(1.25rem, 3vw, 3rem); align-items: center; background: var(--surface); border-radius: var(--r-lg); padding: clamp(.875rem, 1.6vw, 1.25rem); box-shadow: var(--shadow); margin-top: 2.5rem; transition: box-shadow .3s var(--ease), transform .3s var(--ease); }
@media (min-width: 900px) { .lib-featured { grid-template-columns: 1.15fr 1fr; } .lib-featured > div:last-child { padding-right: 1.5rem; } }
.lib-featured h3 { font-family: var(--display); font-weight: 360; font-size: clamp(1.75rem, 3vw, 2.5rem); line-height: 1.1; margin: .875rem 0 .75rem; text-wrap: balance; }
.lib-featured h3 a::after, .lib-card h3 a::after { content: ""; position: absolute; inset: 0; }
.lib-featured .lib-ex { color: #4a4a4a; font-size: 1.0625rem; line-height: 1.6; max-width: 34rem; }
.lib-featured .lib-meta { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; margin-top: 1rem; }
.lib-read { display: inline-flex; gap: .4rem; margin-top: 1.25rem; font-weight: 600; color: var(--deep); }
.lib-featured:hover, .lib-card:hover { box-shadow: var(--shadow-hover, var(--shadow)); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .lib-featured:hover, .lib-card:hover { transform: none; } }

/* rows that scroll sideways: arrows on wide screens, swipe on phones */
.lib-head--sub { margin: 2.5rem 0 1rem; align-items: center; }
.lib-head { align-items: flex-end; }
.lib-shelf-lede { margin-top: .4rem; }
.lib-arrows { display: none; gap: .5rem; flex: none; }
@media (min-width: 700px) { .lib-arrows:not([hidden]) { display: flex; } }
.lib-arrows button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1.5px solid var(--muted-blue); background: var(--surface); color: var(--deep); cursor: pointer; transition: border-color .2s var(--ease), opacity .2s var(--ease); }
.lib-arrows button:hover:not(:disabled) { border-color: var(--deep); }
.lib-arrows button:disabled { opacity: .35; cursor: default; }
.lib-arrows svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-track { display: grid; grid-auto-flow: column; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; overscroll-behavior-x: contain; margin: -1rem -1rem -2rem; padding: 1rem 1rem 2rem; scroll-padding-inline: 1rem; }
.lib-track::-webkit-scrollbar { display: none; }
.lib-track > li { scroll-snap-align: start; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .lib-track { scroll-behavior: auto; } }
.lib-track--cards { grid-auto-columns: 82%; }
.lib-track--cards > li { display: flex; }
.lib-track--cards .lib-card { flex: 1; }
@media (min-width: 700px) { .lib-track--cards { grid-auto-columns: calc((100% - 1.25rem) / 2); } }
@media (min-width: 1040px) { .lib-track--cards { grid-auto-columns: calc((100% - 2.5rem) / 3); } }
/* book cards in the shelf row */
.lib-book { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1.125rem; align-items: start; flex: 1; padding: 1.25rem; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.lib-book .lib-bk { width: 100%; height: auto; }
.lib-book-body { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; min-width: 0; }
.lib-book h3 { font-family: var(--display); font-weight: 400; font-size: 1.1875rem; line-height: 1.2; text-wrap: balance; }
.lib-book .lib-au { margin: 0 0 .35rem; }
.lib-book .lib-tag { font-size: .75rem; padding: .26rem .6rem; }
.lib-book .lib-why { margin: .5rem 0 0; font-size: .9375rem; }
.lib-track > li[id]:target .lib-book { outline: 2px solid var(--deep); outline-offset: 3px; }

/* kept for "Keep reading" on article pages */
.lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.lib-head h2 { font-family: var(--display); font-weight: 360; font-size: clamp(1.625rem, 2.6vw, 2.125rem); }
.lib-head a { color: var(--deep); font-weight: 600; font-size: .9375rem; }
.lib-grid { display: grid; gap: 1.25rem; }
@media (min-width: 700px) { .lib-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .lib-grid { grid-template-columns: repeat(3, 1fr); } }
.lib-card { position: relative; background: var(--surface); border-radius: var(--r-lg); padding: .875rem .875rem 1.375rem; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: box-shadow .3s var(--ease), transform .3s var(--ease); }
.lib-card-body { padding: 1rem .5rem 0; display: flex; flex-direction: column; align-items: flex-start; gap: .625rem; flex: 1; }
.lib-card h3 { font-family: var(--display); font-weight: 380; font-size: 1.4375rem; line-height: 1.15; text-wrap: balance; }
.lib-card h3 a { color: var(--ink); }
.lib-card .lib-ex { color: #4a4a4a; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card .lib-meta { margin-top: auto; padding-top: .25rem; }

.lib-bk { width: 5.5rem; aspect-ratio: 2 / 3; border-radius: 4px 8px 8px 4px; background: var(--c-shape); color: var(--c-ink); padding: .6rem .55rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; box-shadow: inset 4px 0 0 rgb(0 0 0 / .08), 0 10px 20px -12px rgb(0 0 0 / .35); font-family: var(--display); font-size: .8rem; line-height: 1.1; }
.lib-bk small { font-family: var(--sans); font-size: .55rem; letter-spacing: .08em; text-transform: uppercase; }
.lib-bk--img { display: block; object-fit: cover; padding: 0; }
.lib-au { color: #4a4a4a; font-size: .875rem; margin-top: .2rem; }
.lib-why { margin: .75rem 0; font-size: .9375rem; line-height: 1.5; color: #3f3f3f; }
.lib-why b { font-weight: 600; color: var(--ink); }

.lib-end-wrap { padding-top: 0; }
.lib-end { background: var(--soft-blue); border-radius: var(--r-lg); padding: clamp(1.75rem, 4vw, 3rem); display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; justify-content: space-between; }
.lib-end p { font-family: var(--display); font-weight: 360; font-size: clamp(1.5rem, 2.4vw, 2rem); max-width: 34rem; line-height: 1.15; }

/* article page */
.lib-art-top { max-width: 46rem; margin-inline: auto; }
.lib-crumb { font-size: .875rem; color: #4a4a4a; }
.lib-crumb a { color: var(--deep); font-weight: 600; }
.lib-article h1 { font-family: var(--display); font-weight: 340; font-size: clamp(2.125rem, 5vw, 3.5rem); line-height: 1.06; letter-spacing: -.01em; margin: 1rem 0 1.25rem; text-wrap: balance; }
.lib-art-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.lib-share { margin-left: auto; min-height: 2.75rem; background: none; border: 0; padding: 0 .25rem; font: 600 .9375rem/1 var(--sans); color: var(--deep); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.lib-cover--wide { max-width: 60rem; margin: clamp(1.75rem, 4vw, 2.75rem) auto; border-radius: var(--r-lg); }
.lib-prose { max-width: 42rem; margin-inline: auto; font-size: 1.125rem; line-height: 1.75; color: #2f2f2f; }
.lib-prose > * + * { margin-top: 1.25em; }
.lib-prose h2 { font-family: var(--display); font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin-top: 2.25rem; color: var(--ink); }
.lib-prose h3 { font-family: var(--display); font-weight: 400; font-size: 1.375rem; line-height: 1.25; margin-top: 1.75rem; color: var(--ink); }
.lib-prose ul, .lib-prose ol { padding-left: 1.4rem; display: grid; gap: .75rem; }
.lib-prose ul { list-style: disc; }
.lib-prose ol { list-style: decimal; }
.lib-prose li { padding-left: .25rem; }
.lib-prose li::marker { color: var(--c-ink, var(--steel)); font-weight: 600; }
.lib-prose strong { font-weight: 600; color: var(--ink); }
.lib-prose a { color: var(--deep); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
.lib-prose blockquote { margin-block: 2rem; padding: .25rem 0 .25rem 1.25rem; border-left: 3px solid var(--c-shape, var(--muted-blue)); font-family: var(--display); font-size: 1.375rem; line-height: 1.4; color: var(--ink); }
.lib-table { overflow-x: auto; margin-block: 2rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.lib-table table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.5; min-width: 34rem; }
.lib-table th, .lib-table td { text-align: left; vertical-align: top; padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
.lib-table thead th { background: var(--c-bg, var(--soft-blue)); color: var(--c-ink, var(--deep)); font-weight: 600; }
.lib-table tbody th { font-weight: 600; color: var(--ink); }
.lib-table tr:last-child > * { border-bottom: 0; }
.lib-origin { max-width: 42rem; margin: 2.5rem auto 0; padding: 1rem 1.25rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: .9375rem; color: #4a4a4a; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.lib-origin a { color: var(--deep); font-weight: 600; }
.lib-author { max-width: 42rem; margin: 1.25rem auto 0; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 1.25rem; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); }
.lib-author img { width: 3.5rem; height: 3.5rem; border-radius: 50%; object-fit: cover; }
.lib-author p { flex: 1 1 14rem; font-size: .9375rem; color: #4a4a4a; line-height: 1.45; }
.lib-author b { color: var(--ink); font-weight: 600; display: block; }
.lib-more { max-width: 64rem; }

/* Home: the next event's banner (left) and the latest Library item (right).
   Desktop: two columns, same height. Phones: banner card, then a small Library row. */
.home-duo { display: grid; gap: 2.5rem; }
.home-col { display: flex; flex-direction: column; min-width: 0; }
.home-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.home-col-body { flex: 1; display: flex; flex-direction: column; }
.home-ev { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.home-ev-banner { display: block; }
.home-ev-banner .ev-media { border-radius: 0; }
.home-ev-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding: 1rem 1.25rem; }
.home-ev-line p { color: #4a4a4a; font-size: .9375rem; }
.home-ev-line b { color: var(--ink); font-weight: 600; }

.home-lib { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: .75rem 1rem .75rem .75rem; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); transition: box-shadow .3s var(--ease), transform .3s var(--ease); }
.home-lib:hover { box-shadow: var(--shadow-hover, var(--shadow)); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .home-lib:hover { transform: none; } }
.home-lib-media { position: relative; display: block; overflow: hidden; border-radius: .75rem; aspect-ratio: 1; background: var(--soft-blue); }
.home-lib-media > img, .home-lib-media > .lib-cover--art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-lib-media--book { display: grid; place-items: center; background: var(--c-bg); }
.home-lib-media--book > img, .home-lib-media--book > .lib-bk { position: static; width: auto; height: 82%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px 6px 6px 3px; box-shadow: 0 10px 18px -10px rgb(0 0 0 / .45); font-size: .45rem; padding: .3rem; }
.home-lib-body { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.home-lib-title { font-family: var(--display); font-weight: 380; font-size: 1.1875rem; line-height: 1.2; text-wrap: balance; }
.home-lib .lib-meta { font-size: .875rem; }
.home-lib-go { display: none; }

@media (min-width: 900px) {
  .home-duo { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 2rem; }
  .home-duo.is-solo { grid-template-columns: minmax(0, 46rem); }
  .home-ev { flex: 1; }
  .home-ev-banner { flex: 1; display: flex; }
  .home-ev-banner .ev-media { flex: 1; aspect-ratio: auto; min-height: 100%; }
  .home-lib { flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: .875rem; border-radius: var(--r-lg); }
  .home-lib-media { aspect-ratio: auto; flex: 1; min-height: 12rem; border-radius: var(--r-md); }
  .home-lib-media--book > img, .home-lib-media--book > .lib-bk { height: 78%; max-height: 15rem; font-size: .7rem; padding: .5rem; }
  .home-lib-body { gap: .45rem; padding: 1.125rem .5rem .375rem; }
  .home-lib-title { font-size: 1.5rem; }
  .home-lib .lib-meta { font-size: .9375rem; }
  .home-lib-go { display: inline-flex; gap: .4rem; margin-top: .5rem; font-weight: 600; color: var(--deep); }
}
.lib-section .lib-featured { margin-top: 0; }
@media (max-width: 699px) {
  .lib-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter, 1rem) * -1); padding: .25rem var(--gutter, 1rem); }
  .lib-filters::-webkit-scrollbar { display: none; }
  .lib-chip { flex: none; }
}
@media (max-width: 699px) { .lib-book { grid-template-columns: 4.75rem minmax(0, 1fr); gap: .875rem; padding: 1rem; } }
.lib-bk--img { background: #fff; box-shadow: 0 0 0 1px rgb(39 50 59 / .1), 0 10px 20px -12px rgb(0 0 0 / .4); }
/* Home Library card: the book cover always fits whole inside its tinted box (no cropping). */
.home-lib-media--book { position: relative; display: block; }
.home-lib-media--book > img, .home-lib-media--book > .lib-bk { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: auto; height: 86%; max-height: 15rem; aspect-ratio: 2 / 3; }
/* Home Library card, phones and tablets: a bigger cover, plus the "Read it if" line (or the article summary) so the card isn't empty on the right. */
.home-lib { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1.125rem; padding: .875rem 1.25rem .875rem .875rem; }
.home-lib-note { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-top: .25rem; font-size: .9375rem; line-height: 1.5; color: #3f3f3f; }
.home-lib-note b { font-weight: 600; color: var(--ink); }
@media (min-width: 600px) and (max-width: 899px) {
  .home-lib { grid-template-columns: 12rem minmax(0, 1fr); gap: 1.5rem; padding: 1rem 1.75rem 1rem 1rem; border-radius: var(--r-lg); }
  .home-lib-title { font-size: 1.5rem; }
  .home-lib-note { font-size: 1rem; }
  .home-lib-go { display: inline-flex; gap: .4rem; margin-top: .5rem; font-weight: 600; color: var(--deep); }
}
@media (min-width: 900px) { .home-lib-note { -webkit-line-clamp: 2; } }
