:root {
    --accent: #f5e97a;
    --accent-dim: #f5e97a33;
    --bg: #0f0f13;
    --bg-2: #1a1a1f;
    --bg-3: #212129;
    --muted: #9a9ab0;
}

html, body {
    background-color: var(--bg);
    color: white;
    font-family: "JetBrains Mono", monospace;
    scroll-behavior: smooth;
    font-size: clamp(15px, 1.5vh, 99999999px);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Subtle gradient glow behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, #f5e97a0d 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 90%, #7a9af50a 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

h1 {
    font-weight: 900;
    letter-spacing: -0.02em;
}

.nexttopfp h1 {
    font-weight: 500;
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

/* Section heading: accent marker */
#about > div > h1,
#projects > h1 {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 1.25rem;
}

#about > div > h1::before,
#projects > h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25em;
    bottom: 0.25em;
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--accent-dim);
}

strong {
    font-weight: 900;
    color: var(--accent);
}

a {
    color: var(--accent);
    text-decoration: underline 1px;
    text-underline-offset: 3px;
    font-weight: 600;
}

a:hover {
    text-decoration: underline wavy var(--accent) 2px;
    text-shadow: 0 0 12px var(--accent-dim);
}

#starfield {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    z-index: 0;
    position: absolute;
    border-radius: 50%;
    background: white;
    animation: twinkle var(--dur, 3s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    opacity: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: var(--bright, 0.6); transform: scale(1.3); }
}


/* Profile pic with subtle glow + hover */
.pfp {
    height: 12rem;
    border-radius: 2rem;
    box-shadow:
        0 0 0 1px #ffffff1a,
        0 10px 40px -10px #f5e97a33,
        0 20px 60px -20px #00000080;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.pfp:hover {
    transform: translateY(-4px) rotate(-1.5deg);
    box-shadow:
        0 0 0 1px #ffffff22,
        0 14px 50px -10px #f5e97a55,
        0 24px 70px -20px #000000a0;
}

#home {
    display: flex;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 2rem;
    height: 100vh;
    width: 100%;
    padding: 0 3rem;
    box-sizing: border-box;
    position: relative;
}

#about {
    max-width: 65vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100vh;
    margin-left: auto;
    margin-right: auto;
}

#projects {
    max-width: 65vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    margin-left: auto;
    margin-right: auto;
    padding: 8rem 0 4rem;
}

.everythingelse {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.nexttopfp {
    margin-left: 3rem;
}

/* Scroll hint under hero */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 0.95rem;
    animation: bob 2.2s ease-in-out infinite;
    opacity: 0.65;
    transition: opacity 0.4s ease;
}

@keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 6px); }
}

p {
    line-height: 1.6;
}

.nav {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    color: white;
    background-color: var(--bg);
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    font-family: "JetBrains Mono", monospace;
    border-radius: 999px;
    border: 4px dashed var(--accent);
    font-size: 1.1rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
}

.nav.active {
    background-color: var(--accent);
    color: var(--bg);
    box-shadow: 0 0 20px -4px var(--accent-dim);
}

.nav:hover {
    border: 4px solid var(--accent);
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: 0 0 18px -4px var(--accent-dim);
}

body > header button,
body > header a.nav {
    margin-right: 1rem;
}

body > header > div > *:last-child {
    margin-right: 0;
}

body > header {
    z-index: 100;
    width: 100%;
    display: flex;
    justify-content: center;
    position: fixed;
    top: 0;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

body > header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #0f0f13cc 0%, #0f0f1300 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    z-index: -1;
}

img {
    z-index: 10;
}

.contact {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.contact a:hover {
    transform: translateY(-3px);
    background-color: #ffffff10;
    box-shadow: 0 0 18px -4px var(--accent-dim);
}

.contact img {
    width: 2.25rem !important;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
}

.projects {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.project {
    display: flex;
    flex-direction: column;
    border-radius: 1.25rem;
    overflow: hidden;
    border: 1px solid #ffffff0f;
    background: var(--bg-3);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.project:hover {
    transform: translateY(-6px);
    border-color: var(--accent-dim);
    box-shadow:
        0 14px 30px -14px #000000cc,
        0 0 0 1px var(--accent-dim),
        0 0 24px -8px var(--accent-dim);
}

.project img {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    padding: 1.75rem 0;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project:hover img {
    transform: scale(1.04);
}

.pic {
    position: relative;
    z-index: 1;
    display: flex;
    background: linear-gradient(135deg, var(--bg-2) 0%, #15151a 100%);
    width: 100%;
    border-bottom: 1px solid #ffffff0a;
}

.pdesc {
    position: relative;
    z-index: 1;
    padding: 1.25rem 1.25rem 1.4rem;
    background-color: var(--bg-3);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.pdesc strong {
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.pdesc p {
    margin: 0;
    font-size: 0.95rem;
}

.pdesc p:last-child {
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.9rem;
}

footer {
    position: relative;
    z-index: 1;
}

a.nav {
    text-decoration: none;
    gap: 0.45rem;
}

.nav-home-mobile {
    display: none;
}

a.nav:hover {
    text-decoration: none;
    text-shadow: none;
}

.ext-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-external:hover .ext-arrow {
    transform: translate(2px, -2px);
}

/* ---------- blog pages ---------- */
.blog-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.blog-page > main {
    position: relative;
    z-index: 1;
    flex-grow: 1;
    width: 100%;
}

.post-wrap {
    max-width: 68ch;
    width: 100%;
    margin: 0 auto;
    padding: 9rem 1.5rem 5rem;
    box-sizing: border-box;
}

.blog-index {
    max-width: 72ch;
    width: 100%;
    margin: 0 auto;
    padding: 9rem 1.5rem 5rem;
    box-sizing: border-box;
}

.back-link {
    display: inline-block;
    font-size: 0.85rem;
    margin-bottom: 2.5rem;
    text-decoration: none;
    color: var(--muted);
}

.back-link:hover {
    color: var(--accent);
    text-decoration: none;
    text-shadow: 0 0 12px var(--accent-dim);
}

.post-head {
    margin-bottom: 2.75rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ffffff14;
}

.post-head h1 {
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    letter-spacing: -0.02em;
    margin: 0 0 0.75rem;
    line-height: 1.15;
}

.post-head time {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.post-body {
    margin-top: 0;
    line-height: 1.75;
    font-size: 1rem;
}

.post-body > *:first-child { margin-top: 0; }

.post-body h2 {
    font-size: 1.55rem;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    padding-left: 0.9rem;
    position: relative;
    line-height: 1.25;
}

.post-body h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.3em;
    bottom: 0.3em;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.post-body h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.post-body p,
.post-body ul,
.post-body ol {
    margin: 1em 0;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

.post-body li {
    margin: 0.35em 0;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.6rem;
    margin: 1.5rem auto;
    display: block;
    box-shadow: 0 10px 30px -10px #000000aa;
}

.post-body code {
    background: var(--bg-3);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "JetBrains Mono", monospace;
}

.post-body pre {
    background: #15151a;
    padding: 1rem 1.25rem;
    border-radius: 0.6rem;
    overflow-x: auto;
    border: 1px solid #ffffff0d;
    line-height: 1.55;
    margin: 1.25rem 0;
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
    border-radius: 0;
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.25rem 0 0.25rem 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-style: italic;
}

.post-body blockquote p { margin: 0.25em 0; }

.post-body hr {
    border: none;
    border-top: 1px dashed #ffffff22;
    margin: 2.5rem 0;
}

.post-body a { overflow-wrap: anywhere; }

/* Blog index */
.blog-index h1 {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 2rem;
}

.blog-index h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25em;
    bottom: 0.25em;
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--accent-dim);
}

.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-entry {
    border-bottom: 1px solid #ffffff0f;
}

.post-entry a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0.25rem;
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: padding-left 0.2s ease;
}

.post-entry a:hover {
    padding-left: 0.75rem;
    text-decoration: none;
    text-shadow: none;
}

.post-title {
    transition: color 0.2s ease;
}

.post-entry a:hover .post-title {
    color: var(--accent);
}

.post-date {
    color: var(--muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.post-list .empty {
    color: var(--muted);
    padding: 1rem 0;
    font-style: italic;
}

@media (max-width: 1024px) {
    .projects {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    #home {
        flex-direction: column;
        text-align: center;
        padding: 6rem 1.5rem 2rem;
        height: auto;
        min-height: 100vh;
        justify-content: center;
    }

    .nexttopfp {
        margin-left: 0;
        margin-top: 1.5rem;
    }

    .contact {
        justify-content: center;
    }

    #about, #projects {
        max-width: 88vw;
        padding: 5rem 0;
        height: auto;
    }

    .nav {
        padding: 0.55rem 1rem;
        font-size: 0.9rem;
    }

    body > header {
        justify-content: flex-end;
        padding-top: 0.75rem;
        padding-bottom: 1.5rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    body > header > div {
        max-width: 100%;
    }

    body > header::before {
        display: none;
    }

    body > header button.nav {
        display: none;
    }

    body > header a.nav {
        margin-right: 0;
        padding: 0.7rem 1.25rem;
        font-size: 1rem;
    }

    body > header a.nav .ext-arrow {
        width: 16px;
        height: 16px;
    }

    body.blog-page > header {
        justify-content: flex-start;
    }

    body.blog-page > header a.nav.nav-external {
        display: none;
    }

    body.blog-page > header a.nav-home-mobile {
        display: inline-flex;
    }

    .post-wrap,
    .blog-index {
        padding: 8rem 1.25rem 3rem;
    }

    .post-head h1 {
        font-size: clamp(1.75rem, 7vw, 2.25rem);
    }

    .pfp {
        height: 9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
