:root {
    --main-block-space-vert: 20px;
    --main-block-border-thickness: 1px;
    --main-border-thickness: 45px;

    --nav-item-space: 12px;
    --nav-item-padding: 6px;
    --nav-item-border-thickness: 1px;

    --nav-item-inactive-color: black;
    --nav-item-active-color: brown;
    --link-color-primary: rgb(0, 0, 140);
    --link-color-secondary: whitesmoke;
    --project-card-main-color: black;
    --project-card-background: whitesmoke;
    --social-link-main-color: black;
    --social-link-background: whitesmoke;
    --blog-list-main-color: black;
    --article-main-color: black;
    --article-code-background: #eeeeee;
    --article-embed-background: black;
    --article-max-img-height: 390px;
    --article-embed-border-radius: 20px;

    --grid-project-gap: 20px;
    --grid-project-card-gap: 6px;
    --grid-project-card-padding: 6px;
    --grid-project-card-width: 330px;
    --grid-project-card-height: 150px;
    --grid-project-title-padding: 2px;

    --underline-time: 0.6s;
    --underline-curve: cubic-bezier(0.33, 1, 0.68, 1);
    --footnote-highlight-curve: cubic-bezier(0.33, 1, 0.68, 1);
    --footnote-highlight-time: 0.3s;

    font-family: mainFont;
}

@font-face {
    font-family: detail;
    src: url(/font/SourceSerif4_18pt-Light.ttf);
}

@font-face {
    font-family: mainFont;
    src: url(/font/Lora-Regular.ttf);
}

@font-face {
    font-family: articleFont;
    src: url(/font/SourceSerif4_18pt-Regular.ttf);
}

@font-face {
    font-family: mainBold;
    src: url(/font/Lora-Bold.ttf);
}

@font-face {
    font-family: read;
    src: url(/font/SourceSerif4_18pt-Regular.ttf);
}

@font-face {
    font-family: code;
    src: url(/font/IBMPlexMono-Regular.ttf);
}

/* Generic rules */

body {
    margin: 0;
    min-height: 100vh;
    background-color: whitesmoke;
    padding: 0;
    margin: auto;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 2px;
    padding-right: 2px;
    max-width: 1120px;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav-items {
    border-bottom: var(--main-border-thickness) solid;
    border-left: var(--main-border-thickness) solid;
    border-right: var(--main-border-thickness) solid;
    border-image: url('/img/decor/site-border.svg') 30;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav::after {
    width: 200px;
    height: 20px;
    color: transparent;
    background-image: url('/img/decor/site-top-border-decor.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-50%)
                translateY(calc(var(--main-border-thickness) / -2));
}

.site-nav {
    box-sizing: border-box;
    margin-top: var(--main-block-space-vert);
    width: 100%;
    position: relative;
}

.nav-item {
    position: relative;
    font-size: large;
}

.nav-link {
    position: relative;
    display: inline-block;
    box-sizing: content-box;
    padding: var(--nav-item-padding) var(--nav-item-space);
    color: var(--nav-item-inactive-color);
    text-decoration: none;
    text-transform: capitalize;
    font-weight: bold;
}

.nav-link::after {
    box-sizing: border-box;
    content: "";
    color: transparent;
    position: absolute;
    border-bottom: 2px solid var(--nav-item-inactive-color);
    bottom: 0;
    top: 0;
    left: var(--nav-item-space);
    right: var(--nav-item-space);

    transform: scaleX(0.0);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover:after {
    transform: scaleX(1.0);
}

.nav-link.active::after {
    border-color: var(--nav-item-active-color);
    transform: scaleX(1.0);
}

.site-content {
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.site-footer {
    font-family: detail;
    font-size: smaller;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: var(--main-block-space-vert);
    border-top: var(--main-border-thickness) solid;
    border-left: var(--main-border-thickness) solid;
    border-right: var(--main-border-thickness) solid;
    border-image: url('/img/decor/site-border.svg') 30;
    text-align: center;
}

.site-footer::before {
    width: 200px;
    height: 15px;
    color: transparent;
    background-image: url('/img/decor/site-bot-border-decor.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-50%)
                translateY(calc(var(--main-border-thickness) / -2));
}

.button-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    opacity: 0.2;
    box-shadow: 0 0 7px 0 black, 0 0 37px 0 black;
    background-color: black;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.button-link:hover::before, .button-link:focus::before {
    opacity: 1;
}

.button-link:hover, .button-link:focus {
    transform: scale(1.03);
}

.button-link {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Project page */

.project-grid {
    width: 100%;
    display: grid;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    gap: var(--grid-project-gap);
    grid-template-columns: repeat(auto-fill, var(--grid-project-card-width));
    grid-auto-rows: var(--grid-project-card-height);
}

.project {
    width: 100%;
    height: 100%;
    position: relative;
}

.project::before {
    border-radius: 10px;
}

.project-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    text-decoration: none;
    color: var(--project-card-main-color);
    display: grid;
    border-radius: 10px;
    overflow: hidden;
    grid-template-columns: calc(var(--grid-project-card-height)) auto;
}

.project-info {
    padding-right: var(--grid-project-card-padding);
    padding-top: var(--grid-project-card-padding);
    padding-bottom: var(--grid-project-card-padding);
    padding-left: var(--grid-project-card-gap);
    background-color: var(--project-card-background);
}

.project-image-container {
    box-sizing: border-box;
    height: 100%;
    position: relative;
}

.project-image {
    width: 100%;
    object-position: center;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.project-name {
    padding-bottom: var(--grid-project-title-padding);
    width: 100%;
    font-weight: bold;
    font-size: large;
    display: block;
    margin: 0;
}

.project-description {
    width: 100%;
    font-size: small;
    font-family: detail;
    display: block;
    margin: 0;
    text-overflow: ellipsis;
}

/* Socials page */

.social-links {
    padding: 0;
    list-style: none;
    display: grid;
    justify-content: center;
    gap: var(--grid-project-gap);
    grid-template-columns: var(--grid-project-card-width);
}

.social-item {
    margin: 0;
    box-sizing: content-box;
    position: relative;
    width: 100%;
    height: 50px;
}

.social-item::before {
    border-radius: 30px;
}

.social-link {
    padding: 10px;
    position: absolute;
    color: var(--social-link-main-color);
    font-weight: bold;
    text-decoration: none;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--social-link-background);
    gap: 10px;
    display: grid;
    grid-template-columns: 30px auto;
    grid-template-rows: 30px;
    align-items: center;
    font-size: larger;
    border-radius: 30px;
}

.social-image {
    color: var(--social-link-background);
    height: 100%;
    overflow: hidden;
    object-position: center;
    object-fit: contain;
    aspect-ratio: 1 / 1;
}

/* blog list page rules */

.blog-list {
    display: grid;
    grid-template-columns: 1fr;
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
    max-width: min(100%, 700px);
    margin: auto;
    width: 100%;
    grid-auto-rows: 1fr;
}

.blog-link {
    color: var(--blog-list-main-color);
    text-decoration: none;
    padding-top: 30px;
    padding-bottom: 30px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
}

.blog-list > :not(:last-child) {
    border-bottom: 1px var(--blog-list-main-color) dashed;
}

.blog-link-header-container {
    grid-column: 1;
    grid-row: 1;
    height: 19px;
}

.blog-link-header {
    margin: 0;
    font-weight: bold;
    font-size: 16px;
    padding-bottom: 1px;
}

.blog-link-description {
    padding-top: 15px;
    margin: 0;
    grid-column: 1;
    grid-row: 3;
    overflow: hidden;
    height: 100%;
}

.blog-link-date {
    margin: 0;
    font-weight: lighter;
    font-family: detail;
    grid-column: 1;
    grid-row: 2;
    padding-top: 3px;
    font-size: 11px;
}

.blog-link-header {
    display: inline-block;
    position: relative;
}

.blog-link-header:before {
    z-index: -1;
    content: "";
    left: 0;
    right: 0;
    bottom: -1px;
    position: absolute;
    top: 0;
    font-weight: bold;
    border-bottom: 2px solid var(--blog-list-main-color);
    transition: transform var(--underline-time) var(--underline-curve);
    transform: translateX(-50%) scaleX(0);
}

.blog-link:hover .blog-link-header:before {
    transform: translateX(0) scaleX(1);
}

/* article rules */

.article {
    box-sizing: border-box;
    padding-left: 3px;
    padding-right: 3px;
    max-width: min(100%, 700px);
    margin: auto;
    width: 100%;
}

.article * {
    font-size: 1.1rem;
    font-family: articleFont;
}

.article h1 {
    margin: 0;
    margin-bottom: 10px;
    margin-top: 20px;
    display: inline-block;
    position: relative;
    text-transform: capitalize;
}

.article ul {
    margin: 0;
    margin-top: 10px;
    padding-left: 30px;
}

.article ul li {
    margin-top: 2px;
}

.article h1 .zola-anchor {
    font-family: mainFont;
    font-size: 40px;
    text-decoration: none;
    color: var(--article-main-color);
}

.article code, .article code *,
.article pre code {
    font-family: code;
    font-weight: 100;
    font-size: 15px;
}

.article code {
    padding: 4px;
    border-radius: 6px;
    background-color: var(--article-code-background);
}

.article pre {
    margin-left: 2px;
    margin-right: 2px;
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 10px;
    border-radius: 10px;
}

.article pre code {
    padding: 0;
    border-radius: 0;
    background-color: transparent;
}

.article h1:before {
    z-index: -1;
    content: "";
    left: 0;
    right: 0;
    bottom: -3px;
    position: absolute;
    top: 0;
    font-weight: bold;
    border-bottom: 3px solid var(--article-main-color);
    transition: transform var(--underline-time) var(--underline-curve);
    transform: translateX(-50%) scaleX(0);
}

.article h1:hover:before {
    transform: translateX(0) scaleX(1);
}

.article h1:target:before {
    transform: translateX(0) scaleX(1);
}

.article h1 a::before {
    content: "";
    display: inline-block;
    background-repeat: no-repeat;
    background-position: 50% calc(50% + 5px);
    background-size: contain;
    width: 30px;
    height: 38px;
    background-image: url(/img/decor/h1decor.svg);
}

.article p {
    line-height: 1.5;
}

.article li {
    margin-bottom: 10px;
}

.article .yt-embed {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--article-embed-border-radius);
    overflow: hidden;
    background-color: var(--article-embed-background);
}

.article .yt-embed iframe {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: 100%;
    border: none;
}

.article .big-img-embed {
    position: relative;
    width: 100%;
    max-height: var(--article-max-img-height);
    border-radius: var(--article-embed-border-radius);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: var(--article-embed-background);
}

.article .big-img-embed img {
    width: 100%;
    object-fit: cover;
}

.article .footnote-reference a {
    font-family: code;
    font-size: 13px;
    text-decoration: none;
    color: var(--link-color-primary);
    transition-property: color, background-color;
    transition-timing-function: var(--footnote-highlight-curve);
    transition-duration: var(--footnote-highlight-time) ;
}

.article .footnote-reference a:hover {
    color: var(--link-color-secondary);
    background-color: var(--link-color-primary);
}

.article .footnote-reference a:hover::before {
    color: var(--link-color-primary);
}

.article .footnote-reference a:hover::after {
    color: var(--link-color-primary);
}

.article .footnote-reference a::before {
    content: "[";
}

.article .footnote-reference a::after {
    content: "]";
}

.article p a:has(code) {
    overflow: hidden;
    border-radius: 6px;
    padding: 0;
    background-color: var(--article-code-background);
}

.article p > a code {
    background-color: transparent;
}

.article p > a {
    position: relative;
    color: var(--link-color-primary);
    transition-property: color, background-color;
    transition-timing-function: var(--underline-curve);
    transition-duration: var(--underline-time);
}

.article p > a:hover {
    text-decoration: none;
    background-color: transparent;
    color: var(--link-color-secondary);
}

.article p > a:before {
    background-color: var(--link-color-primary);
    transition: transform var(--underline-time) var(--underline-curve);
    transform: translateX(-50%) scaleX(0);
    z-index: -1;
    content: "";
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    position: absolute;
}

.article p > a:hover:before {
    transform: translateX(0) scaleX(1);
}

.article .footnote-definition {
    position: relative;
    padding-left: 5px;
    padding-right: 5px;
}

.article .footnote-definition p {
    margin: 0;
    margin-left: 10px;
    margin-bottom: 5px;
    font-size: 15px;
    display: inline-block
}

.article #\31 {
    margin-top: 40px;
    border-top: 1px var(--article-main-color) dashed;
    padding-top: 40px;
}

.article .footnote-definition-label {
    font-weight: normal;
    font-family: code;
    font-size: 18px;
    border-radius: 40px;
    padding-left: 8px;
    padding-right: 8px;
    padding-top: 2px;
    padding-bottom: 2px;
    top: 0px;
}

.article .footnote-definition:target .footnote-definition-label {
    color: var(--link-color-secondary);
    text-decoration: none;
    background-color: var(--link-color-primary);
}

/* not-found page rules */

.not-found {
    text-align: center;
}

.not-found-header {
    text-transform: capitalize;
    text-decoration: underline;
}