﻿/* ======================================================
   Palette principale: Carta antica + blu petrolio
   ======================================================
   --bg: sfondo generale chiaro tipo carta
   --surface: superfici/card
   --text: testo principale
   --muted: testo secondario
   --brand: blu petrolio
   --brand2: blu petrolio scuro
   --accent: oro/sabbia per dettagli

   Palette alternativa 2: Avorio + terracotta
   --bg: #f8f1e8;
   --surface: #fffaf5;
   --text: #2d241c;
   --muted: #76695d;
   --brand: #9a4f32;
   --brand2: #743822;
   --accent: #c8945b;
   ====================================================== */
:root {
  --bg: #f7f1e6;
  --surface: #fffaf2;
  --text: #2b2520;
  --muted: #6f665c;
  --line: #e6d8c3;
  --brand: #1f4e5f;
  --brand2: #173b49;
  --accent: #d6a84f;
  --soft: #fbf6ec;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(23, 59, 73, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(1180px, 92%); margin: auto; }

.topbar {
  background: radial-gradient(circle at 85% 15%, rgba(214,168,79,.26), transparent 28%), linear-gradient(135deg, #173b49, #1f4e5f);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.topbar:before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 520px;
  height: 520px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  gap: 20px;
  position: relative;
  z-index: 2;
}
.brand { display: flex; flex-direction: column; }
.brand b { font-size: 1.15rem; letter-spacing: .2px; }
.brand small { opacity: .85; }
.nav a.home-link {
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}


/* Barra superiore delle pagine interne: tinta piena, senza sfumature incoerenti */
.detail-topbar {
  background: #173b49;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.detail-topbar .nav a.home-link {
  background: #ffffff;
  color: #1f4e5f;
  border-color: #ffffff;
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
  font-weight: 900;
}
.detail-topbar .nav a.home-link:hover {
  transform: translateY(-2px);
  background: #fbf6ec;
}
.detail-topbar .brand small { opacity: .9; }

/* Barra dedicata alla pagina libro: uniforme e diversa dalla hero */
.book-topbar {
  background: #1f4e5f;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.book-topbar .nav a.home-link {
  background: #fffaf2;
  color: #1f4e5f;
  border-color: #fffaf2;
  box-shadow: 0 8px 22px rgba(0,0,0,.12);
  font-weight: 900;
}
.book-topbar .nav a.home-link:hover {
  transform: translateY(-2px);
  background: #eadfcb;
}
.book-topbar .brand small { opacity: .9; }

.hero { padding: 64px 0 76px; position: relative; z-index: 2; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 34px;
  align-items: center;
}
.kicker,
.section-kicker {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .86rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.kicker {
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.1);
  color: #fff;
}
.section-kicker {
  color: #1f4e5f;
  background: #eadfcb;
  margin-bottom: 10px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 4.2rem);
  line-height: 1.05;
  margin: 18px 0;
  max-width: 850px;
}
.hero p { font-size: 1.18rem; max-width: 720px; opacity: .92; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  border: 1px solid transparent;
  transition: .2s ease;
}
.btn.primary { background: #fff; color: #1f4e5f; }
.btn.ghost { border-color: rgba(255,255,255,.32); color: #fff; }
.btn:hover { transform: translateY(-2px); }

.hero-card {
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 28px;
  padding: 28px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.hero-message h2 {
  margin: 12px 0 10px;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.15;
}
.hero-message p { margin: 0 0 18px; font-size: 1rem; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  color: #1f4e5f;
  background: #fff;
  font-weight: 900;
  font-size: .84rem;
}
.hero-checks { list-style: none; padding: 0; margin: 18px 0 0; }
.hero-checks li {
  position: relative;
  padding: 11px 0 11px 34px;
  border-top: 1px solid rgba(255,255,255,.18);
  font-weight: 700;
}
.hero-checks li:before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 10px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.95);
  color: #1f4e5f;
  font-size: .85rem;
  font-weight: 900;
}

.why-section { padding: 22px 0 8px; }
.section-heading {
  text-align: center;
  max-width: 780px;
  margin: 38px auto 24px;
}
.section-heading span {
  display: inline-block;
  margin-bottom: 8px;
  color: #1f4e5f;
  font-weight: 900;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.section-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  color: #2b2520;
  line-height: 1.18;
}
.section-heading p {
  margin: 0;
  color: #6f665c;
  font-size: 1rem;
  line-height: 1.6;
}
.home-plus {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 26px 0 14px;
}
.plus-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 25px 20px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(20, 40, 80, .08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.plus-card:hover {
  transform: translateY(-5px);
  border-color: #c9b278;
  box-shadow: 0 16px 34px rgba(20, 40, 80, .14);
}
.plus-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fffaf2, #efe3d0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.plus-card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  color: #173b49;
}
.plus-card p {
  margin: 0;
  font-size: .94rem;
  line-height: 1.55;
  color: #6f665c;
}

.section { padding: 48px 0; }
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.section-title h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.section-title p { margin: 0; color: var(--muted); }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.search {
  flex: 1;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 1rem;
  background: #fff;
  box-shadow: 0 8px 22px rgba(20,33,61,.04);
}
.search:focus { outline: 3px solid rgba(31,78,95,.18); border-color: #1f4e5f; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.book-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(20,33,61,.07);
  display: flex;
  flex-direction: column;
  transition: .2s ease;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.cover-wrap {
  background: linear-gradient(180deg, #fbf6ec, #fff);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 330px;
}
.cover-wrap img {
  max-height: 285px;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 16px 32px rgba(15,23,42,.18);
}
.book-body { padding: 22px; display: flex; flex: 1; flex-direction: column; }
.book-body h3 { font-size: 1.18rem; line-height: 1.25; margin: 0 0 7px; }
.book-body h3 a:hover { color: var(--brand2); }
.subtitle { color: var(--brand); font-weight: 800; margin: 0 0 12px; }
.desc { color: var(--muted); font-size: .96rem; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pill {
  font-size: .82rem;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fbf6ec;
  color: #1f4e5f;
}
.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
}
.price { font-size: 1.25rem; font-weight: 900; color: #132932; }
.book-card .btn.primary,
.sidebox .btn.primary,
.buy-panel .btn.primary { background: #1f4e5f; color: #fff; }
.book-card .btn.primary:hover,
.sidebox .btn.primary:hover,
.buy-panel .btn.primary:hover { background: #173b49; }

.detail-hero { background: linear-gradient(135deg, #173b49, #1f4e5f); color: #fff; padding: 36px 0 48px; }
.breadcrumb { font-size: .95rem; opacity: .9; margin-bottom: 22px; }
.detail-grid { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 38px; align-items: start; }
.detail-cover { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); border-radius: 30px; padding: 26px; box-shadow: var(--shadow); align-self: start; display: flex; align-items: center; justify-content: center; }
.detail-cover img { border-radius: 10px; box-shadow: 0 20px 42px rgba(0,0,0,.25); margin: auto; width: 100%; max-width: 350px; height: auto; object-fit: contain; }
.detail-info { min-width: 0; display: block; }
.detail-info h1 { font-size: clamp(1.95rem, 3.7vw, 3.2rem); line-height: 1.08; margin: 0 0 12px; }
.detail-info .lead { font-size: 1.2rem; opacity: .94; }
.buy-panel { background: #fff; color: var(--text); border-radius: 26px; padding: 22px; margin-top: 24px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.buy-panel .price { font-size: 1.8rem; }
.content-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 30px; align-items: start; }
.prose { background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 34px; box-shadow: 0 10px 30px rgba(20,33,61,.06); }
.prose h2 { margin-top: 0; }
.prose p { margin: 0 0 1rem; }
.prose ul { padding-left: 1.2rem; }
.sidebox { position: sticky; top: 18px; }
.info-box,
.cartadocente { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 22px; margin-bottom: 18px; box-shadow: 0 10px 30px rgba(20,33,61,.06); }
.info-row { display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { text-align: right; }
.cartadocente img { max-width: 220px; margin: auto; }
.ad-box { border: 1px dashed #b49a82; background: #fff; border-radius: 24px; padding: 22px; text-align: center; color: #6f665c; margin: 28px auto; box-shadow: 0 6px 24px rgba(20,33,61,.05); }
.ad-box span { display: inline-block; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; color: #1f4e5f; margin-bottom: 8px; }
.ad-box strong { display: block; }
.footer { background: #173b49; color: #eadfcb; margin-top: 50px; padding: 36px 0; }
.footer .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.backtop { color: #fff; opacity: .8; }
.empty { display: none; background: #fff; border-radius: 20px; padding: 25px; border: 1px solid var(--line); color: var(--muted); }
.muted { color: var(--muted); font-size: .95rem; }
.extra-info h3,
.cartadocente h3,
.info-box h3 { margin-top: 0; }
.cartadocente p,
.extra-info p { color: var(--muted); }

@media (max-width: 980px) {
  .hero-grid,
  .detail-grid,
  .content-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .home-plus { grid-template-columns: repeat(2, 1fr); }
  .sidebox { position: static; }
  .detail-cover { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); border-radius: 30px; padding: 26px; box-shadow: var(--shadow); align-self: start; display: flex; align-items: center; justify-content: center; }
  .buy-panel { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 52px; }
}

@media (max-width: 640px) {
  .nav { align-items: flex-start; flex-direction: column; }
  .grid,
  .home-plus { grid-template-columns: 1fr; }
  .cover-wrap { min-height: 280px; }
  .cover-wrap img { max-height: 245px; }
  .section-title { display: block; }
  .prose { padding: 24px; }
  .footer .container { display: block; }
  .detail-cover img { border-radius: 10px; box-shadow: 0 20px 42px rgba(0,0,0,.25); margin: auto; width: 100%; max-width: 350px; height: auto; object-fit: contain; }
  .hero-card { padding: 22px; }
}


/* Correzione stabile pagina dettaglio: intestazione sopra, copertina a sinistra, testo a destra */
.topbar,
.detail-hero {
  min-height: auto;
}

.detail-hero .breadcrumb {
  display: block;
  width: 100%;
  margin-bottom: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 38px;
  align-items: start;
}

.detail-cover {
  grid-column: 1;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 0;
}

.detail-info {
  grid-column: 2;
  min-width: 0;
  display: block;
}

.detail-cover img {
  width: 100%;
  max-width: 350px;
  height: auto;
  object-fit: contain;
}

@media (max-width: 980px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-cover,
  .detail-info {
    grid-column: auto;
  }
  .detail-cover {
    max-width: 420px;
    margin: 0 auto;
  }
}


/* ======================================================
   Estensioni per sito RACCONTI / RIASSUNTI
   ====================================================== */
.category-cover { min-height: 230px; }
.category-cover img { max-height: 190px; }
.soft-section { background: linear-gradient(180deg, #fffaf2, #ffffff); }
.compact-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.compact-item { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 8px 22px rgba(20,33,61,.05); }
.compact-item:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(20,33,61,.10); }
.compact-item img { width: 64px; height: 82px; object-fit: cover; border-radius: 10px; background: #efe3d0; }
.compact-item span { display: flex; flex-direction: column; gap: 4px; }
.compact-item small { color: var(--muted); }
.btn.ghost.dark { color: #1f4e5f; border-color: #d8c9b3; background: #fff; }
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-link { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fffaf2; color: #2b2520; }
.chapter-link:hover { background: #eadfcb; transform: translateY(-1px); color: #1f4e5f; }
.chapter-link:visited { color: #b8892f; }
.chapter-link span { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 900; }
.chapter-link small { color: var(--muted); font-weight: 800; }
.nota-lettura { border-left: 5px solid #1f4e5f; background: #fbf6ec; padding: 16px 18px; border-radius: 14px; margin: 22px 0; color: #173b49; }
.prose blockquote,
.reader-content blockquote { margin: 24px 0; padding: 18px 22px; border-left: 5px solid #b49a82; background: #fffaf2; border-radius: 14px; font-style: italic; color: #374a51; }

.reader-body { background: #f7f1e6; color: #172033; }
.reader-top { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid #e6d8c3; }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.reader-nav div:first-child { display: flex; flex-direction: column; gap: 4px; }
.reader-nav small { color: #6f665c; }
.reader-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.reader-tools button,
.pager button { border: 1px solid #d8c9b3; background: #fff; border-radius: 999px; padding: 9px 12px; font-weight: 800; cursor: pointer; }
.reader-tools button:hover,
.pager button:hover { background: #f8efe3; }
.reader-tools button:disabled,
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.reader-shell { width: min(900px, 92%); margin: 34px auto; }
.reader-page { background: #fffdf7; border: 1px solid rgba(15,23,42,.08); border-radius: 28px; box-shadow: 0 20px 55px rgba(15,23,42,.11); padding: clamp(28px, 5vw, 58px); line-height: 1.78; transition: background .2s ease, color .2s ease; }
.reader-heading { text-align: center; margin-bottom: 26px; }
.reader-heading h1 { margin: 12px 0 6px; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.15; }
.reader-heading p { margin: 0; color: #6f665c; }
.reader-content p { margin: 0 0 1.15em; }
.chapter-image { margin: 0 auto 28px; }
.chapter-image img { width: 100%; max-height: 360px; object-fit: cover; border-radius: 22px; box-shadow: 0 14px 34px rgba(15,23,42,.12); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 22px 0; }
.pager span { font-weight: 900; color: #6f665c; }
.chapter-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 26px 0 44px; }
.theme-day .reader-page { background: #fffdf7; color: #172033; }
.theme-sepia { background: #eadfc9; }
.theme-sepia .reader-page { background: #fbf2df; color: #2e211a; }
.theme-sepia .reader-top { background: rgba(251,242,223,.92); }
.theme-night { background: #0f1e25; }
.theme-night .reader-top { background: rgba(10,18,32,.92); border-bottom-color: #2b2520; color: #e6d8c3; }
.theme-night .reader-nav small,
.theme-night .reader-heading p,
.theme-night .pager span { color: #d8c9b3; }
.theme-night .reader-page { background: #132932; color: #e6d8c3; border-color: #2e4a53; box-shadow: 0 20px 55px rgba(0,0,0,.35); }
.theme-night .reader-tools button,
.theme-night .pager button { background: #2b2520; color: #e6d8c3; border-color: #374a51; }
.theme-night .nota-lettura { background: #193541; color: #f5ead8; }
.theme-night .reader-content blockquote { background: #142a33; color: #eadfcb; border-left-color: #6f665c; }

@media (max-width: 980px) { .compact-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .compact-list { grid-template-columns: 1fr; } .reader-nav { align-items: flex-start; flex-direction: column; } .reader-tools { justify-content: flex-start; } .pager { flex-direction: column; } .chapter-link { grid-template-columns: 38px 1fr; } .chapter-link small { display: none; } }


/* ======================================================
   Layout pubblicità e campo autore
   ====================================================== */
.ad-before-latest {
  margin-top: 14px;
  margin-bottom: 12px;
}

.category-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 30px;
  align-items: start;
}

.category-main {
  min-width: 0;
}

.category-main .grid {
  grid-template-columns: repeat(2, 1fr);
}

.category-aside {
  align-self: start;
}

.category-aside .sidebox {
  position: sticky;
  top: 18px;
}

.category-aside .ad-box {
  margin-top: 0;
}


.book-subtitle-hero {
  margin: -4px 0 14px;
  color: #eadfcb;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
  max-width: 760px;
}

.book-subtitle-card {
  margin: 0 0 8px;
  color: #6f665c;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.35;
}

.compact-item em {
  color: #6f665c;
  font-size: .9rem;
  font-style: normal;
  line-height: 1.25;
}

.book-author-hero {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color: #fffaf2;
  font-weight: 800;
}

.book-author-hero strong {
  color: #ffffff;
}

.book-author-card {
  margin: 0 0 10px;
  color: #1f4e5f;
  font-weight: 800;
  font-size: .94rem;
}

@media (max-width: 980px) {
  .category-layout {
    grid-template-columns: 1fr;
  }
  .category-main .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .category-aside .sidebox {
    position: static;
  }
}

@media (max-width: 640px) {
  .category-main .grid {
    grid-template-columns: 1fr;
  }
}


/* ======================================================
   Home BIBLIOTECA DIGITALE: categorie corpose e novità
   ====================================================== */
.hero-message { max-width: 460px; justify-self: end; }
.hero-message h2 { font-size: clamp(1.45rem, 2.1vw, 1.95rem); }
.hero-message p { margin-bottom: 0; }

.category-card .book-body { gap: 10px; }
.category-latest {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.category-latest > span {
  color: var(--brand);
  font-size: .82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.category-latest a {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px;
  border-radius: 12px;
  background: #fbf6ec;
  border: 1px solid rgba(230,216,195,.75);
}
.category-latest a:hover { background: #eadfcb; color: var(--brand2); }
.category-latest img {
  width: 42px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
  box-shadow: 0 6px 12px rgba(15,23,42,.15);
  grid-row: span 2;
}
.category-latest strong {
  font-size: .9rem;
  line-height: 1.18;
}
.category-latest small {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.15;
}

.latest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.latest-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(20,33,61,.07);
  transition: .2s ease;
}
.latest-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.latest-cover {
  min-height: 340px;
  padding: 22px;
  background: linear-gradient(180deg, #fbf6ec, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
}
.latest-cover img {
  width: auto;
  max-width: 100%;
  max-height: 300px;
  border-radius: 9px;
  object-fit: contain;
  box-shadow: 0 16px 32px rgba(15,23,42,.18);
}
.latest-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  flex: 1;
}
.latest-body b {
  font-size: 1.15rem;
  line-height: 1.22;
  color: var(--text);
}
.latest-body em {
  color: var(--muted);
  font-style: normal;
  font-size: .94rem;
  line-height: 1.35;
}
.latest-body small {
  color: var(--brand);
  font-weight: 800;
}
.latest-body i {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 8px 13px;
  font-style: normal;
  font-size: .86rem;
  font-weight: 900;
}
@media (max-width: 980px) {
  .latest-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-message { justify-self: stretch; max-width: none; }
}
@media (max-width: 640px) {
  .latest-grid { grid-template-columns: 1fr; }
  .latest-cover { min-height: 280px; }
  .latest-cover img { max-height: 245px; }
}


/* ======================================================
   FIX RESPONSIVE categoria.asp - griglia libri su mobile
   Evita che card, immagini o parole lunghe allarghino la pagina.
   ====================================================== */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.category-layout,
.category-main,
.category-book-grid,
.category-book-grid .book-card,
.category-book-grid .book-body,
.category-book-grid .cover-wrap {
  min-width: 0;
  max-width: 100%;
}

.category-book-grid {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-book-grid .book-card {
  width: 100%;
}

.category-book-grid .cover-wrap {
  width: 100%;
  padding: clamp(14px, 4vw, 24px);
}

.category-book-grid .cover-wrap img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.category-book-grid .book-body h3,
.category-book-grid .book-subtitle-card,
.category-book-grid .book-author-card,
.category-book-grid .desc,
.category-book-grid .pill {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 980px) {
  .category-book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .category-book-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px;
  }
  .category-layout {
    display: block;
  }
  .category-main,
  .category-aside {
    width: 100%;
    max-width: 100%;
  }
  .category-book-grid .cover-wrap {
    min-height: 250px;
  }
  .category-book-grid .cover-wrap img {
    max-height: 235px;
  }
  .category-book-grid .book-body {
    padding: 18px;
  }
  .toolbar,
  .search {
    width: 100%;
    max-width: 100%;
  }
  .search {
    min-width: 0;
  }
}


/* Pagina libro.asp - introduzione più compatta */
.content-grid {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.prose {
  font-size: 0.95rem;
  line-height: 1.65;
}

.prose h2 {
  font-size: 1.45rem;
}

.prose p {
  margin-bottom: 0.85rem;
}

.chapter-link b {
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}


/* Paginazione libri in categoria.asp */
.pagination-books {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 34px 0 10px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 999px;
  background: #7b2f2f;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.page-btn:hover {
  background: #5f2323;
  color: #fff;
}

.page-info {
  font-size: 0.95rem;
  color: #6b5b4b;
  font-weight: 600;
}

@media (max-width: 640px) {
  .pagination-books {
    flex-direction: column;
    gap: 10px;
  }

  .page-btn {
    width: 100%;
    max-width: 320px;
  }
}
