@import url('https://fonts.googleapis.com/css2?family=Chewy&family=Nanum+Pen+Script&display=swap');

@keyframes move-gradients {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- Corrected Shake Animation --- */
@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- New Bounce Animations --- */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    80% {
        opacity: 1;
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes bounceOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    20% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(0.7);
        opacity: 0;
    }
}

/* Class to apply the shake animation */
.shake {
    animation: shake 0.82s cubic-bezier(.36, .07, .19, .97);
}

:root {
    --bg-color: #f3e8ff;
    --bg-gradient-1: #ffd1dc;
    --bg-gradient-2: #c1e1ff;
    --window-bg: rgba(255, 255, 255, 0.7);
    --window-border: rgba(255, 255, 255, 1);
    --text-color: #4B5563;
    --text-color-bold: #333;
    --header-main-bg: #ffc2d1;
    --header-about-bg: #c8e6c9;
    --header-projects-bg: #ffe0b2;
    --header-contact-bg: #b3e5fc;
    --header-faq-bg: #ffc0f7;
    --header-downloads-bg: #ffccbc;
    --accent-about: #4caf50;
    --accent-projects: #ff9800;
    --accent-contact: #03a9f4;
    --role-1-bg: #ffad31;
    --role-2-bg: #74b9ff;
    --role-3-bg: #55efc4;
    --project-card-bg: rgba(255, 255, 255, 0.5);
    --toggle-bg: #e0d1f1;
    --toggle-icon-color: #f9a825;
    --scrollbar-track-bg: rgba(0, 0, 0, 0.05);
    --scrollbar-thumb-bg: rgba(0, 0, 0, 0.2);
    --scrollbar-thumb-hover-bg: rgba(0, 0, 0, 0.3);
    --faq-item-bg: rgba(0, 0, 0, 0.03);
    --faq-item-hover-bg: rgba(0, 0, 0, 0.06);
}

html.dark {
    --bg-color: #1a1a2e;
    --bg-gradient-1: #162447;
    --bg-gradient-2: #1f4068;
    --window-bg: rgba(42, 42, 62, 0.7);
    --window-border: rgba(255, 255, 255, 0.2);
    --text-color: #e0e0e0;
    --text-color-bold: #ffffff;
    --header-main-bg: #3e325a;
    --header-about-bg: #2c4a3b;
    --header-projects-bg: #5a4a32;
    --header-contact-bg: #324a5a;
    --header-faq-bg: #703b69;
    --header-downloads-bg: #6a3d3f;
    --accent-about: #81c784;
    --accent-projects: #ffb74d;
    --accent-contact: #4fc3f7;
    --role-1-bg: #fb8c00;
    --role-2-bg: #0984e3;
    --role-3-bg: #00b894;
    --project-card-bg: rgba(255, 255, 255, 0.1);
    --toggle-bg: #2a2a3e;
    --toggle-icon-color: #f0e68c;
    --scrollbar-track-bg: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb-bg: rgba(255, 255, 255, 0.3);
    --scrollbar-thumb-hover-bg: rgba(255, 255, 255, 0.5);
    --faq-item-bg: rgba(255, 255, 255, 0.05);
    --faq-item-hover-bg: rgba(255, 255, 255, 0.1);
}

html {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, var(--bg-gradient-1), transparent 35%),
        radial-gradient(circle at 85% 40%, var(--bg-gradient-2), transparent 40%);
    background-size: 200% 200%;
    animation: move-gradients 20s ease-in-out infinite;
    overflow: hidden;
    cursor: default;
    color: var(--text-color);
    transition: background-color 0.4s ease;
}

.profile-picture {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-picture:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

html.dark .profile-picture:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.window {
    position: absolute;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    background-color: var(--window-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--window-border);
    resize: both;
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
    transform-origin: center;
    opacity: 0;
    transform: scale(0.7);
    /* Removed transition, will be handled by animation */
}

#main-window {
    resize: none;
}

#main-window .window-header {
    cursor: default;
}

.window.open {
    opacity: 1;
    transform: scale(1);
}

/* Apply bounceIn animation to opening windows */
.window.open:not(#main-window) {
    animation: bounceIn 0.4s forwards;
}

/* Apply bounceOut animation to closing windows */
.window.closing {
    animation: bounceOut 0.3s forwards;
}

.window-header {
    padding: 0.5rem 1rem;
    color: var(--text-color-bold);
    font-weight: 700;
    cursor: default;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-main-bg);
    transition: background-color 0.4s ease, color 0.4s ease;
}

.window[data-theme="about"] .window-header {
    background-color: var(--header-about-bg);
}

.window[data-theme="projects"] .window-header {
    background-color: var(--header-projects-bg);
}

.window[data-theme="contact"] .window-header {
    background-color: var(--header-contact-bg);
}

.window[data-theme="faq"] .window-header {
    background-color: var(--header-faq-bg);
}

.window[data-theme="downloads"] .window-header {
    background-color: var(--header-downloads-bg);
}

.accent {
    transition: color 0.4s ease;
}

.accent-link {
    color: var(--accent-contact);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    display: inline-block;
    transition: filter 0.3s ease;
}

.accent-link:hover {
    filter: brightness(85%);
}

.accent-link .original-text,
.accent-link .copy-feedback {
    transition: opacity 0.3s ease-in-out;
}

.accent-link .copy-feedback {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    opacity: 0;
    pointer-events: none;
}

.accent-link.copied .original-text {
    opacity: 0;
}

.accent-link.copied .copy-feedback {
    opacity: 1;
}

.window[data-theme="about"] .accent {
    color: var(--accent-about);
}

.window[data-theme="projects"] .accent {
    color: var(--accent-projects);
}

.window[data-theme="contact"] .accent {
    color: var(--accent-contact);
}

.project-card {
    background-color: var(--project-card-bg);
    transition: background-color 0.4s ease;
}

.window-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-btn {
    background-color: #ff8989;
}

.close-btn:hover {
    background-color: #ff6f6f;
}

.close-btn svg {
    stroke: #4a0e0e;
    transition: transform 0.2s;
}

.close-btn:hover svg {
    transform: rotate(90deg);
}

.window-body {
    padding: 1rem;
    height: calc(100% - 2.75rem);
    overflow-y: auto;
    color: var(--text-color);
    transition: color 0.4s ease;
}

.window-body::-webkit-scrollbar {
    width: 8px;
}

.window-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track-bg);
    border-radius: 10px;
}

.window-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-bg);
    border-radius: 10px;
}

.window-body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover-bg);
}

#main-window .icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100px;
}

#main-window .icon i {
    font-size: 52px;
    line-height: 1;
}

#main-window .icon p {
    color: var(--text-color-bold);
    transition: color 0.4s ease;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
}

.theme-toggle, .music-toggle {
    position: relative;
    top: auto;
    right: auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: var(--toggle-bg);
    border: 1px solid var(--window-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
}

.theme-toggle i {
    font-size: 1.5rem;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: absolute;
    color: var(--toggle-icon-color);
}

#sun-icon {
    transform: translateY(0%) rotate(0deg);
    opacity: 1;
}

#moon-icon {
    transform: translateY(150%) rotate(45deg);
    opacity: 0;
}

html.dark #sun-icon {
    transform: translateY(-150%) rotate(-45deg);
    opacity: 0;
}

html.dark #moon-icon {
    transform: translateY(0%) rotate(0deg);
    opacity: 1;
}

.music-toggle:hover {
    transform: scale(1.1) rotate(-10deg);
}

.music-toggle i {
    font-size: 1.25rem;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: absolute;
    color: var(--toggle-icon-color);
}

.music-on-icon {
    transform: scale(1);
    opacity: 1;
}

.music-off-icon {
    transform: scale(0);
    opacity: 0;
}

.music-toggle.muted .music-on-icon {
    transform: scale(0);
    opacity: 0;
}

.music-toggle.muted .music-off-icon {
    transform: scale(1);
    opacity: 1;
}

.icon {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.icon:hover {
    transform: scale(1.1);
}

.icon i {
    transition: transform 0.3s ease, color 0.3s ease;
}

.icon:hover i {
    transform: rotate(10deg);
}

.intro-text h1 {
    transition: text-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.intro-text:hover h1 {
    text-shadow: 0 0 15px rgba(51, 51, 51, 0.2);
}

html.dark .intro-text:hover h1 {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.role-tag {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.role-tag:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.25);
}

.role-tag.role-1 { background-color: var(--role-1-bg); }
.role-tag.role-2 { background-color: var(--role-2-bg); }
.role-tag.role-3 { background-color: var(--role-3-bg); }

html.dark .role-tag:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.faq-item {
    background-color: var(--faq-item-bg);
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
    overflow: hidden;
}

.faq-item:hover {
    background-color: var(--faq-item-hover-bg);
}

.faq-question {
    width: 100%;
    background-color: transparent;
    border: none;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-color-bold);
    text-align: left;
}

.faq-question:hover {
    background-color: transparent;
}

.faq-question .faq-icon {
    transition: transform 0.3s ease-in-out;
    font-size: 1.5rem;
}

.faq-question.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding: 0 1rem;
}

.faq-answer p {
    padding-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-color);
}

.contact-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 0.75rem;
    padding: 1.5rem;
}

.contact-image-natural {
    width: 200px;
    height: auto;
    margin-bottom: 0.5rem;
}

.contact-title {
    font-size: 1.75rem;
    color: var(--text-color-bold);
    font-family: "Chewy", system-ui;
    font-style: normal;
}

.contact-text {
    max-width: 90%;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.email-text {
    color: var(--text-color);
}

.email-button {
    background-color: var(--accent-contact);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.email-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

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

.social-icon i {
    font-size: 2.25rem;
    color: var(--text-color-bold);
    transition: all 0.3s ease;
}

.social-icon:hover i {
    color: var(--accent-contact);
}

.accent-link {
    color: var(--accent-contact);
    text-decoration: none;
    font-weight: bold;
}

/* --- Mobile Optimizations --- */
@media (max-width: 768px) {
    #main-window {
        width: 95% !important;
        height: auto !important;
        max-height: 90vh !important;
    }

    .window:not(#main-window) {
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
        resize: none !important;
        transition: none !important;
    }

    #main-window .intro-text .text-6xl {
        font-size: 3.5rem;
    }

    #main-window .intro-text .text-4xl {
        font-size: 2rem;
    }
    
    #main-window .window-body {
        gap: 1rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    #main-window .intro-text .flex {
        margin-top: 1rem;
        gap: 0.5rem;
    }

    #main-window .role-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        font-weight: 600;
    }

    #main-window .icon {
        height: 70px;
        padding: 0.5rem;
    }

    #main-window .icon i {
        font-size: 32px;
    }

    #main-window .icon p {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }

    .contact-body {
       justify-content: center;
       padding: 1rem;
    }

    .contact-image-natural {
        width: 150px;
    }
}