/* Shared Home Page Books EB layout.
   Domain colors and phone background positioning belong in book-colors.css.
*/

/* Retain the module's image URL, but paint it only inside the hero. */
.region-content .node--view-mode-homepage-books-eb.book-home {
  color: var(--book-text, #fff);
  background-color: var(--book-surface, #070808);
  background-size: 0 0;
  background-repeat: no-repeat;
}

.book-home,
.book-home * {
  box-sizing: border-box;
}

/* Hero background and shared desktop proportions. */
.book-home > .book-hero {
  display: grid;
  min-width: 0;
  background-image: inherit;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center top;
  background-color: var(--book-surface, #070808);
}

/* Remove Bootstrap clearfix pseudo-elements from the grid wrappers. */
.book-home > .book-hero::after,
.book-home .book-hero__content::before,
.book-home .book-hero__content::after {
  content: none;
}

/* Reserve an 8:3 hero area while allowing additional space for content. */
.book-home > .book-hero::before {
  content: "";
  display: block;
  grid-area: 1 / 1;
  align-self: start;
  width: 100%;
  aspect-ratio: 8 / 3;
  pointer-events: none;
}

/* Desktop: cover and review share a center line.
   Reserve the rightmost 25% of the hero as open background.
*/
.book-home .book-hero__content {
  display: grid;
  grid-area: 1 / 1;
  align-self: start;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: clamp(24px, 4vw, 80px);
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: clamp(24px, 3vw, 60px);
  padding-right: 25%;
}

/* Reset Bootstrap region widths and floats within this layout. */
.book-home .book-hero__cover,
.book-home .book-hero__review,
.book-home > .book-purchase {
  float: none;
  width: auto;
  min-width: 0;
  padding: 0;
}

/* Center both regions within the same content row. */
.book-home .book-hero__cover,
.book-home .book-hero__review {
  align-self: center;
}

/* Book cover. */
.book-home .book-hero__cover .field--name-field-image img {
  display: block;
  float: none;
  width: 100%;
  max-width: min(325px, 21vw);
  height: auto;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--book-cover-border, #5b5b5b);
  box-shadow: 0 0 15px #0008;
}

/* Review slider. */
.book-home .flexslider-field-wrapper {
  margin: 0;
}

.book-home .flexslider {
  position: relative;
  inset: auto;
  transform: none;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
}

.book-home .flexslider .slides {
  margin: 0;
  padding: clamp(20px, 2.5vw, 40px);
  border: 0;
  border-radius: 12px;
  background-color: var(--book-review-surface, #070707a6);
  color: var(--book-text, #fff);
  font-size: 16px;
  font-weight: 700;
}

.book-home .flexslider .slides > li {
  overflow-wrap: anywhere;
}

.book-home .flexslider .field--name-field-tagline {
  margin: 0 0 12px;
  padding: 0 0 12px;
  font-size: clamp(26px, 2.6vw, 48px);
  line-height: 1.1;
  border-bottom: 2px solid var(--book-accent, #c00);
  text-shadow: 0 0 8px #000;
}

.book-home .flexslider .field--name-field-author {
  color: var(--book-author, #ebe9e9);
  font-size: clamp(18px, 1.4vw, 26px);
  line-height: 1.25;
}

.book-home .flexslider .field--name-field-title-publication {
  color: var(--book-publication, aqua);
  font-size: clamp(20px, 1.6vw, 30px);
  line-height: 1.2;
  font-style: italic;
}

/* Optional release countdown. */
.book-home .field--name-field-release-counter {
  margin-top: 16px;
  color: var(--book-timer, #fff);
  font-size: clamp(16px, 1.5vw, 24px);
}

.book-home .field-timer-jquery-countdown,
.book-home .field-timer-jquery-countdown-led.is-countdown {
  position: static;
  transform: none;
  margin: 0;
  padding: 8px;
  max-width: 100%;
  border: 1px solid var(--book-accent, #c00);
  border-radius: 6px;
  color: inherit;
  background-color: var(--book-review-surface, #070707a6);
}

/* Purchase section remains below the hero. */
.book-home > .book-purchase {
  padding: clamp(24px, 4vw, 60px);
  background-color: var(--book-purchase-surface, #000);
}

.book-home .field--name-dynamic-block-fieldnode-more-buy-buttons {
  float: none;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  font-size: 16px;
}

.book-home .field--name-dynamic-block-fieldnode-more-buy-buttons > .field--label {
  margin: 0 0 32px;
  padding-bottom: 16px;
  color: var(--book-heading, wheat);
  border-bottom: 1px solid var(--book-divider, #ccc);
  font-size: clamp(28px, 3vw, 48px);
  font-weight: 300;
  line-height: 1.2;
}

.book-home .views-field-field-purchase-links {
  float: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.book-home .views-field-field-purchase-links > .field-content {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.book-home .views-field-field-purchase-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--book-button-border, #ccc);
  border-radius: 6px;
  background-color: var(--book-button, #333);
  color: var(--book-button-text, #fff);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.book-home .views-field-field-purchase-links a:hover,
.book-home .views-field-field-purchase-links a:focus-visible {
  color: var(--book-button-hover-text, #fff);
  background-color: var(--book-button-hover, #222);
  border-color: var(--book-button-hover-border, #fff);
  text-decoration: underline;
}

/* Tablets: release the extra right-side space for readable reviews. */
@media (max-width: 1024px) {
  .book-home .book-hero__content {
    padding-right: clamp(24px, 3vw, 60px);
  }

  .book-home .views-field-field-purchase-links > .field-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones: stack the cover and review. */
@media (max-width: 767px) {
  .book-home .book-hero__content {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 24px 20px;
  }

  .book-home .book-hero__cover .field--name-field-image img {
    width: 80%;
    max-width: 280px;
  }

  /* Preserve full background height; crop sides to fill the tall panel. */
  .book-home > .book-hero {
    background-size: auto 100%;
    background-position: var(--book-mobile-position, center top);
  }
}

/* Small phones: one purchase button per row. */
@media (max-width: 460px) {
  .book-home .views-field-field-purchase-links > .field-content {
    grid-template-columns: minmax(0, 1fr);
  }
}