/* Cartilha do Candidato 2027 - Flipbook fullpage (premium clean) */
html,
body.cartilha-fullpage-body {
  margin: 0;
  padding: 0;
}

body.cartilha-fullpage-body {
  min-height: 100vh;
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
  color: #16324f;
  background:
    radial-gradient(1100px 620px at 50% -8%, rgba(29, 111, 66, 0.08), rgba(29, 111, 66, 0)),
    linear-gradient(180deg, #f7f9fc 0%, #e8edf3 100%);
}

/* Topbar */
.cartilha-topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
}

.cartilha-topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #1d6f42;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

.cartilha-topbar__back:hover {
  color: #15532f;
}

.cartilha-topbar__title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.2px;
  text-align: center;
}

.cartilha-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cartilha-topbar__label {
  display: inline;
}

/* Estágio principal */
.cartilha-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 61px);
  box-sizing: border-box;
  padding: 1rem 1.25rem 1.5rem;
}

.cartilha-flipbook-wrap {
  margin: 0 auto;
  /* largura calculada via JS para o livro caber na tela */
}

.cartilha-flipbook {
  background: #fff;
  box-shadow: 0 26px 64px rgba(15, 36, 60, 0.30), 0 4px 14px rgba(15, 36, 60, 0.12);
}

.cartilha-flipbook .page {
  overflow: hidden;
  background: #fff;
}

.cartilha-flipbook .page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  -webkit-user-drag: none;
  user-select: none;
}

/* Controles */
.cartilha-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.btn-cartilha {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: #1d6f42;
  padding: 0.65rem 1.15rem;
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.btn-cartilha:hover,
.btn-cartilha:focus {
  background: #15532f;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(29, 111, 66, 0.25);
}

.btn-cartilha:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-cartilha--round {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
}

.btn-cartilha--ghost {
  background: #ffffff;
  color: #1d6f42;
  border: 1px solid #d7e4dc;
}

.btn-cartilha--ghost:hover,
.btn-cartilha--ghost:focus {
  background: #eef7f1;
  box-shadow: 0 8px 18px rgba(29, 111, 66, 0.12);
}

.btn-cartilha--sm {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

.cartilha-controls .cartilha-indicator {
  min-width: 88px;
  text-align: center;
  font-weight: 600;
  color: #16324f;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
}

.cartilha-hint {
  margin: 0.75rem 0 0;
  text-align: center;
  color: #8296a8;
  font-size: 0.82rem;
}

/* Lightbox (zoom) */
.cartilha-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100003;
  background: rgba(8, 18, 28, 0.90);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 1rem;
}

.cartilha-lightbox.is-open {
  display: flex;
}

.cartilha-lightbox .cartilha-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cartilha-lightbox .cartilha-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.cartilha-lightbox .cartilha-lightbox-hint {
  color: #cfd8e0;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.cartilha-lightbox .cartilha-lightbox-viewport {
  flex: 1 1 auto;
  width: 100%;
  max-width: 900px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.cartilha-lightbox .cartilha-lightbox-viewport img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  .cartilha-topbar {
    padding: 0.6rem 0.9rem;
  }

  .cartilha-topbar__title {
    display: none;
  }

  .cartilha-topbar__label {
    display: none;
  }

  .cartilha-stage {
    min-height: calc(100vh - 53px);
    padding: 0.75rem 0.75rem 1.25rem;
  }

  .btn-cartilha--round {
    width: 46px;
    height: 46px;
  }
}
