/* Library guide pages (/library/<name>.html, not library.php): shared layout of App/Library/templates/layout.php, no W3.CSS.
   Library is outside STYLE_GUIDE: own palette, the guides keep their own styles. */

:root {
    --lib-red: #b30c00;
    --lib-gold: rgba(192, 156, 107, 0.85);
    --lib-nav-w: 250px;
    --lib-header-h: 56px;
}

/* --- Base: what old guides got from W3 --- */
html { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; font-family: Verdana, sans-serif; font-size: 15px; line-height: 1.5; color: #000; background: #fff; }
h1, h2, h3, h4, h5, h6 { font-family: "Segoe UI", Arial, sans-serif; margin: 10px 0; }
h1, h2, h3 { color: var(--lib-red); font-weight: bold; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 20px; font-weight: 400; }
h5 { font-size: 18px; font-weight: 400; }
h6 { font-size: 16px; font-weight: 400; }
a { color: inherit; }
img { border-style: none; vertical-align: middle; }
hr { border: 0; border-top: 1px solid #eee; margin: 20px 0; }
button, input, select, textarea { font: inherit; }

/* --- Old guides: rules from info-library.css --- */
ul.menu { line-height: 30px; background: rgba(255, 255, 255, 0.85); border: 2px var(--lib-red) solid; border-radius: 7px; padding: 5px 20px; z-index: 249; list-style-type: none; position: fixed; right: 1%; top: 0; text-align: center; }
ul.menu li { display: inline; margin: 0; padding: 0 5px; }
ul.menu li input { padding: 4px 10px; margin: 0 5px; line-height: 14px; cursor: pointer; border: 1px solid grey; border-radius: 4px; background-color: #efefef; }
ul.menu li input#searchText { text-align: left; cursor: auto; }
ul.menu li input:hover, ul.menu li input:focus { background-color: #f5f5f5; }
ul.menu li input:focus { outline: 0; }
.big_block, .float_block { border-color: var(--lib-red); }
.big_block .obj { margin-top: 3px; margin-bottom: 2px; height: auto; min-height: 35px; padding: 7px 0 7px 55px; float: none; display: inline-block; }
.big_block .obj > img { margin-left: -45px; }
#tooltip { z-index: 200; }
.user-info span { width: 12px; height: 14px; line-height: 14px; font-weight: bold; color: #fff; background-color: #369; border-radius: 4px; text-align: center; font-size: 11px; display: inline-block; }
.user-info span:hover { background-color: #59d; }

/* --- Side menu --- */
/* Menu and header selectors start with .lib-nav / .lib-header: page styles (button {...}, .dress-page button) must not restyle them */
.lib-nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 251;
    width: var(--lib-nav-w); overflow-y: auto; scrollbar-width: none;
    background: #000 url("/assets/images/library/menu2.webp") no-repeat left top / cover;
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 85%, #000 100%), url("/assets/images/library/menu2.webp");
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.lib-nav::-webkit-scrollbar { display: none; }
.lib-logo { display: block; padding: 10px; }
.lib-logo img { display: block; width: 100%; max-width: 230px; height: auto; }
.lib-menu, .lib-menu ul { list-style: none; margin: 0; padding: 0; }
.lib-menu { padding-bottom: 24px; font-size: 18px; }
.lib-nav .lib-menu a, .lib-nav .lib-sec > button {
    position: relative; z-index: 1; display: block; width: 100%;
    padding: 8px 12px 8px 10px; border: 0; background: transparent;
    color: #fff; font: inherit; font-weight: bold; text-align: left; text-decoration: none; cursor: pointer;
}
.lib-nav .lib-menu a::after, .lib-nav .lib-sec > button::after {
    content: ""; position: absolute; z-index: -1; inset: 0 -10px; border-radius: 4px;
    background: transparent; transition: background 0.25s ease, box-shadow 0.25s ease;
}
.lib-nav .lib-menu a:hover::after, .lib-nav .lib-sec > button:hover::after, .lib-nav .lib-menu a:focus-visible::after, .lib-nav .lib-sec > button:focus-visible::after {
    background: var(--lib-gold); box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}
.lib-nav .lib-menu a[aria-current="page"]::after { background: var(--lib-gold); }
.lib-nav .lib-sec > button::before {
    content: ""; float: right; margin: 9px 0 0 6px;
    border: 5px solid transparent; border-top-color: currentColor; border-bottom-width: 0;
}
.lib-nav .lib-sec.open > button::before { transform: rotate(180deg); }
.lib-sec > ul { display: none; }
.lib-sec.open > ul { display: block; }
.lib-sec li { margin-left: 20px; border-left: 3px solid var(--lib-red); }
.lib-nav .lib-sec li a { font-size: 14px; }

/* --- Page --- */
/* Old guides set body padding (info-library-dress.css: 20px); the column .lib-main gives the indent */
body.lib { padding: 0; }
.lib-main { margin-left: var(--lib-nav-w); padding: 20px 25px 0; }
.lib-footer {
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px;
    margin: 75px -25px 0; padding: 24px 25px; background: #9e9e9e; color: #fff; font-size: 14px;
}
.lib-main > .lib-footer a { color: #fff; text-decoration: none; }
.lib-main > .lib-footer a:hover { text-decoration: underline; }

/* --- Contents /library/ (library/index.php) --- */
.lib-toc { max-width: 900px; margin: 0 auto; padding: 10px 0 20px; }
.lib-toc h1 { text-align: center; margin: 10px 0 6px; }
.lib-toc-lead { text-align: center; color: #555; margin: 0 0 24px; }
.lib-toc h2 { margin: 28px 0 8px; padding-bottom: 4px; border-bottom: 1px solid #d3d3d3; }
.lib-toc ul { list-style: none; margin: 0; padding: 0; }
.lib-toc li { padding: 6px 0; }
.lib-toc li a { color: var(--lib-red); font-weight: bold; }
.lib-toc li p { margin: 2px 0 0; color: #555; font-size: 13px; }

/* Old guides: the article menu ul.menu (fixed top right) must not run under the side menu */
@media (min-width: 993px) {
    .lib-main ul.menu { max-width: calc(99vw - var(--lib-nav-w) - 20px); }
}

/* Guide with side contents #sidebar is centered by the window, not by the column next to the menu
   (the guide places #sidebar from the window center); wide pages without it keep the full width */
@media (min-width: 1400px) {
    .lib-main:has(#sidebar) { margin-right: var(--lib-nav-w); }
}

/* --- Mobile: menu behind the header button --- */
.lib-header, .lib-overlay { display: none; }
@media (max-width: 992px) {
    .lib-header {
        position: fixed; top: 0; left: 0; right: 0; z-index: 249;
        display: flex; align-items: center; justify-content: space-between;
        height: var(--lib-header-h); padding: 0 8px 0 16px; background: #000; color: #fff;
    }
    .lib-header .lib-header-title { color: #fff; font-size: 22px; letter-spacing: 2px; text-decoration: none; }
    .lib-header .lib-burger { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; }
    .lib-burger span, .lib-burger span::before, .lib-burger span::after {
        display: block; width: 24px; height: 3px; margin: 0 auto; background: #fff; border-radius: 1px;
    }
    .lib-burger span { position: relative; }
    .lib-burger span::before, .lib-burger span::after { content: ""; position: absolute; left: 0; }
    .lib-burger span::before { top: -8px; }
    .lib-burger span::after { top: 8px; }
    .lib-nav { display: none; max-width: calc(100vw - 48px); }
    .lib.nav-open .lib-nav { display: block; }
    .lib.nav-open .lib-overlay { display: block; position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, 0.5); }
    .lib-main { margin-left: 0; padding: calc(var(--lib-header-h) + 12px) 8px 0; }
    /* Old guides: article menu goes into the flow under the header instead of covering it; item tiles in two columns */
    .lib-main ul.menu { position: static; width: auto; margin: 0 0 12px; border-radius: 0; border-left: 0; border-right: 0; padding: 5px 8px; }
    .lib-main .big_block .obj { width: 47%; }
    .lib-footer { margin: 75px -8px 0; padding: 20px 12px; justify-content: flex-start; }
}

@media (max-width: 710px) {
    .lib-main .big_block .obj { width: 100%; }
}

@media print {
    .lib-nav, .lib-header, .lib-overlay { display: none !important; }
    .lib-main { margin: 0; padding: 0; }
}
