/* Table of contents of the novel: popup tree view (custom.js), styled like the dictionary TOC.
   Page, header and typography come from docs/source/common.css */
/* The flat list is replaced by the popup tree (custom.js); keep it hidden so it never flashes, and show it without JavaScript (see osudy.html) */
nav#obsah {
    display: none;
}

nav#obsah ul {
    list-style: none;
    padding-left: 1.2em;
}

nav#obsah>ul {
    padding-left: 0;
}

nav#obsah li.v {
    margin-top: .6em;
    font-weight: bold;
}

/* Loading spinner (removed on window load, see osudy.html), same look as the portal's */
#osudy-spinner {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(14, 17, 14, 0.5);
}

#osudy-spinner>div {
    position: absolute;
    top: calc(50% - 28px);
    left: calc(50% - 28px);
    width: 56px;
    height: 56px;
    box-sizing: border-box;
    border: 8px solid #eec;
    border-top-color: rgb(109, 109, 179);
    border-radius: 50%;
    animation: osudy-spin 0.7s linear infinite;
}

@keyframes osudy-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Sticky header; opaque so the text doesn't show through while scrolling */
table.header {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-bottom: 60px;
    background: linear-gradient(var(--bg-header), var(--bg-header)), var(--bg-container);
}

/* Keep anchor targets clear of the sticky header (height set by custom.js) */
html {
    scroll-padding-top: calc(var(--osudy-header-h, 150px) + 8px);
}

/* Rule above the TOC launcher */
hr.osudy-toc-rule {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 42px;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--border-header);
}

/* TOC launcher: a plain link inside the header, at the bottom, horizontally centred */
button.osudy-toc-btn {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    padding: 0;
    border: 0;
    background: none;
    color: var(--fg-link);
    font-family: var(--main-font);
    font-size: 14px;
    letter-spacing: 0;
    cursor: pointer;
}

button.osudy-toc-btn:hover,
button.osudy-toc-btn[aria-expanded="true"] {
    text-decoration: underline;
}

/* Positioned by custom.js directly below the header, centred on it */
div.osudy-toc-panel {
    position: fixed;
    transform: translateX(-50%);
    z-index: 29;
    box-sizing: border-box;
    width: min(560px, calc(100vw - 16px));
    max-height: 70vh;
    overflow-y: auto;
    padding: 4px 10px 10px;
    background-color: var(--bg-container);
    border: 1px solid #3a5080;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

div.osudy-toc-panel[hidden] {
    display: none;
}

div.osudy-toc-panel div.toc-head {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 48px;
    padding: 0 8px;
    margin-bottom: 8px;
    font-size: 30px;
    line-height: 1.3;
}

div.osudy-toc-panel div.toc-head>b {
    font-family: var(--heading-font);
    color: var(--fg-header-title);
}

div.osudy-tree div.cindex-node {
    margin: 4px 0;
}

div.osudy-tree div.collapse1 {
    padding: 5px;
    margin-left: 20px;
    margin-right: 0;
}

div.osudy-tree div.index {
    padding: 5px;
    margin: 5px 0;
    border: 1px outset #ccc;
    background-color: #faf9f5;
}

div.osudy-tree img.folder {
    padding: 0;
    margin: 0 4px 5px 0;
    vertical-align: middle;
    cursor: pointer;
}

div.osudy-tree a.cindex {
    font-size: 13px;
    color: #336;
}

div.osudy-tree div.cindex-node>a.cindex {
    font-weight: bold;
}

div.osudy-tree a.cindex:hover {
    text-decoration: underline;
}

.main p {
    text-align: justify;
    margin: .5em 0;
}
