:root {
    --accent: #62C3B4;
    --text: #0E1D1B;
    --cat-color-active: #0E1D1B;
    --cat-color: var(--cat-color-active);
    --max-width: 1300px;
    --post-column: 8;
    --post-width: calc((min(100vw, var(--max-width)) - (var(--post-column) + 1) * 10px) / var(--post-column));
    --regular-text: 14px;
    --lineheight: 1.7;
    --animation-duration: 300ms;
    --userfont: "JetBrains Mono", sans-serif;
    --systemfont: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

@font-face {
    src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
    font-family: "JetBrains Mono";
    font-weight: 400;
    font-style: normal;
}

@font-face {
    src: url("../fonts/JetBrainsMono-Bold.woff2") format("woff2");
    font-family: "JetBrains Mono";
    font-weight: 700;
    font-style: normal;
}

::selection {
    background-color: var(--accent);
    color: #fff;
}

::marker {
    color: transparent;
}

a {
    color: unset;
}

a:hover {
    color: var(--accent);
}

body {
    font-family: var(--userfont);
    font-size: var(--regular-text);
    line-height: var(--lineheight);
    color: var(--text);
    background-color: #F4EDE5;
    position: relative;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    max-width: var(--max-width);
    margin: 0 auto;
}

body > header, body > footer {
    flex: none;
}

body > main {
    flex: 1;
}

.header {
    padding: 20px 20px 40px;
    display: flex;
}

.header .header-logo {
    width: 100px;
    height: 100px;
    margin-right: 10px;
}

.header .header-contact-button {
    width: 40px;
    height: 40px;
    background-color: var(--accent);
    border-radius: 20px;
    border: 1px solid #fff;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-nav {
    height: 45px;
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-width: none;
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.header-nav .header-nav-content {
    display: flex;
    color: #fff;
    line-height: 40px;
    margin: 0 35px;
    font-family: "JetBrains Mono";
    font-weight: bold;
}

.header-nav .header-nav-item {
    display: block;
    align-items: flex-start;
    height: 40px;
    border-radius: 20px;
    font-size: 0;
    text-align: center;
    text-decoration: none;
    margin-right: 10px;
    padding: 0 14px;
    transition-property: border-radius, background-color, padding, font-size;
    transition-duration: var(--animation-duration);
    transition-timing-function: ease;
    background-color: var(--cat-color);
    text-transform: uppercase;
    cursor: pointer;
}

.header-nav .header-nav-item:hover {
    color: #fff;
}

.header-nav .header-nav-item::selection {
    background-color: transparent;
}

.header-nav .header-nav-item.selected,
.header-nav .header-nav-item:hover,
.header-nav .header-nav-item:first-letter {
    font-size: 20px;
}

.header-nav .header-nav-item:hover,
.header-nav .header-nav-item.selected {
    padding: 0 14px 5px 14px;
    border-radius: 15px 15px 0 0;
}

.header-nav .header-nav-item.selected {
    background-color: var(--cat-color-active);
}

.posts {
    display: grid;
    grid-gap: 10px;
    grid-auto-flow: dense;
    grid-template-columns: repeat(var(--post-column), var(--post-width));
    grid-auto-rows: var(--post-width);
    padding-inline: 10px;
    padding-block: 10px;
    margin-block: 0;
    border-radius: 16px;
    background-color: var(--cat-color-active);
}

.posts .post:nth-child(6n + 1) {
    background-color: #5D2256;
}
.posts .post:nth-child(6n + 2) {
    background-color: #5D3B22;
}
.posts .post:nth-child(6n + 3) {
    background-color: #32225D;
}
.posts .post:nth-child(6n + 4) {
    background-color: #5D2C22;
}
.posts .post:nth-child(6n + 5) {
    background-color: #425D22;
}
.posts .post:nth-child(6n) {
    background-color: #225D5A;
}

.posts .post-layout-2-1 {
    grid-column-start: span 2;
    grid-row-start: span 1;
}

.posts .post-layout-2-2 {
    grid-column-start: span 2;
    grid-row-start: span 2;
}

.posts .post-layout-2-3 {
    grid-column-start: span 2;
    grid-row-start: span 3;
}

.posts .post-layout-4-2 {
    grid-column-start: span 4;
    grid-row-start: span 2;
}

.posts .post-layout-4-3 {
    grid-column-start: span 4;
    grid-row-start: span 3;
}

.post {
    padding: 50px 20px 20px;
    border-radius: 10px;
    color: #fff;
    background-color: #fff1;
    background-size: cover;
    background-position: center;
    text-decoration: none;
    overflow: hidden;
    position: relative;
}

.post .post-block {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.post:hover {
    cursor: pointer;
}

.post::after {
    content: 'View Detail';
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    position: absolute;
    background-color: #62C3B4F2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: black;
    opacity: 0;
    transition: opacity var(--animation-duration) ease;
}

.post:hover::after {
    opacity: 1;
}

.post .post-title {
    font-size: 24px;
    margin-block: 0;
}

.post .post-summary {
    font-size: 12px;
    margin-block: 0;
    margin-top: 6px;
    color: #AAAAAA;
}

.post .post-content {
    font-size: 14px;
    margin-top: 10px;
}

.post .post-category {
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    font-size: 0;
    font-weight: bold;
    border-radius: 10px 0 40px;
    position: absolute;
    text-align: center;
    text-transform: uppercase;
    background-color: var(--cat-color);
}

.post .post-category::first-letter {
    font-size: 20px;
}

.post .post-author-avatar {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    position: absolute;
}

.posts-loading-indicator {
    display: block;
    height: 40px;
    margin: 100px auto;
}

.post-detail {
    color: #fff;
    font-size: 14px;
    line-height: 24px;
    padding: 50px 0;
}

.post-detail .post-detail-author-avatar {
    float: left;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    margin-right: 10px;
}

.post-detail .post-detail-author-role {
    color: var(--accent);
}

.post-detail .post-detail-img {
    width: 100%;
    border-radius: 16px;
    margin: 10px 0;
}

.post-detail .post-detail-title {
    font-size: 20px;
    font-weight: bold;
    margin: 10px 0;
}

.post-detail .post-detail-summary {
    font-size: 12px;
    color: #AAAAAA;
    margin-bottom: 10px;
}

.post-detail-content img {
    max-width: 100%;
    height: auto;
}

.post-detail-content a {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-position: under;
    margin-right: 24px;
    position: relative;
}

.post-detail-content a:after {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url('/static/images/link.svg');
    position: absolute;
}

.post-detail-content a:hover {
    color: var(--text);
    background-color: var(--accent);
}

.footer {
    text-align: center;
    font-size: 12px;
    line-height: 24px;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
}

.footer .footer-logo {
    width: 78px;
    height: 24px;
    margin-right: 12px;
}

.footer .footer-legal {
    color: #444;
}

.footer .footer-legal p {
    display: inline;
    word-break: keep-all;
}

#modal {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;

    display: flex;
    flex-direction: column;
    align-items: center;

    opacity: 1;
    transition: opacity var(--animation-duration) ease;
}

#modal.htmx-added,
#modal.htmx-swapping {
    opacity: 0;
}

#modal > .modal-underlay {
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

#modal > .modal-content {
    height: 100%;
    width: 80%;
    max-width: 800px;
    position: relative;
    overflow-y: scroll;
    scrollbar-width: none;

    animation-name: zoomIn;
    animation-duration: var(--animation-duration);
    animation-timing-function: ease;
}

#modal > .modal-content::-webkit-scrollbar {
    width: 0;
}

#modal .modal-close {
    cursor: pointer;
    position: sticky;
    margin-left: auto;
    top: 50px;
    width: 40px;
    height: 40px;
    background-image: url('/static/images/close.svg');
    opacity: 0.8;
}

#modal .modal-close:hover,
#modal .modal-close:active {
    opacity: 1;
}

@keyframes zoomIn {
    0% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}
