:root {
    --border-radius-soft: 12px;
    --border-radius-round: 18px;
    --border-radius-pill: 50px;
    --transition-std: all 0.35s ease-in-out;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --primary-text-color: #e0e0e0;
    --secondary-text-color: rgba(224, 224, 224, 0.7);
    --muted-text-color: rgba(224, 224, 224, 0.5);
    --border-color-subtle: rgba(255, 255, 255, 0.1);
    --background-color-page: #000000;
    --glass-base-bg: rgba(0, 0, 0, 0.5);
    --button-primary-bg: #f0f0f0;
    --button-primary-text: #0a0a0a;
    --button-primary-hover-bg: #ffffff;
    --accent-color: #bdbdbd;
    --image-fade: #000000;
    --gradient-start: rgba(0, 0, 0, 0);
    --gradient-middle: rgba(0, 0, 0, 0.5);
    --gradient-end: rgba(0, 0, 0, 1);
    --gradient-middle-pos: 40%;
    --gradient-end-pos: 70%;
}

body.light-theme {
    --primary-text-color: #1d1d1f;
    --secondary-text-color: rgba(29, 29, 31, 0.7);
    --muted-text-color: rgba(29, 29, 31, 0.5);
    --border-color-subtle: rgba(0, 0, 0, 0.1);
    --background-color-page: #f5f5f7;
    --glass-base-bg: rgba(255, 255, 255, 0.6);
    --button-primary-bg: #000000;
    --button-primary-text: #ffffff;
    --button-primary-hover-bg: #000000;
    --accent-color: #000000;
    --image-fade: #ffffff;
    --gradient-start: rgba(255, 255, 255, 0);
    --gradient-middle: rgba(255, 255, 255, 0.5);
    --gradient-end: #ffffff;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    position: relative;
    background-color: var(--background-color-page);
    background-image:
        linear-gradient(to right, var(--border-color-subtle) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border-color-subtle) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center;
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 4rem 1.5rem;
    overflow-x: hidden;
    transition: background-color 0.4s ease;
    overflow: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
            var(--gradient-start) 0%,
            var(--gradient-middle) var(--gradient-middle-pos),
            var(--gradient-end) var(--gradient-end-pos));
    z-index: 1;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y),
            hsla(0, 0%, 100%, 0.363) 50px,
            hsla(0, 0%, 100%, 0.125) 150px,
            transparent 300px);
    mask-image:
        linear-gradient(to right, white 1px, transparent 1px),
        linear-gradient(to bottom, white 1px, transparent 1px);
    -webkit-mask-image:
        linear-gradient(to right, white 1px, transparent 1px),
        linear-gradient(to bottom, white 1px, transparent 1px);
    mask-size: 60px 60px;
    -webkit-mask-size: 60px 60px;
    mask-position: center;
    -webkit-mask-position: center;
    opacity: var(--cursor-opacity, 0);
    transition: opacity 0.3s ease-out;
    z-index: 0;
}

body.light-theme::after {
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y),
            rgba(0, 0, 0, 0.15) 50px,
            rgba(0, 0, 0, 0.2) 150px,
            transparent 300px);
}

.portfolio-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-section {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 8rem);
    margin-bottom: 6rem;
}

.hero-content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
    width: 100%;
    max-width: 1100px;
}

.hero-text {
    text-align: left;
    animation: fade-in-up 0.8s 0.2s ease-out both;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-pill);
    background: var(--glass-base-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border-color-subtle);
    margin-bottom: 1.5rem;
    color: var(--secondary-text-color);
}

.hero-title {
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: var(--font-weight-bold);
    color: var(--primary-text-color);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: clamp(1rem, 4vw, 1.1rem);
    color: var(--secondary-text-color);
    max-width: 400px;
    margin: 0 0 2rem 0;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hero-buttons .link-button {
    gap: 0.75rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color-subtle);
    color: var(--secondary-text-color);
    font-size: 1.2rem;
    text-decoration: none;
    transition: var(--transition-std);
}

.social-link:hover {
    background: var(--border-color-subtle);
    color: var(--primary-text-color);
    transform: translateY(-2px);
}

.hero-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 450px;
    aspect-ratio: 1 / 1;
    margin-inline: auto;
}

#heroCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--glass-base-bg);
    border: 1px solid var(--border-color-subtle);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
    transition: var(--transition-std);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-switcher:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-switcher .sun-icon,
.theme-switcher .moon-icon {
    font-size: 20px;
    position: absolute;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
}

.theme-switcher .sun-icon {
    color: #f39c12;
    transform: translateY(-150%);
    opacity: 0;
}

.theme-switcher .moon-icon {
    color: #f1c40f;
    transform: translateY(0);
    opacity: 1;
}

body.light-theme .theme-switcher .sun-icon {
    transform: translateY(0);
    opacity: 1;
}

body.light-theme .theme-switcher .moon-icon {
    transform: translateY(150%);
    opacity: 0;
}

.blurry-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.blurry-orbs>div {
    position: absolute;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(100px);
    animation: moveOrb 15s infinite alternate;
}

.blurry-orbs>div:nth-child(1) {
    height: 350px;
    width: 350px;
    top: 10%;
    left: 5%;
    animation-duration: 25s;
}

.blurry-orbs>div:nth-child(2) {
    height: 250px;
    width: 250px;
    top: 60%;
    right: 10%;
    animation-duration: 18s;
    animation-delay: -5s;
}

.blurry-orbs>div:nth-child(3) {
    height: 200px;
    width: 200px;
    bottom: 5%;
    left: 20%;
    animation-duration: 20s;
}

@keyframes moveOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(120px, -80px) scale(1.4);
    }

    100% {
        transform: translate(-40px, 100px) scale(0.8);
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.about-me-section {
    margin-bottom: 4rem;
}

.about-me-card {
    padding: 2.5rem;
    border-radius: var(--border-radius-round);
    animation: fade-in-up 0.8s ease-out both;
}

.about-me-content {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

.about-text {
    flex: 2;
    min-width: 0;
}

.about-text h2 {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary-text-color);
    margin-bottom: 1.5rem;
}

.about-text p {
    color: var(--secondary-text-color);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.about-text p a {
    color: var(--primary-text-color);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color-subtle);
    transition: var(--transition-std);
}

.about-text p a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius-round);
    overflow: hidden;
    animation: fade-in-up 0.8s ease-out both;
}

.interactive-border {
    position: relative;
    background-color: var(--glass-base-bg);
    border: 1px solid var(--border-color-subtle);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.2s ease-out, box-shadow 0.3s ease-out, background-color 0.4s ease;
}

.interactive-border:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

.interactive-border::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid transparent;
    background: radial-gradient(300px circle at var(--x) var(--y), var(--accent-color), transparent 40%) border-box;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: var(--opacity, 0);
    transition: opacity 0.2s ease-out;
    z-index: 3;
}

body.light-theme .interactive-border::before {
    background: radial-gradient(250px circle at var(--x) var(--y), rgba(0, 0, 0, 0.6), transparent 40%) border-box;
}

.project-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    background-color: #111;
    border-radius: var(--border-radius-round) var(--border-radius-round) 0 0;
    overflow: hidden;
    z-index: 2;
}

.project-image iframe,
.project-image img {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    user-select: none;
}

.project-image img {
    object-fit: cover;
    object-position: top;
}

.project-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, var(--image-fade) 20%, transparent 100%);
    pointer-events: none;
}

.project-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 2;
}

.project-header {
    margin-bottom: 1rem;
}

.project-header h2 {
    font-size: 1.5rem;
    font-weight: var(--font-weight-semibold);
    color: var(--primary-text-color);
    margin-bottom: 0.25rem;
}

.project-header span {
    font-size: 0.9rem;
    color: var(--muted-text-color);
    font-weight: var(--font-weight-medium);
}

.project-description {
    color: var(--secondary-text-color);
    line-height: 1.6;
    flex-grow: 1;
}

.project-features {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    color: var(--secondary-text-color);
}

.project-features li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    font-size: 0.9rem;
}

.project-features li::before {
    content: '✓';
    color: var(--accent-color);
    margin-right: 0.75rem;
    font-weight: bold;
}

.project-links {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-soft);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: var(--transition-std);
}

.link-button:hover {
    transform: translateY(-2px);
}

.link-button.primary {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
}

.link-button.primary:hover {
    background-color: var(--button-primary-hover-bg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.link-button.secondary {
    background-color: transparent;
    color: var(--secondary-text-color);
    border: 1px solid var(--border-color-subtle);
}

.link-button.secondary:hover {
    background-color: var(--border-color-subtle);
    color: var(--primary-text-color);
}

.link-button i {
    font-size: 0.9rem;
}

.contact-section {
    margin-top: 4rem;
}

a.contact-card {
    display: block;
    text-decoration: none;
    color: inherit;
    animation: fade-in-up 0.8s ease-out both;
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius-round)
}

.contact-card-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.contact-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--border-color-subtle);
    margin-right: 1.5rem;
}

.contact-text {
    text-align: left;
    flex-grow: 1;
}

.contact-text h2 {
    color: var(--primary-text-color);
    font-size: 1.5rem;
    font-weight: var(--font-weight-semibold);
    margin: 0 0 0.25rem 0;
}

.contact-text p {
    color: var(--secondary-text-color);
    margin: 0;
}

.contact-card .icon-wrapper {
    font-size: 2.5rem;
    color: var(--secondary-text-color);
    transition: color 0.3s ease;
}

a.contact-card:hover .icon-wrapper {
    color: var(--primary-text-color);
}

.open-source-notice {
    text-align: center;
    margin-top: 4rem;
    color: var(--muted-text-color);
    font-size: 0.9rem;
    padding: 0 1rem;
}

.open-source-notice a {
    color: var(--secondary-text-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color-subtle);
    transition: var(--transition-std);
}

.open-source-notice a:hover {
    color: var(--primary-text-color);
    border-bottom-color: var(--primary-text-color);
}

@media (min-width: 960px) {
    .hero-content-wrapper {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    }
}

@media (max-width: 959px) {
    .hero-section {
        text-align: center;
    }

    .hero-text,
    .hero-title,
    .hero-description {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons,
    .social-links {
        justify-content: center;
    }

    .hero-canvas-container {
        display: none;
    }
}

@media (max-width: 820px) {
    .about-me-content {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 3rem 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}