:root {
    height: 100dvh;
    width: 100dvw;
    font-display: swap;
    --grid-color: rgba(88, 88, 88, 0.1);
    --grid-size: 40px;
}

body {
    display: grid;
    font-family: 'JetBrains Mono';
}

.header {
    position: relative;
    justify-self: center;
    margin-top: 5dvh;
    /* transition: all 0.3s ease-in-out; */
    pointer-events: visibleStroke;
    color: #585858;

}

.subheader {
    color: #585858;
    padding-top: 8px;
    font-size: small;
    word-wrap: break-word;
    word-break: keep-all;
    line-height: 1.5rem;
}

@keyframes pulseFade {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.img {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: small;
    animation: cubic-bezier(0.6, -0.28, 0.735, 0.045) pulseFade 2s infinite;
}

.img img {
    max-width: 30%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease-in-out;
}

.clicked {
    animation: none;
    transform: rotate(360deg);
    transition: transform 0.5s ease-in-out;
}

@supports (anchor-name: --header) {
    .header {
        anchor-name: --header;
    }

    .subheader {
        position: fixed;
        position-anchor: --header;
        top: anchor(bottom);
        left: anchor(left);
    }

    .img img {
        position: fixed;
        position-anchor: --header;
        top: anchor(top);
        bottom: anchor(bottom);
    }

}

@supports not (anchor-name: --header) {
    .header {
        left: 3dvw;
    }

    .subheader {
        position: absolute;
        top: 8dvh;
        left: 38dvw;
    }

    .img img {
        position: absolute;
        margin-top: 5dvh;
        border-radius: 2dvw;
    }

    .menu {
        margin-right: 2dvh;
    }
}

.menu {
    display: grid;
    justify-self: center;
    margin-top: 20dvh;
}

.menu .item {
    list-style: linear-gradient(to left, #f0f0f0, #d0d0d0);
    margin: 0 15px;
    font-weight: 400;
    padding: 2px;
}

.menu .item a {
    color: #585858;
    /* color: rgb(37, 35, 35); */
    text-decoration: none;
    font-size: 18px;
}

/* .menu .item a::before {
    content: "{";
    margin-right: 5px;
    transition: opacity 0.3s ease-in-out;
}
.menu .item a:hover::before {
    opacity: 1;
} */
.blog {
    padding-top: 5dvh;
}

.blog ul {
    padding: 0;
    margin: 20px auto;
    max-width: 600px;
}

.blog li {
    margin: 10px 0;
    font-size: 16px;
    font-family: sans-serif;
}

.blog li small,
.blog li small a {
    color: #585858;
}

.blog li a {
    text-decoration: none;
    color: #585858;
    /* color: #333; */
}

.footer {
    padding-bottom: 8px;
    width: 100%;
    text-align: center;
    font-size: small;
    color: #585858;
}

.bg-color-picker {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: transparent;
    width: fit-content;
    height: fit-content;
}

.bg-color-picker input {
    width: 20px;
    background-color: transparent;
    height: 20px;
    border: none;
    cursor: pointer;
    animation: vibrate 0.6s ease-in-out;
}

@keyframes vibrate {
    0% {
        transform: translate(0);
    }

    25% {
        transform: translate(-1px, 1px);
    }

    50% {
        transform: translate(1px, -1px);
    }

    75% {
        transform: translate(-1px, -1px);
    }

    100% {
        transform: translate(0);
    }
}

@media screen and (min-width:800px) {
    body {
        display: run-in;
    }

    .img img {
        max-width: 20%;
    }

    .menu .item a::before {
        opacity: 0;
    }
}

/* Comprehensive Desktop Media Query */
@media screen and (min-width: 768px) {
    :root {
        height: 100vh;
        width: 100vw;
    }

    body {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
        display: grid;
        grid-template-areas:
            "header header"
            "subheader image"
            "menu menu"
            "blog blog"
            "commit commit"
            "footer footer";
        grid-template-columns: 2fr 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        gap: 2rem 3rem;
        min-height: 100vh;
        align-content: start;
    }

    .header {
        grid-area: header;
        justify-self: start;
        margin-top: 1rem;
        font-size: 3.5rem;
    }

    .subheader {
        grid-area: subheader;
        position: static;
        padding-top: 0;
        font-size: 1.1rem;
        font-weight: 300;
        line-height: 1.6;
        max-width: 50dvw;
        margin-top: 0;
    }

    .img {
        grid-area: image;
        justify-self: end;
        align-self: start;
        font-size: 0.9rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .img img {
        position: static;
        max-width: 250px;
        height: auto;
        border-radius: 12px;
        margin-top: 0;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }

    .img img:hover {
        transform: scale(1.02);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    }

    .menu {
        grid-area: menu;
        margin-top: 1rem;
        justify-self: start;
    }

    .menu ol {
        display: flex;
        gap: 3rem;
        padding: 0;
        margin: 0;
    }

    .menu .item {
        margin: 0;
        padding: 0.5rem 0;
        position: relative;
    }

    .menu .item a {
        font-size: 1.2rem;
        font-weight: 500;
        transition: all 0.3s ease;
        position: relative;
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
    }

    .menu .item a:hover {
        background-color: rgba(0, 0, 0, 0.05);
        transform: translateY(-2px);
    }

    .menu .item a::after {
        content: '';
        position: absolute;
        bottom: -5px;
        left: 50%;
        width: 0;
        height: 2px;
        background: #333;
        transition: all 0.3s ease;
        transform: translateX(-50%);
    }

    .menu .item a:hover::after {
        width: 80%;
    }

    .blog {
        grid-area: blog;
        padding-top: 1rem;
    }

    .blog ul {
        max-width: 800px;
        margin: 2rem 0;
    }

    .blog li {
        margin: 1.5rem 0;
        font-size: 1.1rem;
        padding: 1rem;
        border-bottom: 1px solid #eee;
        transition: all 0.3s ease;
    }

    .blog li:hover {
        background-color: rgba(0, 0, 0, 0.02);
    }

    .blog li a {
        font-size: 1.1rem;
        font-weight: 500;
    }

    .blog li small {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        display: block;
    }

    .last-commit {
        grid-area: commit;
        color: #585858;
        margin-top: 1rem;
    }

    .commit {
        padding: 1.5rem;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 0.5rem;
        border-left: 3px solid #33333357;
    }

    .commit small {
        font-size: 1rem;
        line-height: 1.5;
    }

    .footer {
        grid-area: footer;
        margin-top: 2rem;
        font-size: 1rem;
        padding: 2rem 0;
    }

    .bg-color-picker {
        top: 2rem;
        right: 2rem;
    }

    .bg-color-picker input {
        width: 30px;
        height: 30px;
    }

    /* Remove anchor positioning for desktop - use grid instead */
    @supports (anchor-name: --header) {
        .header {
            anchor-name: none;
        }

        .subheader {
            position: static;
        }

        .img img {
            position: static;
        }
    }

    /* Override mobile-specific positioning */
    @supports not (anchor-name: --header) {
        .header {
            left: auto;
        }

        .subheader {
            position: static;
            top: auto;
            left: auto;
        }

        .img img {
            position: static;
            margin-top: 0;
        }
    }

    /* Improve typography hierarchy */
    hr {
        border: none;
        height: 1px;
        background: linear-gradient(90deg, transparent, #ccc, transparent);
        margin: 2rem 0;
    }

    /* Better link styling */
    a {
        transition: all 0.2s ease;
    }

    a:hover {
        color: #0056b3;
    }
}