/* The sounderpy.app header, menu and footer around the docs (_templates/layout.html).
 * Same look as the web app's own (sounderpy-webapp: src/styles/global.css). Sizes are in px because the
 * Read the Docs theme sets its own root font size. */

:root { --app-header-h: 68px; }

/* ---- Header: logo and name on the left, the menu tray on the right; stays at the top ---- */
.app-header {
    position: fixed; top: 0; right: 0; left: 0; z-index: 300; display: flex; align-items: center; justify-content: space-between; gap: 24px;
    height: var(--app-header-h); padding: 0 clamp(16px, 4vw, 56px); box-sizing: border-box;
    border-bottom: 1px solid var(--line-strong); background: rgb(69 65 58 / 97%); backdrop-filter: blur(10px);
    font-family: var(--sans);
}
.app-brand { display: flex; flex: none; align-items: center; gap: 12px; color: var(--forest-deep) !important; text-decoration: none !important; }
.app-brand img { width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 2px 8px rgb(0 0 0 / 30%); }
.app-brand > span { display: flex; align-items: baseline; gap: 10px; }
.app-brand-name { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.app-brand-title { padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--ochre); font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.app-nav-tray {
    display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid rgb(166 146 109 / 45%); border-radius: 10px;
    background: rgb(0 0 0 / 16%); box-shadow: inset 0 1px 3px rgb(0 0 0 / 25%);
}
.app-nav-tray a {
    display: inline-flex; align-items: center; gap: 4px; padding: 6px 13px; border-radius: 7px; color: var(--forest) !important;
    font-size: 16px; font-weight: 650; line-height: 1.35; text-decoration: none !important; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.app-nav-tray a:hover { background: rgb(255 255 255 / 6%); color: var(--forest-deep) !important; }
.app-nav-tray a[aria-current="page"] { background: rgb(221 195 134 / 16%); box-shadow: inset 0 -2px 0 var(--ochre); color: var(--forest-deep) !important; }
.app-nav-icon { flex: none; width: 1.15em; height: 1.15em; margin-right: 3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.app-nav-tray a:hover .app-nav-icon, .app-nav-tray a[aria-current="page"] .app-nav-icon { opacity: 1; }
.app-ext { flex: none; width: .7em; height: .7em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }

/* The theme's layout (sidebar and page) starts under the fixed header. The header is fixed rather than sticky
   because the theme's wrapper stops sticky positioning from working. */
.wy-grid-for-nav { top: var(--app-header-h); }
.wy-nav-side { top: var(--app-header-h); min-height: 0; }
.wy-nav-side .wy-side-scroll { height: 100%; }

@media (max-width: 1180px) {
    .app-nav-tray a { padding: 6px 9px; font-size: 14.5px; }
    .app-brand-name { font-size: 22px; }
}
@media (max-width: 1000px) and (min-width: 769px) {
    .app-nav-tray a { padding: 6px 8px; font-size: 14px; }
    .app-brand-name { font-size: 20px; }
}

/* ---- Phones: a slim bar with a three-line menu button (the docs' own Contents bar sits under it) ---- */
.app-menu-toggle, .app-menu, .app-menu-scrim { display: none; }
@media (max-width: 768px) {
    :root { --app-header-h: calc(56px + env(safe-area-inset-top)); }
    .app-header { padding: env(safe-area-inset-top) 14px 0; }
    .app-nav { display: none; }
    .app-brand img { width: 36px; height: 36px; }
    .app-brand-name { font-size: 20px; }
    .app-brand-title { font-size: 13px; }

    .app-menu-toggle {
        display: inline-flex; width: 44px; height: 44px; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
        padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; cursor: pointer;
    }
    .app-menu-toggle span { display: block; width: 21px; height: 2px; border-radius: 2px; background: var(--forest-deep); transition: transform .2s ease, opacity .2s ease; }
    .app-menu-toggle[aria-expanded="true"] { border-color: var(--ochre); }
    .app-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .app-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .app-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .app-menu {
        position: fixed; z-index: 299; top: var(--app-header-h); right: 0; left: 0; display: grid; gap: 4px; padding: 10px 12px 16px;
        border-bottom: 1px solid var(--line-strong); background: rgb(58 54 47 / 98%); backdrop-filter: blur(12px);
        box-shadow: 0 14px 30px rgb(0 0 0 / 40%); font-family: var(--serif);
    }
    .app-menu[hidden] { display: none; }
    .app-menu a { display: flex; min-height: 50px; align-items: center; gap: 14px; padding: 6px 12px; border-radius: 10px; color: var(--forest-deep) !important; font-size: 20px; text-decoration: none !important; }
    .app-menu a[aria-current="page"] { background: rgb(221 195 134 / 12%); color: var(--ochre) !important; }
    .app-menu svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
    .app-menu .app-ext { width: 13px; height: 13px; margin-left: auto; }
    .app-menu-scrim { position: fixed; z-index: 298; inset: 0; display: block; background: rgb(12 10 8 / 62%); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    html.app-menu-open .app-menu-scrim { opacity: 1; pointer-events: auto; }
    html.app-menu-open { overflow: hidden; }

    /* the docs' own bar: a "Contents" button that opens the docs sidebar */
    .wy-nav-top { position: relative; z-index: 250; display: flex !important; align-items: center; gap: 10px; padding: 10px 16px; line-height: 1; text-align: left; }
    .wy-nav-top i { font-size: 18px; }
    .app-contents-label { color: var(--forest-deep); font-size: 15px; font-weight: 700; cursor: pointer; }
    .wy-nav-side { top: var(--app-header-h); }
}

/* ---- Footer, at the bottom of the reading column: logo, © and version; links; author credit ---- */
.app-footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px;
    margin-top: 28px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-light);
    color: var(--ink-soft); font-family: var(--sans); font-size: 13.5px; line-height: 1.4;
}
.app-footer-id { display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: 14.5px; }
.app-footer-id img { width: 38px; height: 38px; border-radius: 50%; }
.app-footer-id small { display: block; color: var(--ink-soft); font-size: 12.5px; }
.app-footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.app-footer a { display: inline-flex; align-items: center; gap: 4px; color: var(--forest) !important; font-size: 15px; font-weight: 600; text-decoration: none !important; }
.app-footer a:hover { color: var(--clay) !important; text-decoration: underline !important; }
.app-footer-by { font-weight: 500 !important; }
@media (max-width: 600px) { .app-footer { flex-direction: column; align-items: flex-start; } }

/* Nothing in a page widens it past the screen. On phones, long inline code, links and notebook output text
   (which don't break on their own) made pages wider than the screen, so the browser zoomed and the menu
   button sat off the right edge. Long words now wrap, and anything else that reaches past the edge is clipped. */
html, body { overflow-x: clip; }
.rst-content p, .rst-content li, .rst-content td, .rst-content dd, .rst-content a, .rst-content strong, .rst-content em { overflow-wrap: anywhere; }
.rst-content code.literal { white-space: normal; overflow-wrap: break-word; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* Tables on phones: words stay whole and a table wider than the screen scrolls sideways inside its own box
   (these tables have no theme wrapper, so without this the extra columns were cut off at the screen edge) */
@media (max-width: 768px) {
    .rst-content table.docutils { display: block; max-width: 100%; overflow-x: auto; font-size: .92em; }
    .rst-content table.docutils td, .rst-content table.docutils th { padding: 8px 10px; overflow-wrap: normal; }
    .rst-content table code.literal { white-space: nowrap; overflow-wrap: normal; }
}
/* Code in a heading (the notebooks' function signatures) reads as part of the heading, not as a row of boxes */
.rst-content :is(h1, h2, h3, h4) code.literal { padding: 0; border: 0; background: none; color: inherit; font-size: .9em; }
@media (max-width: 768px) { .rst-content :is(h1, h2, h3, h4) code.literal { font-size: .78em; } }

/* Figures line up with the text. Notebook cells drop the "[1]:" prompt column, which indented every code cell
   and figure on wider screens while their right edges ran to the edge of the text. */
div.nbinput.container div.prompt, div.nboutput.container div.prompt { display: none; }
div.nbinput.container div.input_area, div.nboutput.container div.output_area { margin-left: 0; }
/* A picture narrower than the text column (a :width: under 100%) sits in the middle instead of on the left */
.rst-content section > img:not([class*="align-"]),
.rst-content section > a.image-reference > img:not([class*="align-"]) { display: block; margin-inline: auto; }
@media (max-width: 768px) {
    /* Side-by-side picture tables (the gallery, light vs dark) stack one picture per row, each the full width,
       instead of two uneven pictures spilling sideways */
    .rst-content table.docutils:has(img) { display: table; width: 100%; table-layout: fixed; }
    .rst-content table.docutils:has(img) colgroup { display: none; }
    .rst-content table.docutils:has(img) tr { display: block; }
    .rst-content table.docutils:has(img) td { display: block; width: 100%; padding: 10px 0; border: 0; background: none; }
    .rst-content table.docutils:has(img) img { display: block; width: 100%; height: auto; }
    /* Pictures floated beside text sit on their own line, so the text beside them isn't squeezed to a sliver */
    .rst-content img.align-left, .rst-content img.align-right, .rst-content .align-left > img, .rst-content .align-right > img {
        float: none; display: block; max-width: 100%; height: auto; margin: 1rem auto;
    }
}
/* A link to a section lands with its heading just below the fixed header, not hidden under it */
.rst-content [id] { scroll-margin-top: calc(var(--app-header-h, 70px) + 12px); }
