@import url("animations.css");
@import url("grid.css");

:root {
    --min-page-h: calc(100vh - 12rem);
}

header {
    width: 45%;
    height: 100vh;
    padding: 6rem 0;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 3;

    span {
        margin: 0 .25rem;
    }

    nav {
        margin-left: auto;
    }

    @media (max-width: 1024px) {
        width: 100%;
        position: relative;
        padding-bottom: 0;

        .spy,
        .recent {
            display: none;
        }
    }

    @media (max-height: 810px) {
        .recent {
            display: none;
        }
    }

    @media (max-height: 880px) {
        .post:nth-child(3) {
            display: none;
        }
    }
}

nav {
    height: 100%;

    & ul {
        height: 100%;
        display: flex;
        gap: .875rem;
        list-style-type: none;

        & li {
            align-content: center;
        }
    }
}

main {
    container-type: inline-size;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5rem;

    section {
        .sticky {
            --neg-page-pad-x: calc(-1 * var(--page-pad-x));
            position: sticky;
            top: 0;
            z-index: 1;
            width: calc(100% + calc(2 * var(--page-pad-x)));
            height: var(--header-h);
            margin: 0 var(--neg-page-pad-x);
            backdrop-filter: blur(.5rem);
            display: none;
        }

        h3 {
            display: flex;
            height: 100%;
            padding: 0 var(--page-pad-x);
            align-items: center;
        }

        .view-link {
            margin: 1rem;
        }

        @media (max-width: 1024px) {
            .sticky {
                display: block;
            }

            .view-link {
                margin: 1rem 0;
            }
        }

        @container (width < 448px) {
            .card {
                display: flex;
                flex-direction: column;

                .preview:has(img) {
                    order: 1;
                }
            }
        }
    }

    section:last-child {
        margin-bottom: 5rem;
    }
}

footer {
    display: flex;
    justify-content: flex-end;

    a,
    p,
    span {
        font-size: .875rem;
        opacity: .65;
    }

    p > span {
        font-family: var(--display-font-family);
        font-variation-settings: var(--display-wght);
    }
}

.comment {
    opacity: .5;

    span {
        position: relative;
        top: -.1rem;
        margin: 0;
    }
}

.right {
    min-height: var(--min-page-h);
    padding: 5rem 0 6rem;
    width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 4;

    @media (max-width: 1024px) {
        width: 100%;
    }
}

/* .icon class on the svg element */
.icon {
    fill: var(--theme-ui-text-color);
    width: auto;
    height: 100%;
}

button {
    border: 0;
    background: none;
}

button .icon,
a .icon {
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.contact {
    margin-top: 2rem;
    display: flex;
    gap: .625rem;
    list-style: none;

    .icon {
        width: 1.5rem;
        height: 1.5rem;
        fill: var(--theme-sub-text-color);
        transition: fill 100ms linear;

        @media (max-width: 1024px) {
            transition: none;
        }
    }

    .icon:hover {
        fill: var(--theme-ui-text-color);
    }
}


.spy {
    margin-top: 6rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    list-style: none;

    li {
        display: flex;
        gap: .2rem;
        position: relative;
    }

    a {
        display: flex;
        position: relative;
    }

    .active {
        a {
            font-variation-settings: var(--hover-wght);
            transition: font-variation-settings 50ms linear;
        }
    }

    .active:before {
        content: "";
        position: absolute;
        left: -.7rem;
        top: 0;
        margin-right: .5rem;
        width: .2rem;
        height: 100%;
        background-color: var(--theme-ui-text-color);
        animation: scrollFadeIn 100ms linear;
    }
}

img {
    object-fit: cover;
    width: 100%;
    max-width: 200px;
    border-radius: .25rem;
    border: 2px solid var(--theme-border-color);
    transition: border-color 100ms linear;
}

/* _PartialViews css */
.recent {
    margin-top: 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;

    ul {
        display: flex;
        flex-direction: column;
        gap: .875rem;
        list-style: none;
    }

    .post {
        a {
            display: grid;
            grid-template-areas:
                    "preview title"
                    "preview subtitle";
            column-gap: .75rem;
            width: fit-content;
            max-width: 80%;
            height: 100%;
            position: relative;

            img {
                grid-area: preview;
                aspect-ratio: 1 / 1;
                width: auto;
                height: 36px;
                align-self: center;
            }

            .title {
                grid-area: title;
                margin: 0;
                height: 1.5rem;
                overflow: hidden;
                font-size: .875rem;
                text-wrap: nowrap;
                text-overflow: ellipsis;
                color: var(--theme-body-text-color);
                transition: color 100ms linear;
            }

            .date {
                grid-area: subtitle;
                margin: 0;
                font-family: var(--display-font-family);
                font-size: .75rem;
                color: var(--theme-sub-text-color);
            }

            .icon {
                height: .75rem;
                position: absolute;
                right: -1.125rem;
                top: .25rem;
                opacity: 0;
                transition: opacity 100ms linear;
            }
        }
    }

    .post:hover {
        .title {
            color: var(--theme-ui-text-color);
        }

        .icon {
            opacity: 1;
        }
    }
}

.view-link {
    font-family: var(--display-font-family);
    font-variation-settings: var(--bold-wght);
    position: relative;
    display: flex;
    gap: .5rem;
    align-items: center;
    width: fit-content;

    .icon {
        position: absolute;
        right: -1.125rem;
        height: .75rem;
    }
}

.view-link::after {
    content: "";
    position: absolute;
    bottom: -.15rem;
    left: 0;
    right: 0;
    display: block;
    height: .1rem;
    background-color: var(--theme-ui-text-color);
    transition: opacity 100ms linear;
    opacity: 0;
}

.view-link:hover::after {
    opacity: 1;
}


.card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

.card-list:hover {
    .card {
        opacity: .5;
    }
}

.card-list:has(.card:hover) {
    .card:hover {
        opacity: 1;
    }
}

.card {
    position: relative;
    padding: 1rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    transition: opacity 150ms linear;

    .overlay {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;
        border-radius: 0.25rem;
        opacity: 0;
        background-color: rgba(255, 255, 255, 0.25);
        box-shadow: white 0 1px 0 0 inset, black 1px 1px 4px 1px;
        transition: opacity 150ms linear;
    }

    .preview {
        grid-column: 1 / 3;

        p {
            height: 1.5rem;
            font-family: var(--display-font-family);
            font-variation-settings: var(--bold-wght);
            font-size: .875rem;
            text-transform: uppercase;
            color: var(--theme-sub-text-color);
        }

        img {
            aspect-ratio: 16 / 9;
            width: 100%;
            max-width: 200px;
        }
    }

    .text-content {
        grid-column: 3 / -1;
        margin-left: .25rem;
    }

    .header {
        display: flex;
        flex-direction: column;
        gap: .125rem;
        margin-bottom: 1rem;
        flex-grow: 2;

        .title {
            display: flex;
            gap: .325rem;
            align-items: center;
            font-family: var(--display-font-family);
            font-variation-settings: var(--bold-wght);
            transition-property: color, font-variation-settings;
            transition-duration: 50ms;
            transition-timing-function: linear;
            color: var(--theme-ui-text-color);

            .icon {
                width: 1.25rem;
                height: 1.25rem;
                transform: translate(-5%, 5%) rotate(45deg);
                transition-property: opacity, transform;
                transition-duration: 100ms;
                transition-timing-function: linear;
            }
        }

        .subtitle {
            font-family: var(--display-font-family);
            font-variation-settings: var(--bold-wght);
            font-size: .875rem;
            color: var(--theme-sub-text-color);
        }
    }

    @media (max-width: 1024px) {
        margin: 0 -1rem;
    }
}

.card:hover {
    cursor: pointer;

    .header {
        .title {
            font-variation-settings: var(--hover-wght);

            .icon {
                opacity: 1;
                transform: translate(5%, -5%) rotate(45deg);
            }
        }
    }

    .preview img {
        border-color: var(--theme-border-hover-color);
    }

    .overlay {
        opacity: .125;
    }
}

.about {
    padding: 1rem;

    @media (max-width: 1024px) {
        padding: 1rem 0;
    }
}
