@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Source+Serif+4:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

:root {
  --paper: #f5f1e8;
  --paper-deep: #ede7dc;
  --ink: #28231e;
  --muted: #7f776f;
  --rule: #d9d2c7;
  --terracotta: #c85f32;
  --terracotta-dark: #a94621;
  --green: #477a39;
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: var(--serif);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.books-library-page {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; }

.library-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 clamp(22px, 3vw, 46px);
  border-bottom: 1px solid var(--rule);
  background: rgba(245, 241, 232, .9);
  backdrop-filter: blur(18px);
}

.library-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  letter-spacing: .03em;
}

.library-brand strong { font-size: 14px; }
.library-brand > span:last-child { color: var(--terracotta-dark); }

.brand-spark {
  position: relative;
  width: 23px;
  height: 23px;
  display: inline-block;
}

.brand-spark i {
  position: absolute;
  left: 8px;
  top: 2px;
  width: 8px;
  height: 13px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: #d47a47;
  transform-origin: 4px 10px;
}

.brand-spark i:nth-child(2) { background: #e6bd49; transform: rotate(90deg); }
.brand-spark i:nth-child(3) { background: #77a55b; transform: rotate(180deg); }
.brand-spark i:nth-child(4) { background: #7695bd; transform: rotate(270deg); }

.library-nav nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-nav nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  transition: color .2s ease, background .2s ease;
}

.library-nav nav a:hover { color: var(--ink); }
.library-nav nav a.active { color: #fff9ed; background: var(--terracotta); }

.search-trigger {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 126px;
  padding: 8px 11px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, .28);
  color: var(--muted);
  font: 12px/1 var(--mono);
  cursor: pointer;
}

.search-trigger:hover { border-color: #aaa096; color: var(--ink); }
.search-trigger kbd { margin-left: auto; padding: 2px 5px; border: 1px solid var(--rule); border-radius: 5px; font: inherit; }

main { max-width: 1340px; margin: 0 auto; padding: 44px clamp(22px, 4.5vw, 72px) 90px; }

.library-hero {
  padding: 2px 0 30px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .18em;
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}

.hero-row h1 {
  margin: 0;
  font: italic 400 clamp(44px, 5vw, 70px)/1.03 var(--serif);
  letter-spacing: -.035em;
}

.hero-row h1 span {
  position: relative;
  white-space: nowrap;
}

.hero-row h1 span::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 4px;
  background: var(--terracotta);
  transform: rotate(-.4deg);
}

.hero-row p {
  max-width: 720px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.library-count {
  flex: 0 0 auto;
  margin-bottom: 2px;
  padding: 8px 18px;
  border: 1px solid #e8dfd4;
  border-radius: 999px;
  background: rgba(235, 225, 214, .58);
  color: #b15f40;
  font-size: 11px;
}

.library-count b { color: #baaa9f; }

.library-search { margin-top: 24px; max-width: 720px; }
.library-search[hidden] { display: none; }
.library-search label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #cbbfb4;
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 14px 35px rgba(57, 45, 35, .08);
}

.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 13px/1.4 var(--mono); }
.search-field input::placeholder { color: #aaa19a; }
.search-close { padding: 4px 7px; border: 1px solid var(--rule); border-radius: 6px; background: transparent; color: var(--muted); font: 10px/1 var(--mono); cursor: pointer; }
.search-status { min-height: 1.5em; margin: 7px 0 0; color: var(--terracotta-dark); font-size: 11px; }

.book-shelf { padding-top: 46px; }
.book-shelf[hidden] { display: none; }

.shelf-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.shelf-heading h2 { margin: 0; font: italic 600 28px/1.2 var(--serif); }
.shelf-heading span { color: var(--muted); font-size: 10px; }

.books-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px 20px;
}

.book-card { min-width: 0; text-decoration: none; }
.book-card[hidden] { display: none; }

.book-cover {
  position: relative;
  aspect-ratio: .735;
  overflow: hidden;
  padding: 22px 16px 15px;
  border: 1px solid #cfc2a7;
  border-radius: 5px 11px 11px 5px;
  background:
    linear-gradient(90deg, rgba(109, 87, 55, .08), transparent 9%, transparent 94%, rgba(109, 87, 55, .07)),
    #f7efd5;
  color: #453e33;
  box-shadow: 0 7px 0 #e6ddca, 0 10px 22px rgba(53, 42, 30, .14);
  transform-origin: center bottom;
  transition: transform .26s ease, box-shadow .26s ease;
}

.book-cover::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(112, 91, 58, .24);
  border-radius: 2px 7px 7px 2px;
  pointer-events: none;
}

.book-cover::after {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 1px;
  background: rgba(112, 91, 58, .22);
}

.book-card:hover .book-cover {
  transform: translateY(-8px) rotate(-.55deg);
  box-shadow: 0 9px 0 #e6ddca, 0 18px 32px rgba(53, 42, 30, .2);
}

.cover-collection {
  position: absolute;
  top: 11px;
  left: 18px;
  right: 18px;
  overflow: hidden;
  color: #9c7659;
  font: 500 5.5px/1 var(--mono);
  letter-spacing: .08em;
  white-space: nowrap;
}

.cover-status {
  position: absolute;
  z-index: 2;
  top: 20px;
  left: 13px;
  padding: 3px 7px;
  border: 1px solid rgba(71, 122, 57, .45);
  border-radius: 999px;
  background: #eff3dc;
  color: var(--green);
  font: 600 7px/1 var(--mono);
}

.cover-title {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 3px 0;
  text-align: center;
}

.cover-title small { color: #8d6a4b; font: 500 6.5px/1.2 var(--mono); letter-spacing: .08em; }
.cover-title strong { max-width: 12ch; margin-top: 8px; font: 700 clamp(17px, 1.55vw, 24px)/.97 var(--serif); letter-spacing: -.025em; }
.cover-title em { margin-top: 5px; color: #756958; font: italic 400 8px/1.2 var(--serif); }

.cover-art {
  position: absolute;
  z-index: 1;
  left: 9%;
  right: 9%;
  bottom: 11%;
  width: 82%;
  height: 42%;
  color: #584f42;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.5));
}

.cover-note {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 12px;
  overflow: hidden;
  color: #8d765f;
  font: 500 6px/1 var(--mono);
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
}

.cover-ci { background-color: #f0e6ca; }
.cover-cv { background-color: #f4e9d2; }
.cover-rl { background-color: #f2e5ce; }
.cover-nlp { background-color: #eee8d4; }
.cover-os { background-color: #f0e7cf; }
.cover-perf { background-color: #f5e8d3; }
.cover-bpf { background-color: #eee4cc; }

.book-info { padding: 14px 3px 0; }
.book-info h3 { margin: 0; font: italic 400 clamp(18px, 1.45vw, 23px)/1.08 var(--serif); letter-spacing: -.02em; transition: color .2s ease; }
.book-card:hover .book-info h3 { color: var(--terracotta-dark); }
.book-info p { margin: 8px 0 3px; color: #5f574f; font-size: 9px; }
.book-info > span { display: block; color: #8e857d; font-size: 8.5px; }

.library-cta {
  margin-top: 80px;
  padding: 56px clamp(24px, 6vw, 80px);
  border: 1px solid #3b332b;
  border-radius: 16px;
  background: #312b25;
  color: #f8f0e4;
  text-align: center;
  box-shadow: 0 14px 0 rgba(49, 43, 37, .1);
}

.library-cta > span { color: #dc936e; font-size: 9px; letter-spacing: .17em; }
.library-cta h2 { margin: 12px auto 6px; font: italic 400 clamp(33px, 4vw, 52px)/1.05 var(--serif); }
.library-cta p { max-width: 670px; margin: 0 auto; color: #c7bdb2; font-size: 11px; }
.library-cta a { display: inline-flex; gap: 10px; margin-top: 26px; padding: 11px 18px; border-radius: 9px; background: var(--terracotta); color: #fff7ec; text-decoration: none; font-size: 11px; font-weight: 600; }
.library-cta a:hover { background: #db6d3d; }

.library-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(22px, 4.5vw, 72px);
  border-top: 1px solid var(--rule);
  background: rgba(245, 241, 232, .75);
  color: var(--muted);
  font-size: 9px;
}

.library-footer div { display: flex; gap: 18px; }
.library-footer a { text-decoration: none; }
.library-footer a:hover { color: var(--terracotta-dark); }

@media (max-width: 1180px) {
  .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cover-title strong { font-size: 21px; }
}

@media (max-width: 900px) {
  .library-nav { gap: 16px; }
  .library-nav nav a { padding-inline: 10px; }
  .library-brand > span:last-child { display: none; }
  .search-trigger { min-width: 42px; width: 42px; justify-content: center; }
  .search-trigger span:nth-child(2), .search-trigger kbd { display: none; }
  .books-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-row { align-items: flex-start; flex-direction: column; gap: 24px; }
  .library-count { margin: 0; }
}

@media (max-width: 680px) {
  .library-nav { height: 58px; padding: 0 14px; }
  .library-brand { gap: 7px; }
  .library-brand strong { font-size: 12px; }
  .brand-spark { transform: scale(.82); margin-left: -2px; }
  .library-nav nav { margin-left: auto; }
  .library-nav nav a { display: none; }
  .library-nav nav a.active { display: block; padding: 7px 11px; font-size: 10px; }
  .search-trigger { margin-left: 0; }
  main { padding: 32px 16px 68px; }
  .library-hero { padding-bottom: 26px; }
  .hero-row h1 { font-size: clamp(42px, 13vw, 58px); }
  .hero-row h1 span { white-space: normal; }
  .hero-row p { font-size: 11px; line-height: 1.7; }
  .library-count { padding: 7px 13px; font-size: 9px; }
  .book-shelf { padding-top: 38px; }
  .shelf-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .shelf-heading h2 { font-size: 25px; }
  .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 12px; }
  .book-cover { padding-inline: 11px; }
  .cover-title { padding-top: 15px; }
  .cover-title strong { margin-top: 6px; font-size: clamp(15px, 5vw, 20px); }
  .cover-title small { font-size: 5.5px; }
  .cover-title em { font-size: 6.5px; }
  .cover-status { top: 17px; left: 10px; font-size: 6px; }
  .cover-collection { left: 14px; right: 14px; font-size: 4.5px; }
  .cover-note { left: 12px; right: 12px; font-size: 4.8px; }
  .book-info { padding-top: 11px; }
  .book-info h3 { font-size: 18px; }
  .book-info p { font-size: 8px; }
  .book-info > span { font-size: 7.5px; }
  .library-cta { margin-top: 58px; padding: 44px 18px; border-radius: 12px; }
  .library-footer { align-items: center; flex-direction: column; text-align: center; }
}

@media (max-width: 390px) {
  .books-grid { grid-template-columns: 1fr; gap: 38px; }
  .book-card { max-width: 270px; margin-inline: auto; }
  .cover-title strong { font-size: 25px; }
  .book-info h3 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .book-cover { transition: none; }
}
