:root {
    /* FONTS */
    --display-font: 'Manrope', sans-serif;
    --main-font: 'Inter var', sans-serif;

    /* UNITS
     * unit size      - every element should be a multiplier of this
     * main size      - used for headers and icons
     * medium size    - same as above, except that the element in question is contained in something else
     * small size     - used in common text, borders
     */
    --unit-size: 0.5rem;
    --main-size: 1.4rem;
    --medium-size: 1.2rem;
    --small-size: 1rem;

    /* colours and shadows */
    --bg1: #242434;
    --bg2: #46465E;
    --bg3: #8081BA;

    --translucent: #1A1A2666;
    --white: #FFFFFF;

    --shadow: 0px 0px 32px 0px #00000066;
    --shadow-light: 0px 0px 32px 0px #FFFFFF66;

    /* transitions and animations */
    --cubic-transition: all 200ms cubic-bezier(0, 0.55, 0.45, 1);
    --fade-in: fadeIn 200ms cubic-bezier(0, 0.55, 0.45, 1);
    --fade-out: fadeOut 200ms cubic-bezier(0, 0.55, 0.45, 1);
}

/* BACKGROUND IMG GRADIENT */
.bg {
    background-color: var(--bg3);
    background-image: url(../images/bg.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

/* HEADER AND SIDEPANELS */
#header {
    z-index: 1;

    height: 3rem;
    font-size: var(--main-size);
    display: flex;
    justify-content: space-between;
    position: fixed;
    top: 0;
    background-color: var(--bg1);

    padding: var(--unit-size);
    width: 100%;
    align-items: center;

    box-shadow: var(--shadow);
}

/* content should be rendered after the header, not bellow */
#header + * {
    margin-top: 3rem;
}

#instance {
    display: flex;
    align-items: center;
}

#instance:focus svg,
#instance:hover svg {
    fill: var(--bg1);
    transition: var(--cubic-transition);
}

.icon-logo {
    margin-right: var(--small-size);
    fill: var(--white);
}

.panel aside {
    font-size: var(--medium-size);
    display: block;
    position: absolute;
    top: 100%;

    width: 20%;
    animation: var(--fade-in);
    padding: var(--unit-size);
}

.panel aside .footer {
    bottom: var(--unit-size);
    left: var(--unit-size);
    font-size: var(--small-size);
}
#header:above-level.panel[open] ~ * {
    display: none;
}

.icon {
    fill: var(--white);
}

/* CURRENT PAGE LINK */
.active {
    border-radius: var(--unit-size);
    background: var(--white);
    color: var(--bg1) !important;
    transition: var(--cubic-transition);
}

/* CONTAINS ALL ELEMENTS BESIDES HEADER */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    padding: var(--unit-size);
}

/* THE FOCUSED (middle) DIV */
.content {
    display: flex;
    flex-direction: column;
    margin-left: 20%;
    margin-right: 20%;

    width: 100%;
    max-width: 60%;
}

.markdown-blocks {
    background-color: var(--translucent);
    border-radius: 0 0 var(--unit-size) var(--unit-size);
    border: solid 2px var(--bg2);
    border-top: solid 2px var(--bg3);
    padding: var(--unit-size);
}
.markdown-blocks ul {
    margin-left: 1em;
    list-style: disc;
}
.markdown-blocks ul li {
    margin-bottom: 0.2em;
}
.doc-navigation {
    background-color: var(--translucent);
    border-radius: var(--unit-size) var(--unit-size) 0 0;
    border: solid 2px var(--bg2);
    border-bottom: none;
    padding: var(--unit-size);
}
.doc-navigation ul {
    display: flex;
    justify-content: space-evenly;
    font-size: var(--main-size);
    font-family: var(--display-font);
}

/* NOTES */
.notes hr {
    margin-top: var(--unit-size);
    margin-bottom: var(--main-size);
}

.h-entry,
.note {
    background-color: var(--translucent);
    border: solid 2px var(--bg2);
    /*border-top: solid 2px var(--bg3);*/
    border-radius: var(--unit-size);
}

.note-info {
    display: flex;
    justify-content: space-between;
    vertical-align: middle;
    border-radius: var(--unit-size);
    box-sizing: border-box;

    background-color: var(--translucent);
    font-size: var(--medium-size);
    padding: 4px;
}

.note-info .avatar {
    width: auto;
    height: var(--medium-size);
}

/* TODO: icons */
.note-actions {
    display: flex;
    vertical-align: middle;
}
.favourite-button-container {
    width: var(--medium-size) !important;
    height: var(--medium-size) !important;
}
.favourite-button-container button {
    width: inherit !important;
    height: inherit !important;
    border: unset !important;
    padding: unset !important;
    mask-image: url("../icons/heart.svg") !important;
}
.favourite-button-off {
    background: var(--bg2) !important;
}
.favourite-button-on {
    background: var(--white) !important;
}

.note-content {
    padding: var(--small-size);
}
.note-content p {
    padding-left: var(--small-size);
    padding-right: var(--small-size);
}

.note-attachments {
    display: flex;
}

.note-attachments > figure {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    border-radius: var(--unit-size);
    background-color: var(--translucent);
    padding: var(--small-size);
}

.note-attachments > figure figcaption {
    display: flex;
    padding-top: var(--small-size);
}

.note-attachments > figure img,
.note-attachments > figure video {
    width: 100%;
    height: auto;
}

/* MEDIA RESIZE */
@media (min-width: 1200px) {
    /* no need to make the panels disappear at this size */
    .icon-left,
    .icon-right {
        display: none;
    }
}
@media (max-width: 1200px) {
    /* content should occupy the entire width at this size */
    .content {
        margin: unset;
        max-width: 100%;
    }

    /* we need to control panel's view at this size */
    .icon-left,
    .icon-right {
        display: flex;
        width: 100%;
    }

    /* by default they are hidden */
    .panel aside {
        display: none;
    }

    .panel:not(:focus-within or :not[open]) aside {
        display: none;
    }
    .panel[open]:focus-within aside,
    .panel[open] {
        display: flex;
        flex-direction: column;
        font-size: var(--main-size);
    }
    .panel[open] aside {
        padding: var(--unit-size);
        box-sizing: border-box;
        width: 100%;
        height: 100vh;

        background-color: var(--bg3);
        background-image: url(../images/bg.png);
        background-position: center;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        min-height: 100%;

    }

    .panel[open] aside .footer {
        max-width: 100%;
    }
}

/* SECTIONS */
.section-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: var(--unit-size);

    background-color: var(--translucent);
    border-radius: var(--unit-size);
    border: solid 2px var(--bg2);

    font-family: var(--main-font);
    font-weight: 400;
    color: var(--white);
}

.section-title {
    font-family: var(--display-font);
    font-weight: 900;
    font-size: var(--main-size);

    border-radius: var(--unit-size);
    padding: 2px var(--unit-size);

    background-color: var(--translucent);
}
.section-title-menu {
    display: flex;
    justify-content: space-between;
}
.section-title-menu svg {
    align-self: center;
    fill: var(--white);
}

.section-form {
    display: flex;
    flex-direction: column;
    padding: var(--unit-size);
}
.section-form-legend {
    padding: unset;
    margin-bottom: var(--unit-size);
}

.section-form-label {
    display: block;

    font-family: var(--display-font);
    font-size: var(--small-size);
    font-weight: 700;
    line-height: 1.00;
    letter-spacing: -0.20px;
    word-spacing: 1.00px;
    text-transform: none;

    margin-bottom: 2px;
}
.section-form-label + input {
    width: 100%;
}
.help-text {
    font-style: italic;
    font-size: var(--small-size);
}

.section-form-options {
    display: block !important;
    margin-bottom: var(--unit-size);
}

.section-form-textarea {
    border-radius: var(--unit-size);
    background-color: var(--translucent);
    color: var(--white);

    width: 100%;
    max-width: 100%;
    height: calc(6 * var(--main-size));

    border: 2px solid transparent;
    margin-top: var(--unit-size);
    margin-bottom: var(--unit-size);
    padding: var(--unit-size);
    resize: vertical;
}

/* BUTTONS AND INPUT SHENANIGANS */
button,
input:not([type=radio]):not([type=checkbox]) {
    font-size: var(--small-size) !important;
    background-image: linear-gradient(180deg, var(--bg2), transparent) !important;
    color: var(--white) !important;

    border: solid 2px var(--bg2) !important;
}

textarea:hover,
textarea:focus {
    border-color: var(--bg3) !important;
}

input[type=radio] {
    border: solid 0.25em var(--bg2) !important;
    background-color: var(--bg1) !important;
}
input[type=radio]:hover,
input[type=radio]:focus {
    border-color: var(--bg3) !important;
}
input[type=radio]:checked {
    background-color: var(--white) !important;
}

input[type=checkbox] {
    background-color: var(--bg2) !important;
    background-size: cover;
    mask-image: url("../icons/check-off.svg") !important;

}
input[type=checkbox]:hover,
input[type=checkbox]:focus {
    background-color: var(--bg3) !important;
}
input[type=checkbox]:checked {
    background-color: var(--bg3) !important;
    mask-image: url("../icons/check-on.svg") !important;
}

button:hover,
button:focus,
input:hover,
input:focus {
    border-color: var(--bg3) !important;
    color: var(--white) !important;
}

button:hover,
input:is([type=reset], [type=button], [type=submit]):hover {
    color: var(--white) !important;
}

:focus-visible::-moz-focus-inner {
    border-color: var(--bg3) !important;
}

:is(:disabled, :disabled:active)::file-selector-button,
button:is(:disabled, :disabled:active),
input:is([type=reset], [type=button], [type=submit]):is(:disabled, :disabled:active),
select:is(:disabled, :disabled:active) > button {
    color: var(--white) !important;
}

/* file selector */
input[type=file] {
    background: linear-gradient(180deg, var(--bg2), transparent) !important;
}
input[type=file]:focus,
input[type=file]:hover {
    background: linear-gradient(180deg, var(--bg2), var(--bg3) 200%) !important;
}

/* button part of file selector */
::file-selector-button {
    color: var(--white) !important;
}


/* ANIMATIONS */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: unset;
        transform: none;
    }
}

@keyframes fadeOut {
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }

    0% {
        opacity: unset;
        transform: none;
    }
}