:root {
    --topbar-logo-url: url("./rocket_launch_icon.svg");
    --main-color: #4f89fe;
    --accent-color: #eef6ff;
    --main-color-opaque: rgb(104, 154, 254, 80%);
    --scrollbar-color: var(--main-color-opaque);
}

.scrollbox {
    &::-webkit-scrollbar {
        width: 8px;
    }

    &::-webkit-scrollbar-thumb {
        background-color: transparent;
        border-radius: 3px;
        transition: background-color 0.3s ease;
    }

    &::-webkit-scrollbar-track {
        background-color: transparent;
    }

    &.scrolling::-webkit-scrollbar-thumb {
        background-color: var(--scrollbar-color);
    }
    &.scrollbox.scrolling::-webkit-scrollbar-track {
        background-color: rgba(0, 0, 0, 0.08);
    }
}

.phonemos_search_result {
    &::-webkit-scrollbar {
        width: 8px;
    }

    &::-webkit-scrollbar-thumb {
        background-color: transparent;
        border-radius: 3px;
        transition: background-color 0.3s ease;
    }

    &::-webkit-scrollbar-track {
        background-color: transparent;
    }

    &.scrolling::-webkit-scrollbar-thumb {
        background-color: var(--scrollbar-color);
    }
    &.scrolling::-webkit-scrollbar-track {
        background-color: rgba(0, 0, 0, 0.08);
    }
}

html {
    height: -webkit-fill-available;
}

.phonemos_wikipage a {
    color: var(--main-color) !important;
    font-weight: 600;
}

html body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
        "Helvetica Neue", "Noto Color Emoji", sans-serif;
}

body {
    margin: 0;
    overflow: hidden;
    height: 100vh;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    p {
        line-height: 27px;
    }
}

.phonemos_root {
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    width: 100vw;
}

.phonemos_topbar {
    flex: 0 0 100%; /* full width */
    height: 56px;
    border-bottom: 1px solid #e5e7eb;
    box-sizing: border-box;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 6px -6px rgba(0, 0, 0, 0.2);
    position: relative;
}

.phonemos_topbar_left {
    display: flex;
    align-items: center;
}

.phonemos_topic_name_container {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 20px;
}

.phonemos_topbar_topic_name {
    color: var(--main-color);
    margin-left: 10px;
    font-size: 1.7rem;
}

.phonemos_topbar_logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.phonemos_topbar_logo:not(img) {
    mask: var(--topbar-logo-url) center/contain no-repeat;
    -webkit-mask: var(--topbar-logo-url) center/contain no-repeat;
    background-color: var(--main-color);
}

.navigation_sidebar_toggle {
    width: 32px;
    height: 32px;
    background-image: url("./hamburger_icon.svg");
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: none;
}

.phonemos_search_wrapper {
    width: 100%;
    max-width: 250px;
    position: relative;
}

.phonemos_navigation {
    flex: 0 0 250px;
    width: 200px;
    min-width: 200px;
    padding: 30px 30px 20px;
    flex-grow: 0;
    height: calc(100vh - 100px);
    overflow: auto;
    background-color: #f6f6f6;

    .phonemos_search {
        margin-left: -5px;
        margin-bottom: 8px;
    }

    & .phonemos_powered {
        display: block;
        font-size: 0.5em;
        margin-top: 20px;
        width: 100%;
        text-align: left;
    }

    .phonemos_objectTree {
        font-size: 15px;
        letter-spacing: 0.24px;
        line-height: 22px;
        margin-bottom: 40px;
    }

    .phonemos_objectTree ul {
        position: relative;
        list-style: none;
        &:first-child {
            padding-left: 0px;
        }

        & li {
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            & a {
                margin-left: 1px;

                &:hover {
                    text-decoration: underline;
                }
            }

            & svg {
                display: none;
            }
        }

        .phonemos_activeTreeItem > a {
            color: var(--main-color);
            font-weight: 600;
        }
    }
}

.phonemos_objectTree > ul > li > a {
    color: #0d1629;
    font-weight: 600;
    margin: 10px 0px;
    display: block;
    margin: 25px 0px 10px 0px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.phonemos_objectTree > ul:first-child > li:first-child > a:first-child {
    margin: 10px 0px;
}

.phonemos_objectTree > ul:last-child > li:last-child > a:last-child {
    margin: 25px 0px 25px 0px;
}

.phonemos_content {
    flex: 1;
    min-width: 0;
    position: relative;
    flex-grow: 1;
    flex-shrink: 1;
    margin: 0;
    padding: 30px 50px 20px;
    overflow-y: auto;
    overflow-x: auto;
    height: calc(100vh - 100px);

    & article {
        width: 100%;
    }

    .phonemos_content_main {
        padding-bottom: 50px;
    }
}

.phonemos_root .phonemos_wikipage {
    .fabric-editor-block-mark[data-mode="full-width"] {
        /* adjust for other layouts */
        width: calc(100vw - 280px);
    }

    .pm-table-container[data-layout="full-width"] {
        /* adjust in your layouts */
        width: calc(100vw - 280px);
    }
}

.phonemos_root .phonemos_announcements_channel {
    width: 100%;
    ul {
        list-style: none;
        padding-left: 0;

        article {
            margin: 5px 0;
            padding: 1px 0;

            .phonemos_announcement_image {
                float: left;
                margin-right: 16px;
                margin-bottom: 8px;
                width: 120px;
                height: 120px;
                overflow: hidden;
                border-radius: 4px;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }
        }
    }

    .phonemos_announcement {
        container-type: inline-size;
        width: 100%;
        border-radius: 10px;
        border: 1px solid #d7d7d7;
        box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
        padding: 15px;
        transition: all 0.3s;
        margin-bottom: 15px;

        &:hover {
            transform: scale(1.01);
        }

        .phonemos_announcement_image {
            img {
                height: 108px;
                border-radius: 10px;
                background-repeat: no-repeat, no-repeat;
                background-position: center;
                background-size: cover;
                margin-right: 20px;
            }
        }

        .phonemos_announcement_title_area {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;

            h2 {
                flex: 4;
                min-width: 0;
                max-width: 100%;
                font-size: 1.3rem;
                margin-top: 0px;
                margin-bottom: 10px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                a {
                    display: block;
                    text-decoration: none;
                    color: var(--main-color);
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }

            .phonemos_announcement_published {
                flex: 0 0 auto;
                display: flex;
                justify-content: flex-end;
                padding-left: 20px;
                min-width: 0;
                span {
                    width: fit-content;
                    background-color: var(--accent-color);
                    padding: 5px 10px;
                    border-radius: 10px;
                    color: var(--main-color);
                    font-size: 0.9rem;
                    white-space: nowrap;
                }
            }
        }
    }

    .phonemos_announcements_channel_feeds {
        display: flex;
        gap: 8px;
        margin: 8px 0;
        flex-wrap: wrap;

        .phonemos_announcements_channel_feed {
            display: inline-flex;
            align-items: center;
            gap: 4px;

            color: inherit;
            text-decoration: none;

            padding: 4px 8px;
            /* border: 1px solid #ccc; */
            background-color: var(--accent-color);
            border-radius: 3px;
            font-size: 0.85em;

            .phonemos_announcements_channel_feed_icon {
                font-size: 0.8em;
            }
            .phonemos_announcements_channel_feed_label {
                font-size: 0.85em;
            }
        }
    }

    .phonemos_announcement_excerpt {
        line-height: 1.714;
        margin: 0px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        text-overflow: ellipsis;
        overflow: hidden;
    }
}

.phonemos_search {
    position: relative;

    .phonemos_search_query {
        & input {
            padding-left: 30px;
            background-color: var(--accent-color);
            border-radius: 10px;
            border: 1px solid var(--accent-color);
            height: 25px;
            width: 200px;
        }

        & input:focus-visible {
            outline: 1px solid var(--main-color);
        }
    }

    .phonemos_search_query::before {
        content: "";
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 20px;
        pointer-events: none;
        background-color: var(--main-color);
        mask: url("./search_icon.svg") center/contain no-repeat;
        -webkit-mask: url("./search_icon.svg") center/contain no-repeat;
    }

    .phonemos_search_loading_spinner {
        position: absolute;
        z-index: 6001;
        right: 5px;
        top: 3px;
        font-size: 0.8rem;
    }
    .phonemos_search_result {
        display: none;
    }

    .phonemos_search_results {
        li {
            padding: 10px !important;
            p {
                border-radius: 10px;
            }
            .phonemos_object_link {
                font-size: 0.9rem;
            }
            .phonemos_search_extract {
                font-size: 0.85rem;
                margin: 0px;
            }
        }
        .phonemos_object_link {
            font-size: 1.1rem;
            font-weight: 500;
            margin-bottom: 10px;
            display: block;
        }
    }

    .phonemos_search_result.phonemos_search_result_active {
        /* popover style */
        display: block;
        position: absolute;
        top: 100%;
        right: 0;
        width: 95vw;
        max-width: 600px;
        background-color: white;
        border: 1px solid #ccc;
        border-radius: 10px;
        box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
        z-index: 6000;
        padding: 10px 15px;
        overflow: auto;
        height: calc(100vh - 90px);

        & ul {
            padding: 0;
            margin: 0;
            list-style-type: none;
            & li {
                cursor: pointer !important;
                padding: 10px 0;
                border-bottom: 1px solid #eee;
                &:hover {
                    background-color: var(--accent-color);
                }
                &:last-child {
                    border-bottom: none;
                }
            }
        }
    }
}

.phonemos_mobile_search_button {
    display: none;
    width: 26px;
    height: 26px;
    mask: url("./search_icon.svg") center/contain no-repeat;
    -webkit-mask: url("./search_icon.svg") center/contain no-repeat;
    background-color: var(--main-color);
    cursor: pointer;
}

.phonemos_toc_wrapper {
    position: relative;
    width: 0px;
    transition: width 0.3s ease;
}

.phonemos_toc_wrapper.open {
    position: relative;
    width: 360px; /* expanded sidebar width */
}

.phonemos_toc_container {
    height: calc(100vh - 56px);
    position: relative;
    background-color: var(--accent-color);
}

.phonemos_toc_section {
    z-index: 5000;
    height: calc(100vh - 56px);

    .phonemos_toc_contentsWrapper {
        padding: 20px 20px 10px 30px;
        overflow: hidden;
        .phonemos_toc_header-level-1,
        .phonemos_toc_header-level-2,
        .phonemos_toc_header-level-3,
        .phonemos_toc_header-level-4,
        .phonemos_toc_header-level-5 {
            border-bottom: none;
        }

        .phonemos_toc_header-level-3,
        .phonemos_toc_header-level-4,
        .phonemos_toc_header-level-5 {
            margin-bottom: 12px;
        }

        button {
            color: var(--main-color);
        }
    }
}

.phonemos_toc_trigger {
    background-color: var(--main-color);
    position: absolute;
    height: 40px;
    width: 30px;
    left: -30px;
    top: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px 0px 0px 5px;
    z-index: 900;
    cursor: pointer;
}

.phonemos_toc_trigger_icon {
    width: 25px;
    height: 25px;
    mask: url("./list_dropdown_icon.svg") center/contain no-repeat;
    -webkit-mask: url("./list_dropdown_icon.svg") center/contain no-repeat;
    background-color: #fff;
}

.phonemos_toc_trigger_icon.open {
    width: 25px;
    height: 25px;
    mask: url("./chevron_right_icon.svg") center/contain no-repeat;
    -webkit-mask: url("./chevron_right_icon.svg") center/contain no-repeat;
    background-color: #fff;
}

.phonemos_titleContainer {
    position: relative;
    max-width: 1120px;
    margin: -30px -50px 30px;
    box-sizing: border-box;

    .phonemos_pageTitle {
        position: absolute;
        bottom: 3px;
        left: 0px;
        z-index: 10;
        padding: 20px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        background-color: var(--main-color-opaque);
        padding: 10px 20px 10px 50px;
        width: calc(100% - 70px);
        color: white;
        margin: 0px;
    }

    .phonemos_pageTitle::after {
        content: unset;
    }

    .phonemos_titleImage {
        img {
            width: 100%;
            height: 160px;
            object-fit: cover;
        }
    }
}

.phonemos_pageTitle {
    margin-top: 0px;
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
}

.phonemos_pageTitle::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 5px;
    background-color: var(--main-color);
    border-radius: 3px;
}

[data-mention-id],
.date-node[data-node-type="date"] {
    background-color: var(--accent-color);
    color: var(--main-color);
    padding: 3px 5px;
    border-radius: 10px;
    font-weight: 500;
}

.phonemos_object_link {
    span {
        color: var(--main-color);
    }
}

.phonemos_wikipage {
    & .phonemos_media_file {
        & svg {
            color: var(--main-color) !important;
        }
    }
}

@media (max-width: 980px) {
    .phonemos_announcement_title_area {
        flex-direction: column;
        margin-bottom: 8px;
    }
    .phonemos_announcement_published {
        padding-left: 0px !important;
    }
}

@media (max-width: 767px) {
    .phonemos_content {
        padding: 30px 30px 20px;
    }
    .phonemos_topbar_topic_name {
        margin-left: 10px;
        font-size: 1.2rem;
    }

    .navigation_sidebar_toggle {
        display: block;
    }
    .phonemos_navigation {
        transform: translateX(-100%); /* hidden */
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .phonemos_navigation.active {
        transform: translateX(0); /* visible */
        z-index: 1000;
    }

    /* Dim background overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .phonemos_toc_wrapper,
    .phonemos_toc_wrapper.open {
        position: absolute;
        top: 56px;
        right: 0px;
    }

    .phonemos_mobile_search_button,
    .phonemos_search_wrapper.open {
        display: block;
    }

    .phonemos_search_wrapper {
        display: none;
    }

    .phonemos_search_wrapper.open {
        width: 100vw;
        backdrop-filter: blur(2px);
        height: 80px;
        width: 100%;
        position: absolute;
        top: 0px;
        left: 0px;
        z-index: 2000;
        height: 100vh;
        background-color: rgb(0, 0, 0, 0.7);
        max-width: unset;

        .phonemos_search {
            display: block;
            width: 80%;
            max-width: unset;
            margin: 0 auto;
            margin-top: 130px;
            .phonemos_search_query {
                & input {
                    height: 40px;
                    border-radius: 40px;
                    width: 100%;
                }
            }
        }

        .phonemos_search_result.phonemos_search_result_active {
            width: 100%;
            height: calc(100vh - 230px);
            top: calc(100% + 10px);
            left: -15px;
            box-shadow: none;
            border: none;
        }
    }

    .phonemos_searchBox {
        width: 100%;
    }

    .phonemos_search_query {
        padding-right: 30px;
    }

    .phonemos_announcement_image {
        width: 80px !important;
        height: 80px !important;
    }

    .phonemos_root .phonemos_announcements_channel {
        .phonemos_announcement {
            width: unset;
        }
    }

    .phonemos_root .phonemos_announcements_channel {
        & ul {
            article {
                width: unset;
            }
        }
    }
}
