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

body {
    background: linear-gradient(180deg, #05060f 0%, #0b1026 35%, #1c1f47 65%, #3b3564 85%, #6b4d80 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.stars-back,
.stars-front {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
    will-change: transform;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.stars-back {
    transform: translate(calc(var(--mx, 0) * -18px), calc(var(--my, 0) * -18px)) scale(1.08);
}

.stars-front {
    transform: translate(calc(var(--mx, 0) * -42px), calc(var(--my, 0) * -42px)) scale(1.12);
}

.star {
    position: absolute;
    width: var(--size, 2px);
    height: var(--size, 2px);
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, var(--star-color, #fff) 45%, transparent 75%);
    box-shadow: 0 0 var(--glow, 6px) 1px var(--glow-color, rgba(255, 255, 255, 0.7));
    animation: twinkle var(--tw-duration, 3s) ease-in-out infinite;
    animation-delay: var(--tw-delay, 0s);
    will-change: opacity, transform;
}

@keyframes twinkle {
    0%,
    100% {
        opacity: var(--min-o, 0.15);
        transform: scale(0.75);
    }
    50% {
        opacity: var(--max-o, 1);
        transform: scale(1.35);
    }
}

.mountains {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    line-height: 0;
    pointer-events: none;
}

.mountains svg {
    display: block;
    width: 100%;
    height: auto;
}

#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.2);
}

#nav nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nav-toggle:active {
    transform: scale(0.9);
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.25s ease;
}

#nav.open .nav-toggle {
    animation: burger-pop 0.4s ease;
}

@keyframes burger-pop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(0.85);
    }
    100% {
        transform: scale(1);
    }
}

#nav.open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#nav.open .nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: translateX(-8px);
}

#nav.open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    #nav {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1.25rem;
    }

    .nav-toggle {
        align-self: flex-start;
        display: flex;
    }

    #nav nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        margin-top: 0;
        transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease, margin-top 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    }

    #nav.open nav {
        max-height: 420px;
        opacity: 1;
        margin-top: 0.75rem;
    }

    #nav nav a {
        text-align: center;
        border-radius: 12px;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.35s ease, transform 0.35s ease, background-color 0.2s ease, color 0.2s ease;
    }

    #nav.open nav a {
        opacity: 1;
        transform: translateY(0);
    }

    #nav.open nav a:nth-child(1) {
        transition-delay: 0.1s;
    }

    #nav.open nav a:nth-child(2) {
        transition-delay: 0.17s;
    }

    #nav.open nav a:nth-child(3) {
        transition-delay: 0.24s;
    }

    #nav.open nav a:nth-child(4) {
        transition-delay: 0.31s;
    }

    #nav.open nav a:nth-child(5) {
        transition-delay: 0.38s;
    }

    body.day-mode .nav-toggle {
        background: rgba(0, 0, 0, 0.12);
    }

    body.day-mode .nav-toggle:hover {
        background: rgba(0, 0, 0, 0.2);
    }

    body.day-mode .nav-toggle span {
        background: #1f2937;
    }
}

#nav nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#nav nav a:hover {
    background: #fff;
    color: #111827;
}

.hero {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    pointer-events: none;
    z-index: 2;
}

.hero h1 {
    font-size: clamp(2.2rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    text-shadow: 0 0 24px rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.day-mode .hero h1 {
    color: #1f2937;
    text-shadow: 0 0 24px rgba(255, 255, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (prefers-reduced-motion: reduce) {
    .star {
        animation: none;
    }

    .about-star {
        display: none;
    }

    .stars-back,
    .stars-front {
        transition: none;
    }
}

#theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    z-index: 30;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

body.day-mode #theme-toggle {
    background: rgba(0, 0, 0, 0.12);
}

body.day-mode #theme-toggle:hover {
    background: rgba(0, 0, 0, 0.22);
}

.sun {
    position: absolute;
    top: 24%;
    right: 22%;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff7d6 0%, #ffd166 45%, #ff9e40 100%);
    box-shadow: 0 0 80px 30px rgba(255, 200, 100, 0.55), 0 0 180px 80px rgba(255, 180, 90, 0.25);
    display: none;
    z-index: 0;
    animation: sun-pulse 6s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.06);
    }
}

body.day-mode {
    background: linear-gradient(180deg, #4aa8e0 0%, #8ecae6 30%, #f9dcb0 60%, #f9a97e 82%, #f2746b 100%);
    background-attachment: fixed;
}

body.day-mode .sun {
    display: block;
}

body.day-mode .stars-back,
body.day-mode .stars-front {
    display: none;
}

body.day-mode .mountains svg path:first-child {
    fill: #4d6b3f;
}

body.day-mode .mountains svg path:last-child {
    fill: #2c4033;
}

body.day-mode #nav {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.25);
}

body.day-mode #nav nav a {
    color: #1f2937;
}

body.day-mode #nav nav a:hover {
    background: #1f2937;
    color: #fff;
}

html {
    scroll-behavior: smooth;
}

.about {
    position: relative;
    overflow: hidden;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 5rem;
}

.about-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    max-width: 900px;
    flex-wrap: wrap;
}

.about-stars {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.about-star {
    position: absolute;
    top: var(--top, 0%);
    left: var(--left, 0%);
    width: var(--trail, 50px);
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 60%, #fff 100%);
    border-radius: 999px;
    opacity: 0;
    transform-origin: left center;
    transform: rotate(var(--angle, 45deg));
    animation: about-shoot var(--duration, 6s) linear infinite;
    animation-delay: var(--delay, 0s);
}

.about-star::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: var(--head, 3px);
    height: var(--head, 3px);
    transform: translate(-70%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, 0.8) 40%, transparent 70%);
}

@keyframes about-shoot {
    0% {
        opacity: 0;
        transform: rotate(var(--angle, 45deg)) translateX(0);
    }
    8% {
        opacity: var(--max-o, 0.7);
    }
    18% {
        opacity: var(--max-o, 0.7);
    }
    100% {
        opacity: 0;
        transform: rotate(var(--angle, 45deg)) translateX(var(--travel, 20vw));
    }
}

.profile {
    width: 220px;
    height: 220px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.profile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-text {
    max-width: 480px;
    text-align: left;
}

.about-text h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.about-text p {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
}

body.day-mode .profile {
    border-color: rgba(0, 0, 0, 0.2);
}

body.day-mode .about-text h2 {
    color: #1f2937;
}

body.day-mode .about-text p {
    color: rgba(31, 41, 55, 0.8);
}

body.day-mode .about-stars {
    display: none;
}

body.day-mode .about-star {
    background: linear-gradient(90deg, transparent 0%, rgba(31, 41, 55, 0.35) 60%, rgba(31, 41, 55, 0.75) 100%);
}

body.day-mode .about-star::before {
    background: radial-gradient(circle, rgba(31, 41, 55, 0.9) 0%, rgba(31, 41, 55, 0.4) 40%, transparent 70%);
}

.skills {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 5rem;
}

.skills-inner {
    width: 100%;
    max-width: 820px;
    text-align: center;
}

.skills-inner h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.skill-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 640px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.skill-card svg {
    width: 48px;
    height: 48px;
}

.skill-card span {
    color: #fff;
    font-weight: 600;
}

body.day-mode .skills-inner h2 {
    color: #1f2937;
}

body.day-mode .skill-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .skill-card:hover {
    background: #fff;
}

body.day-mode .skill-card span {
    color: #1f2937;
}

.works {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 5rem;
}

.works-inner {
    width: 100%;
    max-width: 1040px;
    text-align: center;
}

.works-inner h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.works-carousel {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.carousel-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.carousel-btn svg {
    width: 20px;
    height: 20px;
}

.carousel-btn:hover:not(:disabled) {
    background: #ffd166;
    color: #1f2937;
}

.carousel-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.works-carousel.is-carousel .carousel-btn {
    display: flex;
}

.works-viewport {
    flex: 1;
    overflow: hidden;
}

.works-track {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    will-change: transform;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.work-card {
    flex: 0 0 var(--card-w, 320px);
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: left;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.work-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.work-card:focus-visible {
    outline: 2px solid #ffd166;
    outline-offset: 2px;
}

.work-preview {
    height: 160px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 10px, transparent 10px 20px),
        var(--preview, linear-gradient(135deg, #1c1f47, #3b3564));
    transition: transform 0.3s ease;
}

.work-card:hover .work-preview {
    transform: scale(1.03);
}

.js .work-card {
    opacity: 0;
}

.works-inner.is-revealing .work-card,
.works-inner.revealed .work-card {
    opacity: 1;
}

.works-inner.is-revealing .work-card {
    animation: card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 0.08s);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(26px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.works-track.animating .work-card {
    animation: card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 0.05s);
}

.work-card:nth-child(1) .work-preview {
    --preview: linear-gradient(135deg, #3b3564, #6b4d80);
}

.work-card:nth-child(2) .work-preview {
    --preview: linear-gradient(135deg, #1c4e80, #3fa7d6);
}

.work-card:nth-child(3) .work-preview {
    --preview: linear-gradient(135deg, #7d2f4d, #c25e8f);
}

.work-body {
    padding: 1.25rem 1.25rem 1.4rem;
}

.work-body h3 {
    color: #fff;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.work-body p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 1rem;
}

.work-tools {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
}

.work-tools li {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: help;
}

.work-tools li svg {
    width: 20px;
    height: 20px;
}

.works-dots {
    display: none;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.works-carousel.is-carousel ~ .works-dots {
    display: flex;
}

.works-dot {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.works-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.works-dot.active {
    background: #ffd166;
    transform: scale(1.25);
}

body.day-mode .works-inner h2 {
    color: #1f2937;
}

body.day-mode .work-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
}

body.day-mode .work-card:hover {
    background: #fff;
}

body.day-mode .work-body h3 {
    color: #1f2937;
}

body.day-mode .work-body p {
    color: rgba(31, 41, 55, 0.8);
}

body.day-mode .work-tools li {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

body.day-mode .carousel-btn {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.08);
    color: #1f2937;
}

body.day-mode .carousel-btn:hover:not(:disabled) {
    background: #1f2937;
    color: #fff;
}

body.day-mode .works-dot {
    background: rgba(0, 0, 0, 0.25);
}

body.day-mode .works-dot:hover {
    background: rgba(0, 0, 0, 0.5);
}

body.day-mode .works-dot.active {
    background: #1f2937;
}

.contact {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 5rem;
}

.contact-inner {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.contact-inner h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: #ffd166;
    background: rgba(255, 255, 255, 0.12);
}

.contact-form button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 999px;
    background: #ffd166;
    color: #1f2937;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.contact-form button:hover {
    background: #ffc94d;
    transform: translateY(-2px);
}

.form-status {
    color: #8ee69a;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.contact-socials {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 2rem;
}

.contact-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.contact-socials a:hover {
    background: #ffd166;
    color: #1f2937;
    transform: translateY(-3px);
}

body.day-mode .contact-inner h2 {
    color: #1f2937;
}

body.day-mode .contact-form input,
body.day-mode .contact-form textarea {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.7);
    color: #1f2937;
}

body.day-mode .contact-form input::placeholder,
body.day-mode .contact-form textarea::placeholder {
    color: rgba(31, 41, 55, 0.5);
}

body.day-mode .contact-form input:focus,
body.day-mode .contact-form textarea:focus {
    border-color: #ff9e40;
    background: #fff;
}

body.day-mode .form-status {
    color: #1a7f37;
}

body.day-mode .contact-socials a {
    color: #1f2937;
    background: rgba(0, 0, 0, 0.08);
}

body.day-mode .contact-socials a:hover {
    background: #1f2937;
    color: #fff;
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
    }

    .hero {
        padding: 4.5rem 1rem 1rem;
    }

    .about,
    .skills,
    .works,
    .contact {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .about-inner {
        gap: 1.75rem;
    }

    .profile {
        width: 160px;
        height: 160px;
    }

    .about-text h2,
    .skills-inner h2,
    .works-inner h2,
    .contact-inner h2 {
        font-size: 1.6rem;
    }

    .skills-grid {
        gap: 0.9rem;
    }

    .skill-card {
        padding: 1.1rem 0.5rem;
    }

    .skill-card svg {
        width: 40px;
        height: 40px;
    }

    .work-preview {
        height: 130px;
    }

    .contact-form input,
    .contact-form textarea {
        padding: 0.7rem 0.9rem;
    }
}