:root {
    --background-color: #121212;
    --text-color: #f3f4f6;
    /* svg stroke color (basically it's color) */
    --svg-stroke-color: whitesmoke;
    /* background color of hint texts that shows when hovering over svg header elements (ex: Home) */
    --hover-text-color: rgba(211, 198, 186, 0.4);
    /* background color of svg header elements on hover */
    --svg-hover-color: rgba(93, 85, 85, 0.717);
    /* color of "Android Armor" text on hover */
    --header-title-hover-color: var(--element-color);
    --header-menu-components-bg: #27272a;
    --chapter-hover-bg-color: rgba(91, 97, 103, 0.361);
    --chapters-bg-color: #3736363b;
    --footer-bg: black;
    --link-color: #f5f5f4;
    --contact-svg-color: rgb(255, 255, 255);
    --image-bg: #2a302ba2;
    --element-color: #f97416;
}

* {
    box-sizing: border-box;
    transition: color 0.8s ease !important;
    transition: stroke 0.8s ease !important;
    transition: background-color 0.8s ease !important;

    /* fix blue box showing when clicking on same svg/button more than once
    https://stackoverflow.com/a/62948134/17370961 */
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: #ea9a49;
    color: white;
}

::-moz-selection {
    background: #ea9a49;
    color: white;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);

    margin: 5px 10px;

    text-align: center;

    font-family: monospace;

    transition: font-size 0.1s ease;

    min-height: 120vh;

    display: flex;
    flex-direction: column;
}

body h1 {
    font-size: 2.5em;
}

.chapters-header {
    font-size: 1em;
    display: flex;
    justify-content: center;
    position: relative;
}

#chapters-list {
    display: flex;
    justify-content: center;
}

.chapters-header p {
    text-decoration: none;
    font-weight: bold;
    color: inherit;
    opacity: 0.3;
    transition: opacity 0.3s ease !important;
    margin: 0 auto;
    width: 100%;
}

.chapters-header a {
    display: flex;
    flex-direction: row;
    align-items: center;
    box-sizing: content-box;
    /* width: 15%; */
    height: 40px;
    padding: 0.5em 0.8em;
    margin: 0.5em;
    text-decoration: none;
    color: inherit;
}

.chapters-header a.active {
    border-bottom: 2px solid red;

    p {
        opacity: 1;
    }
}

.chapters-header:hover a p {
    opacity: 1;
}

.chapters-header a:hover {
    background-color: var(--chapter-hover-bg-color);
    cursor: pointer;
}

.chapters-header .mobile-title {
    padding: 20px;
    font-size: 2em;
    display: none;

    position: relative;

    p {
        display: inline;
        opacity: 0.9;
    }

    div {
        display: inline;

        position: absolute;

        right: 0;
        /* top: 60%; */

        svg {
            width: 0.8em;
            height: fit-content;
            fill: var(--text-color);
        }
    }
}

.chapters-header .mobile-title:hover {
    cursor: pointer;
}

iframe {
    width: 30em;
    height: 15em;
    margin: 1em;
}

@media screen and (max-width: 600px) {
    .chapters-header {
        position: relative;

        width: 60%;

        margin: 0 auto;

        a {
            display: none;
            box-sizing: border-box;
        }

        .mobile-title {
            display: block;
        }
        #chapters-list {
            display: block;
            top: 100%;
            border-radius: 20px;
            padding: 15px;
            height: fit-content;

            text-align: center;
            justify-content: center;

            margin-top: 1em;

            background-color: var(--chapters-bg-color);

            a {
                text-align: center;
                display: block;
                width: 100%;
                height: unset;
                margin: unset;
                font-size: 1.4em;

                p {
                    opacity: 1;
                }
            }

            a:not(:last-child) {
                margin-bottom: 5px;
            }
        }
    }

    .chapters-header a.active {
        border-bottom: unset;
        p {
            opacity: 1;
            border-bottom: 2px solid red;
            /* color: var(--element-color); */
            width: fit-content;
        }
    }
}

.header-items {
    font-size: 1.4em;
    height: 2em;
    font-weight: bold;
    border-bottom: 2px solid whitesmoke;
    font-family: sans-serif;
    z-index: 1;
    position: relative;

    .header-title-text {
        color: whitesmoke;
        text-decoration: none;
    }
}

.page-separator {
    visibility: hidden;
    display: block;
    width: 100%;
    overflow: hidden;
}

.header-clickable-items-container {
    display: flex;
    align-items: center;
    float: right;
}

.header-item {
    position: relative;
    display: inline-block;
    height: 2em;
    width: 2em;

    svg {
        width: 1.8em;
        padding: 5px;
        fill: transparent !important;
        path,
        circle {
            stroke: var(--svg-stroke-color);
            stroke-width: 2;
        }
        * {
            fill: transparent !important;
            path,
            circle {
                stroke: var(--svg-stroke-color);
                stroke-width: 2;
            }
        }
    }

    img {
        width: 1.8em;
        padding: 5px;
        padding-right: 0;
        padding-bottom: 0.7em;
        scale: 0.9;
    }
}

.svg-header-item {
    width: 1.8em;
    padding: 5px;
    * {
        fill: transparent !important;
        path,
        circle {
            stroke: var(--element-color);
            stroke-width: 2;
        }
    }
}

.clickable-header-item {
    svg {
        border-radius: 10px;
        transition: all 0.1s ease !important;
    }
}

/* .clickable-header-item:hover {
    svg {
        background-color: var(--svg-hover-color);
        scale: 0.95;
    }
} */

.header-item:hover {
    cursor: pointer;
    transform: scale(1.2);

    .header-hover-info {
        display: block;
    }

    svg {
        * {
            path,
            circle {
                stroke: var(--element-color);
            }
        }
        path,
        circle {
            stroke: var(--element-color);
        }
    }
}

.header-separator {
    display: inline-block;
    border-left: 2px solid var(--svg-stroke-color);
    height: 1.3em;
    margin: 0 10px;
    position: relative;
}

.header-icon {
    float: left;

    display: flex;
    align-items: center;

    /* we don't want icon to be very small when we set padding since it will resize it to fit */
    width: fit-content;
    a {
        /* make text a bit far from the icon */
        padding-left: 5px;
        transition: color 1s ease !important;
    }

    svg {
        path {
            transition: all 1s ease !important;
        }
    }
}

.header-icon:hover {
    /* prevent rescaling of title caused by header-item:hover */
    transform: scale(1) !important;
    a {
        color: var(--header-title-hover-color);
    }
    svg {
        path {
            stroke: var(--header-title-hover-color);
        }
    }
}

/* avoid coloring text with blue and underlying it when it is inside <a> element  */
.unstyled-link {
    text-decoration: inherit;
    color: inherit;
}

.header-hover-info {
    display: none;

    width: fit-content;

    /* we don't want text to be on 2 lines  */
    text-wrap: nowrap;

    /* we need it to set right property */
    position: absolute;

    font-size: 0.7em;

    font-weight: normal;

    /* make it appear on left corner on the svg */
    /* why right 100%? it will move it 100% (svg div width) from the right, making it end at the start of the left */
    right: 100%;
    padding: 0.25em;
    margin-top: -0.1em;
    background-color: var(--hover-text-color);
    border-radius: 4px;
}

.header-hover-info:hover {
    /* adding !important so it have higher priority than that in .header-item:hover */
    display: none !important;
}

.header-menu-mobile {
    display: none;
}

.header-mobile-default-hidden {
    display: block;
}

.header-components {
    display: inherit;
    align-items: center;
}

@media screen and (max-width: 460px) {
    #next-chapter {
        font-size: 0.8em;
    }

    .header-menu-mobile {
        display: block;
    }

    .header-separator {
        display: block;
        border-bottom: 2px solid var(--svg-stroke-color);
        border-left: unset;
        width: 3em;
        height: unset;
        margin: 5px auto;
    }

    .header-components {
        /* display: block; */
        position: absolute;
        display: none;
        right: 0;
        top: 2em;
        border-radius: 5px;
        padding-top: 10px;
        padding-bottom: 10px;
        background-color: var(--header-menu-components-bg);
        width: 3.6em;
    }

    .header-clickable-items-container {
        div[class="header-item header-mobile-default-hidden"] {
            position: unset;
            height: unset;
            width: unset;

            svg {
                display: none;
            }

            .header-hover-info {
                position: unset;
                display: block !important;
                padding: 0.4em;
                right: unset;
                margin: 0 auto;
                width: 80%;
            }

            /* unset opacity set by the original hover  */
            .header-hover-info:hover {
                opacity: 0.6;
            }
        }
    }

    .header-clickable-items-container:hover {
        .header-components {
            display: inline-block;
        }
    }

    .header-item:hover {
        cursor: pointer;
        transform: scale(1);
    }
}

@media screen and (max-width: 360px) {
    body {
        font-size: 14px;
    }
}

@media screen and (max-width: 280px) {
    body {
        font-size: 12px;
    }
}

@media screen and (max-width: 240px) {
    body {
        font-size: 10px;
    }
}

@media screen and (min-width: 530px) {
    .server-svg {
        left: 15%;
    }

    .pipeline-svg {
        right: 15%;
    }

    .repo-svg {
        left: 15%;
    }
}

.info-table {
    border-color: var(--element-color);

    tr td:not(:first-child) {
        text-align: justify;
    }
    tr td:is(:first-child) {
        text-align: left;
    }
}

@media screen and (min-width: 900px) {
    .info-table {
        width: 70%;
    }
}

@media screen and (min-width: 700px) {
    .server-svg {
        top: 20%;
        left: 30%;
    }

    .page-description {
        width: 90%;
    }

    .pipeline-svg {
        top: 49%;
        right: 30%;
    }

    .repo-svg {
        left: 30%;
    }
}

@media screen and (max-width: 650px) {
    .chapters-header {
        font-size: 11px;
        /* div {
            height: 30px;
        } */
    }
    .info-table {
        font-size: 10px;
    }
}

@media screen and (max-width: 525px) {
    .chapters-header {
        font-size: 8px;
        div {
            height: 20px;
        }
    }
}

.inline-link {
    color: var(--link-color);
    font-weight: bold;
}

.page-description {
    margin: 0 auto;
    width: 95%;
}

.footer {
    background-color: var(--footer-bg);
    margin: -5px -10px;
    margin-top: 25px;
    overflow: hidden;
    padding: 0 10px 2em 10px;
    margin-top: auto;
}

.footer .container {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: row;
    padding-bottom: 3em;
    position: relative;
}

.footer .section a {
    font-weight: bolder;
    opacity: 0.7;
    color: inherit;
    text-decoration: none;
    display: block;
    /* height: 1.5em; */
    height: 3em;
    font-size: 0.9em;
    width: fit-content;
}

.footer .section a:hover {
    margin-left: 5px;
    cursor: pointer;
    font-size: 1em;
    /* height: 1.35em; */
    height: 2.7em;
    opacity: 1;
    color: var(--element-color);
}

.footer .section {
    width: 100%;
    /* h2 {
        text-align: center;
    } */
}

.footer .section:not(:last-child) {
    margin-right: 10px !important;
}

@media screen and (max-width: 500px) {
    .footer {
        padding: 0 10px 20px 10px;
    }
}

/* @media screen and (max-width: 580px) {
    .footer .section:not(:last-child) a {
        height: 3em;
    }

    .footer .section:not(:last-child) a:hover {
        height: 2.7em;
    }
} */

.footer .copyright {
    padding-top: 2em;
    border-top: 1px solid whitesmoke;
    /* text-align: center; */
}

.footer .section .about {
    font-size: 0.8em;
}

.footer .section svg {
    width: 3em;
    padding: calc(0.3em + 2px);

    border-radius: 50px;
    background-color: #222326;

    path,
    circle {
        fill: whitesmoke;
    }
    circle,
    path:not(:first-child),
    rect {
        stroke: whitesmoke;
    }

    /* email */
    path[stroke-linejoin="round"] {
        stroke: whitesmoke;
        fill: unset;
    }
}

.footer .section svg:hover {
    cursor: pointer;

    transform: scale(1.2);
    border-radius: 50px;

    path,
    circle {
        fill: var(--element-color);
    }
    circle,
    path:not(:first-child),
    rect {
        stroke: var(--element-color);
    }

    /* email */
    path[stroke-linejoin="round"] {
        stroke: var(--element-color);
        fill: unset;
    }
}

.footer .section:is(:last-child) {
    text-align: right;
    float: right;
    width: fit-content !important;
    padding-right: 80px;

    h2 {
        padding-left: 0.3em;
        width: fit-content;
    }

    a {
        font-weight: unset;
        opacity: unset;
        color: inherit;
        text-decoration: none;
        height: unset;
        font-size: unset;
        width: unset;
    }

    a:hover {
        margin-left: unset;
        font-size: unset;
        height: unset;
    }

    .inline-link {
        text-align: left;
        padding-left: 0.3em;
    }
}

@media screen and (max-width: 900px) {
    .footer .section:is(:last-child) {
        padding-right: 5%;
    }
}

@media screen and (max-width: 480px) {
    .footer .section h2 {
        font-size: 0.9em;
    }
    /* .footer .section:is(:last-child) {
        svg {
            width: 2em;
        }
    } */
}

@media screen and (min-width: 900px) {
    .footer .section:is(:first-child) {
        padding-left: 80px;
        padding-right: 80px;
    }
}

h3 {
    padding-top: 2em;
    padding-bottom: 2em;
}

.article-img {
    max-width: 100%;
    border-radius: 15px;
    background-color: var(--image-bg);
}

@media screen and (max-width: 700px) {
    .footer .container {
        margin-bottom: 100px;
        justify-content: center;
    }
    .footer .section:is(:last-child) {
        position: absolute;
        bottom: -70px;
        h2 {
            display: none;
        }
    }
    .inline-link {
        padding-top: 10px;
    }
}

details summary {
    font-size: 2.5em;
}

@media screen and (min-width: 601px) {
    details summary {
        font-size: 0;
    }
}

.article-container {
    display: flex;
    position: relative;
}

.article p,
.article h2 {
    text-align: left;
}

.article {
    /* max-height: 80vh;
    overflow: auto; */

    scrollbar-color: whitesmoke;
    scrollbar-width: thin;
    width: 100%;

    padding-right: 5px;

    border-right: 2px solid var(--element-color);
}

.article-summary {
    position: sticky;
    top: 0;
    width: 30%;
    word-wrap: break-word;
    padding-left: 2%;
    right: 0;
    height: fit-content;

    text-align: left;

    p {
        font-size: 1.4em;
        font-weight: bold;
        margin: unset;
    }

    a {
        color: inherit;
        text-decoration: none;
        transition: padding 0.2s linear !important;
        border-bottom: 2px solid transparent;
        padding-left: 8%;
    }

    * {
        transition: opacity 0.2s ease !important;
    }
}

.article-chapters-container {
    opacity: 0.4;
}

#article-chapters {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
}

#chapter-title {
    border-bottom: 5px solid transparent;
}

.article-chapters-container:hover {
    opacity: 1;
}

.article-chapters-container a:last-child {
    margin-bottom: 10%;
}

.article-summary a:hover {
    font-weight: bolder;
    background: linear-gradient(to right, var(--element-color), transparent);
    padding-left: unset;
    padding-right: 8%;
}

.summary-chapter-changes {
    display: inline;
}

.summary-chapter-changes .next,
.prev {
    transition: unset;
    border: unset;
    transition: padding 1s ease;
    opacity: 0.4;
}

.summary-chapter-changes .next {
    float: right;
    padding: unset !important;
    padding-right: 5% !important;
}

.summary-chapter-changes .prev {
    padding-left: unset;
}

.summary-chapter-changes .next:hover {
    border: unset;
    background: unset;
    /* padding-left: 9%; */
    /* padding-right: unset; */
    opacity: 1;
    color: var(--element-color);
}

.summary-chapter-changes .prev:hover {
    border: unset;
    background: unset;
    opacity: 1;
    color: var(--element-color);
    /* padding-left: 5%; */
}

.content-section {
    width: fit-content;
    transition: border 0.3s ease !important;
    border-bottom: 3px solid transparent;
}

.content-section:hover {
    /* border-bottom: 3px solid var(--element-color); */
    cursor: pointer;
    color: var(--element-color);
}

.content-section:target {
    border-bottom: 3px solid var(--element-color);
}

@media screen and (min-width: 700px) {
    .article-summary {
        font-size: 0.9em;
    }
}

@media screen and (min-width: 800px) {
    .article-summary {
        width: 40%;
    }
}

@media screen and (min-width: 950px) {
    .article-summary {
        font-size: 1em;
    }
    .article-summary {
        width: 30%;
    }
}

@media screen and (max-width: 800px) {
    .article-summary {
        display: none;
        z-index: -1;
    }

    .article {
        max-height: unset;
        border-right: unset;
    }
}

.particle {
    position: fixed;
    height: 5px;
    width: 5px;
    background: radial-gradient(circle at center, var(--element-color), transparent 60%);
    z-index: -999;
}

.code-block {
    display: block;
    text-align: center;
    background-color: #282c34c4;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700px;
    margin: 0 auto;
    padding: 1em;
    margin-bottom: 1em;
    font-weight: bolder;

    width: fit-content;

    max-width: 90%;

    pre {
        text-align: left;

        /* wrap text in pre tag: https://stackoverflow.com/a/248013 */
        white-space: pre-wrap;
        white-space: -moz-pre-wrap;
        white-space: -pre-wrap;
        white-space: -o-pre-wrap;
        word-wrap: break-word;
        word-break: break-all;
    }
}

.code-block[type="text"] {
    width: unset !important;
    p {
        word-wrap: break-word;
        text-align: center;
        width: 100%;
    }
}

.assembly-view {
    display: block;

    display: flex;
    background-color: #282c34c4;
    margin-left: 2%;
    margin-right: 2%;

    width: fit-content;
    margin: 0 auto;

    border-radius: 15px;

    align-items: center;

    position: relative;

    text-align: center;

    .code-block {
        background-color: transparent;
        border-radius: 0;
        margin: 0 auto;
    }

    /* .code-block:last-child {
        border-radius: 0;
        border-left: 2px solid var(--element-color);
    } */

    /* .separator {
        margin: 0 auto;
        height: auto;
        border-left: 2px solid var(--element-color);
    } */

    .code-block + .code-block {
        border-left: 3px solid var(--element-color);
    }
}

@media screen and (max-width: 660px) {
    .assembly-view {
        display: block;
        margin: 0 auto;
        /* .code-block:last-child {
            border-left: unset;
            border-top: 2px solid var(--element-color);
        } */
        .code-block + .code-block {
            border-left: unset;
            border-top: 3px solid var(--element-color);
        }
        .code-block {
            width: 100%;
            flex-direction: unset;
            display: block;
        }
    }
}

/* @media screen and (max-width: 450px) {
    .code-block {
        font-size: 0.75em !important;
    }
} */

.contact-icon {
    padding-top: 3px;
}

iframe {
    max-width: 80%;
    border-radius: 20px;
}

.custom-button {
    background-color: var(--element-color);
    width: fit-content;
    padding: 1em;
    border-radius: 10px;
    margin: 2em auto;
    font-size: 1.3em;
    font-weight: bolder;
}

.animated-custom-button {
    animation: ButtonLoopUpdate 1.5s ease-in-out infinite;
}

@keyframes ButtonLoopUpdate {
    0%,
    100% {
        /* transform: rotateZ(-5deg); */
        transform: scale(1.05);
    }
    50% {
        /* transform: rotateZ(5deg); */
        transform: scale(1);
    }
}

.custom-button:hover {
    cursor: pointer;
    /* animation: unset; */
    /* scale: 1.2; */
    box-shadow: 0px 0px 1em var(--element-color);
}

input[type="email"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid whitesmoke;
    border-radius: 4px;
    margin-bottom: 16px;
    resize: vertical;
    max-width: 80%;

    &:focus {
        outline: none;
        border-color: transparent;
    }
}

textarea {
    height: 200px;
}

input[type="submit"] {
    background-color: var(--element-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: unset !important;

    flex-direction: column;
    display: flex;

    margin: 1em auto;

    &:hover {
        box-shadow: 0px 0px 1em var(--element-color);
    }
}

.contact-form {
    background-color: rgba(30, 29, 29, 0.614);
    padding: 1em;
    border-radius: 15px;
    margin: 2em auto;
    width: 80%;

    * {
        margin: 0 auto;
    }

    label {
        flex-direction: column;
        display: flex;
        margin-top: 1em;
        margin-bottom: 0.5em;
        color: var(--element-color);
        font-weight: bolder;
        font-size: 1.5em;
    }

    h2 {
        border-bottom: 2px solid var(--element-color);
        width: fit-content;
        padding: 0 10px;
    }

    .unstyled-link {
        color: var(--element-color);
        font-weight: bolder;
        border-bottom: 2px solid var(--element-color);
    }
}

@media screen and (min-width: 700px) {
    .contact-form {
        width: 50%;
    }
}

#contact-done-message {
    display: none;
}

#next-chapter {
    border-bottom: 2px solid var(--element-color);
    border-top: 2px solid var(--element-color);
    width: fit-content;
    margin: 2em auto;
    padding: 1.5em 0.5em;

    &:hover {
        cursor: pointer;
    }
}
