/* StoryMint Library page (WS4). The layout, shelves and typeset covers live in /marketing-v2.css (.mk-lib*,
   .mk-shelf*, .mk-typeset); the cards are the shared /sm-book-card.css. This file keeps only what is specific
   to library cards: two-line titles on the shelves and a steady card height while covers load. */
.mk-lib .mk-shelf-row .sm-book-card { height: 100%; }
/* one line of chips: the format chip always shows in full; a secondary chip (the theme) that does not fit wraps
   onto a second line, which is clipped, so it disappears whole instead of reading "Colorin… Ani…" */
.mk-lib .sm-book-card-meta { flex-wrap: wrap; align-items: flex-start; row-gap: 12px; max-height: 22px; overflow: hidden; }
.mk-lib .sm-book-card-meta > * { flex: 0 0 auto; max-width: 100%; line-height: 18px; }
.mk-lib .sm-book-card-meta > .sm-book-card-badge { overflow: hidden; text-overflow: ellipsis; }
.mk-lib .sm-book-card-meta > .sm-book-card-date { padding: 2px 0; font-size: 12px; }
/* "En inglés" on the Spanish site sits on the cover, so it never competes with the format chip */
.mk-lib .sm-book-card-cover { position: relative; }
.mk-lib .mk-lib-lang { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 2px 8px; border-radius: var(--sm-r-pill, 999px); background: rgba(255, 255, 255, .94); color: var(--sm-ink, #17201a); font: 700 11px/16px var(--sm-font-body, system-ui, sans-serif); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); pointer-events: none; }
.mk-lib .sm-book-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
@media (max-width: 639.98px) {
  .mk-lib .sm-book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-lib .mk-shelf-row { grid-auto-columns: minmax(136px, 44vw); }
}
/* skeleton and real cards share one height, so filling a shelf never moves the page */
.mk-lib .sm-book-card-body { height: 104px; box-sizing: border-box; overflow: hidden; }
.mk-lib .sm-book-card-title { min-height: 2.6em; }
/* Beta novel covers (/library/novel-cover.js): the pipeline's cover is the same dark-green type block for every
   novel, so novels get a drawn cover instead. Palette per book (--nc-*), title sized off the cover width (cqi) so
   it stays readable from a 136 px shelf card to the 480-960 px showcase renders; nothing on it is under 10 px. */
.sm-novel-cover {
  position: absolute; inset: 0; z-index: 0; container-type: inline-size; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 11% 10% 9% 15%;
  background: radial-gradient(120% 70% at 85% 0%, color-mix(in srgb, var(--nc-accent) 22%, transparent), transparent 60%), var(--nc-bg, #3b2350);
  color: var(--nc-fg, #fbeee0);
}
.sm-novel-cover::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 6.5%; background: color-mix(in srgb, var(--nc-bg) 70%, #000); box-shadow: inset -1px 0 0 color-mix(in srgb, var(--nc-accent) 45%, transparent); }
.sm-novel-cover[data-frame="1"]::after { content: ""; position: absolute; inset: 5% 5% 5% 11%; border: 1px solid color-mix(in srgb, var(--nc-accent) 55%, transparent); border-radius: 3px; pointer-events: none; }
.sm-novel-cover > * { position: relative; }
.sm-novel-cover-kicker { font: 700 10px/1.2 var(--sm-font-body, system-ui, sans-serif); font-size: max(10px, 6.4cqi); letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--nc-fg) 82%, var(--nc-bg)); }
.sm-novel-cover > .sm-novel-cover-wash { position: absolute; top: -10%; right: -22%; width: 86%; aspect-ratio: 1; color: var(--nc-accent); opacity: .13; pointer-events: none; }
.sm-novel-cover-motif { display: block; flex: 0 1 auto; min-height: 0; height: 28cqi; aspect-ratio: 1; margin: auto 0 8%; padding: 5cqi; box-sizing: content-box; border: 1.5px solid color-mix(in srgb, var(--nc-accent) 55%, transparent); border-radius: 50%; color: var(--nc-accent); }
.sm-novel-cover-wash svg, .sm-novel-cover-motif svg { display: block; width: 100%; height: 100%; }
.sm-novel-cover-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
  font-family: "Fraunces", Georgia, "Iowan Old Style", "Times New Roman", "DejaVu Serif", serif; font-weight: 700;
  font-size: 15px; font-size: clamp(15px, 13.5cqi, 96px); line-height: 1.08; letter-spacing: -.01em;
  overflow-wrap: break-word; hyphens: auto; text-wrap: balance;
}
.sm-novel-cover-foot { margin-top: 7%; padding-top: 5%; min-width: 34%; border-top: 2px solid var(--nc-accent); font: 700 10px/1.2 var(--sm-font-body, system-ui, sans-serif); font-size: max(10px, 5.6cqi); letter-spacing: .08em; color: color-mix(in srgb, var(--nc-fg) 82%, var(--nc-bg)); }

/* ── ux-fix 2026-11 (library lane) ────────────────────────────────────────────────────────────────────────────
   MAJ-08: the cover sits in the 3:4 slot as a book: its own shape (never cropped or barred), a spine shade on the
   left, a soft drop shadow. library.js sizes .mk-lib-book from the picture (--ar, .is-wide) once it loads; until
   then (or if it fails) the typeset cover shows. No title is drawn over the art (owner-final O-30). */
.mk-lib .sm-book-card-cover.has-book { background: linear-gradient(180deg, var(--sm-paper, #faf8f3), var(--sm-panel, #f1ede4)); }
.mk-lib .sm-book-card-cover.has-book > .mk-typeset { visibility: hidden; }
.mk-lib .mk-lib-book {
  position: absolute; z-index: 1; left: 50%; top: 50%;
  width: auto; height: calc(100% - 26px); aspect-ratio: var(--ar, 3 / 4);
  transform: translate(-50%, -50%);
  overflow: hidden; border-radius: 3px 6px 6px 3px; opacity: 0;
  box-shadow: 0 12px 20px -10px rgba(16, 32, 22, .55), 0 2px 5px rgba(16, 32, 22, .2);
  transition: opacity .2s ease, transform .3s var(--sm-ease, ease);
}
.mk-lib .mk-lib-book.is-wide { width: calc(100% - 28px); height: auto; }
.mk-lib .mk-lib-book.is-loaded { opacity: 1; }
.mk-lib .mk-lib-book > img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none;
  margin: 0; border-radius: 0; object-fit: cover; aspect-ratio: auto;
}
.mk-lib .mk-lib-book::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .06) 3%, rgba(255, 255, 255, .22) 4.5%, rgba(255, 255, 255, 0) 9%),
    linear-gradient(270deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, 0) 3%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.mk-lib .sm-book-card:hover .mk-lib-book { transform: translate(-50%, calc(-50% - 3px)); }
/* MIN-05 / MAJ-07: "Read now" (green, full width, 44 px) and the free PDF on every card */
.mk-lib .mk-lib-card-actions { flex-wrap: nowrap; padding: 0 12px 12px; }
.mk-lib .mk-lib-card-actions .sm-book-card-read { min-width: 0; white-space: nowrap; }
.mk-lib .sm-book-card-download { flex: 0 0 auto; min-width: 44px; min-height: 44px; justify-content: center; padding: 0 10px; gap: 4px; font-size: 12px; }
.mk-lib .sm-book-card-download svg { flex: 0 0 auto; }
/* a narrow card (shelves, two-up phone grid) stacks them: "Read now" keeps its full width and label */
.mk-lib .sm-book-card { container-type: inline-size; }
@container (max-width: 209px) {
  .mk-lib .mk-lib-card-actions { flex-direction: column; align-items: stretch; gap: 6px; padding: 0 10px 10px; }
  .mk-lib .sm-book-card-download { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-lib .mk-lib-book { transition: none; }
  .mk-lib .sm-book-card:hover .mk-lib-book { transform: translate(-50%, -50%); }
}

/* ── ux-fix 2026-11 batch 2 (library lane) ───────────────────────────────────────────────────────────────────── */
/* MIN-38: shelf arrows (>= 1024 px) and a fade on the side that has more books */
.mk-shelf-track { position: relative; }
.mk-shelf-nav { display: none; }
@media (min-width: 1024px) {
  .mk-shelf-nav {
    position: absolute; z-index: 3; top: calc(38% - 22px); display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; border: 1px solid var(--sm-line-strong, #d6d2c8); border-radius: 10px;
    background: var(--sm-surface, #fff); color: var(--sm-ink, #111512); box-shadow: var(--sm-shadow-md, 0 6px 18px rgba(16, 32, 22, .16));
    cursor: pointer; transition: opacity var(--sm-dur, .15s) ease, background-color var(--sm-dur, .15s) ease;
  }
  .mk-shelf-nav:hover { background: var(--sm-tint, #eef6f0); }
  .mk-shelf-nav:focus-visible { outline: 2px solid var(--sm-accent, #145c32); outline-offset: 2px; }
  .mk-shelf-nav.is-prev { left: -14px; }
  .mk-shelf-nav.is-next { right: -14px; }
  .mk-shelf-nav[disabled] { opacity: 0; pointer-events: none; }
  .mk-shelf-track.can-next .mk-shelf-row { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); }
  .mk-shelf-track.can-prev .mk-shelf-row { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px); mask-image: linear-gradient(90deg, transparent, #000 56px); }
  .mk-shelf-track.can-prev.can-next .mk-shelf-row { -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 72px), transparent); }
}
/* MIN-37: a shorter hero so the first shelf starts on the first screen; the decorative collage stays smaller on
   desktop and is left out on phones (the books below are the real covers) */
.mk-lib-hero { padding-block: clamp(1.5rem, 3.5vw, 2.75rem) clamp(1.25rem, 3vw, 2.25rem); }
.mk-lib-hero .mk-h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); }
.mk-lib-hero .mk-collage-3 { max-height: 230px; }
.mk-lib-hero .mk-collage-3 .mk-cover { max-height: 230px; width: auto; }
@media (max-width: 860px) {
  .mk-lib-hero .mk-collage-3 { display: none; }
}
/* MIN-37: the category chips stay in reach while the grid scrolls (one sticky filter row above "All books") */
.mk-lib #library-categories {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 4; flex-wrap: nowrap; overflow-x: auto;
  margin-inline: -4px; padding: .6rem 4px .7rem;
  background: var(--sm-paper, #faf8f3); box-shadow: 0 1px 0 color-mix(in srgb, var(--sm-line, #e7e4dc) 80%, transparent);
}
@media (max-width: 860px) { .mk-lib #library-categories { top: calc(env(safe-area-inset-top, 0px) + 60px); } }
/* MIN-37: 20 books a page fill whole rows: 5 across on desktop, 4 on tablets, 2 on phones (6 across left 2 alone) */
@media (min-width: 1024px) {
  .mk-lib #library-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 640px) and (max-width: 1023.98px) {
  .mk-lib #library-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* MIN-71: a failed load is not "no matches": the dashed box turns into a notice with "Try again" */
.mk-lib-empty[data-state="error"] { border-style: solid; border-color: color-mix(in srgb, var(--sm-crayon-1, #c2410c) 35%, var(--sm-line, #e7e4dc)); }
.mk-lib-empty [hidden] { display: none; }
.mk-lib[data-block="shelves"] { padding-top: clamp(1.5rem, 3.5vw, 2.75rem); }

/* ── owner-final 2026-11-01 (library lane) ───────────────────────────────────────────────────────────────────────
   O-30 / POL-13: one title per card, under the cover (none is drawn over the art any more): 13.5 px on 1.3, two
   lines then an ellipsis, the whole title on hover (the link's title=); shelf and grid cards share one body height. */
.mk-lib .sm-book-card-title { font-size: 13.5px; line-height: 1.3; -webkit-line-clamp: 2; line-clamp: 2; min-height: 2.6em; letter-spacing: -.005em; }
.mk-lib .sm-book-card-body { height: 96px; }
/* O-15: a novel's cover image (the same as on its book page) replaces the drawn cover once it loads */
.mk-lib .sm-book-card-cover.has-book > .sm-novel-cover { visibility: hidden; }

/* ── owner list 3 2026-11-02 (reader lane) ─────────────────────────────────────────────────────────────────────────
   Q-18: the cover art (.mk-lib-book is z-index 1) sat over the title's stretched link (::after, z-index 0), so a
   click on a cover did nothing. Nothing drawn on the cover takes the pointer; the click falls through to the link.
   The hover lift stays on .sm-book-card:hover. */
.mk-lib .sm-book-card-cover,
.mk-lib .sm-book-card-cover > *,
.mk-lib .mk-lib-book, .mk-lib .mk-lib-book > img,
.mk-lib .sm-novel-cover, .mk-lib .mk-typeset { pointer-events: none; }
.mk-lib .mk-lib-card-actions { position: relative; z-index: 3; }
/* Q-19: the category chips scroll sideways without a visible scrollbar; a soft fade on the side that has more
   chips (library.js sets .can-prev / .can-next), and a focused chip is scrolled clear of the fade. */
.mk-lib .mk-lib-cats { scrollbar-width: none; -ms-overflow-style: none; scroll-padding-inline: 40px; overscroll-behavior-x: contain; }
.mk-lib .mk-lib-cats::-webkit-scrollbar { display: none; width: 0; height: 0; }
.mk-lib .mk-lib-cats::before, .mk-lib .mk-lib-cats::after {
  content: ""; position: sticky; z-index: 1; flex: 0 0 32px; align-self: stretch; pointer-events: none;
  opacity: 0; transition: opacity .15s ease;
}
.mk-lib .mk-lib-cats::before { left: 0; margin-right: -32px; order: -1; background: linear-gradient(90deg, var(--sm-paper, #faf8f3), transparent); }
.mk-lib .mk-lib-cats::after { right: 0; margin-left: -32px; order: 99; background: linear-gradient(270deg, var(--sm-paper, #faf8f3), transparent); }
.mk-lib .mk-lib-cats.can-prev::before, .mk-lib .mk-lib-cats.can-next::after { opacity: 1; }
.mk-lib .mk-lib-cats .mk-chip { scroll-margin-inline: 40px; }
@media (prefers-reduced-motion: reduce) { .mk-lib .mk-lib-cats::before, .mk-lib .mk-lib-cats::after { transition: none; } }
/* Q-19: the large empty band between the shelves and the chips: both sections kept their full .mk-sec padding */
.mk-lib[data-block="shelves"] { padding-bottom: clamp(1.25rem, 3vw, 2.25rem); }
.mk-lib[data-block="catalogGrid"] { padding-top: clamp(.75rem, 2vw, 1.25rem); }
