@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Playfair+Display:wght@700&display=swap');

:root {
    --bg-color: #fdfaf6;
    --text-color: #1a1a1a;
    --sepia-bg: #f4ecd8;
    --dark-bg: #1a1a1a;
    --dark-text: #e0e0e0;
    --max-width: 700px;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Crimson Pro', 'Georgia', serif;
    line-height: 1.7;
    font-size: 20px;
    transition: background-color 0.3s, color 0.3s;
}

/* Reader Container */
.reader-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px 80px 20px;
    box-sizing: border-box;
    min-height: 100vh;
}

/* Navigation / Controls Overlay */
.reader-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: opacity 0.3s;
}

.reader-controls:hover {
    opacity: 1;
}

.control-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #444;
}

.control-btn:hover {
    background: #f0f0f0;
}

.control-btn.active {
    background: #ffeaa7;
    border-color: #fab1a0;
}

/* Bookmark Marker */
.bookmark-marker {
    border-left: 4px solid #fab1a0;
    padding-left: 10px;
    margin-left: -14px;
    background: rgba(250, 177, 160, 0.1);
}

/* Typography Enhancements */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    margin-top: 2em;
    margin-bottom: 1em;
    color: #000;
}

p {
    margin-bottom: 1.5em;
    text-indent: 1.5em; /* Traditional book paragraph indent */
}

p:first-of-type, h1 + p, h2 + p, h3 + p {
    text-indent: 0; /* No indent for first paragraph after headings */
}

/* Specific Calibre overrides */
.calibre {
    display: block !important;
}

.calibre1 {
    display: block !important;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2em auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Night Mode Class */
body.night-mode {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

body.night-mode .reader-controls {
    background: rgba(40, 40, 40, 0.9);
}

body.night-mode .control-btn {
    background: #333;
    color: #eee;
    border-color: #555;
}

body.night-mode h1, body.night-mode h2, body.night-mode h3 {
    color: #fff;
}

/* Back Button */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    opacity: 0.6;
}

.back-link:hover {
    opacity: 1;
}
