/* ============================================================
   FANTASY BOOK GENERATOR — STYLESHEET
   Load order:  impheim.css  →  tool-page.css  →  this file
   ============================================================ */

/* ---- Bookish amber/indigo glows (overrides tool-page.css default) ---- */
body::after {
  background:
    radial-gradient(ellipse 130% 55% at 50% -8%,  rgba(80, 50, 180, 0.20) 0%,  transparent 60%),
    radial-gradient(ellipse 55%  45% at  4% 95%,  rgba(120, 60, 20,  0.12) 0%,  transparent 55%),
    radial-gradient(ellipse 45%  40% at 96% 88%,  rgba(30,  70, 160,  0.10) 0%,  transparent 55%),
    radial-gradient(ellipse 70%  35% at 50% 110%, rgba(160, 80,  20,  0.08) 0%,  transparent 50%);
}

/* ---- Tool section wrapper ---- */
.tool-section { width: 100%; padding: 0; }

/* ---- Book grid ---- */
.book-grid {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 20px; width: 100%; padding: 0 10px;
}

/* ---- Book card ---- */
.book-card {
  width: clamp(260px, 19vw, 440px);
  border-radius: 20px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 6px 28px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.055),
    inset 0 -1px 0 rgba(0,0,0,.3);
  transition: transform .38s cubic-bezier(.34,1.56,.64,1), box-shadow .28s ease;
  position: relative;
  font-size: clamp(14px, 0.9vw, 22px);
  padding: 0;
  display: flex; flex-direction: column;
  background: initial;
}
.book-card:hover {
  transform: translateY(-12px) scale(1.018);
  box-shadow:
    0 24px 60px rgba(0,0,0,.7),
    0 0 0 1.5px var(--book-accent),
    0 0 30px color-mix(in srgb, var(--book-accent) 25%, transparent),
    inset 0 1px 0 rgba(255,255,255,.07);
}
.book-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--book-accent); z-index: 2;
  box-shadow: 0 0 14px var(--book-accent), 0 0 4px rgba(255,255,255,.4);
}

/* Cover canvas */
.book-cover-wrap { width: 100%; position: relative; background: #080408; }
.book-cover-wrap canvas { display: block; width: 100%; height: auto; }

/* Info section */
.book-info { padding: 0.9em 1.1em 1.15em; display: flex; flex-direction: column; gap: .55rem; flex: 1; background: inherit; }

.book-title  { font-family: var(--font-d); font-size: 1.02rem; font-weight: 600; color: var(--book-text, var(--text)); line-height: 1.3; }
.book-author { font-size: .82rem; color: var(--text2); font-style: italic; }

.book-badges { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.book-badge  {
  font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: .18rem .55rem; border-radius: 20px;
  border: 1px solid currentColor; line-height: 1.4;
}
.book-badge.cat { color: var(--muted); border-color: var(--border2); }

.book-meta     { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .75rem; font-size: .8rem; }
.book-meta-key { color: var(--muted); }
.book-meta-val { color: var(--text2); }

.book-value          { font-size: .88rem; color: var(--gold); font-weight: 600; }
.book-condition-note { font-size: .75rem; color: var(--muted); font-style: italic; }

/* Magic / spellbook section */
.book-magic-section {
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 8px; padding: .6rem .75rem;
  font-size: .8rem; color: var(--text2); line-height: 1.6;
}
.book-magic-label   { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
.spell-list         { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.spell-tag          { font-size: .68rem; padding: .1rem .45rem; border-radius: 4px; background: rgba(40,100,200,0.18); border: 1px solid rgba(40,100,200,0.35); color: #80b0f0; }
.spell-level-label  { font-size: .68rem; color: var(--muted); margin-top: .3rem; display: block; }

/* Reviews */
.book-reviews { display: flex; flex-direction: column; gap: .45rem; }
.review-item  { font-size: .78rem; line-height: 1.55; }
.review-name  { font-weight: 600; color: var(--text2); }
.review-text  { color: var(--muted); font-style: italic; }
.review-sentiment     { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; margin-left: .35rem; }
.review-sentiment.pos { color: #5eb865; }
.review-sentiment.mix { color: var(--gold); }
.review-sentiment.neg { color: #c05040; }

/* ---- Card entrance ---- */
@keyframes bookIn {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
.book-card.anim { animation: bookIn .48s cubic-bezier(.34,1.56,.64,1) both; }

/* ---- Print: book-specific layout (tool-page.css hides nav/controls) ---- */
@media print {
  .book-grid { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 1rem; justify-content: unset !important; }
  .book-card { background: #fff !important; border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; color: #000 !important; }
  .book-title, .book-author, .book-meta-key, .book-meta-val { color: #000 !important; }
  .book-value { color: #8a6a00 !important; }
  .book-magic-section { background: #f8f8f0 !important; border-color: #ccc !important; color: #333 !important; }
  .book-badge.cat { color: #555 !important; border-color: #999 !important; }
  .review-text { color: #444 !important; }
  .review-name { color: #222 !important; }
  .spell-tag { background: #eef !important; border-color: #99c !important; color: #336 !important; }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .book-grid { flex-direction: column; align-items: center; }
  .book-card { width: 90vw; max-width: 380px; font-size: 15px; }
}
