/* Improved Ebook Stylesheet */

/* Page settings */
@page {
    margin: 2% 3%;
}

/* Base typography */
body {
    font-family: 'Bookerly', 'Georgia', serif;
    font-size: 100%;
    line-height: 1.5;
    color: #333;
    background-color: #FAFAF8;
    text-rendering: optimizeLegibility;
    margin: 0 auto;
    max-width: 100%;
    padding: 0 5%;
}

/* Comment tooltip styles - updated for inline usage */
.comment-marker {
    position: relative;
    display: inline;
    color: inherit;
    border-bottom: 1px dotted #0066cc;
    cursor: help;
}

.comment-marker:hover .comment-text {
    visibility: visible;
    opacity: 1;
}

.comment-text {
    visibility: hidden;
    width: 250px;
    background-color: #f8f8f8;
    color: #333;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    font-style: normal;
    font-weight: normal;
    font-size: 0.9em;
    line-height: 1.4;
}

.comment-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #f8f8f8 transparent transparent transparent;
}

/* Responsive layout for different screen sizes */
@media screen and (min-width: 768px) {
    body {
        max-width: 80%;
    }
}

@media screen and (min-width: 1024px) {
    body {
        max-width: 70%;
    }
}

@media screen and (min-width: 1280px) {
    body {
        max-width: 60%;
    }
}

/* For 16:9 widescreen displays */
@media screen and (min-width: 1600px) {
    body {
        max-width: 50%;
    }
}

/* Typography scale */
h1,
.booktitle,
.parttitle,
.toctitle {
    font-size: 1.6em;
    line-height: 1.3;
    font-weight: 700;
    margin: 1.5em 0 0.8em;
    text-align: center;
}

h2,
.chaptertitle,
.prefacetitle,
.mattertitle,
.indextitle {
    font-size: 1.4em;
    line-height: 1.3;
    font-weight: 600;
    margin: 1.2em 0 0.7em;
    text-align: center;
}

h3,
.h,
.h1,
.contentschaptertitle {
    font-size: 1.2em;
    line-height: 1.3;
    font-weight: 600;
    margin: 1em 0 0.6em;
}

/* Paragraphs */
p,
.para,
.paraaftertitle {
    font-size: 1em;
    line-height: 1.5;
    margin: 0.8em 0;
    text-align: justify;
}

.para {
    text-indent: 1.2em;
}

.paraaftertitle {
    text-indent: 0;
}

/* Lists */
.listbulleted,
.featurelistbulleted {
    font-size: 1em;
    line-height: 1.5;
    margin: 0.3em 0 0.3em 1.5em;
    text-align: left;
}

.listnumbered {
    font-size: 1em;
    line-height: 1.5;
    margin: 0.3em 0 0.3em 1.5em;
    text-align: left;
}

/* Tables */
.bodytable {
    border-collapse: collapse;
    margin: 1em 0;
    width: 100%;
}

.headercell {
    font-size: 0.9em;
    font-weight: bold;
    padding: 0.5em;
    border-bottom: 1px solid #999;
    text-align: left;
}

.bodycell {
    font-size: 0.9em;
    padding: 0.5em;
    border-bottom: 1px solid #eee;
    text-align: left;
}

/* Quotes and epigraphs */
.quote,
.epigraph {
    font-size: 0.95em;
    line-height: 1.5;
    margin: 1em 2em;
    text-align: left;
    font-style: italic;
    color: #555;
}

.epigraphsource,
.tablesource {
    font-size: 0.9em;
    text-align: right;
    margin: 0.5em 2em 1em;
    font-style: italic;
    color: #666;
}

/* Figures */
.figure {
    margin: 1.5em 0;
    text-align: center;
}

.figurecaption {
    font-size: 0.9em;
    margin: 0.7em 0;
    text-align: center;
    color: #555;
}

/* References and footnotes */
.reference,
.footnoteentry {
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0.5em 0;
    text-align: left;
    text-indent: -1.5em;
    padding-left: 1.5em;
}

.referenceshead {
    font-size: 1.1em;
    font-weight: bold;
    margin: 1.5em 0 1em;
}

/* Features and callouts */
.feature {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1em;
    margin: 1.2em 0.5em;
}

.featureh {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0 0 0.7em;
    text-align: center;
}

/* TOC styling */
.contentsh {
    font-size: 1em;
    margin: 0.4em 0 0.4em 1.5em;
    text-align: left;
}

.contentsparttitle {
    font-size: 1.2em;
    font-weight: bold;
    margin: 1em 0 0.5em;
    text-align: center;
}

/* Copyright and metadata */
.copyright {
    font-size: 0.9em;
    margin: 2em 0;
    text-align: center;
    color: #666;
}

/* Utilities */
.calibre5,
.calibre15 {
    font-weight: bold;
}

.calibre2,
.calibre14 {
    font-style: italic;
}

.underline {
    text-decoration: underline;
}

/* Superscript and subscript */
.calibre7 {
    font-size: 0.8em;
    vertical-align: super;
}

.calibre9 {
    font-size: 0.8em;
    vertical-align: sub;
}

/* Cover image */
.ep_cover_page {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* Hide elements that shouldn't be visible */
.calibre3,
.noprint {
    display: none;
}

/* Text highlighting styles */
.highlight {
    display: inline;
    background-color: #ffff99;
    /* Light yellow background */
    padding: 0 2px;
    border-radius: 2px;
}

.highlight-blue {
    background-color: #cce5ff;
    /* Light blue */
}

.highlight-green {
    background-color: #d4edda;
    /* Light green */
}

.highlight-pink {
    background-color: #f8d7da;
    /* Light pink */
}

.highlight-purple {
    background-color: #e2d4f8;
    /* Light purple */
}