/* ============================================================
   books.css — the flip-cover shelf (shared by the homepage teaser
   and the full library page) + the library page's own layout.
   Loaded after base.css on both index.html and books.html.
   ============================================================ */

/* ── Flip-cover grid ── */
.shelf-hint  { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: 0.1em; color: var(--ink3); text-transform: none; }
.shelf-count { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: 0.1em; color: var(--ink3); }

.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 30px 20px; padding-top: 8px; }
.flipbook {
  position: relative; aspect-ratio: 5 / 7; border: none; background: none; padding: 0; cursor: pointer;
  perspective: 1000px; transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.flipbook:hover, .flipbook:focus-visible { z-index: 6; transform: translateY(-8px) scale(1.07); outline: none; }
.fb-inner {
  position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.3,.1,.2,1);
  border-radius: 2px 5px 5px 2px; box-shadow: 0 12px 22px -12px rgba(30,20,8,0.5);
}
.flipbook:hover .fb-inner, .flipbook:focus-visible .fb-inner, .flipbook[aria-pressed="true"] .fb-inner { transform: rotateY(180deg); }
.fb-front, .fb-back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 2px 5px 5px 2px; overflow: hidden; }
.fb-front {
  background-color: var(--c, #444);
  background-image: linear-gradient(150deg, rgba(255,255,255,0.15), rgba(255,255,255,0) 42%, rgba(0,0,0,0.24));
  display: flex; flex-direction: column; justify-content: flex-end; padding: 14px 12px 15px 20px; color: #fff;
}
.fb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.fb-front::before { content: ""; z-index: 2; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: rgba(0,0,0,0.28); box-shadow: inset -1px 0 0 rgba(255,255,255,0.16); }
.fb-front::after  { content: "FLIP \25B8"; z-index: 2; position: absolute; top: 10px; right: 10px; font-family: var(--mono); font-weight: 700; font-size: 7.5px; letter-spacing: 0.1em; color: rgba(255,255,255,0.85); text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.fb-ft { font-family: var(--serif); font-weight: 600; font-size: 15px; line-height: 1.08; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }   /* fallback plate, behind cover image */
.fb-fa { font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; opacity: 0.82; margin-top: 6px; }
.fb-rate {
  position: absolute; z-index: 3; top: 10px; left: 11px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: #F2C75C;
  background: rgba(18,12,4,0.55); padding: 3px 7px; border-radius: 20px; backdrop-filter: blur(2px);
  box-shadow: 0 2px 6px -2px rgba(0,0,0,0.5);
}
.fb-back {
  transform: rotateY(180deg); background: var(--clip); border: 1px solid var(--line2);
  display: flex; flex-direction: column; gap: 6px; justify-content: flex-start; padding: 13px 12px 12px;
}
.fb-cat   { font-family: var(--mono); font-weight: 700; font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.fb-stars { font-family: var(--mono); color: var(--teal); font-size: 11px; letter-spacing: 1px; }
.fb-note  { font-family: var(--body); font-size: 12px; line-height: 1.4; color: var(--ink2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* sticky note that invites the click */
.fb-open {
  margin-top: auto; align-self: flex-start;
  font-family: var(--mono); font-weight: 700; font-size: 8.5px; letter-spacing: 0.05em;
  color: #6a531f; background: #EFD79B; padding: 5px 8px; border-radius: 2px;
  transform: rotate(-2.5deg); box-shadow: 0 3px 7px -2px rgba(60,40,10,0.4), inset 0 1px 0 rgba(255,255,255,0.4);
}
.flipbook:hover .fb-open, .flipbook:focus-visible .fb-open { animation: stickyNudge 1.15s ease-in-out infinite; }
@keyframes stickyNudge { 0%, 100% { transform: rotate(-2.5deg) translateY(0); } 50% { transform: rotate(-2.5deg) translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .fb-inner, .flipbook { transition: none; } .fb-open { animation: none !important; } }

/* ── "Browse the full library" link (homepage teaser) ── */
.shelf-all {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 30px;
  font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; color: var(--accent);
  border-bottom: 1px solid transparent; transition: border-color .2s, gap .2s;
}
.shelf-all:hover { border-color: var(--accent); gap: 12px; }
.shelf-all span { font-weight: 400; color: var(--ink3); }

/* ============================================================
   LIBRARY PAGE (books.html)
   ============================================================ */
.lib-head { padding: 118px 0 26px; }
.lib-title { font-family: var(--serif); font-weight: 500; font-size: clamp(42px, 8.5vw, 92px); line-height: 0.94; letter-spacing: -0.03em; margin: 12px 0 16px;
  text-shadow: 0.026em 0.012em 0 color-mix(in srgb, var(--teal) 78%, transparent), -0.026em -0.012em 0 color-mix(in srgb, var(--accent) 78%, transparent); }
.lib-intro { font-size: 19px; line-height: 1.6; color: var(--ink2); max-width: 60ch; }
.lib-intro b { color: var(--ink); font-weight: 500; }

.library { padding-bottom: 30px; }
.lib-toolbar {
  position: sticky; top: 62px; z-index: 50;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; align-items: center;
  padding: 14px 0; margin-bottom: 44px;
  border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2);
  background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px);
}
.lib-sorts, .lib-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lib-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink3); margin-right: 2px; }
.lib-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em; color: var(--ink2);
  background: none; border: 1px solid var(--line2); border-radius: 20px; padding: 6px 13px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.lib-btn:hover { border-color: var(--accent); color: var(--accent); }
.lib-btn.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.lib-group { margin-bottom: 50px; }
.lib-group-head { display: flex; align-items: baseline; gap: 14px; padding-bottom: 12px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.lib-group-name { font-family: var(--serif); font-weight: 500; font-size: 25px; letter-spacing: -0.01em; }
.lib-group-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink3); }
.lib-empty { font-size: 16px; color: var(--ink3); font-style: italic; padding: 30px 0; }

@media (max-width: 720px) {
  .lib-toolbar { top: 56px; justify-content: flex-start; }
}

/* ============================================================
   NOTE CARD — click a book to read & write your own take
   ============================================================ */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

.note-modal { position: fixed; inset: 0; z-index: 210; display: none; align-items: center; justify-content: center; padding: 24px; }
.note-modal.open { display: flex; }
.note-back { position: absolute; inset: 0; background: rgba(20,14,6,0.55); backdrop-filter: blur(3px); }
.note-card {
  position: relative; z-index: 1; width: min(540px, 94vw); max-height: 88vh; overflow: auto;
  background: var(--clip); border: 1px solid var(--line2); border-top: 4px solid var(--accent); border-radius: 5px;
  padding: 26px 26px 20px; box-shadow: 0 44px 90px -34px rgba(0,0,0,0.6); animation: cardIn .3s cubic-bezier(.2,.7,.2,1);
}
.note-close { position: absolute; top: 6px; right: 12px; border: none; background: none; cursor: pointer; font-family: var(--mono); font-size: 20px; line-height: 1; color: var(--ink3); padding: 4px; }
.note-close:hover { color: var(--accent); }

.note-head { display: grid; grid-template-columns: 88px 1fr; gap: 20px; margin-bottom: 22px; }
.note-cover { position: relative; aspect-ratio: 5 / 7; border-radius: 2px 4px 4px 2px; background: var(--c, #444); overflow: hidden; display: flex; align-items: flex-end; padding: 9px; box-shadow: 0 12px 22px -12px rgba(0,0,0,0.5), inset 7px 0 10px -7px rgba(0,0,0,0.4); }
.note-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.note-cover-t { position: relative; font-family: var(--serif); font-weight: 600; font-size: 11px; line-height: 1.05; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.note-cat { font-family: var(--mono); font-weight: 700; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.note-title { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.08; margin: 6px 0 2px; }
.note-author { font-family: var(--mono); font-size: 11px; color: var(--ink3); }
.note-stars { font-family: var(--mono); color: #C79A2E; letter-spacing: 2px; font-size: 14px; margin-top: 8px; }
.note-read { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink3); margin-top: 4px; }

.note-label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink3); margin-bottom: 8px; }
.note-editor {
  display: block; width: 100%; min-height: 190px; resize: vertical; box-sizing: border-box;
  border: 1px solid var(--line2); border-radius: 4px; color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(var(--paper) 0 27px, color-mix(in srgb, var(--line) 72%, transparent) 27px 28px);
  font-family: var(--body); font-size: 16px; line-height: 28px; padding: 7px 14px 14px;
}
.note-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.note-editor::placeholder { color: var(--ink3); }

.note-foot { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.note-status { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.03em; color: var(--ink3); }
.note-count { font-family: var(--mono); font-size: 10.5px; color: var(--ink3); margin-left: auto; }
.note-copy { font-family: var(--mono); font-size: 11px; color: var(--accent); background: none; border: 1px solid var(--line2); border-radius: 20px; padding: 5px 12px; cursor: pointer; transition: border-color .18s, color .18s; }
.note-copy:hover { border-color: var(--accent); }
@media (max-width: 480px) { .note-head { grid-template-columns: 64px 1fr; gap: 14px; } .note-title { font-size: 20px; } }
