/* ═══════════════════════════════════════════════════════════════════════════
   RH SENIOR Academy Library — identidade visual própria
   Premium · escuro · dourado fosco · executivo · estilo Netflix
   Escopo: páginas /library (carregado apenas nelas).
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --lib-bg:       #070d17;
  --lib-bg-2:     #0b1626;
  --lib-bg-3:     #13233f;
  --lib-surface:  rgba(255, 255, 255, .045);
  --lib-surface-2:rgba(255, 255, 255, .08);
  --lib-gold:     #d4af37;
  --lib-gold-2:   #e6c878;
  --lib-text:     #eaf0f7;
  --lib-muted:    #9fb0c3;
  --lib-border:   rgba(212, 175, 55, .22);
  --lib-border-2: rgba(255, 255, 255, .10);
  --lib-shadow:   0 20px 50px rgba(0, 0, 0, .45);
}

body.library {
  margin: 0;
  background:
    radial-gradient(140% 90% at 50% -10%, #14253f 0%, var(--lib-bg-2) 45%, var(--lib-bg) 100%);
  background-attachment: fixed;
  color: var(--lib-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.library h1, .library h2, .library h3, .library .lib-display {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  letter-spacing: .01em;
}

.library a { color: inherit; text-decoration: none; }
.lib-container { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }

.lib-eyebrow {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--lib-gold);
}

/* ─── Botões ──────────────────────────────────────────────────────────────── */
.lib-btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: .9rem;
  padding: .8rem 1.6rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.lib-btn-gold {
  background: linear-gradient(135deg, var(--lib-gold-2), var(--lib-gold));
  color: #1a1404 !important; box-shadow: 0 10px 26px rgba(212, 175, 55, .28);
}
.lib-btn-gold:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(212, 175, 55, .42); }
.lib-btn-ghost { background: transparent; color: var(--lib-gold-2) !important; border-color: var(--lib-border); }
.lib-btn-ghost:hover { background: var(--lib-surface-2); border-color: var(--lib-gold); transform: translateY(-2px); }

/* ─── Header ──────────────────────────────────────────────────────────────── */
.lib-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 13, 23, .72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--lib-border-2);
}
.lib-header .lib-container {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 1rem;
}
.lib-header img { height: 34px; width: auto; }
.lib-nav { display: flex; align-items: center; gap: 1.6rem; }
.lib-nav a { font-size: .86rem; color: var(--lib-muted); transition: color .15s; }
.lib-nav a:hover, .lib-nav a.active { color: var(--lib-gold-2); }
.lib-nav-toggle { display: none; background: none; border: 0; color: var(--lib-text); font-size: 1.3rem; }

/* ─── Hero ────────────────────────────────────────────────────────────────── */
.lib-hero {
  position: relative; overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 5rem);
  text-align: center;
}
.lib-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(212, 175, 55, .14), transparent 70%),
    radial-gradient(40% 50% at 85% 20%, rgba(46, 82, 152, .25), transparent 70%);
  pointer-events: none;
}
.lib-hero > * { position: relative; z-index: 1; }

/* Vídeo de fundo do hero (home da Library) */
.lib-hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; border: 0; pointer-events: none;
}
/* Sobreposição com o fundo escuro que já existe (opacidade 75% = 25% de transparência) */
.lib-hero-overlay {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(140% 90% at 50% -10%, #14253f 0%, #0b1626 45%, #070d17 100%);
  opacity: .75;
}
.lib-hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.8rem);
  font-weight: 700; margin: .6rem 0 1rem; color: #fff; line-height: 1.08;
}
.lib-hero h1 .gold {
  background: linear-gradient(135deg, var(--lib-gold-2), var(--lib-gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lib-hero p {
  max-width: 720px; margin: 0 auto 1.8rem; color: var(--lib-muted);
  font-size: clamp(.98rem, 2vw, 1.12rem);
}
.lib-hero-actions { display: flex; gap: .9rem; justify-content: center; flex-wrap: wrap; }

/* ─── Faixa de números ───────────────────────────────────────────────────── */
.lib-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  max-width: 880px; margin: 2.8rem auto 0;
  border-top: 1px solid var(--lib-border-2); padding-top: 1.8rem;
}
.lib-stats .num {
  font-family: 'Playfair Display', serif; font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700; color: var(--lib-gold-2); line-height: 1;
}
.lib-stats .lbl { font-size: .72rem; color: var(--lib-muted); margin-top: .35rem; letter-spacing: .04em; }

/* ─── Linhas de livros (Netflix rows) ────────────────────────────────────── */
.lib-section { padding: clamp(2.8rem, 6vw, 4.4rem) 0; }
.lib-row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.3rem; gap: 1rem;
}
.lib-row-head h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); color: #fff; margin: 0; }
.lib-row-head .sub { color: var(--lib-muted); font-size: .85rem; }

.lib-row {
  display: grid; grid-auto-flow: column; gap: .7rem;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: .4rem .2rem 1.2rem; margin: 0 -.2rem;
  scrollbar-width: thin; scrollbar-color: var(--lib-border) transparent;
}
.lib-row::-webkit-scrollbar { height: 8px; }
.lib-row::-webkit-scrollbar-thumb { background: var(--lib-border); border-radius: 8px; }
.lib-row.framework { grid-auto-columns: minmax(210px, 230px); }
.lib-row.guide     { grid-auto-columns: minmax(165px, 180px); }

/* Grid alternativo (sem scroll) para telas largas — usado quando há poucos itens */
.lib-grid { display: grid; gap: .7rem; }
.lib-grid.framework { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.lib-grid.guide     { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
/* ─── Coleção (cards padrão da página do curso: capa + título + subtítulo) ── */
.lib-collection { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; align-items: stretch; }
@media (max-width: 1100px) { .lib-collection { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .lib-collection { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (max-width: 600px)  { .lib-collection { grid-template-columns: 1fr; max-width: 360px; margin: 0 auto; gap: 1.25rem; } }

.lib-bookcard {
  display: flex; flex-direction: column; text-align: center; height: 100%;
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--lib-border); border-radius: 16px; padding: 1.1rem;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.lib-bookcard:hover { transform: translateY(-4px); border-color: var(--lib-gold); box-shadow: 0 24px 52px rgba(0,0,0,.48); }
.lib-bookcard-cover {
  aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; margin-bottom: .9rem;
  background: #0a1322; display: flex; align-items: center; justify-content: center;
}
/* contain: mostra a capa inteira sem cortar o título (capas atuais são paisagem;
   quando o cliente subir capas 3:4 reais, preenche o quadro igual à página do curso). */
.lib-bookcard-cover img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s ease; }
.lib-bookcard:hover .lib-bookcard-cover img { transform: scale(1.04); }
.lib-bookcard-cover .ph { color: var(--lib-gold); opacity: .55; font-size: 2rem; }
.lib-bookcard-title {
  font-family: 'Inter', system-ui, sans-serif; font-size: 1rem; font-weight: 700;
  color: #fff; margin: 0 0 .25rem; line-height: 1.3;
}
.lib-bookcard-sub { font-size: .8rem; color: var(--lib-muted); margin: 0 0 .5rem; line-height: 1.4; }
.lib-bookcard-meta { margin-top: auto; font-size: .72rem; color: var(--lib-gold); letter-spacing: .04em; }

/* ─── Card de livro (estilo Netflix: pôster vertical + título sobreposto) ── */
.lib-card {
  position: relative; scroll-snap-align: start; display: block;
  aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: #0a1322; border: 1px solid var(--lib-border-2);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.lib-card:hover {
  transform: scale(1.045); z-index: 3;
  border-color: var(--lib-gold); box-shadow: var(--lib-shadow);
}
.lib-card-cover { position: absolute; inset: 0; }
.lib-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.lib-card:hover .lib-card-cover img { transform: scale(1.07); }
.lib-card-cover .ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--lib-gold); opacity: .5; font-size: 2rem;
}
.lib-card-title {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 2.4rem .95rem .85rem;
  background: linear-gradient(to top, rgba(4,8,15,.94) 12%, rgba(4,8,15,.65) 48%, transparent 100%);
}
.lib-card-title h3 {
  margin: 0; color: #fff; font-weight: 700; line-height: 1.2;
  font-size: 1.05rem; text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.lib-card.guide .lib-card-title h3 { font-size: .9rem; }
.lib-card.guide .lib-card-title { padding: 2rem .8rem .7rem; }

/* ─── Detalhe do livro ───────────────────────────────────────────────────── */
.lib-book-hero { display: grid; grid-template-columns: 280px 1fr; gap: 2.5rem; padding: clamp(2rem, 5vw, 3.5rem) 0; align-items: start; }
.lib-book-cover {
  aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden;
  box-shadow: var(--lib-shadow); border: 1px solid var(--lib-border); background: #0a1322;
  display: flex; align-items: center; justify-content: center;
}
.lib-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.lib-book-info h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); color: #fff; margin: .4rem 0 .6rem; }
.lib-book-info .sub { color: var(--lib-gold-2); font-size: 1.05rem; margin-bottom: 1rem; }
.lib-book-info .desc { color: var(--lib-muted); font-size: 1rem; margin-bottom: 1.4rem; }
.lib-book-meta { display: flex; gap: 1.6rem; flex-wrap: wrap; margin-bottom: 1.6rem; color: var(--lib-muted); font-size: .85rem; }
.lib-book-meta b { color: var(--lib-text); }

/* Lista de capítulos */
.lib-chapters { margin-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.lib-chapter-item {
  display: flex; align-items: center; gap: 1rem;
  background: var(--lib-surface); border: 1px solid var(--lib-border-2);
  border-radius: 12px; padding: .9rem 1.1rem; transition: border-color .18s, background .18s;
}
.lib-chapter-item:hover { border-color: var(--lib-border); background: var(--lib-surface-2); }
.lib-chapter-item .idx { font-family: 'Playfair Display', serif; color: var(--lib-gold); font-size: 1.1rem; min-width: 28px; }
.lib-chapter-item .t { flex: 1; color: var(--lib-text); font-weight: 500; }
.lib-chapter-item .free { font-size: .68rem; color: var(--lib-gold-2); border: 1px solid var(--lib-border); border-radius: 999px; padding: .15rem .6rem; }

/* ─── Leitor de capítulo ─────────────────────────────────────────────────── */
.lib-reader { padding: clamp(2rem, 5vw, 3.5rem) 0 4rem; }
.lib-reader-head { max-width: 760px; margin: 0 auto 2rem; text-align: center; }
.lib-breadcrumb { font-size: .78rem; color: var(--lib-muted); margin-bottom: 1rem; }
.lib-breadcrumb a:hover { color: var(--lib-gold-2); }
.lib-reader-head h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); color: #fff; margin: .4rem 0; }
.lib-reader-head .book { color: var(--lib-gold-2); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }

.lib-article {
  max-width: 720px; margin: 0 auto;
  font-size: 1.08rem; line-height: 1.85; color: #dde5ef;
}
.lib-article h1, .lib-article h2, .lib-article h3 { color: #fff; margin: 2rem 0 .8rem; }
.lib-article h2 { font-size: 1.6rem; } .lib-article h3 { font-size: 1.3rem; }
.lib-article p { margin: 0 0 1.3rem; }
.lib-article a { color: var(--lib-gold-2); text-decoration: underline; }
.lib-article img { max-width: 100%; height: auto; border-radius: 12px; margin: 1.5rem 0; box-shadow: var(--lib-shadow); }
.lib-article ul, .lib-article ol { margin: 0 0 1.3rem 1.3rem; }
.lib-article li { margin-bottom: .5rem; }
.lib-article blockquote {
  border-left: 3px solid var(--lib-gold); margin: 1.5rem 0; padding: .4rem 0 .4rem 1.4rem;
  color: var(--lib-gold-2); font-style: italic; font-family: 'Playfair Display', serif; font-size: 1.2rem;
}

/* Navegação prev/next */
.lib-reader-nav {
  max-width: 720px; margin: 3rem auto 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* CTA curso ao final */
.lib-cta-course {
  max-width: 760px; margin: 3rem auto 0; text-align: center;
  background: linear-gradient(160deg, rgba(212,175,55,.10), rgba(255,255,255,.02));
  border: 1px solid var(--lib-border); border-radius: 18px; padding: 2.4rem 1.5rem;
}
.lib-cta-course h3 { font-size: 1.5rem; color: #fff; margin: 0 0 .6rem; }
.lib-cta-course p { color: var(--lib-muted); margin: 0 0 1.4rem; }

/* Botão flutuante "Conhecer curso" */
.lib-float-cta {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 60;
  box-shadow: 0 12px 30px rgba(212,175,55,.35);
}

/* ─── Leitor de PDF ──────────────────────────────────────────────────────── */
.lib-reader-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 1.2rem 0 2.6rem; padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--lib-border-2); flex-wrap: wrap;
}
.lib-reader-title { font-size: clamp(1.5rem, 3.2vw, 2.2rem); color: #fff; margin: 0; line-height: 1.15; }
.lib-tag-unlocked, .lib-tag-preview {
  font-size: .74rem; font-weight: 600; padding: .35rem .85rem; border-radius: 999px; white-space: nowrap;
}
.lib-tag-unlocked { color: #0c1f12; background: linear-gradient(135deg, #7bdca0, #34c97a); }
.lib-tag-preview  { color: var(--lib-gold-2); border: 1px solid var(--lib-border); }

.lib-pdf {
  background: #0a1322; border: 1px solid var(--lib-border-2); border-radius: 14px;
  overflow: hidden; box-shadow: var(--lib-shadow);
}
.lib-pdf:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.lib-pdf-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem .8rem; background: rgba(255,255,255,.04); border-bottom: 1px solid var(--lib-border-2);
}
.lib-pdf-nav, .lib-pdf-tools { display: flex; align-items: center; gap: .4rem; }
.lib-pdf-btn {
  background: var(--lib-surface-2); color: var(--lib-text); border: 1px solid var(--lib-border-2);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.lib-pdf-btn:hover { border-color: var(--lib-gold); color: var(--lib-gold-2); }
.lib-pdf-page { color: var(--lib-muted); font-size: .85rem; padding: 0 .5rem; min-width: 64px; text-align: center; }
.lib-pdf-stage {
  position: relative; overflow: auto; padding: 1rem; min-height: 50vh; max-height: 80vh;
  display: flex; align-items: flex-start; justify-content: center; background: #060c16;
}
.lib-pdf:fullscreen .lib-pdf-stage { max-height: none; flex: 1; }
.lib-pdf-stage canvas { border-radius: 4px; box-shadow: 0 8px 28px rgba(0,0,0,.5); background: #fff; }
.lib-pdf-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: var(--lib-muted); }

/* ─── Gate de leitura (captura de lead) ──────────────────────────────────── */
.lib-article-wrap { position: relative; }
.lib-article.gated {
  max-height: 340px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 48%, transparent 96%);
          mask-image: linear-gradient(#000 48%, transparent 96%);
}
.lib-gate { margin-top: -70px; position: relative; z-index: 2; display: flex; justify-content: center; padding: 0 .5rem; }
/* Variante usada na página de leitura (card centralizado, não sobreposto) */
.lib-gate--standalone { margin: 1rem 0 4rem; }

.lib-gate-card {
  width: 100%; max-width: 600px; text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(212,175,55,.10), transparent 60%),
    linear-gradient(165deg, #0f1f37, #0a1322);
  border: 1px solid var(--lib-border); border-radius: 22px;
  padding: clamp(2rem, 5vw, 3.2rem) clamp(1.4rem, 5vw, 2.8rem);
  box-shadow: var(--lib-shadow);
}
.lib-gate-icon {
  width: 60px; height: 60px; margin: 0 auto 1.2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  color: var(--lib-gold-2); background: rgba(212,175,55,.12); border: 1px solid var(--lib-border);
}
.lib-gate-card h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); color: #fff; margin: .6rem 0 .7rem; }
.lib-gate-card > p { color: var(--lib-muted); font-size: .95rem; margin: 0 auto 2rem; max-width: 440px; }

.lib-gate-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; text-align: left; }
.lib-gate-form > button, .lib-gate-form > .lib-gate-note { grid-column: 1 / -1; }
.lib-field { position: relative; }
.lib-field input, .lib-field select {
  width: 100%; height: 58px; font-size: .95rem;
  background: rgba(255,255,255,.045); color: var(--lib-text);
  border: 1px solid var(--lib-border-2); border-radius: 12px; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.lib-field input  { padding: 1.45rem .95rem .5rem; }
.lib-field select {
  padding: 0 2.4rem 0 .95rem; color: var(--lib-muted); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23d4af37'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center;
}
.lib-field input:focus, .lib-field select:focus {
  border-color: var(--lib-gold); background: rgba(255,255,255,.07);
  box-shadow: 0 0 0 3px rgba(212,175,55,.14);
}
.lib-field label {
  position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
  font-size: .95rem; color: var(--lib-muted); pointer-events: none; transition: .15s ease;
}
.lib-field input:focus + label,
.lib-field input:not(:placeholder-shown) + label {
  top: 1.1rem; transform: none; font-size: .68rem; color: var(--lib-gold-2); letter-spacing: .05em; text-transform: uppercase;
}
.lib-gate-form > button { margin-top: .5rem; height: 54px; }
.lib-gate-note { font-size: .76rem; color: var(--lib-muted); text-align: center; margin: .4rem 0 0; }
@media (max-width: 540px) { .lib-gate-form { grid-template-columns: 1fr; } }

/* ─── Bloco institucional ────────────────────────────────────────────────── */
.lib-institutional {
  border-top: 1px solid var(--lib-border-2); margin-top: 2rem;
  padding: clamp(2.5rem, 5vw, 3.5rem) 0; text-align: center;
}
.lib-institutional h2 { font-size: clamp(1.4rem, 3vw, 2rem); color: #fff; margin-bottom: .8rem; }
.lib-institutional p { max-width: 680px; margin: 0 auto 1.5rem; color: var(--lib-muted); }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.lib-footer {
  background: #050a12; border-top: 1px solid var(--lib-border-2);
  padding: 2.5rem 0; color: var(--lib-muted); font-size: .82rem;
}
.lib-footer .lib-container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.lib-footer a:hover { color: var(--lib-gold-2); }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.lib-empty { text-align: center; padding: 4rem 1rem; color: var(--lib-muted); }
.lib-empty i { color: var(--lib-gold); opacity: .5; }

/* ─── Responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .lib-stats { grid-template-columns: repeat(2, 1fr); gap: 1.4rem; }
  .lib-book-hero { grid-template-columns: 1fr; }
  .lib-book-cover { max-width: 240px; margin: 0 auto; }
  .lib-nav { display: none; }
  .lib-nav.open {
    display: flex; flex-direction: column; align-items: flex-start; gap: .9rem;
    position: absolute; top: 68px; left: 0; right: 0;
    background: rgba(7,13,23,.97); padding: 1.2rem 1.25rem; border-bottom: 1px solid var(--lib-border-2);
  }
  .lib-nav-toggle { display: block; }
}
