/**
 * EBA eBook Detail — Single eBook page widget
 */

.eba-wrapper.eba-ed {
    background: var(--eba-ivory);
}

/* ===== HERO ===== */
.eba-ed__hero {
    background: #0f172a;
    color: #ffffff;
    padding: clamp(3rem, 6vw, 5rem) 0;
    position: relative;
    overflow: hidden;
}

.eba-ed__hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(212, 162, 76, 0.18) 0%, transparent 70%);
    pointer-events: none;
}

.eba-ed__hero-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
    position: relative;
    z-index: 1;
}

.eba-ed__cover-frame {
    aspect-ratio: 2 / 3;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.5);
    transform: rotate(-2deg);
    transition: transform 0.4s var(--eba-ease);
    position: relative;
}

.eba-ed__cover-frame::before {
    content: '';
    position: absolute;
    top: 16px; left: 16px; bottom: 16px;
    width: 6px;
    background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
}

.eba-ed__cover-frame:hover { transform: rotate(0); }

.eba-ed__cover-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

.eba-ed__cover-placeholder {
    aspect-ratio: 2 / 3;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--eba-border);
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.5);
}

.eba-ed__eyebrow {
    color: var(--eba-gold-light) !important;
    margin-bottom: var(--eba-space-3) !important;
}

.eba-ed__title {
    font-family: var(--eba-font-heading);
    font-size: clamp(2rem, 3.5vw + 0.5rem, 3.5rem);
    color: #ffffff;
    line-height: 1.1;
    font-weight: 400;
    margin: 0 0 var(--eba-space-4);
    letter-spacing: -0.02em;
}

.eba-ed__excerpt {
    font-size: var(--eba-text-lg);
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin: 0 0 var(--eba-space-5);
    max-width: 56ch;
}

.eba-ed__meta {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1rem, 2vw, 2rem);
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--eba-text-sm);
    margin-bottom: var(--eba-space-5);
    padding-bottom: var(--eba-space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.eba-ed__meta span { display: inline-flex; align-items: center; gap: 6px; }
.eba-ed__meta svg { color: var(--eba-gold-light); }

.eba-ed__hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--eba-space-3);
    align-items: center;
}

.eba-ed__hero-actions .eba-btn--outline {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.eba-ed__hero-actions .eba-btn--outline:hover {
    background: #ffffff !important;
    color: var(--eba-charcoal) !important;
    border-color: #ffffff !important;
}

.eba-ed__price-large {
    font-family: var(--eba-font-heading);
    font-size: 2.5rem;
    color: var(--eba-gold-light);
    font-weight: 500;
    line-height: 1;
}

/* ===== BODY ===== */
.eba-ed__body {
    padding: clamp(3rem, 5vw, 5rem) 0;
}

.eba-ed__layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
}

.eba-ed__main { min-width: 0; }

.eba-ed__section { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.eba-ed__section:last-child { margin-bottom: 0; }

.eba-ed__section-title {
    font-family: var(--eba-font-heading);
    font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
    color: var(--eba-charcoal);
    font-weight: 500;
    margin: 0 0 var(--eba-space-4);
    letter-spacing: -0.01em;
}

.eba-ed__about {
    font-size: var(--eba-text-lg);
    line-height: 1.75;
    color: var(--eba-text-muted);
    background: #ffffff;
    border: 1px solid var(--eba-border);
    border-radius: var(--eba-radius-lg);
    padding: clamp(1.75rem, 4vw, 2.5rem);
}

.eba-ed__about h2,
.eba-ed__about h3 {
    color: var(--eba-charcoal);
    margin-top: var(--eba-space-5);
    margin-bottom: var(--eba-space-3);
    font-family: var(--eba-font-heading);
}

.eba-ed__about h2:first-child,
.eba-ed__about h3:first-child { margin-top: 0; }

.eba-ed__about p { margin-bottom: var(--eba-space-3); }
.eba-ed__about ul, .eba-ed__about ol { margin: var(--eba-space-3) 0 var(--eba-space-4) var(--eba-space-5); }

/* What's Inside */
.eba-ed__inside-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--eba-space-3);
    background: #ffffff;
    border: 1px solid var(--eba-border);
    border-radius: var(--eba-radius-lg);
    padding: clamp(1.5rem, 3vw, 2rem);
}

.eba-ed__inside-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--eba-space-2);
    color: var(--eba-text);
    line-height: 1.5;
}

.eba-ed__inside-list svg {
    color: var(--eba-gold-dark);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Format */
.eba-ed__format-desc {
    color: var(--eba-text-muted);
    line-height: 1.7;
    margin-bottom: var(--eba-space-4);
}

.eba-ed__compat-heading {
    font-family: var(--eba-font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--eba-text-muted);
    font-weight: 600;
    margin: 0 0 var(--eba-space-3);
}

.eba-ed__compat {
    display: flex;
    flex-wrap: wrap;
    gap: var(--eba-space-2);
}

.eba-ed__compat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid var(--eba-border);
    border-radius: var(--eba-radius-full);
    font-size: 0.8125rem;
    color: var(--eba-text);
}

.eba-ed__compat-item svg { color: var(--eba-gold-dark); flex-shrink: 0; }

/* ===== STICKY PURCHASE CARD ===== */
.eba-ed__sidebar {
    position: sticky;
    top: 100px;
}

.eba-ed__card {
    background: #ffffff;
    border: 1px solid var(--eba-border);
    border-radius: var(--eba-radius-xl);
    overflow: hidden;
    box-shadow: var(--eba-shadow-lg);
}

.eba-ed__card-cover {
    aspect-ratio: 16 / 10;
    background: var(--eba-ivory-dark);
    overflow: hidden;
}

.eba-ed__card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.eba-ed__card-body { padding: var(--eba-space-5); }

.eba-ed__card-heading {
    font-family: var(--eba-font-heading);
    font-size: var(--eba-text-xl);
    color: var(--eba-charcoal);
    margin: 0 0 var(--eba-space-3);
    font-weight: 500;
}

.eba-ed__price {
    font-family: var(--eba-font-heading);
    font-size: clamp(2rem, 2.5vw, 2.5rem);
    color: var(--eba-gold-dark);
    font-weight: 500;
    line-height: 1;
    margin-bottom: var(--eba-space-4);
}

.eba-ed__highlights {
    list-style: none;
    padding: var(--eba-space-4) 0 0;
    margin: var(--eba-space-4) 0 0;
    border-top: 1px solid var(--eba-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eba-ed__highlights li {
    display: flex;
    align-items: center;
    gap: var(--eba-space-2);
    font-size: 0.875rem;
    color: var(--eba-text-muted);
}

.eba-ed__highlights svg,
.eba-ed__highlight-icon {
    color: var(--eba-gold-dark);
    flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .eba-ed__layout { grid-template-columns: 1fr; }
    .eba-ed__sidebar { position: static; order: -1; max-width: 480px; margin: 0 auto; }
    .eba-ed__hero-grid { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
    .eba-ed__cover-frame { max-width: 240px; margin: 0 auto; }
    .eba-ed__hero-actions { justify-content: center; }
    .eba-ed__excerpt, .eba-ed__meta { margin-left: auto; margin-right: auto; }
    .eba-ed__meta { justify-content: center; }
}

@media (max-width: 640px) {
    .eba-ed__hero { padding: 2.5rem 0 !important; }
    .eba-ed__hero-grid { gap: 1.5rem !important; }
    .eba-ed__hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
    .eba-ed__hero-actions .eba-btn { width: 100%; justify-content: center; padding: 12px 18px !important; font-size: 14px !important; }
    .eba-ed__cover-frame { max-width: 180px; }
    .eba-ed__title { font-size: clamp(1.5rem, 7vw, 2rem) !important; line-height: 1.15 !important; }
    .eba-ed__excerpt { font-size: 0.9375rem !important; line-height: 1.55 !important; }
    .eba-ed__meta { flex-wrap: wrap; gap: 10px !important; font-size: 12.5px !important; }
    .eba-ed__body { padding: 2rem 0 !important; }
    .eba-ed__section { padding: 1.25rem 1.25rem !important; border-radius: 12px !important; }
    .eba-ed__section + .eba-ed__section { margin-top: 1rem !important; }
    .eba-ed__section-title { font-size: 1.25rem !important; margin-bottom: 0.875rem !important; }
    .eba-ed__inside-list li { font-size: 0.9375rem; line-height: 1.5; }
    .eba-ed__card { padding: 1.25rem !important; }
    .eba-ed__card-heading { font-size: 1.125rem !important; }
    .eba-ed__price { font-size: 1.75rem !important; }
    .eba-ed__compat { gap: 8px !important; }
    .eba-ed__compat-item { padding: 5px 10px !important; font-size: 11.5px !important; }
}

@media (max-width: 420px) {
    .eba-ed__hero { padding: 2rem 0 !important; }
    .eba-ed__title { font-size: 1.5rem !important; }
    .eba-ed__eyebrow { font-size: 10.5px !important; }
    .eba-ed__cover-frame { max-width: 160px; }
}

/* ===== READ PREVIEW LIGHTBOX ===== */
.eba-ed__preview-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: #d4a24c;
    color: #0f172a;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 0 7px;
    margin-left: 4px;
}

.eba-ed-preview {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.eba-ed-preview.is-open {
    display: flex;
    animation: ebaEdPreviewFade 0.2s ease-out;
}
@keyframes ebaEdPreviewFade { from { opacity: 0 } to { opacity: 1 } }

.eba-ed-preview__backdrop {
    position: absolute; inset: 0;
    background: #0f172a;
    cursor: pointer;
}

.eba-ed-preview__panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #fafaf7;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
@media (min-width: 900px) {
    .eba-ed-preview { padding: 18px; }
    .eba-ed-preview__panel {
        width: calc(100vw - 36px);
        height: calc(100vh - 36px);
        max-width: 1280px;
        border-radius: 18px;
        box-shadow: 0 30px 60px -15px rgba(0,0,0,0.5);
    }
}

/* HEAD */
.eba-ed-preview__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #eee9df;
    flex-shrink: 0;
}
.eba-ed-preview__head h3 {
    font-family: 'Cormorant Garamond', Georgia, serif !important;
    font-weight: 600 !important;
    font-size: 1.125rem !important;
    color: #0f172a !important;
    margin: 0 !important;
    flex: 1;
}
.eba-ed-preview__head h3 small {
    font-family: 'Inter', system-ui, sans-serif !important;
    color: #94a3b8;
    font-size: 12.5px;
    font-weight: 500;
    margin-left: 4px;
}
.eba-ed-preview__head-meta {
    font-size: 12px;
    color: #64748b;
}
.eba-ed-preview__head-meta span {
    color: #d4a24c;
    font-weight: 700;
}

.eba-ed-preview__close,
button.eba-ed-preview__close {
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    background: #0f172a !important;
    color: #d4a24c !important;
    border: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center; justify-content: center;
    padding: 0 !important;
    transition: all 0.18s;
}
.eba-ed-preview__close:hover {
    background: linear-gradient(135deg, #d4a24c, #e0b96b) !important;
    color: #0f172a !important;
    transform: rotate(90deg);
}

/* STAGE */
.eba-ed-preview__stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f1ede4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.eba-ed-preview__slide {
    position: absolute;
    inset: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.eba-ed-preview__slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}
.eba-ed-preview__slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 20px 50px -20px rgba(15, 23, 42, 0.45);
    border-radius: 6px;
    background: #fff;
}

/* NAV */
.eba-ed-preview__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #eee9df;
    flex-shrink: 0;
}
.eba-ed-preview__nav-btn,
button.eba-ed-preview__nav-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 10px 18px !important;
    background: #fff !important;
    border: 1px solid #ddd4c6 !important;
    border-radius: 10px !important;
    color: #475569 !important;
    font-family: inherit !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.18s;
}
.eba-ed-preview__nav-btn:hover:not(:disabled) {
    border-color: #d4a24c !important;
    color: #b58834 !important;
}
.eba-ed-preview__nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.eba-ed-preview__nav-btn--primary {
    background: linear-gradient(135deg, #d4a24c, #e0b96b) !important;
    background-image: linear-gradient(135deg, #d4a24c, #e0b96b) !important;
    color: #0f172a !important;
    border-color: #d4a24c !important;
}
.eba-ed-preview__nav-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(212, 162, 76, 0.45);
    color: #0f172a !important;
}
.eba-ed-preview__counter {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}
.eba-ed-preview__counter strong {
    color: #d4a24c;
    font-weight: 700;
    font-size: 15px;
    margin-right: 2px;
}

body.eba-ed-preview-open,
html.eba-ed-preview-open {
    overflow: hidden;
}

@media (max-width: 540px) {
    .eba-ed-preview__head h3 { font-size: 1rem !important; }
    .eba-ed-preview__head { padding: 12px 14px; }
    .eba-ed-preview__nav { padding: 12px 14px; }
    .eba-ed-preview__nav-btn { padding: 9px 14px !important; font-size: 12.5px !important; }
    .eba-ed-preview__stage { padding: 14px; }
    .eba-ed-preview__slide { inset: 14px; }
}
