/**
 * Reader Engine CSS v2.0.0
 * Core styles for the eBook reader "bubble" (framework-agnostic)
 *
 * These styles are injected by the reader engine and define the appearance
 * of the core reading experience, independent of the outer UI.
 *
 * @license MIT
 * @version 2.0.0
 */

.ebook-reader-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    /* Allow one-finger vertical scrolling; the engine only intercepts
       two-finger pinch gestures, so pan-y is safe. */
    touch-action: pan-y;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background 0.3s ease;
    contain: layout style;
}

.ebook-reader-area {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    transition: background .3s ease, color .3s ease;
    width: 100%;
    max-width: 46rem;      /* keep the reading measure comfortable */
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    padding: 0;
    contain: layout style;
}

.ebook-text-content {
    transition: padding .1s ease-out, opacity .2s ease-in-out, color .3s ease, font-family .2s ease;
    position: relative;
    min-height: 100%;
    padding: 56px 64px 0 64px;
    padding-bottom: 60vh;
    contain: layout style paint;
}

@media (max-width: 768px) {
    .ebook-text-content {
        padding: 64px 22px 0 22px;
        padding-bottom: 70vh;
    }
}

.ebook-text-content.transitioning {
    opacity: .4;
}

.bionic {
    font-weight: 700;
    transition: color 0.3s ease;
    contain: style;
}

/* Base flow-word styling (always present for click detection) */
.flow-word {
    display: inline;
    position: relative;
    cursor: pointer;
}

/* Flow mode specific styling (opacity effects) */
.ebook-text-content.flow-mode .flow-word {
    font-weight: 400;
    transition: opacity 0.2s ease;
    will-change: opacity;
    contain: layout style;
}

.ebook-text-content.flow-mode .flow-word:hover {
    opacity: .7;
}

.ebook-text-content.flow-mode .flow-word.active {
    opacity: 1;
}

.ebook-text-content.flow-mode .flow-word.inactive {
    opacity: .2;
}

.ebook-focus-indicator {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 50;
    background: var(--theme-focus, rgba(96,165,250,.16));
    border-bottom: 3px solid var(--theme-focus-border, #3b82f6);
    display: none;
    border-radius: 4px;
    transition: background 0.2s ease, border-color 0.2s ease;
    will-change: transform;
    contain: layout style paint;
}

.ebook-focus-indicator.visible {
    display: block;
}
