/******************************************************************************/
/* STEPBible User Guide (J_UserGuide).

   Colours and font size come from the STEPBible variables defined in J_Lib's
   j_common.css (--clrHighlight, --clrText, --clrBackground, --defaultFontSize
   ...), which j_userGuideSettings.js overrides with the user's own STEP
   display settings.  So the guide follows the user's theme, including dark
   backgrounds.

   The guide sits in a panel of J_Lib's multi-panel layout, so its narrow
   layouts use container queries (the width of the guide panel), not media
   queries (the width of the window).

   Two groups of classes:
     .jUG-app...  the application chrome (header, menu, search, page footer)
     .jUG-...     presentation classes used inside the imported guide pages
                  (generated by tools/build_userguide.py).                    */
/******************************************************************************/

:root {
    --jUG-headerHeight: 52px;
    --jUG-menuWidth: 290px;
    --jUG-border: color-mix(in srgb, var(--clrText) 22%, var(--clrBackground));
    --jUG-shade: color-mix(in srgb, var(--clrHighlight) 9%, var(--clrBackground));
    --jUG-shadeStrong: color-mix(in srgb, var(--clrHighlight) 18%, var(--clrBackground));
    --jUG-muted: color-mix(in srgb, var(--clrText) 70%, var(--clrBackground));
    --jUG-fontText: Georgia, 'Times New Roman', serif;
    --jUG-fontUi: Helvetica, Arial, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    color: var(--clrText);
    background: var(--clrBackground);
}

.jUG-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: var(--jUG-fontUi);
    font-size: var(--defaultFontSize);  /* J_Lib panels default to 2rem. */
    background: var(--clrBackground);
    container-type: inline-size;
    container-name: jUG-guide;
}

/* J_Lib's j_common.css gives every a:hover an !important colour (and every
   link no underline); keep the guide's own. */
.jUG-appMenu a:hover, .jUG-appBreadcrumb a:hover, .jUG-appPageFooter a:hover,
.jUG-appResults a:hover, .jUG-content a:hover { color: var(--clrHighlight) !important; }
.jUG-appSource a:hover { color: var(--jUG-muted) !important; }
.jUG-appMenu a:hover, .jUG-appBreadcrumb a:hover, .jUG-appPageFooter a:hover,
.jUG-appResults a:hover, .jUG-appSource a:hover { background: none; }

/* The scripture panel (application.html). */
.jUG-scriptureHolder { background: var(--clrBackground); border-left: 1px solid var(--jUG-border); }


/******************************************************************************/
/* Header */
/******************************************************************************/

.jUG-appHeader {
    flex: 0 0 var(--jUG-headerHeight);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-bottom: 2px solid var(--clrHighlight);
    background: var(--clrBackground);
    z-index: 3;
}

.jUG-appLogo { display: flex; align-items: center; flex: 0 0 auto; }
.jUG-appLogo svg { display: block; }
.jUG-appLogo path, .jUG-appLogo polygon { fill: var(--clrHighlight); }

.jUG-appTitle {
    font-family: var(--jUG-fontUi);
    font-size: 18px;
    font-weight: bold;
    color: var(--clrHighlight);
    white-space: nowrap;
}

.jUG-appSearch {
    margin-left: auto;
    flex: 0 1 260px;
    min-width: 0;
    position: relative;
}

.jUG-appSearch input {
    width: 100%;
    height: 32px;
    padding: 4px 10px 4px 30px;
    font-size: 14px;
    font-family: var(--jUG-fontUi);
    color: var(--clrText);
    background: color-mix(in srgb, var(--clrHighlight) 7%, var(--clrBackground));
    border: 1px solid var(--clrHighlight);
    border-radius: 4px;
}

.jUG-appSearch input:focus { outline: 2px solid var(--clrRelatedWordBg); outline-offset: 0; }

.jUG-appSearch::before {             /* magnifying glass */
    content: '';
    position: absolute;
    left: 10px; top: 9px;
    width: 9px; height: 9px;
    border: 2px solid var(--clrHighlight);
    border-radius: 50%;
}
.jUG-appSearch::after {
    content: '';
    position: absolute;
    left: 19px; top: 19px;
    width: 2px; height: 6px;
    background: var(--clrHighlight);
    transform: rotate(-45deg);
}

.jUG-appMenuButton {
    display: none;
    flex: 0 0 auto;
    width: 36px; height: 32px;
    padding: 6px 8px;
    border: 1px solid var(--clrHighlight);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}
.jUG-appMenuButton span {
    display: block;
    height: 2px;
    margin: 3px 0;
    background: var(--clrHighlight);
}


/******************************************************************************/
/* Body: menu + page */
/******************************************************************************/

.jUG-appBody {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    position: relative;
}

.jUG-appMenu {
    flex: 0 0 var(--jUG-menuWidth);
    overflow-y: auto;
    padding: 10px 0 30px 0;
    border-right: 1px solid var(--jUG-border);
    background: var(--clrBackground);
    font-size: 14px;
}

.jUG-appMenu ul { list-style: none; }
.jUG-appMenu ul ul { margin-left: 14px; border-left: 1px solid var(--jUG-border); }

.jUG-appMenu a {
    display: block;
    padding: 5px 12px 5px 14px;
    color: var(--clrText);
    text-decoration: none;
    line-height: 1.3;
    border-left: 3px solid transparent;
}
.jUG-appMenu a:hover { background: var(--jUG-shade); color: var(--clrHighlight); }
.jUG-appMenu a.jUG-current {
    border-left-color: var(--clrHighlight);
    background: var(--jUG-shadeStrong);
    color: var(--clrHighlight);
    font-weight: bold;
}

.jUG-appMenu > ul > li { margin-top: 6px; }
.jUG-appMenu > ul > li > a {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: 12.5px;
    color: var(--clrHighlight);
}

.jUG-appMain {
    flex: 1 1 auto;
    overflow-y: auto;
    min-width: 0;
    scroll-behavior: smooth;
}

.jUG-appPage {
    max-width: 920px;
    margin: 0 auto;
    padding: 18px 28px 40px 28px;
}

.jUG-appBreadcrumb {
    font-size: 13px;
    color: var(--jUG-muted);
    margin-bottom: 6px;
}
.jUG-appBreadcrumb a { color: var(--clrHighlight); text-decoration: none; }
.jUG-appBreadcrumb a:hover { text-decoration: underline; }

.jUG-appPageTitle {
    font-family: var(--jUG-fontUi);
    font-size: 28px;
    font-weight: bold;
    color: var(--clrHighlight);
    margin: 0 0 14px 0;
    line-height: 1.2;
}

.jUG-appPageFooter {
    clear: both;
    margin-top: 36px;
    padding-top: 14px;
    border-top: 1px solid var(--jUG-border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}
.jUG-appPageFooter a { color: var(--clrHighlight); text-decoration: none; max-width: 48%; }
.jUG-appPageFooter a:hover { text-decoration: underline; }
.jUG-appPageFooter .jUG-next { margin-left: auto; text-align: right; }

.jUG-appSource {
    margin-top: 10px;
    font-size: 12px;
    color: var(--jUG-muted);
}
.jUG-appSource a { color: var(--jUG-muted); text-decoration: underline; }


/******************************************************************************/
/* Search results */
/******************************************************************************/

.jUG-appResults { list-style: none; }
.jUG-appResults li { padding: 10px 0; border-bottom: 1px solid var(--jUG-border); }
.jUG-appResults a { font-weight: bold; color: var(--clrHighlight); text-decoration: none; font-size: 16px; }
.jUG-appResults a:hover { text-decoration: underline; }
.jUG-appResults .jUG-snippet { font-family: var(--jUG-fontText); font-size: 14px; margin-top: 4px; }
.jUG-appResults mark, .jUG-content mark.jUG-hit { background: var(--clrAccentCream2, #ffffc0); color: inherit; }
.jUG-appEmpty { font-style: italic; color: var(--jUG-muted); }


/******************************************************************************/
/* Imported page content */
/******************************************************************************/

.jUG-content {
    font-family: var(--jUG-fontText);
    font-size: var(--defaultFontSize);
    line-height: 1.55;
    color: var(--clrText);
    overflow-wrap: break-word;
}

.jUG-content::after { content: ''; display: block; clear: both; }

.jUG-content h2, .jUG-content h3, .jUG-content h4 {
    font-family: var(--jUG-fontUi);
    color: var(--clrHighlight);
    line-height: 1.25;
    margin: 1em 0 .4em 0;
}
.jUG-content h2 { font-size: 1.45em; padding-bottom: 4px; border-bottom: 1px solid var(--jUG-border); }
.jUG-content h3 { font-size: 1.2em; }
.jUG-content h4 { font-size: 1.05em; }

.jUG-content p { margin: .6em 0; }
.jUG-content ul, .jUG-content ol { margin: .4em 0 .4em 1.6em; }
.jUG-content li { margin: .15em 0; }
.jUG-content .jUG-boldList { font-weight: bold; margin-top: .2em; margin-bottom: .2em; }
.jUG-content blockquote { margin: .6em 0 .6em 1.2em; padding-left: .8em; border-left: 3px solid var(--jUG-shadeStrong); }
.jUG-content hr { border: 0; border-top: 1px solid var(--jUG-border); margin: 1em 0; }
.jUG-content sup { font-size: .7em; }

.jUG-content a { color: var(--clrHighlight); text-decoration: underline; }
.jUG-content a:hover { background: var(--clrRelatedWordBg); }
.jUG-content a[target="_blank"]:not(.jUG-imageLink)::after {   /* external link marker */
    content: '\2197';
    font-size: .75em;
    margin-left: 2px;
    text-decoration: none;
    display: inline-block;
}
.jUG-content a.jUG-stepLink {                                     /* opens the passage in STEP */
    text-decoration-style: dotted;
}
.jUG-content a.jUG-stepLink::before {
    content: '\1F4D6';
    font-size: .8em;
    margin-right: 3px;
}

.jUG-content .jUG-center { text-align: center; }
.jUG-content .jUG-coloured { color: var(--clrHighlight); }
.jUG-content .jUG-bold { font-weight: bold; }

/* Images */
.jUG-content img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border-radius: 3px;
}
.jUG-content .jUG-imageLink { display: inline-block; }
.jUG-content .jUG-imageLink img { box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.jUG-content .jUG-imageLink:hover { background: none; }
.jUG-content .jUG-imageLink:hover img { outline: 2px solid var(--clrHighlight); }
.jUG-content img.jUG-icon { box-shadow: none; }
.jUG-content img.jUG-small { max-width: min(100%, 320px); }

.jUG-content .jUG-floatRight { float: right; clear: right; margin: .2em 0 1em 1.2em; max-width: 45%; }
.jUG-content .jUG-floatLeft  { float: left;  clear: left;  margin: .2em 1.2em 1em 0; max-width: 45%; }

/* Tables: the blog uses tables both for layout and for real data. */
.jUG-content table { border-collapse: collapse; margin: .6em 0; }
.jUG-content table.jUG-layoutTable { width: 100%; }
.jUG-content table.jUG-layoutTable td { vertical-align: top; padding: 0 6px 0 0; }

.jUG-content table.jUG-dataTable {
    width: 100%;
    font-size: .92em;
    line-height: 1.4;
}
.jUG-content table.jUG-dataTable td,
.jUG-content table.jUG-dataTable th {
    border: 1px solid var(--jUG-border);
    padding: 4px 7px;
    vertical-align: top;
    text-align: left;
}
.jUG-content table.jUG-dataTable th,
.jUG-content table.jUG-dataTable .jUG-shaded {
    background: var(--jUG-shade);
}
.jUG-content table.jUG-dataTable tr:first-child th {
    background: var(--clrHighlight);
    color: white;
    border-color: var(--clrHighlight);
}
.jUG-content .jUG-tableScroll { overflow-x: auto; max-width: 100%; }

/* Embedded videos and documents */
.jUG-content .jUG-video {
    position: relative;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    margin: .8em auto;
}
.jUG-content .jUG-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 4px; }
.jUG-content .jUG-embed iframe { width: 100%; height: 480px; border: 1px solid var(--jUG-border); }

/* Blocks created with the editor (j_userGuideEditor.html) */
.jUG-content .jUG-figure { margin: .8em 0; }
.jUG-content .jUG-figure img { display: block; }
.jUG-content .jUG-figure.jUG-alignCenter { text-align: center; }
.jUG-content .jUG-figure.jUG-alignCenter img { margin: 0 auto; }
.jUG-content .jUG-figure.jUG-alignLeft  { float: left;  clear: left;  margin: .2em 1.2em 1em 0; max-width: 45%; }
.jUG-content .jUG-figure.jUG-alignRight { float: right; clear: right; margin: .2em 0 1em 1.2em; max-width: 45%; }
.jUG-content .jUG-figure.jUG-sizeSmall img  { width: 240px; max-width: 100%; }
.jUG-content .jUG-figure.jUG-sizeMedium img { width: 480px; max-width: 100%; }
.jUG-content .jUG-figure.jUG-sizeFull img   { width: 100%; }
.jUG-content .jUG-figure figcaption { font-size: .85em; color: var(--jUG-muted); margin-top: .35em; font-style: italic; }

.jUG-content .jUG-note {
    margin: .9em 0;
    padding: .7em 1em .7em 2.6em;
    border-left: 4px solid var(--clrHighlight);
    background: var(--jUG-shade);
    border-radius: 0 4px 4px 0;
    position: relative;
}
.jUG-content .jUG-note::before { position: absolute; left: .8em; top: .65em; }
.jUG-content .jUG-note-info::before    { content: '\2139\FE0F'; }
.jUG-content .jUG-note-tip::before     { content: '\1F4A1'; }
.jUG-content .jUG-note-warning         { border-left-color: #c77c02; background: color-mix(in srgb, #f0a202 14%, var(--clrBackground)); }
.jUG-content .jUG-note-warning::before { content: '\26A0\FE0F'; }
.jUG-content .jUG-note > :first-child { margin-top: 0; }
.jUG-content .jUG-note > :last-child { margin-bottom: 0; }

.jUG-content .jUG-buttonRow { margin: .9em 0; }
.jUG-content a.jUG-button {
    display: inline-block;
    padding: .45em 1.1em;
    border-radius: 4px;
    background: var(--clrHighlight);
    color: white;
    text-decoration: none;
    font-family: var(--jUG-fontUi);
    font-size: .95em;
}
.jUG-content a.jUG-button:hover { background: color-mix(in srgb, var(--clrHighlight) 85%, black); color: white; }
.jUG-content a.jUG-button::after, .jUG-content a.jUG-button::before { color: inherit; }

.jUG-content .jUG-alignCenter { text-align: center; }
.jUG-content .jUG-alignRight:not(.jUG-figure) { text-align: right; }

/* Target of an in-page link */
.jUG-content .jUG-flash { animation: jUG-flash 1.6s ease-out; }
@keyframes jUG-flash {
    0%   { background: var(--clrAccentCream2, #ffffc0); }
    100% { background: transparent; }
}


/******************************************************************************/
/* Narrow guide panel */
/******************************************************************************/

@container jUG-guide (max-width: 700px) {
    .jUG-appMenuButton { display: block; }
    .jUG-appMenu {
        position: absolute;
        top: 0; bottom: 0; left: 0;
        width: min(var(--jUG-menuWidth), 88%);
        z-index: 2;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, .25);
    }
    body.jUG-menuOpen .jUG-appMenu { transform: none; }
    .jUG-appPage { padding: 14px 16px 30px 16px; }
    .jUG-appPageTitle { font-size: 23px; }
}

@container jUG-guide (max-width: 520px) {
    .jUG-appTitle { display: none; }
    .jUG-appSearch { flex: 1 1 auto; }
    .jUG-content .jUG-floatRight, .jUG-content .jUG-floatLeft {
        float: none;
        display: block;
        max-width: 100%;
        margin: .6em 0;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jUG-appMain { scroll-behavior: auto; }
    .jUG-appMenu { transition: none; }
    .jUG-content .jUG-flash { animation: none; }
}
