/* Core Styles */
body { margin: 0; background-color: #111111; overflow: hidden; }
canvas { display: block; opacity: 0; transition: opacity 1s ease-in; }
canvas.visible { opacity: 1; }
canvas:focus-visible { outline: 2px solid #6fdd7a; outline-offset: 4px; }

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: #000;
    color: #6fdd7a;
    padding: 10px;
    z-index: 9999;
    font-family: monospace;
    text-decoration: none;
    border: 1px solid #6fdd7a;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 10px;
}

/* UPDATED: Label transform to position it below the object */
.label {
    position: absolute; top: 0; left: 0;
    color: #efc75e; /* Gold theme */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px; padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #efc75e; border-radius: 0;
    backdrop-filter: blur(2px); pointer-events: none; user-select: none; text-align: center;
    opacity: 1; transition: opacity 0.5s;
    /* transform removed, handled by JS */
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(239, 199, 94, 0.3);
}
.label.hidden { opacity: 0; pointer-events: none; }

#label-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
    overflow: visible;
}
.label-connector {
    stroke: #efc75e;
    stroke-width: 1.5;
    fill: none;
    filter: drop-shadow(0 0 4px #efc75e);
}
.back-button {
    position: absolute; top: 25px; left: 25px; background: rgba(0, 0, 0, 0.3); color: white;
    border: 1px solid rgba(255, 255, 255, 0.5); padding: 10px 20px; font-family: 'Trebuchet MS', sans-serif;
    font-size: 16px; cursor: pointer; border-radius: 5px; opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease-in-out; backdrop-filter: blur(5px); z-index: 100;
}
.back-button.visible { opacity: 1; pointer-events: all; }
.content-panel {
    position: absolute; top: 60%; left: 50%; transform: translate(-50%, -50%);
    width: 85%; max-width: 700px; max-height: 70vh; overflow-y: auto;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(15px); border-radius: 8px; border: 1px solid rgba(111, 221, 122, 0.2);
    color: white; font-family: 'Trebuchet MS', sans-serif; padding: 2.5em;
    opacity: 0; pointer-events: none; transition: opacity 0.5s ease-in-out 0.5s;
    z-index: 99;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.content-panel::-webkit-scrollbar { width: 6px; }
.content-panel::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.content-panel::-webkit-scrollbar-thumb { background: #6fdd7a; border-radius: 3px; }
.content-panel.visible { opacity: 1; pointer-events: all; }
.content-panel h2 { text-align: center; color: #6fdd7a; margin-top: 0; font-family: 'Consolas', 'Monaco', monospace; letter-spacing: 1px; text-transform: uppercase; font-size: 1.8em; margin-bottom: 1em;}
.content-panel h3 { color: #6fdd7a; margin-bottom: 0.5em; font-size: 1.2em; border-bottom: 1px solid rgba(111, 221, 122, 0.3); padding-bottom: 0.2em; width: fit-content; }
.content-panel p { text-align: left; line-height: 1.6; margin-bottom: 1.5em; font-size: 1em; color: #ddd; }
.content-panel a { text-decoration: none; }

.cta-button {
    display: inline-block;
    padding: 10px 24px;
    background: transparent;
    color: #6fdd7a;
    border: 1px solid #6fdd7a;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    text-align: center;
    border-radius: 0;
    font-weight: bold;
}
.cta-button:hover {
    background: rgba(111, 221, 122, 0.15);
    box-shadow: 0 0 15px rgba(111, 221, 122, 0.4);
    transform: translateY(-2px);
}
.cta-button.secondary {
    border-color: rgba(255,255,255,0.5);
    color: rgba(255,255,255,0.8);
    margin-left: 10px;
}
.cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    color: white;
}
.project-actions {
    display: flex;
    justify-content: center;
    margin-top: 2em;
}
#skill-detail-view {
    position: absolute;
    top: 0; right: 0; width: 40%; height: 100%;
    display: flex; flex-direction: column;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(10px);
    transform: translateX(100%);
    transition: transform 0.8s ease-in-out;
    pointer-events: none;
    z-index: 100;
}
#skill-detail-view.visible { transform: translateX(0); pointer-events: all; }
#skill-detail-content {
    padding: 3em 2em; color: white; font-family: 'Trebuchet MS', sans-serif;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
#skill-detail-content h2 { color: #6fdd7a; margin-top: 0; }
#skill-detail-sidebar {
    padding: 2em; display: flex; flex-wrap: wrap;
    gap: 1em; /* Adjusted gap */
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
    overflow-y: auto; /* Allow scrolling if many tools */
}

.tool-item {
    width: 120px; /* Reduced width */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align items to the top */
    gap: 0.75em; /* Reduced gap */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px; /* Reduced padding */
    box-sizing: border-box;
    padding-bottom: 0.75em; /* Add some bottom padding */
}
.tool-item img {
    max-width: 68px; /* Reduced max width */
    max-height: 68px; /* Reduced max height */
    height: auto;
    flex-shrink: 0; /* Prevent image from shrinking */
}
.tool-label {
    font-size: 11px; /* Reduced font size */
    color: #ccc;
    text-align: center;
    line-height: 1.3;
    min-height: 2.2em; /* Adjusted min-height */
    display: flex; /* Use flex to center text vertically */
    align-items: center;
    justify-content: center;
    width: 100%; /* Ensure label takes full width */
}


.gallery-nav { display: none !important; }
.star-wars-overlay { position: absolute; inset: 0; background: linear-gradient(#000 0%, rgba(0,0,0,0.7) 60%); z-index: 50; display:flex; align-items:flex-end; justify-content:center; perspective: 400px; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity 1s; }
.star-wars-overlay.visible { opacity: 1; visibility: visible; }
.star-wars-overlay {
    background: #000 url('https://images.unsplash.com/photo-1506318137071-a8bcbf6755dd?q=80&w=2070&auto=format&fit=crop') center/cover;
}
.star-wars-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 40%;
    background: linear-gradient(to bottom, #000 0%, transparent 100%);
    z-index: 10;
}

.crawl-container {
    position: relative;
    top: 50%;
    transform-origin: 50% 100%;
    transform: rotateX(25deg);
    width: 90%;
    max-width: 700px;
}

.crawl-content {
    color: #feda4a;
    font-weight: 700;
    letter-spacing: 1.5px;
    line-height: 1.8;
    text-align: justify;
    opacity: 0;
    font-family: 'News Gothic Bold', 'ITC Serif Gothic', serif;
    font-size: 28px;
}
.crawl-content .title {
    text-align: center;
    margin-bottom: 2em;
}
.crawl-content h1 {
    font-size: 2em;
    margin: 0;
    text-transform: uppercase;
}
.crawl-content p {
    margin-bottom: 1.5em;
}

.animate-crawl {
    animation: crawl 60s linear forwards;
}

@keyframes crawl {
    0% { top: 100%; opacity: 1; transform: translateY(0); }
    100% { top: 0; opacity: 0; transform: translateY(-200%); }
}

/* Skip Button */
#skip-btn {
    position: absolute;
    bottom: 30px; right: 30px;
    z-index: 1000;
    background: transparent;
    color: #2ff;
    border: 1px solid #2ff;
    padding: 10px 20px;
    font-family: monospace;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    transition: all 0.5s ease;
}

#skip-btn:hover {
    background: #2ff;
    color: #000;
    box-shadow: 0 0 15px #2ff;
}

/* --- SCENE 3: HYPERSPACE JUMP --- */
#hyperspace-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2000;
    pointer-events: none; /* Let clicks pass through if needed */
    opacity: 0; /* Hidden by default */
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hyperspace-stars {
    width: 2px;
    height: 2px;
    background: transparent;
    /* Create a "star field" using box-shadow */
    box-shadow:
        10vw 10vh #fff, 20vw 80vh #fff, 80vw 10vh #fff, 90vw 90vh #fff,
        40vw 40vh #fff, 60vw 60vh #fff, 50vw 50vh #fff, 10vw 90vh #fff;
    border-radius: 50%;
}

/* The Jump Animation Class */
.engage-hyperdrive {
    /* Scale dots into lines, moving towards user */
    animation: hyperdrive-jump 1.5s ease-in forwards;
}

@keyframes hyperdrive-jump {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow:
        10vw 10vh #fff, 20vw 80vh #fff, 80vw 10vh #fff, 90vw 90vh #fff,
        40vw 40vh #fff, 60vw 60vh #fff, 50vw 50vh #fff, 10vw 90vh #fff;
    }
    10% {
        /* Slightly shrink before expansion (anticipation) */
        transform: scale(0.8);
    }
    50% {
        /* Stretch into lines */
        transform: scale(5) rotate(10deg);
        box-shadow:
        10vw 10vh 2px 20vh #fff, 20vw 80vh 2px 20vh #fff, 80vw 10vh 2px 20vh #fff, 90vw 90vh 2px 20vh #fff,
        40vw 40vh 2px 20vh #fff, 60vw 60vh 2px 20vh #fff, 50vw 50vh 2px 20vh #fff, 10vw 90vh 2px 20vh #fff;
    }
    100% {
        /* Massive scale + Fade to white */
        transform: scale(50);
        background-color: white;
        box-shadow: none;
    }
}

/* --- SCENE 1: LOADER --- */
.loader-overlay { position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; z-index: 999; background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.85) 75%); backdrop-filter: blur(4px); transition: opacity 0.8s ease-in, transform 0.8s ease-in, visibility 0.8s; visibility: visible; opacity: 1; }
.loader-overlay.collapsing { transform: scale(0); opacity: 0; visibility: hidden; }

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80%;
    max-width: 600px;
}

.loader { display:flex; flex-direction:column; align-items:center; gap:18px; }
.cube-scene { width: 140px; height: 140px; perspective: 600px; }
.cube { width: 80px; height: 80px; position: relative; transform-style: preserve-3d; transform: rotateX(20deg) rotateY(20deg); animation: cube-tilt 5s linear infinite; }
.cube-face { position:absolute; width: 80px; height: 80px; background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 6px 18px rgba(0,0,0,0.6) inset; }
.face-front { transform: translateZ(40px); } .face-back { transform: rotateY(180deg) translateZ(40px); } .face-right { transform: rotateY(90deg) translateZ(40px); } .face-left { transform: rotateY(-90deg) translateZ(40px); } .face-top { transform: rotateX(90deg) translateZ(40px); } .face-bottom { transform: rotateX(-90deg) translateZ(40px); }
@keyframes cube-tilt { 0% { transform: rotateX(10deg) rotateY(0deg); } 50% { transform: rotateX(30deg) rotateY(180deg); } 100% { transform: rotateX(10deg) rotateY(360deg); } }
.orbit { position: absolute; inset: 0; pointer-events: none; }
.dot { position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; margin:-6px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd866, #ff9a00); box-shadow: 0 0 14px rgba(255,160,40,0.85); }
.orbit .dot.d1 { transform-origin: -48px 0; animation: orbit1 2.8s linear infinite; } .orbit .dot.d2 { transform-origin: -60px 0; animation: orbit2 3.6s linear infinite reverse; } .orbit .dot.d3 { transform-origin: -36px 0; animation: orbit3 2.2s linear infinite; }
@keyframes orbit1 { 0% { transform: rotate(0deg) translateX(-48px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(-48px) rotate(-360deg); } } @keyframes orbit2 { 0% { transform: rotate(0deg) translateX(-60px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(-60px) rotate(-360deg); } } @keyframes orbit3 { 0% { transform: rotate(0deg) translateX(-36px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(-36px) rotate(-360deg); } }

/* Lightsaber Loader Styles */
.lightsaber-container {
    position: relative;
    height: 20px;
    background: transparent;
    display: flex;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 20px;
    width: 100%;
}

.hilt {
    width: 80px;
    height: 25px;
    background: #b5b5b5;
    background-image: linear-gradient(90deg, #555 10%, #ddd 50%, #555 90%);
    border-radius: 2px;
    position: relative;
    z-index: 2;
    border-right: 4px solid #000;
    flex-shrink: 0;
}

.switch {
    width: 15px;
    height: 6px;
    background: #b00;
    position: absolute;
    top: -4px;
    left: 40px;
}

.plasma-blade {
    height: 15px;
    width: 0%;
    background: #fff;
    border-radius: 0 10px 10px 0;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 10px #2ff, 0 0 20px #2ff, 0 0 40px #2ff, 0 0 80px #2ff;
    transition: width 0.2s linear;
}

#loading-text {
    font-size: 1.2rem;
    color: #2ff;
    letter-spacing: 2px;
    min-height: 1.5em;
    font-family: monospace;
}

#percentage-text {
    font-size: 1.5rem;
    color: #2ff;
    font-family: monospace;
    margin-top: 10px;
}

/* Bottom Left Menu Structure */
.bottom-left-menu {
    position: absolute;
    bottom: 25px;
    left: 25px;
    display: flex;
    flex-direction: column-reverse; /* Bottom up order */
    gap: 15px;
    z-index: 100;
    align-items: flex-start; /* Align left */
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-button, .submenu-item {
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0;
    /* Removed background, border, backdrop-filter for transparent look */
    background: transparent;
    border: none;
    border-radius: 8px; /* Slightly rounded corners if needed, but no border */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none; /* Removed box shadow */
    color: white;
    text-decoration: none;
    position: relative; /* For tooltip positioning */
}

.menu-button:focus-visible, .submenu-item:focus-visible, .cta-button:focus-visible, .back-button:focus-visible, #skip-btn:focus-visible {
    outline: 2px solid #6fdd7a;
    outline-offset: 4px;
}

.submenu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: auto; /* Allows tooltip to be seen on hover */
}

#portfolios-submenu .submenu-item {
    cursor: default;
}
#portfolios-submenu .submenu-item:hover {
    transform: none;
}

.menu-button:hover, .submenu-item:hover {
    background: transparent;
    transform: translateY(-2px); /* Slightly increased lift */
    /* No border or box shadow on hover */
    border-color: transparent;
}

.menu-button:active, .submenu-item:active {
    transform: translateY(1px);
    box-shadow: none;
}

.menu-button img, .submenu-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); /* Shadow on the image itself */
    transition: transform 0.2s ease;
}

.menu-button:hover img, .submenu-item:hover img {
    transform: scale(1.1); /* Scale up image on hover */
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.8));
}

.menu-button.active {
    /* No border or background changes for active state, maybe scale? */
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.menu-button.active img {
     transform: scale(1.1); /* Keep scaled if active */
     filter: drop-shadow(0 0 10px rgba(111, 221, 122, 0.5)); /* Glow effect */
}

/* Special styling for the Help button "i" text to make it look like a button */
.menu-button span[style*="font-family: serif"] {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 2px solid white;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

.menu-button:hover span[style*="font-family: serif"] {
    background: rgba(255,255,255,0.1);
    border-color: #6fdd7a;
    color: #6fdd7a;
    box-shadow: 0 0 15px rgba(111, 221, 122, 0.4);
    transform: scale(1.05);
}


/* Submenu */
.submenu {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-left: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    position: absolute;
    left: 100%; /* Position to the right of the button */
    bottom: 0; /* Align bottom */
}

.menu-item.expanded .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: all;
}

/* Legend Content specific style */
.submenu.legend-content {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid #6fdd7a;
    padding: 1em;
    width: 220px;
    flex-direction: column;
    gap: 5px;
    bottom: 0;
    border-radius: 4px;
}

.legend-content p {
    margin: 5px 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #ddd;
    font-family: 'Consolas', 'Monaco', monospace;
}
.legend-content span {
    color: #6fdd7a;
}

/* Tooltips */
.tooltip {
    position: absolute;
    color: #6fdd7a;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    padding: 4px 8px;
    background: rgba(0, 20, 0, 0.9);
    border: 1px solid #6fdd7a;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 0 10px rgba(111, 221, 122, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tooltip::after {
    content: '';
    position: absolute;
    border-width: 5px;
    border-style: solid;
}

/* Submenu Item Tooltips (Above) */
.submenu-item .tooltip {
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%) translateY(-10px);
    margin-bottom: 8px;
}
.submenu-item .tooltip::after {
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-color: #6fdd7a transparent transparent transparent;
}
.submenu-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Main Menu Button Tooltips (Right) */
.menu-button .tooltip {
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(5px);
    margin-left: 10px;
}
.menu-button .tooltip::after {
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border-color: transparent #6fdd7a transparent transparent;
}
.menu-button:hover .tooltip,
.menu-button:focus-visible .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(10px);
}

.submenu-item:hover .tooltip,
.submenu-item:focus-visible .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Hide main button tooltip if menu is expanded */
.menu-item.expanded .menu-button .tooltip {
    display: none;
}

/* Screen Reader Only Class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}