/* Carlos Bernardo — convite editorial do livro
   Abre a cada carregamento, pode ser minimizado e respeita os dois temas. */

.book-popup[hidden],
.book-popup-reopen[hidden] {
  display: none;
}

body.book-popup-open {
  overflow: hidden;
}

.book-popup {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 18%, rgb(var(--theme-primary) / 0.14), transparent 28rem),
    rgb(7 7 7 / 0.82);
  backdrop-filter: blur(14px) saturate(0.8);
  -webkit-backdrop-filter: blur(14px) saturate(0.8);
  animation: book-popup-backdrop-in 420ms ease both;
}

.book-popup__dialog {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(15rem, 0.78fr) minmax(0, 1.22fr);
  width: min(61rem, 100%);
  max-height: min(45rem, calc(100dvh - 2rem));
  overflow: auto;
  color: rgb(var(--theme-on-surface));
  border: 1px solid rgb(var(--theme-primary) / 0.34);
  border-radius: 1.75rem;
  background: rgb(var(--theme-surface-container-lowest));
  box-shadow:
    0 2rem 6rem rgb(0 0 0 / 0.56),
    inset 0 0 0 1px rgb(var(--theme-on-surface) / 0.035);
  animation: book-popup-dialog-in 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book-popup__dialog:focus {
  outline: none;
}

.book-popup__dialog::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -5rem;
  bottom: -7rem;
  width: 22rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--theme-primary) / 0.1), transparent 68%);
  pointer-events: none;
}

.book-popup__visual {
  position: relative;
  display: grid;
  min-height: 31rem;
  place-items: center;
  overflow: hidden;
  border-radius: 1.7rem 0 0 1.7rem;
  background:
    linear-gradient(150deg, rgb(131 182 236 / 0.08), transparent 44%),
    radial-gradient(circle at 50% 28%, rgb(131 182 236 / 0.2), transparent 42%),
    #0a1a2e;
}

.book-popup__visual::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(90deg, transparent 49.5%, rgb(255 255 255 / 0.14) 50%, transparent 50.5%),
    repeating-linear-gradient(0deg, transparent 0 5px, rgb(255 255 255 / 0.05) 6px);
  pointer-events: none;
}

.book-popup__book {
  position: relative;
  width: 12.25rem;
  aspect-ratio: 0.68;
  overflow: hidden;
  transform: rotate(-4deg) perspective(48rem) rotateY(8deg);
  transform-origin: left center;
  border: 1px solid rgb(131 182 236 / 0.38);
  border-radius: 0.25rem 0.7rem 0.7rem 0.25rem;
  background: #0b1420;
  box-shadow:
    -0.55rem 0 0 #0c0908,
    -0.72rem 0 0 rgb(131 182 236 / 0.34),
    1.6rem 2rem 3rem rgb(0 0 0 / 0.48);
}

.book-popup__book::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0.5rem;
  right: -0.45rem;
  bottom: 0.5rem;
  width: 0.55rem;
  border-radius: 0 0.35rem 0.35rem 0;
  background: repeating-linear-gradient(0deg, #eee5d9 0 2px, #cbbfb2 3px);
}

.book-popup__cover-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-popup__content {
  align-self: center;
  padding: clamp(2.3rem, 5vw, 4.75rem) clamp(1.4rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3.5rem);
}

.book-popup__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1.15rem;
  color: rgb(var(--theme-primary));
  font-family: Inter, Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.book-popup__eyebrow::before {
  content: "";
  width: 1.9rem;
  height: 1px;
  background: currentColor;
}

.book-popup__title {
  max-width: 10ch;
  margin: 0;
  color: rgb(var(--theme-on-surface));
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-size: clamp(2.5rem, 6vw, 4.75rem);
  font-style: italic;
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.book-popup__body {
  max-width: 34rem;
  margin: 1.5rem 0 0;
  color: rgb(var(--theme-on-surface-variant));
  font-family: Inter, Arial, sans-serif;
  font-size: clamp(0.98rem, 1.6vw, 1.08rem);
  line-height: 1.65;
}

.book-popup__features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.55rem 0 0;
  padding: 0;
  list-style: none;
}

.book-popup__features li {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: rgb(var(--theme-on-surface));
  border: 1px solid rgb(var(--theme-outline-variant) / 0.72);
  border-radius: 999px;
  background: rgb(var(--theme-surface-container-low) / 0.72);
  font-family: Inter, Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
}

.book-popup__features li::before {
  content: "";
  flex: 0 0 0.38rem;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: rgb(var(--theme-primary));
  box-shadow: 0 0 0 0.22rem rgb(var(--theme-primary) / 0.12);
}

.book-popup__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.85rem;
}

.book-popup__primary,
.book-popup__secondary,
.book-popup__close,
.book-popup-reopen {
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-family: Inter, Arial, sans-serif;
  font-weight: 650;
}

.book-popup__primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.9rem 1.2rem;
  color: rgb(var(--theme-on-primary));
  border-radius: 999px;
  background: rgb(var(--theme-primary));
  box-shadow: 0 0.9rem 2rem rgb(var(--theme-primary) / 0.2);
  font-size: 0.82rem;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.book-popup__primary-arrow {
  font-size: 1.05rem;
  line-height: 1;
}

.book-popup__primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 1.15rem 2.5rem rgb(var(--theme-primary) / 0.28);
}

.book-popup__secondary {
  padding: 0.75rem 0.2rem;
  color: rgb(var(--theme-on-surface-variant));
  border: 0;
  border-bottom: 1px solid rgb(var(--theme-outline) / 0.42);
  background: transparent;
  font-size: 0.78rem;
  transition: color 200ms ease, border-color 200ms ease;
}

.book-popup__secondary:hover {
  color: rgb(var(--theme-on-surface));
  border-color: rgb(var(--theme-primary));
}

.book-popup__close {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.75rem;
  padding: 0;
  place-items: center;
  color: rgb(var(--theme-on-surface));
  border: 1px solid rgb(var(--theme-outline-variant) / 0.72);
  border-radius: 50%;
  background: rgb(var(--theme-surface-container-lowest) / 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.book-popup__close:hover {
  color: rgb(var(--theme-primary));
  border-color: rgb(var(--theme-primary));
  transform: rotate(4deg);
}

.book-popup__close .material-symbols-outlined {
  font-size: 1.2rem;
}

.book-popup-reopen {
  position: fixed;
  z-index: 80;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1rem 0.75rem 0.78rem;
  color: rgb(var(--theme-on-primary));
  border: 1px solid rgb(var(--theme-primary));
  border-radius: 999px;
  background: rgb(var(--theme-primary));
  box-shadow: 0 1rem 2.5rem rgb(0 0 0 / 0.28);
  font-size: 0.78rem;
  animation: book-popup-chip-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.book-popup-reopen .material-symbols-outlined {
  font-size: 1.15rem;
}

@keyframes book-popup-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes book-popup-dialog-in {
  from { opacity: 0; transform: translateY(1.5rem) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes book-popup-chip-in {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .book-popup {
    align-items: start;
    padding: 0.75rem;
  }

  .book-popup__dialog {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 1.25rem;
  }

  .book-popup__visual {
    min-height: 11.5rem;
    border-radius: 1.2rem 1.2rem 0 0;
  }

  .book-popup__book {
    width: 6.9rem;
    transform: rotate(-3deg) perspective(40rem) rotateY(8deg);
  }

  .book-popup__content {
    padding: 1.65rem 1.2rem 1.3rem;
  }

  .book-popup__eyebrow {
    margin-bottom: 0.8rem;
    font-size: 0.62rem;
  }

  .book-popup__title {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
  }

  .book-popup__body {
    margin-top: 1rem;
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .book-popup__features {
    margin-top: 1rem;
  }

  .book-popup__features li {
    min-height: 2rem;
    padding: 0.4rem 0.62rem;
    font-size: 0.67rem;
  }

  .book-popup__actions {
    align-items: stretch;
    margin-top: 1.25rem;
  }

  .book-popup__primary {
    flex: 1 1 100%;
  }

  .book-popup__secondary {
    flex: 1 1 100%;
    border: 0;
    text-align: center;
  }

  .book-popup__close {
    top: 0.75rem;
    right: 0.75rem;
    color: #eef3f8;
    border-color: rgb(255 255 255 / 0.28);
    background: rgb(6 16 28 / 0.7);
  }
}

@media (max-height: 680px) and (max-width: 720px) {
  .book-popup__visual {
    display: none;
  }

  .book-popup__dialog {
    margin-block: auto;
  }

  .book-popup__close {
    color: rgb(var(--theme-on-surface));
    border-color: rgb(var(--theme-outline-variant) / 0.72);
    background: rgb(var(--theme-surface-container-lowest) / 0.82);
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-popup,
  .book-popup__dialog,
  .book-popup-reopen,
  .book-popup__primary,
  .book-popup__close {
    animation: none;
    transition-duration: 0.01ms;
  }
}
