.section-ebook-product {
  --ebook-ink: #12141a;
  --ebook-muted: #5c6472;
  --ebook-line: rgba(18, 20, 26, 0.08);
  --ebook-paper: #ffffff;
  --ebook-surface: #f3f1ec;
  --ebook-accent: #1a5cff;
  --ebook-accent-deep: #0e3fbf;
  --ebook-star: #e6a700;
  --ebook-radius: 24px;
  --ebook-shadow: 0 24px 60px rgba(18, 20, 26, 0.12);
  position: relative;
  padding: clamp(2.5rem, 5vw, 4.5rem) 0;
  background:
    radial-gradient(1200px 500px at 10% 0%, rgba(26, 92, 255, 0.08), transparent 55%),
    radial-gradient(900px 420px at 90% 100%, rgba(18, 20, 26, 0.05), transparent 50%),
    linear-gradient(180deg, #faf9f7 0%, #f0eee8 100%);
  overflow: hidden;
}

.section-ebook-product .container {
  position: relative;
  z-index: 1;
}

.section-ebook-product .ebook-change-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  border: 1px solid rgba(18, 20, 26, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--ebook-ink);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  pointer-events: auto !important;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.section-ebook-product .ebook-change-btn:hover {
  background: #fff;
  box-shadow: 0 8px 20px rgba(18, 20, 26, 0.1);
  transform: translateY(-1px);
}

.section-ebook-product[data-single-ebook="1"] .ebook-change-btn {
  display: none !important;
}

.section-ebook-product .ebook-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 0;
  align-items: stretch;
  background: var(--ebook-paper);
  border: 1px solid var(--ebook-line);
  /*border-radius: calc(var(--ebook-radius) + 4px);*/
  box-shadow: var(--ebook-shadow);
  overflow: hidden;
}

.section-ebook-product .ebook-media {
  position: relative;
  min-height: 100%;
  background: transparent;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.section-ebook-product .ebook-media::before {
  display: none;
}

.section-ebook-product .ebook-cover-frame {
  padding: 30px;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  aspect-ratio: auto;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  transform: none;
  transition: none;
}

.section-ebook-product .ebook-cover-frame:hover {
  transform: none;
  box-shadow: none;
}

.section-ebook-product .ebook-product-image {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  display: block;
}

.section-ebook-product .ebook-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.75rem, 4vw, 3rem);
  background: var(--ebook-paper);
}

.section-ebook-product .ebook-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(26, 92, 255, 0.08);
  color: var(--ebook-accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-ebook-product .ebook-product-title {
  margin: 0 0 1rem;
  color: var(--ebook-ink);
  font-size: clamp(1.85rem, 3.4vw, 2.75rem);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.section-ebook-product .ebook-price-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.9rem;
  margin-bottom: 1.15rem;
}

.section-ebook-product .ebook-price {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 750;
  color: var(--ebook-ink);
  letter-spacing: -0.02em;
}

.section-ebook-product .ebook-rrp {
  font-size: 1.05rem;
  color: #8b93a1;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.section-ebook-product .ebook-save-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: #e8f7ef;
  color: #146c3c;
  font-size: 0.75rem;
  font-weight: 700;
}

.section-ebook-product .ebook-description {
  color: var(--ebook-muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 1.35rem;
  max-width: 38rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-ebook-product .ebook-description p {
  margin-bottom: 0.65rem;
}

.section-ebook-product .ebook-description p:last-child {
  margin-bottom: 0;
}

.section-ebook-product .ebook-reviews {
  margin-bottom: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--ebook-line);
}

.section-ebook-product .ebook-rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
}

.section-ebook-product .ebook-stars {
  color: var(--ebook-star);
  letter-spacing: 0.12em;
  font-size: 1.05rem;
  line-height: 1;
}

.section-ebook-product .ebook-reviews-meta {
  color: var(--ebook-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.section-ebook-product .ebook-reviews-list {
  display: grid;
  gap: 0.75rem;
}

.section-ebook-product .ebook-review-item {
  background: var(--ebook-surface);
  border: 1px solid var(--ebook-line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.section-ebook-product .ebook-review-item strong {
  display: block;
  color: var(--ebook-ink);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.section-ebook-product .ebook-review-item .ebook-stars {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.section-ebook-product .ebook-review-text {
  color: var(--ebook-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.section-ebook-product .ebook-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: auto;
  flex-direction: column;
}

.section-ebook-product .ebook-purchase-btn {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, var(--ebook-accent) 0%, var(--ebook-accent-deep) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  border-radius: 14px;
  padding: 0.95rem 1.55rem;
  cursor: pointer;
  pointer-events: auto !important;
  box-shadow: 0 14px 30px rgba(26, 92, 255, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.section-ebook-product .ebook-purchase-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(26, 92, 255, 0.34);
  filter: brightness(1.03);
}

.section-ebook-product .ebook-purchase-btn:active {
  transform: translateY(0);
}

.section-ebook-product .ebook-download-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
  background: linear-gradient(135deg, #0f9d58 0%, #0b7a44 100%);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  border-radius: 14px;
  padding: 0.95rem 1.55rem;
  cursor: pointer;
  pointer-events: auto !important;
  box-shadow: 0 14px 30px rgba(15, 157, 88, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.section-ebook-product .ebook-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(15, 157, 88, 0.34);
  filter: brightness(1.03);
  color: #fff !important;
  text-decoration: none;
}

.section-ebook-product .ebook-secure-note {
  color: var(--ebook-muted);
  font-size: 0.82rem;
}

.section-ebook-product .ebook-placeholder {
  min-height: 360px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ebook-muted);
  border: none;
  border-radius: 0;
  background: var(--ebook-surface);
  padding: 1.5rem;
  text-align: center;
  font-weight: 500;
}

.section-ebook-product .ebook-details .ebook-placeholder {
  color: var(--ebook-muted);
  border-color: rgba(18, 20, 26, 0.15);
  background: var(--ebook-surface);
  min-height: 120px;
}

@media (max-width: 991.98px) {
  .section-ebook-product .ebook-shell {
    grid-template-columns: 1fr;
  }

  .section-ebook-product .ebook-media,
  .section-ebook-product .ebook-cover-frame,
  .section-ebook-product .ebook-product-image,
  .section-ebook-product .ebook-placeholder {
    min-height: 280px;
  }
}

@media (max-width: 575.98px) {
  .section-ebook-product .ebook-change-btn {
    top: 0.65rem;
    right: 0.65rem;
  }

  .section-ebook-product .ebook-details {
    padding: 1.35rem 1.2rem 1.6rem;
  }
}

/* —— Purchase modal —— */
body.ebook-purchase-modal-open {
  overflow: hidden;
}

.ebook-purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.ebook-purchase-modal[hidden] {
  display: none !important;
}

.ebook-purchase-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 20, 0.55);
  backdrop-filter: blur(4px);
}

.ebook-purchase-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 720px);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(12, 14, 20, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ebook-purchase-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  z-index: 3;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #12141a;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(12, 14, 20, 0.12);
}

.ebook-purchase-modal__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  min-height: 0;
  flex: 1;
}

.ebook-purchase-modal__left {
  display: flex;
  flex-direction: column;
  background: #f3f1ec;
  min-height: 100%;
  border-right: 1px solid rgba(18, 20, 26, 0.08);
}

.ebook-purchase-modal__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 78%;
  overflow: hidden;
  background: #e8e4dc;
}

.ebook-purchase-modal__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ebook-purchase-modal__cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c6472;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ebook-purchase-modal__summary {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem 1.35rem 1.5rem;
  min-height: 0;
}

.ebook-purchase-modal__kicker {
  display: inline-flex;
  margin-bottom: 0.55rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: rgba(26, 92, 255, 0.1);
  color: #0e3fbf;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.ebook-purchase-modal__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.25;
  color: #12141a;
  font-weight: 700;
}

.ebook-purchase-modal__total-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.15rem;
}

.ebook-purchase-modal__total-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c6472;
  line-height: 1;
  padding-bottom: 0.2rem;
}

.ebook-purchase-modal__price {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a5cff;
  text-align: right;
  line-height: 1;
}

.ebook-purchase-modal__right {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  overflow: auto;
  background: #fff;
}

.ebook-purchase-modal__form-heading {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #12141a;
}

.ebook-purchase-modal__form-sub {
  margin: 0 0 1.35rem;
  color: #5c6472;
  font-size: 0.92rem;
}

.ebook-purchase-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.ebook-purchase-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ebook-purchase-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #3a4050;
}

.ebook-purchase-field input {
  width: 100%;
  border: 1px solid rgba(18, 20, 26, 0.12);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font-size: 0.98rem;
  color: #12141a;
  background: #fafaf8;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ebook-purchase-field input:focus {
  border-color: rgba(26, 92, 255, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 92, 255, 0.12);
}

.ebook-stripe-element {
  width: 100%;
  border: 1px solid rgba(18, 20, 26, 0.12);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  background: #fafaf8;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 48px;
}

.ebook-stripe-element.StripeElement--focus {
  border-color: rgba(26, 92, 255, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 92, 255, 0.12);
}

.ebook-purchase-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.ebook-purchase-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(200, 40, 40, 0.08);
  color: #a11;
  font-size: 0.88rem;
}

.ebook-purchase-error.is-info {
  background: rgba(26, 92, 255, 0.08);
  color: #0e3fbf;
}

.ebook-purchase-submit {
  appearance: none;
  border: none;
  margin-top: 0.25rem;
  border-radius: 14px;
  padding: 0.95rem 1.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #1a5cff 0%, #0e3fbf 100%);
  box-shadow: 0 12px 28px rgba(26, 92, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ebook-purchase-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(26, 92, 255, 0.34);
}

.ebook-purchase-secure {
  margin: 0;
  text-align: center;
  color: #5c6472;
  font-size: 0.78rem;
}

@media (max-width: 767.98px) {
  .ebook-purchase-modal {
    padding: 0.65rem;
    align-items: flex-end;
  }

  .ebook-purchase-modal__dialog {
    max-height: 94vh;
    border-radius: 18px 18px 12px 12px;
  }

  .ebook-purchase-modal__grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .ebook-purchase-modal__left {
    border-right: none;
    border-bottom: 1px solid rgba(18, 20, 26, 0.08);
  }

  .ebook-purchase-modal__cover {
    aspect-ratio: 16 / 10;
    max-height: none;
  }

  .ebook-purchase-modal__summary {
    padding: 1rem 1.15rem 1.15rem;
  }

  .ebook-purchase-modal__right {
    padding: 1.25rem 1.15rem 1.5rem;
  }
}
