:root {
    --primary-dark: oklch(15% 0.05 265);
    --primary-light: oklch(90% 0.05 230);
    --secondary-dark: oklch(40% 0.27 265);
    --secondary-light: oklch(80% 0.125 230);
    --accent: oklch(50% 0.28 275);
    --error: oklch(70% 0.185 50);
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    position: absolute;
    overflow-x: hidden;
    width: 100vw;
    box-sizing: border-box;
    color: var(--primary-light);
    background-color: var(--primary-dark);
}

a, a:visited {
    color: var(--primary-light);
}

/* FONTS */
@font-face {
    font-family: "RedHatDisplay";
    src: url("/~miika.rankaviita/style/font/RedHatDisplayVF.woff2") format('woff2-variations');
    font-weight: 300 900;
    font-style: normal;
    font-display: fallback;
}
@font-face {
    font-family: "RedHatText";
    src: url("/~miika.rankaviita/style/font/RedHatTextVF.woff2") format('woff2-variations');
    font-weight: 300 700;
    font-style: normal;
    font-display: fallback;
}

@font-face {
    font-family: "AzeretRegular";
    src: url("/~miika.rankaviita/style/font/AzeretMono-Regular.woff2") format('woff2');
}
@font-face {
    font-family: "AzeretSemibold";
    src: url("/~miika.rankaviita/style/font/AzeretMono-SemiBold.woff2") format('woff2');
}

@font-face {
    font-family: "SometypeMono";
    src: url("/~miika.rankaviita/style/font/SometypeMono-Regular.woff2") format('woff2');
}

@font-face {
    font-family: Arial;
    src: local(Arial);
    size-adjust: 98%;
}

@font-face {
    font-family: DejaVu Sans;
    src: local(DejaVu Sans);
    size-adjust: 99%;
}

@font-face {
    font-family: Liberation Sans;
    src: local(Liberation Sans);
    size-adjust: 98%;
}

math {
    font-family: "STIX";
}

h2 {
    font-family: "RedHatDisplay", sans-serif;
}

p {
    font-family: "SometypeMono", monospace;
}

.accented {
    color: var(--accent);
}

/* NAME */
#name {
    position: absolute;
    margin-top: 2rem;
    margin-left: 2rem;
    text-decoration: none;
    color: var(--secondary-light);
    font-family: "AzeretRegular", monospace;
}

@media (max-width: 74rem) {
    #name {
        display: none;
    }
}

/*#NAVBAR */
#navbar {
    max-width: 40rem;
    height: 3.2rem;
    margin-top: 1em;
    margin-right: auto;
    margin-left: auto;
    border: 2px solid var(--secondary-light);
    border-radius: 1.6rem;
    overflow: hidden;
    display: grid;
}

@media (max-width: 42rem) {
    #navbar {
        margin: 1em 0.9em 0em 0.9em;
    }
}

#links {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-evenly;
}

#links li {
    list-style: none;
    padding: 0;
    flex-grow: 1;
}

#links li:hover {

}

#links a {
    display: block;
    height: 3.2rem;
    line-height: 3.2rem;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    color: var(--secondary-light);
    font-family: "RedHatText", sans-serif;
    font-size: 1.2rem;
    mix-blend-mode: difference;
}

.selected {
    display: block;
    width: calc(100% - 4rem);
    // height: 2.6rem;
    // line-height: 2.6rem;
    // transform: translate(2rem, .3rem);
    height: 2.2rem;
    line-height: 2.2rem;
    transform: translate(2rem, .5rem);
    color: var(--primary-dark);
    background-color: var(--secondary-light);
    border-radius: 1.6rem;
}

@media (max-width: 40rem) {
    .selected {
        width: calc(100% - 2rem);
        transform: translate(1rem, .3rem);
    }
}


@media (max-width: 35rem) {
    .selected {
        width: calc(100% - 1.5rem);
        transform: translate(0.75rem, .3rem);
    }
}

#links #indicator {
    grid-column: 1/2;
    grid-row: 1/2;
}

#indicator {
    position: relative;
    width: 6.5rem;
    height: 2.2rem;
    background-color: var(--secondary-light);
    top: -2.7rem;
    border-radius: 1.1rem;
    z-index: -1;
    transform: translateX(-7rem);
}

// TODO: Correct the styles so that the loading animation is centred and not moving
#card .loading, #articles .loading, #posts .loading, #post-content .loading {
    position: relative;
    margin: 0;
    width: fit-content;
    top: 30vh;
    left: 50%;
    transform: translateX(-8.5rem);
    font-family: "RedHatDisplay", "Arial", sans-serif;
    font-size: 3.2rem;
    font-weight: 600;
    letter-spacing: 4px;
    color: oklch(90% 0.05 230 / 0.4);
    background: linear-gradient(to bottom, var(--primary-light), var(--primary-light)) no-repeat;
    background-clip: text;
    background-size: 100% 30%;
    animation: 7s loading infinite;
}

#card .loading {
    grid-row-end: 3;
    grid-column-end: 5;
    top: 12rem;
    color: oklch(40% 0.27 265 / 0.4);
    background: linear-gradient(to bottom, var(--secondary-dark), var(--secondary-dark)) no-repeat;
    background-clip: text;
    background-size: 100% 30%;
}

.loading:after {
    content: "";
    animation-name: dots;
    animation-duration: 3s;
    animation-iteration-count: infinite;
}

@keyframes loading {
    from {
        background-size: 100% 30%;
        background-position-y: 0rem;
    }

    30%, 60% {
        background-size: 100% 80%;
        background-position-y: 0rem;
    }

    90%, to {
        background-position-y: 3.3rem;
    }
}

@keyframes dots {
    from {
        content: "";
    }

    33% {
        content: ".";
    }

    67% {
        content: "..";
    }

    to {
        content: "...";
    }
}

#card .error-header, #articles .error-header, #posts .error-header, #post-content .error-header {
    position: relative;
    margin: 30vh 1rem 0.2rem 1rem;
    width: fit-content;
    font-family: "RedHatDisplay", "Arial", sans-serif;
    font-size: 3.2rem;
    font-weight: 600;
    letter-spacing: 5px;
    color: var(--error);
    animation: 2.5s opacity infinite alternate ease-in;
}

#card .error-header {
    grid-row-end: 3;
    grid-column-end: 5;
    top: 12rem;
    color: var(--error);
}

#card .error-msg, #articles .error-msg, #posts .error-msg, #post-content .error-msg {
    position: relative;
    margin: 0rem 1rem 0.2rem 1rem;
    width: fit-content;
    font-family: "RedHatText", "Arial", sans-serif;
    font-size: 1.5rem;
    font-weight: 450;
    letter-spacing: 2px;
    color: var(--error);
    animation: 2.5s opacity infinite alternate ease-in;
}

#card .error-msg {
    grid-row-end: 3;
    grid-column-end: 5;
    top: 12rem;
    color: var(--error);
}

@keyframes opacity {
    from {
        opacity: 100%;
    }

    to {
        opacity: 60%;
    }
}

.button {
    position: relative;
    display: inline-block;
    height: 3.2rem;
    line-height: 3.2rem;
    margin: 2rem 0rem 0rem 1rem;
    padding: 0rem 1.6rem 0rem 1.6rem;
    text-align: center;
    vertical-align: middle;
    color: var(--secondary-light);
    cursor: pointer;
    font-family: "RedHatText", "Arial", sans-serif;
    font-size: 1.2rem;
    font-weight: 400;
    border: 2px solid var(--secondary-light);
    border-radius: 1.6rem;
}

#card .button {
    color: var(--secondary-dark);
    border-color: var(--secondary-dark);
}
