.coffee-book-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.coffee-book-cta--primary {
    background-color: #2563eb;
    color: #fff;
}

.coffee-book-cta--primary:hover {
    opacity: 0.9;
}

.coffee-book-cta--secondary {
    background-color: #fff;
    color: #000;
    border: 2px solid #000;
}

.coffee-book-cta--secondary:hover {
    background-color: #f9fafb;
}

.book-preview-section {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

#preview-chapter {
    scroll-margin-top: calc(var(--header-height, 60px) + 6rem);
    padding-top: 3rem;
}

@media (max-width: 767px) {
    #preview-chapter {
        scroll-margin-top: calc(var(--header-height, 60px) + 4rem);
        padding-top: 2rem;
    }
}

.book-preview-viewer {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.book-preview-viewer.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    gap: 0.75rem;
    padding: 0.75rem 1rem 1rem;
    background: #0f172a;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    max-width: none;
}

.book-preview-viewer.is-fullscreen .book-preview-chapters {
    max-width: none;
    justify-content: center;
}

.book-preview-viewer.is-fullscreen .book-preview-chapter-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
}

.book-preview-viewer.is-fullscreen .book-preview-chapter-btn:hover:not(.is-active):not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.book-preview-viewer.is-fullscreen .book-preview-chapter-btn.is-active {
    background: #fff;
    border-color: #fff;
    color: #0f172a;
}

.book-preview-viewer.is-fullscreen .book-preview-stage {
    flex: 1;
    min-height: 0;
    max-width: none;
    width: 100%;
    padding: 0.5rem 0 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.book-preview-viewer.is-fullscreen .book-preview-mount {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.book-preview-viewer.is-fullscreen .book-preview-zoom-viewport.is-zoomed {
    cursor: grab;
}

.book-preview-viewer.is-fullscreen .book-preview-loading {
    min-height: 0;
    flex: 1;
    color: #cbd5e1;
}

.book-preview-viewer.is-fullscreen .book-preview-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
}

.book-preview-viewer.is-fullscreen .book-preview {
    min-height: 0;
    height: auto;
    max-height: 100%;
    width: 100%;
}

.book-preview-viewer.is-fullscreen .book-preview-controls {
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    pointer-events: auto;
}

.book-preview-viewer.is-fullscreen .book-preview-hint {
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.book-preview-viewer.is-fullscreen .book-preview-mount .stf__parent {
    max-width: 100%;
    max-height: 100%;
}

.book-preview-viewer.is-fullscreen .book-preview-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f8fafc;
}

.book-preview-viewer.is-fullscreen .book-preview-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.book-preview-viewer.is-fullscreen .book-preview-indicator,
.book-preview-viewer.is-fullscreen .book-preview-hint {
    color: #94a3b8;
}

.book-preview-viewer.is-fullscreen .book-preview-btn.is-active-fullscreen {
    background: #fff;
    border-color: #fff;
    color: #0f172a;
}

body.book-preview-fullscreen-open {
    overflow: hidden;
}

.book-preview-viewer:not(.is-fullscreen) .book-preview-mount {
    max-height: min(58vh, 640px);
}

.book-preview-chapters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    max-width: 920px;
    margin-inline: auto;
}

.book-preview-chapter-btn {
    padding: 0.55rem 1.1rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.book-preview-chapter-btn:hover:not(.is-active):not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.book-preview-chapter-btn.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.book-preview-chapter-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.book-preview-mount {
    width: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.book-preview-zoom-viewport {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.book-preview-zoom-viewport.is-zoomed .stf__parent {
    touch-action: pan-x pan-y;
}

.book-preview-zoom-viewport.is-zoomed {
    cursor: grab;
}

.book-preview-zoom-viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.book-preview-zoom-inner {
    margin: 0 auto;
    transform-origin: top center;
}

.book-preview-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.book-preview-btn.is-active-zoom {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.book-preview-viewer.is-fullscreen .book-preview-btn.is-active-zoom {
    background: #fff;
    border-color: #fff;
    color: #0f172a;
}

.book-preview-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 920px;
    margin-inline: auto;
    padding: 1.5rem;
    border-radius: 1rem;
    background: radial-gradient(circle at 50% 20%, #ffffff 0%, #e8edf4 100%);
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.book-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 420px;
    color: #475569;
    font-size: 1rem;
}

.book-preview-loading[hidden],
.book-preview[hidden] {
    display: none !important;
}

.book-preview-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #cbd5e1;
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: book-preview-spin 0.8s linear infinite;
}

@keyframes book-preview-spin {
    to {
        transform: rotate(360deg);
    }
}

.book-preview {
    width: 100%;
    min-height: 420px;
}

.book-preview-page {
    background: #fff;
    overflow: hidden;
}

.book-preview-page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    image-rendering: auto;
}

.book-preview-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
}

.book-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.book-preview-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.book-preview-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.book-preview-indicator {
    min-width: 5.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #334155;
    font-size: 0.95rem;
}

.book-preview-hint {
    margin: 0;
    text-align: center;
    color: #64748b;
    font-size: 0.875rem;
}

@media (max-width: 767px) {
    .book-preview-stage {
        padding: 1rem;
    }
}
