/****
 * Knowledge base article layout and content styles.
 *
 * Loaded only by views/knowledgebase/articlespublic/article.phtml (bump its ?v= when changing this file).
 * vendor.css has a global reset (ul { list-style: none; padding: 0 } and ol, li { list-style: none })
 * that strips bullets and step numbers from article HTML, so everything inside #article-content is
 * re-styled here. Rules use the #article-content id so they beat the deeply nested
 * .knowledge-base-article-page ... table rules in vendor.css and the GeneratePress CSS on guest pages.
 *
 * @author Shane Machon <shane@mywebteam.com.au>
 */

.kb-article-page {
    --kb-primary: #012073;
    --kb-link: #1e6bca;
    --kb-heading: #283557;
    --kb-text: #33394d;
    --kb-muted: #6b7489;
    --kb-border: #dde3ee;
    --kb-soft: #f4f7fc;
    --kb-code-bg: #eaf0fa;
}

/* ---- Page width: use more of the screen on large displays ----
 * Guest pages (publicTemplate.phtml) wrap content in the WordPress theme's .site.grid-container and a
 * GenerateBlocks .gb-inside-container, both capped at 1200px. Lift the caps only when a KB article is on
 * the page. Browsers without :has() keep the old 1200px width. */
.site.grid-container:has(.kb-article-page),
.gb-container:has(.kb-article-page) > .gb-inside-container {
    max-width: none;
}

.gb-container:has(.kb-article-page) > .gb-inside-container {
    padding-left: 0;
    padding-right: 0;
}

.kb-article-page > .container {
    max-width: 1440px;
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
}

.kb-article-page .knowledge-base-article-page {
    padding: 30px 0;
}

.kb-article-page .knowledge-base-content-block .system-requirements-block {
    padding: 32px 40px;
    background: #fff;
}

.kb-article-page .knowledge-base-content-block .system-requirements-block h3 {
    font-size: 30px;
    line-height: 1.25;
    color: var(--kb-heading);
}

/* ---- Body: content + "On this page" nav ---- */
.kb-article-body {
    display: block;
}

@media (min-width: 1200px) {
    .kb-article-body.has-toc {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 48px;
        align-items: start;
    }

    .kb-article-body.has-toc .kb-toc {
        order: 2;
        position: sticky;
        top: 96px; /* clears the sticky menu on guest pages */
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

.kb-toc {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.4;
}

.kb-toc details {
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    background: var(--kb-soft);
}

.kb-toc summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 700;
    color: var(--kb-heading);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 12px;
}

.kb-toc ol {
    list-style: none;
    margin: 0;
    padding: 0 8px 10px;
}

.kb-toc li {
    list-style: none;
    margin: 0;
}

.kb-toc a {
    display: block;
    padding: 6px 10px;
    border-left: 3px solid transparent;
    border-radius: 0 4px 4px 0;
    color: var(--kb-muted);
    text-decoration: none;
}

.kb-toc a:hover,
.kb-toc a:focus {
    color: var(--kb-link);
    background: #fff;
}

.kb-toc a.active {
    color: var(--kb-primary);
    font-weight: 700;
    border-left-color: var(--kb-primary);
    background: #fff;
}

/* ---- Article typography ---- */
#article-content {
    font-size: 17px;
    line-height: 1.7;
    color: var(--kb-text);
    overflow-wrap: break-word;
}

#article-content > :first-child {
    margin-top: 0;
}

#article-content p {
    margin: 0 0 1em;
}

#article-content h2,
#article-content h3,
#article-content h4 {
    color: var(--kb-heading);
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    scroll-margin-top: 110px;
}

#article-content h2 {
    font-size: 26px;
    line-height: 1.3;
    margin: 2em 0 .75em;
    padding-top: 1.25em;
    border-top: 1px solid var(--kb-border);
}

#article-content > h2:first-child {
    padding-top: 0;
    border-top: none;
}

#article-content h3 {
    font-size: 21px;
    line-height: 1.35;
    margin: 1.6em 0 .6em;
    padding: 0;
    border: none;
}

#article-content h4 {
    font-size: 18px;
    margin: 1.4em 0 .5em;
}

#article-content a {
    color: var(--kb-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

#article-content a:hover {
    color: var(--kb-primary);
}

#article-content strong,
#article-content b {
    font-weight: 700;
    color: #1d2438;
}

/* ---- Bulleted lists ---- */
#article-content ul {
    list-style: disc outside;
    margin: 0 0 1.25em;
    padding-left: 1.5em;
}

#article-content ul ul {
    list-style-type: circle;
    margin: .4em 0 0;
}

#article-content ul > li {
    list-style: inherit;
    display: list-item;
    margin: 0 0 .45em;
    padding-left: .25em;
}

#article-content ul > li::marker {
    color: var(--kb-primary);
}

/* ---- Numbered lists: top-level <ol> render as step cards ---- */
#article-content ol {
    list-style: none;
    counter-reset: kb-step;
    margin: 0 0 1.5em;
    padding: 0;
}

#article-content ol > li {
    counter-increment: kb-step;
    list-style: none;
    position: relative;
    margin: 0 0 10px;
    padding: 14px 18px 14px 62px;
    min-height: 56px;
    background: var(--kb-soft);
    border: 1px solid var(--kb-border);
    border-radius: 8px;
}

#article-content ol > li::before {
    content: counter(kb-step);
    position: absolute;
    left: 16px;
    top: 13px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--kb-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
}

#article-content ol > li > :last-child {
    margin-bottom: 0;
}

/* Lists nested inside a step stay plain */
#article-content li ol {
    counter-reset: none;
    list-style: decimal outside;
    margin: .5em 0 0;
    padding-left: 1.5em;
}

#article-content li ol > li {
    list-style: inherit;
    display: list-item;
    counter-increment: none;
    min-height: 0;
    margin: 0 0 .35em;
    padding: 0 0 0 .25em;
    background: none;
    border: none;
    border-radius: 0;
}

#article-content li ol > li::before {
    content: none;
}

#article-content li ul {
    margin: .5em 0 0;
}

/* ---- Tables ---- */
#article-content .kb-table-scroll {
    overflow-x: auto;
    margin: 0 0 1.25em;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
}

#article-content table {
    width: 100%;
    margin: 0 0 1.25em;
    border-collapse: collapse;
    font-size: 16px;
    line-height: 1.5;
    background: #fff;
}

#article-content .kb-table-scroll table {
    margin: 0;
}

#article-content table th,
#article-content table thead tr th,
#article-content table td,
#article-content table tbody tr td,
#article-content table tbody tr td:first-child,
#article-content table tbody tr:nth-child(even) td,
#article-content table tbody tr:nth-child(even) td:first-child {
    width: auto;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--kb-border);
    color: var(--kb-text);
    font-size: 16px;
    font-weight: 400;
    text-align: left;
    vertical-align: top;
    text-transform: none;
    background: #fff;
}

#article-content table thead tr th,
#article-content table th {
    background: var(--kb-primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

#article-content table tbody {
    border: none;
}

#article-content table tbody tr:nth-child(even) td,
#article-content table tbody tr:nth-child(even) td:first-child {
    background: var(--kb-soft);
}

#article-content table tbody tr td:first-child,
#article-content table tbody tr:nth-child(even) td:first-child {
    font-weight: 700;
    color: var(--kb-heading);
}

#article-content table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Code ---- */
#article-content code {
    padding: .1em .4em;
    border-radius: 4px;
    background: var(--kb-code-bg);
    color: var(--kb-primary);
    font-size: .9em;
    overflow-wrap: anywhere;
}

#article-content pre {
    margin: 0 0 1.25em;
    padding: 16px 18px;
    border-radius: 8px;
    background: #1f2433;
    color: #e6e9f2;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}

#article-content pre code {
    padding: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    overflow-wrap: normal;
}

/* ---- Callouts, quotes, images, rules ---- */
#article-content blockquote,
#article-content .note,
#article-content .tip,
#article-content .warning {
    margin: 0 0 1.25em;
    padding: 14px 18px;
    border-left: 4px solid var(--kb-link);
    border-radius: 0 8px 8px 0;
    background: #eef4fd;
    color: var(--kb-text);
    font-size: 16px;
    font-style: normal;
}

#article-content .tip {
    border-left-color: #2e9e5b;
    background: #edf8f1;
}

#article-content .warning {
    border-left-color: #d98a00;
    background: #fff6e5;
}

#article-content blockquote > :last-child,
#article-content .note > :last-child,
#article-content .tip > :last-child,
#article-content .warning > :last-child {
    margin-bottom: 0;
}

#article-content img {
    max-width: 100%;
    height: auto;
    margin: .5em 0 1em;
    border: 1px solid var(--kb-border);
    border-radius: 6px;
}

#article-content hr {
    margin: 2em 0;
    border: none;
    border-top: 1px solid var(--kb-border);
}

/* ---- Tablet / phone ---- */
@media (max-width: 991px) {
    .kb-article-page .knowledge-base-content-block .system-requirements-block {
        padding: 24px 20px;
    }

    .kb-article-page .knowledge-base-content-block .system-requirements-block h3 {
        font-size: 24px;
    }

    .kb-article-page .knowledge-base-search {
        padding: 16px 20px;
    }

    .kb-article-page .knowledge-base-search .knowledge-search-submit {
        right: 20px;
        top: 16px;
    }
}

@media (max-width: 575px) {
    .kb-article-page .knowledge-base-article-page {
        padding: 16px 0;
    }

    .kb-article-page .knowledge-base-content-block .system-requirements-block {
        padding: 20px 16px;
    }

    .kb-article-page .knowledge-base-content-block .system-requirements-block h3 {
        font-size: 22px;
    }

    #article-content {
        font-size: 16px;
    }

    #article-content h2 {
        font-size: 22px;
    }

    #article-content ol > li {
        padding: 12px 14px 12px 52px;
    }

    #article-content ol > li::before {
        left: 12px;
        top: 11px;
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 14px;
    }

    #article-content table th,
    #article-content table td,
    #article-content table thead tr th,
    #article-content table tbody tr td,
    #article-content table tbody tr td:first-child {
        padding: 10px 12px;
        font-size: 15px;
    }
}

/* ---- Print: just the instructions ---- */
@media print {
    .kb-article-page .knowledge-base-search,
    .kb-article-page .knowledge-base-sidebar,
    .kb-article-page .kb-toc,
    .kb-article-page .knowledge-next-prev,
    .kb-article-page #knowledge-stars,
    .kb-article-page .comment-form,
    .kb-article-page .comment-block,
    .kb-article-page .posting-disabled {
        display: none !important;
    }

    .kb-article-page .knowledge-base-content-block .system-requirements-block {
        padding: 0;
    }

    #article-content ol > li {
        break-inside: avoid;
    }
}
