/* App speech (the orange button) marks the read passage and word in theme colors
   without changing line or table metrics. Edge Read Aloud keeps its own styling. */
#book-content .tts-highlight {
    outline: 1px dashed currentColor;
    outline-offset: 2px;
}

::highlight(reader-tts-word) {
    background-color: color-mix(in srgb, var(--container-bg) 88%, var(--text-color) 12%);
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-color: var(--text-color);
    text-decoration-thickness: 2px;
}

/* Edge Read Aloud wraps the whitespace between table cells (and could wrap a cell or
   row) in an inline msreadoutspan, which a table turns into an anonymous cell or row.
   Remove only the wrapper's box; the text, the cells and Edge's word marks stay. */
#book-content :is(table, thead, tbody, tfoot, tr, colgroup) > msreadoutspan {
    display: contents !important;
}

#toc-list a.active {
    background: color-mix(in srgb, var(--container-bg) 90%, var(--text-color) 10%);
    color: var(--text-color);
    box-shadow: inset 3px 0 var(--text-color);
    font-weight: 600;
}

/* The bookmark (ayraç): an amber underline that keeps the theme's text colors. It is a
   CSS highlight, so it never changes the text nodes Edge Read Aloud and speech use. */
::highlight(reader-bookmark) {
    background-color: color-mix(in srgb, var(--container-bg) 86%, #ffb300 14%);
    text-decoration: underline;
    text-decoration-color: #ffb300;
    text-decoration-thickness: 2px;
}

::highlight(reader-bookmark-flash) {
    background-color: color-mix(in srgb, var(--container-bg) 62%, #ffb300 38%);
}

/* Book search (Kitapta ara): every match on screen in yellow and the current one in orange, as a browser or PDF
   viewer finds; dark letters keep both readable in every theme. Words the source page draws (transparent text
   over a PDF's picture) only get the tint. */
::highlight(reader-search) {
    background-color: #ffe25a;
    color: #111;
}

::highlight(reader-search-current) {
    background-color: #ff9632;
    color: #111;
}

::highlight(reader-search-hidden) {
    background-color: rgba(255, 226, 90, 0.55);
}

::highlight(reader-search-current-hidden) {
    background-color: rgba(255, 150, 50, 0.6);
}

/* Original PDF view ("original-only"): the PDF.js text layer sits transparently over the
   rendered canvas, so highlights keep letters transparent and paint translucent tints. */
.pdf-source-text .textLayer span::highlight(reader-tts-word) {
    background-color: rgba(255, 152, 0, 0.35);
    color: transparent;
    text-decoration: none;
}

.pdf-source-text .textLayer span::highlight(reader-bookmark) {
    background-color: rgba(255, 179, 0, 0.28);
    color: transparent;
    text-decoration: underline;
    text-decoration-color: #ffb300;
    text-decoration-thickness: 2px;
}

.pdf-source-text .textLayer span::highlight(reader-bookmark-flash) {
    background-color: rgba(255, 179, 0, 0.5);
    color: transparent;
    text-decoration: none;
}

.pdf-source-text .textLayer span::highlight(reader-search),
.pdf-source-text .textLayer span::highlight(reader-search-hidden) {
    background-color: rgba(255, 226, 90, 0.55);
    color: transparent;
}

.pdf-source-text .textLayer span::highlight(reader-search-current),
.pdf-source-text .textLayer span::highlight(reader-search-current-hidden) {
    background-color: rgba(255, 150, 50, 0.6);
    color: transparent;
}

.book-search-hit[aria-current="true"] {
    background: color-mix(in srgb, var(--container-bg) 90%, var(--text-color) 10%);
    color: var(--text-color);
    box-shadow: inset 3px 0 var(--text-color);
}
