/* Site extras — matches Next.js globals.css behavior */

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(45, 212, 191, 0.3);
  color: inherit;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes scrollDown {
  0% { transform: translateY(-16px); opacity: 0; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(48px); opacity: 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.hero-particle {
  animation: float 10s ease-in-out infinite;
}

.scroll-line {
  animation: scrollDown 1.5s ease-in-out infinite;
}

.loading-ring {
  animation: spin 1s linear infinite;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero slide transitions */
.hero-slide-content {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-slide-content.is-transitioning {
  opacity: 0;
  transform: translateY(1rem);
}

/* Book detail — GRATIS ribbon */
.book-cover-bg {
  position: relative;
}

.book-gratis-badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 12;
  width: auto;
  height: 2.1rem;
  max-width: 42%;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.28));
}

@media (min-width: 640px) {
  .book-gratis-badge {
    height: 2.35rem;
    top: 0.85rem;
    right: 0.85rem;
  }
}

/* Loading screen */
#loading-screen.is-complete {
  opacity: 0;
  pointer-events: none;
}

#loading-screen.is-hidden {
  display: none;
}

/* Mobile menu */
#mobile-menu-backdrop.open,
#mobile-menu-panel.open {
  pointer-events: auto;
  opacity: 1;
}

#mobile-menu-panel.open {
  transform: translateY(0) scale(1);
}

/* Book grid stagger */
.book-grid-item {
  position: relative;
  animation: fadeInUp 0.5s ease-out both;
  overflow: visible;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-grid-item:nth-child(1) { animation-delay: 0ms; }
.book-grid-item:nth-child(2) { animation-delay: 100ms; }
.book-grid-item:nth-child(3) { animation-delay: 200ms; }
.book-grid-item:nth-child(4) { animation-delay: 300ms; }

/* Book card "Details ansehen" pill */
a.book-details-pill {
  background: #ffc421;
  padding: 2px 10px;
  border-radius: 25px;
  color: #000000;
  text-decoration: none;
}

a.book-details-pill:hover,
a.book-details-pill:focus-visible {
  color: #000000;
  background: #ffcf52;
}

/* Book detail CTA: "Buch kaufen / ansehen" — yellow in dark mode */
html.dark a.book-official-cta {
  background: #ffc421 !important;
  color: #000000 !important;
}
html.dark a.book-official-cta:hover,
html.dark a.book-official-cta:focus-visible {
  background: #ffcf52 !important;
  color: #000000 !important;
}

/* GRATIS badge — direct child of .book-grid-item (above the card) */
.book-grid-item > .book-gratis-badge--grid {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 40;
    width: auto;
    height: 24px;
    max-width: 100%;
    transform: translate(-31%, -43%);
    pointer-events: none;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

@media (min-width: 640px) {
  .book-grid-item > .book-gratis-badge--grid {
    height: 22px;
    max-width: 4.75rem;
    transform: translate(10%, -24%);
  }
}

@media (min-width: 1024px) {
  .book-grid-item > .book-gratis-badge--grid {
    height: 35px;
    max-width: 100%;
    transform: translate(-48%, -40%);
  }
}

/* Book detail: description (300 chars) + inline … Mehr anzeigen */
.book-description {
  margin-top: 1.5rem;
}

.book-description__text {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: #475569;
  word-wrap: break-word;
}

.dark .book-description__text {
  color: #ffffff;
}

.book-description__suffix {
  white-space: nowrap;
}

.book-description__ellipsis {
  color: inherit;
  font-weight: inherit;
  font-size: 0.9375rem;
}

.book-description__toggle {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: #14b8a6;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  white-space: nowrap;
  cursor: pointer;
  vertical-align: baseline;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.book-description__toggle-icon {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.2em;
  vertical-align: -0.1em;
  transition: transform 0.25s ease;
}

.book-description.is-expanded .book-description__suffix {
  display: block;
  margin-top: 0.875rem;
  white-space: normal;
}

.book-description.is-expanded .book-description__toggle {
  font-size: 0.875rem;
}

.book-description.is-expanded .book-description__toggle-icon {
  transform: rotate(180deg);
}

.book-description.is-expanded .book-description__ellipsis {
  display: none;
}

.book-description__toggle:hover,
.book-description__toggle:focus-visible {
  color: #2dd4bf;
  opacity: 0.95;
  outline: none;
}

.book-description__toggle:focus-visible {
  text-decoration-thickness: 2px;
}

@media (min-width: 768px) {
  .book-description__text {
    font-size: 1.0625rem;
    line-height: 1.75;
  }

  .book-description__toggle {
    font-size: 0.875rem;
  }

  .book-description.is-expanded .book-description__toggle {
    font-size: 0.9375rem;
  }
}

/* Book detail: Kurzfassung panel */
.book-summary-panel {
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(45, 212, 191, 0.28);
  background-color: #f0fdfa;
}

@media (min-width: 640px) {
  .book-summary-panel {
    padding: 2rem;
  }
}

html.dark .book-summary-panel {
    border-color: #0f172a;
    background-color: #0f172a;
}

.book-summary-page-title {
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #0d9488;
}

html.dark .book-summary-page-title {
  color: #2dd4bf;
}

.book-summary-content {
  color: #334155;
}

html.dark .book-summary-content {
  color: #cbd5e1;
}

.book-summary-h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
}

html.dark .book-summary-h3 {
  color: #f8fafc;
}

.book-summary-h3:first-child {
  margin-top: 0;
}

.book-summary-h4 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: #134e4a;
}

html.dark .book-summary-h4 {
  color: #5eead4;
}

.book-summary-p {
  margin: 0 0 1rem;
  font-size: 15px;
  line-height: 1.7;
}

.book-summary-p:last-child {
  margin-bottom: 0;
}

.book-summary-list {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
  list-style: disc;
}

.book-summary-list li {
  margin-bottom: 0.5rem;
  font-size: 15px;
  line-height: 1.65;
}

.book-summary-list li:last-child {
  margin-bottom: 0;
}

/* Author library notice — light & dark (html.dark) */
.book-summary-author {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html.dark .book-summary-author {
  border-color: #475569;
  background-color: #1e293b;
  color: #e2e8f0;
  box-shadow: none;
}

.book-summary-author__title {
  margin: 0 0 0.625rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: #0f766e;
}

html.dark .book-summary-author__title {
  color: #2dd4bf;
}

.book-summary-author__text {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #475569;
}

html.dark .book-summary-author__text {
  color: #cbd5e1;
}

.book-summary-author__text--muted {
  color: #64748b;
}

html.dark .book-summary-author__text--muted {
  color: #94a3b8;
}

.book-summary-author__text strong {
  font-weight: 600;
  color: #0f172a;
}

html.dark .book-summary-author__text strong {
  color: #f8fafc;
}

.book-summary-author__list {
  margin: 0 0 0.75rem 1.25rem;
  padding: 0;
  list-style: disc;
}

.book-summary-author__list li {
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.book-summary-author__list li:last-child {
  margin-bottom: 0;
}

.book-summary-author__cta {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
}

.book-summary-author a.book-summary-author__link {
  color: #0d9488;
  text-decoration: none;
  transition: color 0.2s ease;
}

.book-summary-author a.book-summary-author__link:hover {
  color: #0f766e;
  text-decoration: underline;
}

html.dark .book-summary-author a.book-summary-author__link {
  color: #2dd4bf;
}

html.dark .book-summary-author a.book-summary-author__link:hover {
  color: #5eead4;
}

.book-summary-author__link--bold {
  font-weight: 600;
}

/* Book cover backdrop (detail page + shared) */
.book-cover-bg {
  overflow: visible;
  background-image: linear-gradient(2deg, #d9d7d7, #f0efec);
  background-color: #8a8a8a;
}

.dark .book-cover-bg {
  background-image: linear-gradient(293deg, #87919f, #c9d3df);
  background-color: #808080;
}

/* GRATIS ribbon — on top of .book-cover-bg, top-right (screenshot) */
.book-cover-bg .book-gratis-badge {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 30;
    width: auto;
    height: 28px;
    max-width: 100%;
    transform: translate(-25%, -40%);
    pointer-events: none;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4));
}

@media (min-width: 640px) {
  .book-cover-bg .book-gratis-badge {
    height: 29px;
    max-width: 100%;
    transform: translate(-18%, -39%);
  }
}

/* Hardcover images — full bleed via book-3d.css */

/* Search: outside .reveal — sits above book grid stacking context */
#library-search {
  position: relative;
  z-index: 50;
}

#search-inline-results {
  position: absolute;
  z-index: 60;
}

#books-grid-wrap {
  position: relative;
  z-index: 0;
  transition: opacity 0.25s ease;
}

.reveal {
  overflow: visible;
}
