@font-face {
    font-family: 'Death Star';
    src: url('Assets/Death Star.otf') format('opentype');
    font-display: swap;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow-y: hidden;
    overflow-x: hidden;
    background-color: #0c001f;
}

body {
    position: relative;
    min-width: 1000px;
    min-height: 600px;
    background-image: url('Assets/Background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    font-family: 'Courier New', Courier, monospace;
}

.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px,1px,1px,1px);
    white-space: nowrap;
}

main {
    width: 100vw;
    height: 100vh;
    min-width: 1000px;
    min-height: 600px;
    position: relative;
}

/* --- Main Scene Styles --- */
#earth-viewport {
    position: absolute;
    width: 95vw;
    height: 95vw;
    left: 50%;
    bottom: -50vw;
    transform: translateX(-50%) translateZ(0);
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
}
.earth-layer {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    will-change: transform;
}
#earth {
    z-index: 2;
    transform-origin: 50% 50%;
    cursor: grab;
    user-select: none;
    touch-action: none;
    pointer-events: auto;
}
#earth:active {
    cursor: grabbing;
}
#earth-glow,
#earth-sparkles {
    pointer-events: none;
}
#earth-glow {
    z-index: 1; width: 92%; height: 92%; top: 4%; left: 4%;
}
#earth-sparkles {
    z-index: 3;
    animation: twinkle 1s ease-in-out infinite;
}
#click-to-open {
    position: absolute;
    top: 37%;
    left: 50%;
    width: 20%;
    z-index: 4;
    animation: pulse 2.5s ease-in-out infinite;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    outline: none;
}

/* Astronaut floats by default, in front of all elements */
#astronaut {
    position: absolute;
    width: 8vw;
    max-width: 180px;
    left: 50%;
    bottom: 15vw;
    z-index: 9999;
    animation: float 3s ease-in-out infinite;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transform-origin: 50% 50%;
    transition: box-shadow 0.2s;
}

#astronaut.dragging, #astronaut.freed {
    animation: none !important;
    cursor: grabbing;
}

#header-text-img {
    position: absolute;
    bottom: 39vw;
    left: 50%;
    transform: translateX(-50%);
    width: 50vw;
    max-width: 800px;
    z-index: 10;
}

#iamshaheer {
    position: absolute;
    top: 22vh;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    font-family: 'Death Star', 'Courier New', Courier, monospace;
    font-size: 4vw;
    color: transparent;                 /* Make text transparent */
    letter-spacing: 4px;
    font-weight: normal;
    z-index: 11;
    text-align: center;
    pointer-events: none;
    -webkit-text-stroke: 2.5px #B39DFF; /* Purple border (stroke) */
    filter: drop-shadow(0 0 1px #B39DFF);
}

/* --- Social Links Scaling --- */
#social-links {
    position: absolute;
    top: 50%;
    left: 5vw;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 3vw;
    z-index: 10;
}
#social-links a img {
    width: 5vw;
    max-width: 64px;
    min-width: 36px;
    transition: transform 0.2s;
}
#social-links a:hover img,
#social-links a:focus img {
    transform: scale(1.15);
}
/* --- For really large screens --- */
@media (min-width: 1600px) {
    #social-links a img {
        width: 6vw;
        max-width: 90px;
        min-width: 56px;
    }
    #social-links {
        gap: 3vw;
    }
}
@media (min-width: 2000px) {
    #social-links a img {
        width: 7vw;
        max-width: 120px;
        min-width: 64px;
    }
    #social-links {
        gap: 3.5vw;
    }
}

/* --- Portfolio Screen & Container --- */
#portfolio-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80vw;
    max-width: 1536px;
    z-index: 11;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.8);
    transition: all 0.4s cubic-bezier(.65,.05,.36,1);
    pointer-events: none;
}
body.portfolio-opened #portfolio-container {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}
#portfolio-screen {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 1px;
}
#close-button {
    position: absolute;
    top: -15px; right: -15px;
    width: 40px; height: 40px;
    background: #1a0a2e;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 24px;
    line-height: 36px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.3s ease-in-out 0.4s, transform 0.3s ease-in-out 0.4s;
    z-index: 20;
}
body.portfolio-opened #close-button {
    opacity: 1;
    transform: scale(1);
}
#close-button:focus {
    outline: 2px solid #8ef;
    box-shadow: 0 0 0 3px #8ef4;
}

/* --- State Change --- */
body.portfolio-opened #click-to-open {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

/* --- Keyframes --- */
@keyframes float {
    0% {transform: translate(-50%, 0vw) translateZ(0);}
    50% {transform: translate(-50%, -1vw) translateZ(0);}
    100% {transform: translate(-50%, 0vw) translateZ(0);}
}
@keyframes twinkle { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes pulse {
    0% {transform: translate(-50%, -50%) scale(1);}
    50% {transform: translate(-50%, -50%) scale(1.05);}
    100% {transform: translate(-50%, -50%) scale(1);}
}

/* --- Responsive Design --- */
@media (max-width: 900px) {
    body, main {
        min-width: 0;
        min-height: 0;
        width: 100vw;
        height: 100vh;
    }
    #earth-viewport, #header-text-img, #astronaut, #portfolio-container {
        width: 95vw !important;
        max-width: 100vw;
        left: 50%;
        transform: translateX(-50%);
    }
    #header-text-img {
        width: 90vw;
        max-width: 100vw;
        bottom: 62vw;
    }
    #astronaut {
        width: 18vw;
        max-width: 90px;
        bottom: 7vw;
    }
    #social-links {
        left: 2vw;
        top: auto;
        bottom: 2vw;
        flex-direction: row;
        gap: 4vw;
        transform: none;
    }
    #social-links a img {
        width: 10vw;
        max-width: 40px;
    }
    #portfolio-container {
        border-radius: 12px;
    }
    #close-button {
        width: 32px; height: 32px;
        font-size: 18px;
        line-height: 28px;
        top: -10px; right: -10px;
    }
}

#contact-me {
    position: fixed;
    top: 28px;
    right: 40px;
    color: white;
    text-decoration: none;
    font-size: 2.5rem;
    font-family: Impact, Charcoal, sans-serif;
    z-index: 100;
    background: none;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    letter-spacing: 1px;
    pointer-events: auto;
}
#contact-me:visited,
#contact-me:active,
#contact-me:focus {
    color: white;
    text-decoration: none;
}
#contact-me:hover,
#contact-me:focus {
    color: #b39dff;
    transform: scale(1.16);
    text-decoration: none !important;
}
/* --- New Astronaut Prompt Bubble --- */
#astronaut-prompt-bubble {
    position: absolute;
    /* Adjust top/left to position it perfectly next to the astronaut's helmet */
    top: 45vh;
    left: 55vw;
    background: #B39DFF;
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    z-index: 9998; /* Just below the astronaut if they overlap */
    white-space: nowrap; /* Prevents text from breaking into a new line */
    
    /* Starts hidden and can be faded in */
    opacity: 0;
    pointer-events: none; /* So the bubble can't be clicked */
    transition: opacity 0.5s ease-in-out;
}

/* This class will be added by JS to make the bubble visible */
#astronaut-prompt-bubble.visible {
    opacity: 1;
}
#portfolio-message {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    text-align: center;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    font-size: 3rem;
    z-index: 12;
    line-height: 1.6;
}

#portfolio-message .subtext {
    font-size: 1.1rem;
    color: #bbbbbb;
    margin-top: 0.8em;
}
