/**
 * Scripture Read-Along Highlighting Styles
 *
 * Creates a smooth, sliding gradient bar that highlights words
 * as scripture audio plays.
 */

/* Base word styling - minimal, just for reference points */
.readalong-word {
    display: inline;
    position: relative;
    z-index: 1; /* Ensure text sits above the highlight bar */
}

/* The sliding gradient highlight bar */
.readalong-highlight-bar {
    position: absolute;
    pointer-events: none; /* Don't interfere with text selection */
    z-index: 0; /* Behind text but visible */

    /* Rounded pill shape */
    border-radius: 20px;

    /* Horizontal gradient - designed to be repositionable
       The gradient is 200% wide so we can slide it left/right */
    background: linear-gradient(90deg,
        transparent 0%,
        transparent 25%,
        rgba(59, 130, 246, 0.1) 35%,
        rgba(59, 130, 246, 0.3) 42%,
        rgba(59, 130, 246, 0.5) 47%,
        rgba(59, 130, 246, 0.7) 50%,
        rgba(59, 130, 246, 0.5) 53%,
        rgba(59, 130, 246, 0.3) 58%,
        rgba(59, 130, 246, 0.1) 65%,
        transparent 75%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: 50% center; /* Default: centered */

    /* Subtle shadow for depth */
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);

    /* Smooth transitions:
       - opacity: for fade in/out
       - background-position: short duration to smooth out micro-jumps at word boundaries */
    transition: opacity 0.2s ease-out, background-position 60ms linear;

    /* Initially hidden */
    opacity: 0;
}

/*
 * Ensure highlighted words wrap naturally across lines
 * The gradient effect will flow naturally since each word is an inline element
 */
.scripture-text p {
    line-height: 1.8; /* Increased line height for better readability with highlights */
}

/* Make sure the text container can position the bar */
.scripture-text {
    position: relative;
}

/* Scripture block needs to contain the sticky floating button */
.scripture-block {
    position: relative;
}

/* Next-line preview bar - dimmer, starts at left edge */
.readalong-next-line-bar {
    background: linear-gradient(90deg,
        rgba(59, 130, 246, 0.5) 0%,
        rgba(59, 130, 246, 0.4) 5%,
        rgba(59, 130, 246, 0.25) 15%,
        rgba(59, 130, 246, 0.12) 30%,
        rgba(59, 130, 246, 0.05) 50%,
        transparent 70%,
        transparent 100%
    );
    background-size: 100% 100%;
    background-position: 0% center;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.15);
    transition: opacity 0.15s ease-out, background-position 60ms linear;
}

/* Floating pause button container - sticky positioning within scripture block */
.scripture-floating-container {
    position: sticky;
    bottom: 16px;
    height: 0; /* Doesn't take up space in flow */
    overflow: visible;
    z-index: 100;
    pointer-events: none; /* Let clicks through except on button */
}

/* Floating pause button - appears when audio controls scroll off-screen */
.scripture-floating-pause {
    position: absolute;
    bottom: 0;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.98);
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: background 0.1s ease-out, box-shadow 0.1s ease-out;
    pointer-events: auto; /* Re-enable clicks on button */
}

.scripture-floating-pause:hover {
    background: rgba(250, 250, 250, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.scripture-floating-pause:active {
    background: rgba(240, 240, 240, 1);
}

.scripture-floating-pause svg {
    width: 16px;
    height: 16px;
}

/* Interactive text hint - subtle cursor change when audio is playing */
.scripture-text--interactive {
    cursor: pointer;
}

/* Subtle hover effect on interactive text */
.scripture-text--interactive:hover {
    /* Very subtle background hint */
    background: rgba(59, 130, 246, 0.02);
    border-radius: 4px;
}

/* Accessibility: Reduce or disable motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .readalong-highlight-bar,
    .readalong-next-line-bar {
        /* Disable sliding animation - just show static highlight */
        transition: none;
        /* Use a simpler, non-animated highlight */
        background: rgba(59, 130, 246, 0.3);
        background-size: 100% 100%;
    }

    .scripture-floating-pause {
        transition: none;
    }
}
