@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --bg: #edf7ff;
    --bg-elev: #f6fbff;
    --text: #15324a;
    --text-muted: #5f7894;
    --stroke: rgba(124, 165, 197, 0.34);
    --surface: 236, 246, 255;
    --neon-1: 144, 198, 255;
    --neon-2: 180, 219, 255;
    --radius: 14px;
    --shadow-soft: 0 14px 36px rgba(120, 160, 192, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 16% 0%, rgba(var(--neon-1), 0.3), transparent 42%),
        radial-gradient(circle at 86% 15%, rgba(var(--neon-2), 0.24), transparent 40%),
        var(--bg);
    line-height: 1.7;
    transition: opacity 0.28s ease;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -4;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(222, 240, 255, 0.56));
}

body.is-exiting {
    opacity: 0;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.14;
}

p {
    margin: 0;
}

.redirect-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(36, 76, 108, 0.82);
    background: rgba(236, 246, 255, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 10;
}

body.is-exiting .redirect-overlay {
    opacity: 1;
}

nav,
.hero,
.cards,
.page-hero,
.page-content,
.about {
    position: relative;
    z-index: 3;
}

nav {
    width: min(1180px, calc(100% - 48px));
    margin: 18px auto 0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: rgba(246, 252, 255, 0.84);
    backdrop-filter: blur(10px);
}

.logo {
    color: #23445f;
    font-size: 16px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    font-family: 'IBM Plex Mono', monospace;
}

#typing-name {
    display: inline-block;
    font-weight: 600;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: rgba(39, 80, 115, 0.7);
    margin-left: 2px;
    animation: blink 0.75s infinite;
    vertical-align: -2px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

nav a {
    color: #5e7792;
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 8px 12px;
    border-radius: 999px;
    transition: color 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

nav a:hover,
nav a.active {
    color: #245a84;
    background: rgba(var(--neon-1), 0.26);
}

.social {
    display: flex;
    align-items: center;
    gap: 8px;
}

.social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(var(--neon-1), 0.4);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.social svg {
    fill: rgba(var(--neon-1), 0.85);
}

.social a:hover {
    background: rgba(var(--neon-1), 0.13);
    transform: translateY(-2px);
}

.hero {
    width: min(1180px, calc(100% - 48px));
    margin: 40px auto 0;
    padding: 70px 58px;
    min-height: 72vh;
    border: 1px solid var(--stroke);
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(247, 252, 255, 0.95), rgba(230, 244, 255, 0.92));
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 36px;
    align-items: center;
}

.hero-text {
    max-width: 710px;
}

.hero-text h1 {
    font-size: clamp(36px, 5vw, 56px);
    letter-spacing: -0.8px;
}

.hero-text h2,
.hero-text h3 {
    margin-top: 10px;
    font-size: clamp(26px, 3.6vw, 40px);
    letter-spacing: -0.5px;
}

.accent {
    color: rgba(var(--neon-1), 1);
}

.hero-text p {
    margin-top: 24px;
    max-width: 590px;
    font-size: 18px;
    color: var(--text-muted);
}

.hero-image {
    width: 100%;
    max-width: 355px;
    justify-self: end;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 20px;
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow-soft);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.hero-image img:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 42px rgba(104, 153, 196, 0.3);
}

.page-hero {
    width: min(980px, calc(100% - 48px));
    margin: 44px auto 0;
    padding: 18px 8px 10px;
}

.page-hero h1 {
    font-size: clamp(38px, 5vw, 52px);
    color: var(--text);
}

.page-hero p {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 18px;
    max-width: 640px;
}

.page-content {
    width: min(980px, calc(100% - 48px));
    margin: 10px auto 80px;
    padding: 0;
}

.project-item,
.note-item,
.blog-item {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.88), rgba(var(--surface), 0.94));
    border: 1px solid var(--stroke);
    border-left: 3px solid rgba(var(--neon-1), 0.55);
    padding: 26px 28px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    transition: transform 0.2s ease, border-left-color 0.2s ease, background-color 0.2s ease;
}

.project-item:hover,
.note-item:hover,
.blog-item:hover {
    transform: translateY(-3px);
    border-left-color: rgba(var(--neon-1), 0.9);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(235, 247, 255, 0.98));
}

.project-item h3,
.note-item h3,
.blog-item h3 {
    font-size: 25px;
    color: rgba(var(--neon-1), 0.95);
    margin-bottom: 10px;
}

.project-item p,
.note-item p,
.blog-item p {
    color: #4d6884;
}

.about {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto 90px;
    padding: 76px 58px;
    border: 1px solid var(--stroke);
    border-radius: 28px;
    background: linear-gradient(170deg, rgba(249, 253, 255, 0.94), rgba(230, 244, 255, 0.93));
    position: relative;
    overflow: hidden;
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(144, 188, 220, 0.36);
    border-radius: 22px;
    padding: 30px 30px 20px;
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 26px rgba(130, 173, 210, 0.16);
}

.sticker-cloud {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.sticker {
    position: absolute;
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    box-shadow: none;
    opacity: 0.42;
    mix-blend-mode: multiply;
    animation: floatSticker 6.5s ease-in-out infinite;
}

.sticker-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 44% 56% 46% 54% / 48% 43% 57% 52%;
    transform: rotate(-8deg);
    display: block;
    filter: saturate(0.82) contrast(1.08);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.78), 0 10px 20px rgba(114, 154, 188, 0.24);
}

.sticker-icon {
    width: 100%;
    height: 100%;
    padding: 24px;
    border-radius: 52% 48% 57% 43% / 46% 58% 42% 54%;
    color: #8b4f71;
    background: linear-gradient(165deg, #fff2f7, #ffdfe9);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.78), 0 10px 20px rgba(114, 154, 188, 0.24);
    display: block;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sticker:nth-child(odd) .sticker-img { transform: rotate(7deg); }
.sticker:nth-child(3n) .sticker-img { border-radius: 52% 48% 61% 39% / 44% 60% 40% 56%; }
.sticker:nth-child(4n) .sticker-img { border-radius: 38% 62% 35% 65% / 54% 38% 62% 46%; }

.sticker:nth-child(1) { top: 12px; left: 16px; animation-delay: 0s; }
.sticker:nth-child(2) { top: 34px; right: 14px; animation-delay: 0.8s; }
.sticker:nth-child(3) { top: 150px; left: -10px; animation-delay: 1.4s; }
.sticker:nth-child(4) { top: 204px; right: -18px; animation-delay: 2.2s; }
.sticker:nth-child(5) { top: 324px; left: 16px; animation-delay: 0.5s; }
.sticker:nth-child(6) { top: 374px; right: 12px; animation-delay: 1.6s; }
.sticker:nth-child(7) { bottom: 186px; left: -6px; animation-delay: 2.5s; }
.sticker:nth-child(8) { bottom: 122px; right: 8px; animation-delay: 0.9s; }
.sticker:nth-child(9) { bottom: 26px; left: 22px; animation-delay: 1.9s; }
.sticker:nth-child(10) { bottom: 22px; right: 26px; animation-delay: 2.8s; }

.about h2 {
    margin-bottom: 22px;
    font-size: 12px;
    letter-spacing: 2.7px;
    text-transform: uppercase;
    color: rgba(var(--neon-1), 0.9);
    font-family: 'IBM Plex Mono', monospace;
}

.about p,
.about-body {
    color: #4f6a86;
    font-size: 16px;
    line-height: 1.95;
    margin-bottom: 16px;
}

.scroll-indicator {
    position: fixed;
    left: 50%;
    bottom: 38px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 5;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.scroll-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-indicator span {
    font-family: 'IBM Plex Mono', monospace;
    color: rgba(var(--neon-1), 0.8);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.scroll-arrow {
    width: 2px;
    height: 24px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(var(--neon-1), 0.85), transparent);
    animation: bounce 2s infinite;
}

.math-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.1;
    font-family: 'IBM Plex Mono', monospace;
    color: rgba(92, 146, 194, 0.66);
    white-space: pre;
    font-size: 12px;
    line-height: 14px;
    letter-spacing: 1px;
    mix-blend-mode: normal;
}

#binary-canvas,
#graph-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    display: block;
}

#graph-canvas {
    z-index: 0;
    opacity: 0.62;
}

#binary-canvas {
    z-index: 1;
    opacity: 0.45;
}

.cards {
    width: min(1180px, calc(100% - 48px));
    margin: 24px auto 50px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.card {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(var(--surface), 0.96));
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.scroll-fade {
    opacity: 0;
}

.scroll-fade.visible {
    animation: fadeIn 0.6s ease-out forwards;
}

.scroll-slide {
    opacity: 0;
    transform: translateY(40px);
}

.scroll-slide.visible {
    animation: slideUp 0.7s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes blink {
    0%,
    49% {
        opacity: 1;
    }
    50%,
    100% {
        opacity: 0;
    }
}

@keyframes floatSticker {
    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }
    50% {
        transform: translateY(-10px) rotate(1deg);
    }
}

@media (max-width: 1080px) {
    nav {
        width: calc(100% - 28px);
    }

    .hero,
    .about,
    .cards,
    .page-hero,
    .page-content {
        width: calc(100% - 28px);
    }

    .hero {
        padding: 54px 34px;
        gap: 28px;
        grid-template-columns: 1fr;
    }

    .hero-image {
        justify-self: start;
        max-width: 300px;
    }

    .about {
        padding: 58px 34px;
    }
}

@media (max-width: 760px) {
    nav {
        border-radius: 18px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 14px;
        gap: 10px;
    }

    .logo {
        width: 100%;
        text-align: center;
    }

    nav ul {
        justify-content: center;
        gap: 6px;
    }

    nav a {
        font-size: 11px;
        padding: 7px 10px;
    }

    .hero {
        margin-top: 22px;
        min-height: auto;
        border-radius: 20px;
        padding: 40px 24px;
    }

    .hero-text p {
        font-size: 16px;
    }

    .about {
        border-radius: 20px;
        padding: 44px 24px;
        margin-bottom: 64px;
    }

    .about-content {
        padding: 22px 18px 14px;
        border-radius: 16px;
    }

    .sticker-cloud {
        position: static;
        inset: auto;
        margin-top: 18px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        pointer-events: auto;
    }

    .sticker {
        position: static;
        animation: none;
        width: 70px;
        height: 70px;
        opacity: 0.6;
    }

    .sticker-img {
        width: 100%;
        height: 100%;
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.84), 0 6px 12px rgba(114, 154, 188, 0.16);
    }

    .sticker-icon {
        padding: 18px;
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.84), 0 6px 12px rgba(114, 154, 188, 0.16);
    }

    .page-hero {
        margin-top: 28px;
    }

    .page-hero p {
        font-size: 16px;
    }

    .project-item,
    .note-item,
    .blog-item {
        padding: 20px;
    }

    .project-item h3,
    .note-item h3,
    .blog-item h3 {
        font-size: 22px;
    }

    .scroll-indicator {
        bottom: 18px;
    }
}

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