﻿/* Novela.Web/wwwroot/css/nav-buttons.css
   ───────────────────────────────────────────────
   The status bar's page controls, and how raised they look.
   Settings → Theme → Button style (theme.js puts data-bar-buttons on <html>):
     pebbles  Previous / Next page are round soft keys, tinted with the button color (the default)
     strip    the page controls and "Page 12 of 340" sit together on one raised strip,
              with Previous / Next page as pebbles on it
     strip-all      … every button a pebble, the page ones largest
     flat     nothing raised
   In every style but flat, the other buttons in the bar (Settings, Search, Page mode…) are softly raised.
   The raised look is the same leather as the Library's raised buttons (reader.css, "Raised (3D) buttons"):
   light from above, a shine on the top edge, a shadow below; lifts under the mouse, sinks when pressed.
   ─────────────────────────────────────────────── */

/* The raised colors, for the status bar and the Library's top line. theme.js sets them from
   Settings → Button style (each theme's color, or yours); these are only the fallback (leather). */
:root {
    --raised-top: #a5734c;
    --raised-bottom: #6e4429;
    --raised-text: #fbf3e6;
    --raised-border: #4f2f1b;
    --raised-active: #ffd27a;      /* "on" buttons (Beautiful, reading aloud…) turn gold */
}

/* The arrows: thin, rounded lines instead of the heavy font chevrons */
.nav-chev {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The page controls' wrapper: in "strip" it's the raised strip (below); in every other style it just
   holds the six arrows and the position close together, so they read as one group (they used to sit
   loose in the bar, spaced like every other button — on the iPad, with Flat, nothing looked grouped) */
.nav-pager {
    display: flex;
    align-items: center;
    gap: .1rem;
}

/* A little space between the page controls and Page mode / Columns / Alignment (every style),
   so those three don't look like part of the navigation */
.reader-nav-bar .nav-pager + .nav-btn {
    margin-left: 1rem;
}

/* ── Pebbles: Previous / Next page as round soft keys — the same quiet look as the other buttons,
   with a touch more of the button color and the arrow in that color, so they're easy to find
   without pulling the eye from the page ── */
html[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]) {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    color: var(--raised-bottom);
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--chrome-bg) 85%, #fff),
        color-mix(in srgb, var(--chrome-bg) 80%, var(--raised-bottom)));
    border: 1px solid color-mix(in srgb, var(--chrome-border) 65%, var(--raised-bottom));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        0 1px 2px rgba(0, 0, 0, .1);
    transition: box-shadow .12s ease, transform .12s ease, color .12s ease;
}

    html[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]) .nav-chev {
        width: 18px;
        height: 18px;
        stroke-width: 2;
    }

    /* Under the mouse: the arrow darkens and the pebble lifts a little */
    html[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]):hover:not(:disabled) {
        color: color-mix(in srgb, var(--raised-bottom) 70%, #000);
        background: linear-gradient(to bottom,
            color-mix(in srgb, var(--chrome-bg) 70%, #fff),
            color-mix(in srgb, var(--chrome-bg) 82%, var(--raised-bottom)));
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .6),
            0 2px 5px rgba(0, 0, 0, .14);
    }

    /* Pressed: pushed in */
    html[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]):active:not(:disabled) {
        transform: translateY(1px);
        background: color-mix(in srgb, var(--chrome-bg) 78%, var(--raised-bottom));
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
    }

    /* Dark themes: a lighter arrow (the dark button color wouldn't show) and a fainter shine */
    html.theme-dark[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]) {
        color: color-mix(in srgb, var(--raised-top) 55%, #fff);
        background: linear-gradient(to bottom,
            color-mix(in srgb, var(--chrome-bg) 88%, #fff),
            color-mix(in srgb, var(--chrome-bg) 75%, var(--raised-bottom)));
        border-color: color-mix(in srgb, var(--chrome-border) 60%, var(--raised-top));
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .07),
            0 1px 2px rgba(0, 0, 0, .4);
    }

        html.theme-dark[data-bar-buttons="pebbles"] .reader-nav-bar :is([data-action="prev-page"], [data-action="next-page"]):hover:not(:disabled) {
            color: #fff;
        }

/* ── Soft keys, in every style but Flat: the bar's other buttons gently raised — light, quiet,
   in the bar's own colors with a hint of the button color. Only the buttons directly in the bar's
   groups; the page controls (inside .nav-pager) are styled by the style's own rules. ── */
html:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-group > .nav-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 .4rem;
    font-size: 1.05rem;
    border-radius: 8px;
    color: color-mix(in srgb, var(--reader-fg) 75%, transparent);
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--chrome-bg) 85%, #fff),
        color-mix(in srgb, var(--chrome-bg) 88%, var(--raised-bottom)));
    border: 1px solid color-mix(in srgb, var(--chrome-border) 80%, var(--raised-bottom));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        0 1px 2px rgba(0, 0, 0, .08);
    transition: box-shadow .12s ease, transform .12s ease, color .12s ease;
}

    html:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-group { gap: .4rem; }

    /* Under the mouse: the icon darkens and the key lifts a little */
    html:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-group > .nav-btn:hover:not(:disabled) {
        color: var(--reader-fg);
        background: linear-gradient(to bottom,
            color-mix(in srgb, var(--chrome-bg) 70%, #fff),
            color-mix(in srgb, var(--chrome-bg) 92%, var(--raised-bottom)));
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .6),
            0 2px 5px rgba(0, 0, 0, .12);
    }

    /* Pressed: pushed in */
    html:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-group > .nav-btn:active:not(:disabled) {
        transform: translateY(1px);
        background: color-mix(in srgb, var(--chrome-bg) 85%, var(--raised-bottom));
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
    }

    /* Dark themes: a fainter shine, so the keys don't glow */
    html.theme-dark:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-group > .nav-btn {
        background: linear-gradient(to bottom,
            color-mix(in srgb, var(--chrome-bg) 88%, #fff),
            color-mix(in srgb, var(--chrome-bg) 85%, var(--raised-bottom)));
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .07),
            0 1px 2px rgba(0, 0, 0, .4);
    }

    /* "On" buttons (Beautiful, reading aloud, on a shelf) keep the theme's link color */
    html:not([data-bar-buttons="flat"]) body.beautiful-on .nav-btn[data-action="beautify"],
    html:not([data-bar-buttons="flat"]) body.reading-aloud .nav-btn[data-action="read-aloud"],
    html:not([data-bar-buttons="flat"]) .reader-nav-bar .nav-btn[data-shelf-button].active {
        color: var(--reader-link);
    }

/* ── Strip: the page controls on one raised strip ── */
html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager {
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 12px;
    color: var(--raised-text);
    background: linear-gradient(to bottom, var(--raised-top), var(--raised-bottom));
    border: 1px solid var(--raised-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .35),
        0 1px 0 rgba(0, 0, 0, .1),
        0 2px 4px rgba(0, 0, 0, .25);
}

    html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager .nav-btn {
        color: var(--raised-text);
        padding: .3rem .55rem;
        border-radius: 9px;
    }

        html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager .nav-btn:hover:not(:disabled) {
            background: rgba(255, 255, 255, .12);
        }

        html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager .nav-btn:active:not(:disabled) {
            background: rgba(0, 0, 0, .18);
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35);
        }

    /* Pebbles sitting on the strip, a shade lighter than it:
         strip         Previous / Next page
         strip-all     every button: page ones large, the rest small
       (Beginning / End of the book stay small or flat, so they're harder to hit by mistake) */
    html[data-bar-buttons="strip"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]),
    html[data-bar-buttons="strip-all"] .reader-nav-bar .nav-pager .nav-btn {
        --pebble: 26px;
        --pebble-icon: 14px;
        width: var(--pebble);
        height: var(--pebble);
        padding: 0;
        margin: 0 .2rem;
        border-radius: 50%;
        background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--raised-top) 80%, #fff), var(--raised-bottom) 90%);
        border: 1px solid var(--raised-border);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .35),
            0 1px 2px rgba(0, 0, 0, .35);
        transition: box-shadow .12s ease, transform .12s ease, filter .12s ease;
    }

    /* Sizes: the page pebbles are the big ones (30 px in strip, 34 px beside the smaller ones in strip-all) */
    html[data-bar-buttons="strip"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]) { --pebble: 30px; --pebble-icon: 16px; }
    html[data-bar-buttons="strip-all"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]) { --pebble: 34px; --pebble-icon: 18px; }

    html[data-bar-buttons="strip"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]) .nav-chev,
    html[data-bar-buttons="strip-all"] .reader-nav-bar .nav-pager .nav-btn .nav-chev {
        width: var(--pebble-icon);
        height: var(--pebble-icon);
        stroke-width: 2;
    }

    /* Under the mouse: lighter, lifting a little (the flat buttons on the strip lighten too) */
    html[data-bar-buttons="strip"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]):hover:not(:disabled),
    html[data-bar-buttons="strip-all"] .reader-nav-bar .nav-pager .nav-btn:hover:not(:disabled) {
        background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--raised-top) 65%, #fff), var(--raised-bottom) 90%);
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .4),
            0 3px 5px rgba(0, 0, 0, .35);
    }

    /* Pressed: pushed into the strip, the light flips */
    html[data-bar-buttons="strip"] .reader-nav-bar .nav-pager :is([data-action="prev-page"], [data-action="next-page"]):active:not(:disabled),
    html[data-bar-buttons="strip-all"] .reader-nav-bar .nav-pager .nav-btn:active:not(:disabled) {
        background: radial-gradient(circle at 50% 72%, var(--raised-top), var(--raised-bottom) 90%);
        transform: translateY(1px);
        box-shadow: inset 0 2px 3px rgba(0, 0, 0, .4);
    }

    /* The position text, between thin dividers */
    html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager .reader-progress {
        min-width: 12rem;
        padding: 0 .7rem;
        color: var(--raised-text);
        text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
        border-left: 1px solid rgba(0, 0, 0, .25);
        border-right: 1px solid rgba(0, 0, 0, .25);
        box-shadow: inset 1px 0 0 rgba(255, 255, 255, .12), inset -1px 0 0 rgba(255, 255, 255, .12);
    }

/* Buttons only the iPhone/iPad/Mac app has (Share EPUB in the reader): hidden unless <html> has the
   class "in-app", which js/page-shell.js adds inside the app. On the PC they never show. */
html:not(.in-app) [data-app-only] { display: none !important; }

/* ── Groups in the bar's right half: Read aloud · Shelves · Beautiful, then brightness, then text size,
   with a little more space between the groups than inside them ── */
.reader-nav-bar [data-action="brightness-down"],
.reader-nav-bar [data-action="font-smaller"] {
    margin-left: .6rem;
}

/* ── Flat: no raised keys, so the buttons were wide (padding .7rem each side) and the bar was wider
   than an iPad held sideways (1180 points): the gear and A+ were cut off. Narrower now, closer to the
   other styles. ── */
html[data-bar-buttons="flat"] .reader-nav-bar .nav-btn {
    padding: .4rem .45rem;
}

html[data-bar-buttons="flat"] .reader-nav-bar .nav-group {
    gap: .25rem;
}

/* ── Narrow windows (an iPad held upright: 820 points; a narrow window on the PC): a tighter bar ──
   • the position text gets less room, in smaller letters (it may take two lines)
   • Beginning / End of the book step aside (Contents goes there too)
   • Columns steps aside: below 900 points there's only ever one column anyway (reader.css),
     except on a phone held sideways (short as well as narrow), which can show two */
@media (max-width: 1000px) {
    .reader-nav-bar .reader-progress,
    html[data-bar-buttons^="strip"] .reader-nav-bar .nav-pager .reader-progress {
        min-width: 0;
        max-width: 7.5rem;
        padding: 0 .3rem;
        font-size: .72rem;
        line-height: 1.15;
    }

    .reader-nav-bar :is([data-action="book-start"], [data-action="book-end"]) {
        display: none;
    }

    .reader-nav-bar .nav-left { padding-left: .4rem; }
    .reader-nav-bar .nav-right { padding-right: .4rem; }
    .reader-nav-bar .nav-pager + .nav-btn { margin-left: .5rem; }
    .reader-nav-bar [data-action="brightness-down"],
    .reader-nav-bar [data-action="font-smaller"] { margin-left: .35rem; }
}

@media (max-width: 900px) and (min-height: 501px) {      /* a phone held sideways keeps it (reader.css) */
    .reader-nav-bar [data-action="columns"] {
        display: none;
    }
}

/* ── Phones held upright (an iPhone is about 400 points wide): the reading page's bar in two rows ──
   One row can't hold all the buttons; the left end (the gear) was pushed off the screen.
   • Top row: the page controls (Beginning / End of the book too) and "Page 12 of 340", centred.
   • Bottom row: every other button, spread evenly across.
   • Share EPUB (also in the Library's ⋯ menu) and the brightness buttons (drag up or down in
     the left margin does the same) step aside to make room.
   How: the centre group is "display: contents" — its box disappears and its buttons become the
   bar's own, so the page controls can be given a row of their own (order: -1, full width).
   The bar is taller, so --reader-nav-h (which the page's height is worked out from) grows too.
   Only the reading page: the Library's bar (.library-bar) is short enough as it is. */
/* The half-moon brightness button is only for a phone held upright (shown in the block below) */
.reader-nav-bar [data-action="brightness-slider"] { display: none; }

@media (max-width: 600px) {
    body.paged, body.scroll { --reader-nav-h: 92px; }

    /* Brightness: the half-moon (a small slider, reader.js) takes Shelves' place. Shelves is still in
       the reader sideways, and in the Library */
    .reader-nav-bar:not(.library-bar) [data-action="brightness-slider"] { display: inline-block; }
    .reader-nav-bar:not(.library-bar) [data-shelf-button] { display: none; }

    .reader-nav-bar:not(.library-bar) {
        flex-wrap: wrap;
        align-content: center;
        justify-content: space-evenly;
        gap: .2rem 0;
        padding: .2rem .25rem;
        box-sizing: border-box;
    }

    .reader-nav-bar:not(.library-bar) .nav-center { display: contents; }

    .reader-nav-bar:not(.library-bar) .nav-pager {
        order: -1;
        flex: 1 0 100%;
        justify-content: center;
    }

    /* The top row has room for Beginning / End of the book again (hidden below 1000 points, above) */
    .reader-nav-bar:not(.library-bar) .nav-pager :is([data-action="book-start"], [data-action="book-end"]) {
        display: inline-block;
    }

    .reader-nav-bar:not(.library-bar) :is(.nav-left, .nav-right) {
        flex: none;
        gap: 0;
        padding: 0;
    }

    .reader-nav-bar:not(.library-bar) .nav-btn {
        padding: .35rem .45rem;
        font-size: 1.15rem;
    }

    .reader-nav-bar:not(.library-bar) .nav-pager + .nav-btn,
    .reader-nav-bar:not(.library-bar) [data-action="font-smaller"] { margin-left: 0; }

    .reader-nav-bar:not(.library-bar) :is([data-action="share-book"], [data-action="brightness-down"], [data-action="brightness-up"]) {
        display: none;
    }
}
