/* Headings keep more space above them than below */
.entry-content h2 {
    margin-top: 14px;
}

.entry-content h3 {
    margin-top: 10px;
}

.entry-content hr + h2 {
    margin-top: 18px;
}

.entry-content h2 + h3,
.entry-content .wp-block-image + h2,
.entry-content .wp-block-image + h3,
.entry-content > h2:first-child,
.entry-content > h3:first-child {
    margin-top: 0;
}

/* Links that open in a new tab */
.entry-content a[target="_blank"]:not(.et_pb_button):not(:has(img))::after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-left: 0.25em;
    vertical-align: -0.05em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Sidebar: its own scrolling, so the lower pages stay reachable with sections open */
@media (min-width: 981px) {
    body #docs-sidebar {
        top: 96px;
        max-height: calc(100vh - 112px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .admin-bar #docs-sidebar {
        top: 128px;
        max-height: calc(100vh - 144px);
    }
}

#docs-sidebar .docs-sidebar-list .docs-sidebar-list {
    display: none;
    margin-left: 10px;
    padding-left: 6px;
    border-left: 1px solid #e6e6e6;
}

#docs-sidebar .current-page-ancestor > .docs-sidebar-list {
    display: block;
}

#docs-sidebar .docs-sidebar-item,
#docs-sidebar li.current-page-ancestor:not(.has-children),
#docs-sidebar ul li.docs-sidebar-item:not(.has-children):nth-child(odd) {
    padding: 0;
    background: none;
}

#docs-sidebar ul li.docs-sidebar-item:not(.has-children):nth-child(n) {
    padding-left: 24px;
}

#docs-sidebar .docs-sidebar-list-header {
    display: flex;
    align-items: flex-start;
    padding: 0;
}

#docs-sidebar .docs-sidebar-item a {
    display: block;
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1.35;
}

#docs-sidebar .docs-sidebar-item a:hover {
    background-color: #f0f5f1;
}

#docs-sidebar .docs-current > a,
#docs-sidebar .docs-current > .docs-sidebar-list-header > a {
    background-color: #d8ffe1;
}

#docs-sidebar .toggle-sublist {
    flex: none;
    width: 24px;
    height: 27px;
    padding: 0;
    border: 0;
    background: none;
    color: #888;
    cursor: pointer;
}

#docs-sidebar .toggle-sublist::before {
    content: "";
    display: inline-block;
    border-left: 6px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
}

#docs-sidebar .toggle-sublist.expanded::before {
    transform: rotate(90deg);
}

/* Less empty space at the top of the page */
body:not(.et-tb) #main-content .container,
body:not(.et-tb-has-header) #main-content .container {
    padding-top: 18px;
}
