/* ============================================================================
   Estante de Storybooks — Layouts de página
   ============================================================================ */

/* ───────────────────────  Barra superior  ─────────────────────── */
.sb-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, #2c1e16, #221711);
  border-bottom: 1px solid var(--gold-deep);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}
.sb-topbar .sb-brand { color: var(--paper); }
.sb-topbar .sb-brand-name { color: var(--paper); }
.sb-topbar .sb-brand-name .amp { color: var(--gold); }
.sb-topbar .sb-brand-mark { background: rgba(255, 255, 255, 0.14); }

.sb-nav { display: flex; align-items: center; gap: 6px; }
.sb-nav a {
  font-size: 14.5px;
  text-decoration: none;
  color: rgba(244, 236, 216, 0.78);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: background 0.18s ease, color 0.18s ease;
}
.sb-nav a:hover { color: var(--paper); background: rgba(255, 255, 255, 0.08); }
.sb-nav a.active { color: var(--paper); background: rgba(197, 160, 89, 0.22); }

.sb-userchip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(197, 160, 89, 0.35);
  color: var(--paper);
  font-size: 13.5px;
  cursor: pointer;
}
.sb-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--wood-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

/* Menu mobile */
.sb-nav-toggle { display: none; background: none; border: none; color: var(--paper); cursor: pointer; padding: 6px; }
@media (max-width: 820px) {
  .sb-nav-toggle { display: inline-flex; }
  .sb-nav {
    position: absolute;
    top: var(--topbar-h); right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: #2c1e16;
    border: 1px solid var(--gold-deep);
    border-radius: var(--r-md);
    padding: 8px;
    min-width: 200px;
    box-shadow: var(--shadow-pop);
    display: none;
  }
  .sb-nav.open { display: flex; }
}

/* ───────────────────────  Palco (mesa de leitura)  ─────────────────────── */
.sb-page { padding: 32px 16px 72px; }

.stage {
  max-width: var(--stage-max);
  margin: 0 auto;
  background-color: var(--paper);
  box-shadow:
    inset 0 0 80px rgba(139, 90, 43, 0.35),
    inset 0 0 18px rgba(0, 0, 0, 0.08),
    15px 15px 50px rgba(0, 0, 0, 0.6),
    -5px 0 12px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-md);
  position: relative;
  padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 48px) 56px;
}
.stage::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 14px;
  background: linear-gradient(to right,
    rgba(0,0,0,0.35), rgba(0,0,0,0.08) 35%,
    rgba(255,255,255,0.18) 60%, rgba(0,0,0,0.08) 80%, rgba(0,0,0,0) 100%);
  border-radius: 6px 0 0 6px;
  pointer-events: none;
}

/* ───────────────────────  Cabeçalho de página  ─────────────────────── */
.masthead { text-align: center; padding: 4px 8px 40px; border-bottom: 1px solid var(--line); }
.masthead .sb-eyebrow { margin-bottom: 16px; }
.masthead .sb-eyebrow::before, .masthead .sb-eyebrow::after {
  content: ''; width: 42px; height: 1px; background: var(--gold-deep);
}
.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(40px, 6vw, 74px);
  line-height: 0.98;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.page-title .amp { color: var(--gold-deep); }
.masthead .lead {
  max-width: 600px;
  margin: 22px auto 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.masthead .lead em { color: var(--ink); font-style: italic; }

/* ───────────────────────  Rótulo de seção / prateleira  ─────────────────────── */
.shelf-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 48px 4px 26px;
}
.shelf-label h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: 28px;
  margin: 0;
  color: var(--ink-soft);
  white-space: nowrap;
}
.shelf-label .count {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
.shelf-label .rule {
  flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-deep), transparent);
}

/* ───────────────────────  Grade de livros  ─────────────────────── */
.shelf {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 28px 22px;
}
@media (max-width: 1100px) { .shelf { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 880px)  { .shelf { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px)  { .shelf { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; } }

.book-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform 0.35s ease;
}
.book-card:hover { transform: translateY(-6px); }
.book-card.locked { cursor: pointer; }

.book-card .cover {
  position: relative;
  aspect-ratio: 3/4;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card), inset 0 0 18px rgba(139, 90, 43, 0.18);
  overflow: hidden;
  border-radius: 2px 6px 6px 2px;
}
.book-card .cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 9px;
  background: linear-gradient(to right,
    rgba(0,0,0,0.35), rgba(0,0,0,0.05) 50%, rgba(255,255,255,0.15) 70%, rgba(0,0,0,0));
  z-index: 2;
}
.book-card .cover::after {
  content: '';
  position: absolute;
  top: 4px; bottom: 4px; right: -3px;
  width: 3px;
  background: repeating-linear-gradient(to bottom, var(--paper-edge), var(--paper-edge) 2px, #c8bcaf 3px);
  border-radius: 0 2px 2px 0;
  z-index: 0;
}
.cover-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: sepia(0.18) contrast(1.05) saturate(0.95);
}
.cover-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(46,30,22,0.82) 0%, rgba(46,30,22,0) 48%),
    radial-gradient(circle at center, transparent 55%, rgba(46,30,22,0.35) 100%);
}
.cover-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 14px 12px 12px;
  text-align: center;
  color: var(--paper);
}
.cover-title .num {
  display: inline-block;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(244, 236, 216, 0.78);
  margin-bottom: 4px;
}
.cover-title .num::before, .cover-title .num::after { content: '·'; margin: 0 8px; color: var(--gold); }
.cover-title .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 26px;
  line-height: 1;
  margin: 0 0 4px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.cover-title .tagline { font-size: 13px; font-style: italic; color: rgba(244,236,216,0.88); margin: 0; }

/* Selo de status no canto */
.ribbon {
  position: absolute;
  top: 10px; right: -4px;
  z-index: 4;
  padding: 5px 12px 5px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--bark);
  box-shadow: 2px 3px 6px rgba(0,0,0,0.35);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 6px 50%);
}
.ribbon.free  { background: var(--gold); color: var(--ink); }
.ribbon.read  { background: var(--ok);   color: #fff; }

/* Coração de favorito */
.fav-btn {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 5;
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(46,30,22,0.45);
  color: var(--paper);
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: transform 0.15s ease, background 0.15s ease;
}
.fav-btn:hover { transform: scale(1.12); }
.fav-btn.on { color: #e8736e; background: rgba(46,30,22,0.6); }
.fav-btn.on svg { fill: currentColor; }

/* Cobertura de cadeado */
.lock-veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(34, 23, 17, 0.55);
  color: var(--paper);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.book-card.locked .cover .lock-veil { opacity: 1; }
.lock-veil span { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; }
.book-card.locked .cover-img { filter: sepia(0.4) grayscale(0.5) brightness(0.8); }

/* Legenda sob a capa */
.blurb {
  margin: 12px 4px 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.blurb .verse {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.book-card .meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 4px 0;
}

/* ───────────────────────  Vitrine de coleções (catálogo)  ─────────────────────── */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 20px;
  margin-top: 40px;
}
@media (max-width: 620px) { .collections-grid { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; } }
@media (max-width: 400px) { .collections-grid { grid-template-columns: 1fr; gap: 18px; } }

.collection-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.35s ease;
}
.collection-card:hover { transform: translateY(-6px); }

.collection-card .cc-cover {
  position: relative;
  height: 260px;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card), inset 0 0 18px rgba(139, 90, 43, 0.18);
  overflow: hidden;
  border-radius: 2px 6px 6px 2px;
}
.collection-card .cc-cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 9px;
  background: linear-gradient(to right,
    rgba(0,0,0,0.35), rgba(0,0,0,0.05) 50%, rgba(255,255,255,0.15) 70%, rgba(0,0,0,0));
  z-index: 2;
}
.collection-card:hover .cc-cover {
  box-shadow: 6px 8px 22px rgba(0,0,0,0.45), inset 0 0 22px rgba(139, 90, 43, 0.25);
}

.cc-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 18px 16px 16px;
  text-align: center;
  color: var(--paper);
}
.cc-title .cc-eyebrow {
  display: inline-block;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(244, 236, 216, 0.8);
  margin-bottom: 6px;
}
.cc-title .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 30px;
  line-height: 1;
  margin: 0 0 6px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.cc-title .name .amp { color: var(--gold); }
.cc-title .tagline { font-size: 13.5px; font-style: italic; color: rgba(244,236,216,0.9); margin: 0; }

.cc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 4px 0;
}
.cc-status {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.cc-cta {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--gold-deep);
  white-space: nowrap;
}

/* ───────────────────────  Banner da página de coleção  ─────────────────────── */
.collection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding: 22px 26px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent 30%), var(--paper-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 24px rgba(139, 90, 43, 0.12);
}
.collection-banner.unlocked { border-color: var(--line); }
.collection-banner .stamp {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.collection-banner p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 560px;
}
.collection-banner p em { color: var(--ink); font-style: italic; }
.collection-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ───────────────────────  Cartões de coleção (legado/faixa)  ─────────────────────── */
.collection-strip { margin-top: 8px; }
.collection-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 44px 2px 4px;
}
.collection-head h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 34px;
  margin: 0;
  color: var(--ink);
}
.collection-head .amp { color: var(--gold-deep); }
.collection-head .badge {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.collection-sub {
  margin: 2px 2px 24px;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ───────────────────────  Painel/caixa de pergaminho  ─────────────────────── */
.parchment {
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent 25%), var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 28px 32px;
  position: relative;
  box-shadow: inset 0 0 24px rgba(139, 90, 43, 0.12);
}
.parchment::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(139, 90, 43, 0.22);
  pointer-events: none;
}
.parchment .stamp {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.parchment h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 10px;
  color: var(--ink);
}

/* ───────────────────────  Estatísticas (hub/perfil)  ─────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.stat {
  text-align: center;
  padding: 22px 16px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.stat .num {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 44px;
  line-height: 1;
  color: var(--gold-deep);
}
.stat .lbl {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ───────────────────────  Rodapé / colofão  ─────────────────────── */
.colophon {
  text-align: center;
  margin-top: 52px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.colophon .verse {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 21px;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 8px;
  text-wrap: balance;
  line-height: 1.45;
}
.colophon .ref {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ═══════════════════════  TELAS DE AUTENTICAÇÃO  ═══════════════════════ */
.auth-screen {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) { .auth-screen { grid-template-columns: 1fr; } }

.auth-aside {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  color: var(--paper);
  background:
    radial-gradient(circle at 30% 20%, rgba(197,160,89,0.25), transparent 55%),
    linear-gradient(150deg, #3a281c, #221711);
  border-right: 1px solid var(--gold-deep);
}
@media (max-width: 900px) { .auth-aside { display: none; } }

.aa-content { position: relative; z-index: 2; max-width: 440px; }
.auth-aside .sb-brand-name { color: var(--paper); }
.auth-aside h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.02;
  margin: 0 0 14px;
}
.auth-aside h1 em { color: var(--gold); font-style: italic; }
.auth-aside p { font-size: 17px; line-height: 1.6; color: rgba(244,236,216,0.82); margin: 0; }
.auth-aside ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; }
.auth-aside li { display: flex; align-items: flex-start; gap: 12px; }
.aa-check {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--wood-deep);
  margin-top: 1px;
}
.aa-rings {
  position: absolute;
  right: -120px; bottom: -120px;
  opacity: 0.25;
  z-index: 1;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 5vw, 56px);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(139,90,43,0.08), transparent 60%),
    radial-gradient(circle at 85% 85%, rgba(139,90,43,0.08), transparent 60%);
}
.auth-form { width: 100%; max-width: 400px; }
.auth-form > .sb-eyebrow { margin-bottom: 10px; }
.auth-form h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 40px;
  margin: 0 0 6px;
  color: var(--ink);
}
.auth-lead { margin: 0 0 22px; color: var(--ink-soft); font-size: 16px; }
.auth-fields { display: grid; gap: 16px; margin-top: 16px; }
.auth-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 4px 0;
}
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-tip {
  margin-top: 22px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.auth-tip b { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }

/* ───────────────────────  Modal (desbloqueio)  ─────────────────────── */
.sb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(34, 23, 17, 0.6);
  backdrop-filter: blur(3px);
}
.sb-modal-backdrop.open { display: flex; }
.sb-modal {
  width: 100%;
  max-width: 420px;
  background: var(--paper);
  border: 1px solid var(--gold-deep);
  border-radius: var(--r-md);
  padding: 30px 32px;
  position: relative;
  box-shadow: var(--shadow-pop);
}
.sb-modal h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 30px;
  margin: 0 0 6px;
  color: var(--ink);
}
.sb-modal p { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.sb-modal .close-x {
  position: absolute;
  top: 14px; right: 14px;
  background: none; border: none;
  font-size: 22px; color: var(--ink-muted);
  cursor: pointer; line-height: 1;
}

/* ───────────────────────  Perfil  ─────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  margin-top: 8px;
}
@media (max-width: 760px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-card { text-align: center; }
.profile-avatar {
  width: 92px; height: 92px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, var(--gold), var(--gold-deep));
  color: var(--wood-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  border: 2px solid var(--gold-deep);
  box-shadow: inset 0 0 16px rgba(0,0,0,0.2);
}
.profile-form { display: grid; gap: 16px; }
.profile-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .profile-form .row { grid-template-columns: 1fr; } }
