:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: #ffffff;
    --sphere-radius: 400px;
    --icon-size: 70px;
    --animation-duration: 30s;
    --zoom-scale: 1;
    --zoom-x: 0px;
    --zoom-y: 0px;
    --tilt-x: 0deg;
    --tilt-y: 0deg;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Space Mono', monospace;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    cursor: crosshair;
}

/* Side Navigation */
.side-nav {
    position: fixed;
    top: 40%;
    transform: translateY(-50%);
    z-index: 100;
    padding: 8vw;
    perspective: 1000px;
}

.left-nav {
    left: 0;
}

.right-nav {
    right: 0;
}

.side-nav a {
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    opacity: 0.7;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4), 0 0 25px rgba(255, 255, 255, 0.15);
    transition: opacity 0.3s ease, letter-spacing 0.3s ease, color 0.3s ease, transform 0.1s ease-out, text-shadow 0.3s ease;
    display: inline-block;
    white-space: nowrap;
    font-family: 'Syncopate', sans-serif;
    transform-style: preserve-3d;
    transform: translate(var(--nav-parallax-x, 0px), var(--nav-parallax-y, 0px)) rotateX(var(--nav-tilt-y, 0deg)) rotateY(var(--nav-tilt-x, 0deg));
    will-change: transform;
}

.side-nav a:hover {
    opacity: 1;
    letter-spacing: 6px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 40px rgba(255, 255, 255, 0.4);
}

/* Parallax Scenes */
.background-scene {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    /* Receives translation and tilt from JS */
    transform: translate(var(--parallax-x), var(--parallax-y)) rotateX(var(--tilt-y)) rotateY(var(--tilt-x));
    transition: transform 0.1s ease-out;
}

/* Zoom Wrapper - NO SCALE */
#zoom-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    transform-style: preserve-3d;
}

/* Central Text - Fixed in foreground but reactive to 3D */
.center-content {
    z-index: 50;
    text-align: center;
    pointer-events: none;
    position: absolute;
    transform-style: preserve-3d;
    /* Translate Z to 500px pushes it physically in front of the 400px spheres */
    /* Scale down slightly to counteract the perspective zoom effect of moving it closer */
    transform: translate(var(--main-parallax-x, 0px), var(--main-parallax-y, 0px)) translateZ(500px) rotateX(var(--main-tilt-y, 0deg)) rotateY(var(--main-tilt-x, 0deg)) scale(0.75);
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.main-name {
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
}

.sub-name {
    font-size: 1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.8em;
    opacity: 0.7;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Scythe Background */
.scythe-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-100px);
    width: 600px;
    height: 600px;
    z-index: -1;
    opacity: 0.6;
    pointer-events: none;
    filter: brightness(0.8) contrast(1.2);
}

.scythe-bg img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.main-name {
    text-shadow: 0 0 20px rgba(0, 0, 0, 1), 0 0 10px rgba(255, 255, 255, 0.2);
}

/* 3D Wireframe Cube (Central Decoration) */
.cube-system {
    position: absolute;
    z-index: 5;
    transform-style: preserve-3d;
}

.cube {
    width: 250px;
    height: 250px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate-cube 40s linear infinite;
}

.face {
    position: absolute;
    width: 250px;
    height: 250px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.front {
    transform: translateZ(125px);
}

.back {
    transform: rotateY(180deg) translateZ(125px);
}

.left {
    transform: rotateY(-90deg) translateZ(125px);
}

.right {
    transform: rotateY(90deg) translateZ(125px);
}

.top {
    transform: rotateX(90deg) translateZ(125px);
}

.bottom {
    transform: rotateX(-90deg) translateZ(125px);
}

@keyframes rotate-cube {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* Spherical Orbit System */
.sphere-orbit {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    pointer-events: none;
}

.sphere-wrapper {
    position: relative;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    animation: rotate-sphere var(--animation-duration) linear infinite;
}

@keyframes rotate-sphere {
    from {
        transform: rotateY(0deg);
    }

    to {
        transform: rotateY(360deg);
    }
}

.icon-sphere {
    position: absolute;
    transform-style: preserve-3d;
    /* Fibonacci Sphere / Distribution logic for 15 items */
    --phi: calc(acos(-1 + (2 * var(--i) - 1) / 15));
    --theta: calc(sqrt(15 * pi) * var(--phi));

    /* Place icons on the sphere surface */
    /* Simplified distribution for CSS: different latitudes/longitudes */
    --lat: calc((var(--i) - 8) * 15deg);
    /* Spread out vertically */
    --lon: calc(var(--i) * 24deg);
    /* 360/15 = 24 */

    transform: rotateY(var(--lon)) rotateX(var(--lat)) translateZ(var(--sphere-radius));
}

/* Mini 3D Cube for Logos */
.mini-cube {
    width: var(--icon-size);
    height: var(--icon-size);
    position: relative;
    transform-style: preserve-3d;

    /* Counter-rotation to keep logos "rectos" */
    /* We must negate the parent's sphere-wrapper rotation and own sphere placement */
    animation: counter-sphere var(--animation-duration) linear infinite;
}

@keyframes counter-sphere {

    /* Counter-rotate the latitude/longitude to keep orientation static to viewer */
    from {
        transform: rotateX(calc(-1 * var(--lat))) rotateY(calc(-1 * var(--lon))) rotateY(0deg);
    }

    to {
        transform: rotateX(calc(-1 * var(--lat))) rotateY(calc(-1 * var(--lon))) rotateY(-360deg);
    }
}

.mface {
    position: absolute;
    width: var(--icon-size);
    height: var(--icon-size);
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.6);
}

.logo-img {
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    z-index: 10;
    /* Logo stays "recto" (upright) by being on the front face of the counter-rotated cube */
    transform: translateZ(calc(var(--icon-size) / 2 + 1px));
    object-fit: contain;
}

.mf {
    transform: translateZ(calc(var(--icon-size) / 2));
}

.mb {
    transform: rotateY(180deg) translateZ(calc(var(--icon-size) / 2));
}

.ml {
    transform: rotateY(-90deg) translateZ(calc(var(--icon-size) / 2));
}

.mr {
    transform: rotateY(90deg) translateZ(calc(var(--icon-size) / 2));
}

.mt {
    transform: rotateX(90deg) translateZ(calc(var(--icon-size) / 2));
}

.mbt {
    transform: rotateX(-90deg) translateZ(calc(var(--icon-size) / 2));
}

/* Grid Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 80px 80px;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}

/* ===================================
   RESPONSIVE STYLES
   =================================== */

/* Tablets and Laptops */
@media screen and (max-width: 1366px),
(max-height: 768px) {
    :root {
        --sphere-radius: 300px;
        --icon-size: 60px;
    }

    .side-nav {
        padding: 4vw;
        top: 35%;
    }

    .side-nav a {
        font-size: 1.2rem;
        letter-spacing: 3px;
    }

    .main-name {
        font-size: clamp(1.5rem, 5vw, 3rem);
    }

    .sub-name {
        letter-spacing: 0.5em;
        font-size: 0.8rem;
    }

    .sword-bg,
    .wings-bg {
        width: 220px;
        height: 220px;
        top: calc(35% - 110px);
    }

}

/* Small Tablets */
@media screen and (max-width: 1024px) {
    :root {
        --sphere-radius: 250px;
        --icon-size: 50px;
    }
}

/* Mobile Portrait */
@media screen and (max-width: 768px) {
    :root {
        --sphere-radius: 160px;
        --icon-size: 38px;
    }

    body {
        overflow: hidden;
        cursor: default;
        height: 100vh;
        width: 100vw;
    }

    #zoom-wrapper {
        height: 100vh;
        width: 100%;
    }

    .side-nav {
        position: fixed;
        top: 0;
        bottom: auto;
        left: 0;
        right: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 16px 0 12px;
        transform: none;
        background: rgba(0, 0, 0, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        z-index: 200;
    }

    .left-nav,
    .right-nav {
        left: auto;
        right: auto;
        position: static;
    }

    .side-nav a {
        font-size: 1rem;
        letter-spacing: 4px;
        opacity: 0.9;
        text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
    }

    .nav-bg {
        display: none;
    }

    .center-content {
        transform: none;
        position: absolute;
        top: 50%;
        left: 50%;
        translate: -50% -50%;
        width: 92%;
        text-align: center;
    }

    .main-name {
        font-size: clamp(2.5rem, 10vw, 4rem);
        letter-spacing: 0.15em;
    }

    .sub-name {
        font-size: clamp(0.65rem, 2.5vw, 0.95rem);
        letter-spacing: 0.4em;
        opacity: 0.8;
    }

    .scythe-bg {
        width: min(80vw, 350px);
        height: min(80vw, 350px);
    }

}

/* Very Small Mobile */
@media screen and (max-width: 480px) {
    :root {
        --sphere-radius: 140px;
        --icon-size: 30px;
    }

    .main-name {
        font-size: clamp(2rem, 11vw, 3rem);
        letter-spacing: 0.1em;
    }

    .sub-name {
        font-size: clamp(0.5rem, 3vw, 0.7rem);
        letter-spacing: 0.22em;
    }


    .scythe-bg {
        width: min(80vw, 260px);
        height: min(80vw, 260px);
    }
}

/* Touch devices: disable 3D for performance */
@media (hover: none) and (pointer: coarse) {

    .center-content,
    .background-scene {
        transition: none;
        will-change: auto;
    }

    .center-content {
        transform: translateZ(150px) scale(0.72);
    }
}



/* Pinterest Assets General 3D Pop */
.nav-bg img,
.scythe-bg img {
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.5));
    transition: filter 0.3s ease;
}

/* Navigation BG Assets */
.nav-bg {
    position: fixed;
    /* Positioned relative to viewport, independently */
    width: 280px;
    height: 280px;
    opacity: 0.3;
    pointer-events: none;
    transform-style: preserve-3d;
    transition: opacity 0.5s ease, transform 0.3s ease;
}

/* Sword stays aligned with the left nav link */
.sword-bg {
    top: calc(40% - 140px);
    left: calc(8vw + 30px);
    /* moved right */
    transform: translate(var(--nav-parallax-x, 0px), var(--nav-parallax-y, 0px)) translateZ(-30px) rotateX(var(--nav-tilt-y, 0deg)) rotateY(var(--nav-tilt-x, 0deg));
}

/* Wings stays aligned with the right nav link */
.wings-bg {
    top: calc(40% - 140px);
    right: calc(8vw + 30px);
    /* moved left */
    transform: translate(calc(-1 * var(--nav-parallax-x, 0px)), var(--nav-parallax-y, 0px)) translateZ(-30px) rotateX(var(--nav-tilt-y, 0deg)) rotateY(var(--nav-tilt-x, 0deg));
}

.side-nav a {
    z-index: 1;
    /* text on top of nav-bg */
}

.nav-bg img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
    transition: filter 0.3s ease;
}

.left-nav:hover .sword-bg,
.right-nav:hover .wings-bg {
    opacity: 0.75;
}

/* Mobile Adjustments */
@media screen and (max-width: 768px) {

    .pc-container,
    .girl-container {
        width: 120px;
    }

    .psvita-container {
        width: 150px;
    }
}