/* ===== READING EXPERIENCE ENHANCEMENTS ===== */
/* Subtle improvements for better chapter readability */

/* ===== READING PROGRESS BAR ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(139, 69, 19, 0.1);
    z-index: 1001;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8B4513, #CD853F);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(139, 69, 19, 0.3);
}

/* ===== TYPOGRAPHY IMPROVEMENTS ===== */
.content-block {
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 800px; /* Optimal reading line length */
    margin: 0 auto;
}

.content-block p {
    margin-bottom: 1.5rem;
    text-align: justify;
    text-justify: inter-word;
}

.content-block p:last-child {
    margin-bottom: 2rem;
}

/* Better paragraph spacing after headings */
.content-block h2 + p,
.content-block h3 + p,
.content-block h4 + p {
    margin-top: 0.5rem;
}

/* ===== ENHANCED SIDE-BY-SIDE LAYOUTS ===== */
.side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--color-card-bg);
    border-radius: 12px;
    border-left: 4px solid var(--color-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.side-by-side .column {
    padding: 0;
}

.side-by-side .column h4 {
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.side-by-side .column p {
    margin-bottom: 1rem;
    text-align: left;
}

.side-by-side .column ul {
    padding-left: 1.2rem;
}

.side-by-side .column li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* ===== ENHANCED LIST STYLING ===== */
.content-block ul,
.content-block ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.content-block li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.content-block li:last-child {
    margin-bottom: 0;
}

.content-block li strong {
    color: var(--color-primary);
}

/* Nested lists */
.content-block li ul,
.content-block li ol {
    margin: 0.5rem 0;
    margin-left: 1rem;
}

/* ===== CODE AND QUOTE STYLING ===== */
.content-block code {
    background: var(--color-primary);
    color: var(--color-text-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    font-weight: 600;
}

/* Enhanced quote styling - default inline for single words */
.content-block p strong:only-child {
    color: #8B4513;
    font-weight: 700;
}

/* Block styling only for specific important content - requires manual class */
.content-block p strong.highlight-block,
.content-block .highlight-text strong {
    display: block;
    background: #ffffff;
    color: #8B4513;
    border: 2px solid #8B4513;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
}

/* Key insight boxes */
.content-block p:has(strong:first-child) {
    background: rgba(125, 240, 194, 0.1);
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* ===== READING FLOW ENHANCEMENTS ===== */
.content-block h3 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(125, 240, 194, 0.3);
}

.content-block h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

/* Visual break for major sections */
.content-block h3:not(:first-child)::before {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #00693E, #8B4513);
    margin: 2rem 0 1rem 0;
    border-radius: 2px;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .content-block {
        font-size: 1.05rem;
        line-height: 1.6;
        max-width: 100%;
    }

    .side-by-side {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    .content-block p {
        text-align: left; /* Remove justify on mobile for better readability */
    }
    
    .content-block h3:not(:first-child)::before {
        width: 40px;
        height: 2px;
        margin: 1.5rem 0 0.5rem 0;
    }
}

/* ===== DARK MODE ADJUSTMENTS ===== */
body.dark-mode .side-by-side {
    background: rgba(125, 240, 194, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.dark-mode .content-block p:has(strong:first-child) {
    background: rgba(125, 240, 194, 0.08);
}

body.dark-mode .content-block code {
    background: var(--color-primary);
    color: var(--color-background);
}

/* Dark mode for highlighted text blocks */
body.dark-mode .content-block p strong:only-child {
    color: #D2B48C;
}

body.dark-mode .content-block p strong.highlight-block,
body.dark-mode .content-block .highlight-text strong {
    background: var(--color-card-bg);
    color: #D2B48C;
    border-color: #D2B48C;
    box-shadow: 0 2px 8px rgba(210, 180, 140, 0.1);
}

/* Dark mode for progress bar */
body.dark-mode .reading-progress {
    background: rgba(125, 240, 194, 0.2);
}

body.dark-mode .reading-progress-bar {
    background: linear-gradient(90deg, #7df0c2, #5dd4a3);
    box-shadow: 0 0 10px rgba(125, 240, 194, 0.4);
}

/* ===== SUBTLE FOCUS INDICATORS ===== */
.content-block:focus-within {
    outline: none;
}

/* Better selection styling for reading */
.content-block ::selection {
    background: rgba(125, 240, 194, 0.3);
    color: inherit;
}

body.dark-mode .content-block ::selection {
    background: rgba(125, 240, 194, 0.4);
}
