/* =========================================
   1. Base Styles & Reset
   ========================================= */
body {
    margin: 0;
    padding: 0;
    background-color: #181818;
    font-family: "Pixelify Sans", sans-serif;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
    color: #ffffff;
    overflow: hidden; /* Prevent scrollbars on body */
    height: 100vh;
    width: 100vw;
}

#unity-canvas {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    background: #181818;
}

#unity-canvas {
    width: 960px;
    height: 720px; /* Matches HTML attribute, though style said 720px in original. I will stick to style preference or make it responsive */
    background: #181818;
}

/* Mobile adjustments handled by JS, but we can add some base responsiveness */
@media (max-width: 960px) {
    #unity-canvas {
        width: 100%;
        height: auto;
        aspect-ratio: 960/720;
    }
}

/* =========================================
   2. Loading Screen
   ========================================= */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #181818;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 24px;
    margin: 0;
}

.loading-text::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
    display: inline-block;
    width: 24px;
    text-align: left;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* =========================================
   3. Fixed UI Elements
   ========================================= */
.social-icons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 20px;
    z-index: 100;
}

.social-icon {
    color: #ffffff;
    font-size: 24px;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.social-icon:hover {
    color: #dddddd;
    transform: scale(1.1);
}

.wip-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #aaaaaa;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
    pointer-events: none;
}

.wip-container i {
    color: #f0ad4e;
}

/* =========================================
   4. Main Layout
   ========================================= */
.global-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: auto; /* Block clicks when visible */
}

.global-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Allow clicks to pass through when hifdden */
}

#main-layout {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 4;
    pointer-events: none; /* Let clicks pass through to canvas where not interacting */
}

/* Sidebar (Left Column) */
.sidebar {
    flex: 0 0 300px; /* Fixed width or percentage */
    display: flex;
    flex-direction: column;
    min-width: 425px;
    padding: 40px;
    box-sizing: border-box;
    pointer-events: none; /* Let clicks pass through to Unity canvas */
    /* justify-content: center; */ /* Align vertically center? User said "clock and below projects" */
    padding-top: 100px; /* Space from top */
}

.clock {
    font-size: 94px;
    margin-bottom: 40px;
    line-height: 1;
    text-shadow: 2px 2px 0px #000000;
    pointer-events: none; /* Don't block Unity canvas */
}

.projects-container {
    text-align: left;
    pointer-events: auto; /* Enable clicks on project links */
}

.projects-container h3 {
    font-size: 24px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid #fff;
    display: inline-block;
    padding-bottom: 5px;
    text-shadow: 2px 2px 0px #000000;
}

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-list li {
    margin-bottom: 10px;
}

.project-list a {
    color: #cccccc;
    text-decoration: none;
    font-size: 18px;
    transition: color 0.2s, padding-left 0.2s;
    display: block;
    text-shadow: 1px 1px 0px #000000;
}

.project-list a:hover {
    color: #ffffff;
    padding-left: 5px;
}

.project-list a.active {
    color: #ffffff;
    padding-left: 5px;
}

.project-wip {
    color: #777777;
    font-size: 18px;
    display: block;
    text-shadow: 1px 1px 0px #000000;
    cursor: default;
}

.project-wip i {
    color: #f0ad4e;
    margin-right: 8px;
    font-size: 14px;
}

/* Content Area (Right Column) */
.content-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    /* padding: 40px; */
    box-sizing: border-box;
    pointer-events: none; /* Let clicks pass through to Unity canvas */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.content-area.hidden {
    width: 0;
    height: 0;
    overflow: hidden;
    flex: 0;
}

.content-area:not(.hidden) {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    flex: 1;
    z-index: 4; /* Above the backdrop (z-index: 3) */
}

/* Removed .content-backdrop as it is replaced by .global-backdrop */

.project-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 40px;
    box-sizing: border-box;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
    overflow: scroll;
    overflow-x: visible;
}

.project-content::-webkit-scrollbar {
    width: 8px;
}

.project-content::-webkit-scrollbar-track {
    background: transparent;
}

.project-content::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}

/* =========================================
   5. Project Details Styling
   ========================================= */
.project-detail {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 60px;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.project-header h2 {
    font-size: 36px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.content-block {
    margin-bottom: 60px;
}

.content-block::after {
    content: "";
    display: table;
    clear: both;
}

.content-image {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0px 4px 6px rgba(0,0,0,0.1);
}

.content-image.no-round {
    border-radius: 0px;
    box-shadow: none;
}

.left {
    float: left;
    margin-right: 30px;
    margin-bottom: 20px;
}

.right {
    float: right;
    margin-left: 30px;
    margin-bottom: 20px;
}

.project-detail p {
    font-size: 18px;
    line-height: 1.6;
    color: #ddd;
}

.project-detail a {
    color: #f0ad4e;
    text-decoration: none;
    border-bottom: 1px dotted #f0ad4e;
}

.project-detail a:hover {
    color: #fff;
    border-bottom-style: solid;
}

.youtube-video {
    margin-bottom: 40px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.gallery {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.gallery img {
    border-radius: 10px;
    max-height: 150px;
    transition: transform 0.2s;
    cursor: pointer;
}

.gallery a {
    text-decoration: none !important;
    border-bottom: none !important;
}

.gallery img:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

/* =========================================
   6. Decorations (Spheres) - Kept from original
   ========================================= */
.ar-section-01 {
    position: relative;
    min-height: 230px;
}

.ar-section-01 .sphere-left-01 {
    position: absolute;
    bottom: -100px;
    right: 0px;
}

.ar-section-01 .sphere-left-01 img {
    width: 112px;
    animation: ball 3s ease-in-out infinite;
    animation-delay: -5.5s;
}

.ar-section-01 .sphere-left-02 {
    position: absolute;
    bottom: -100px;
    right: 70px;
    z-index: -1;
}

.ar-section-01 .sphere-left-02 img {
    width: 73px;
    transform: rotate(35deg);
    animation: ball02 3s ease-in-out infinite;
}

.ar-section-01 .sphere-bottom-01 {
    position: absolute;
    top: -210px;
    left: 350px;
    z-index: 121;
}

.ar-section-01 .sphere-bottom-01 img {
    width: 201.147px;
    transform: rotate(60deg);
    animation: ball 5s ease-in-out infinite;
}

.ar-section-01 .sphere-bottom-02 {
    position: absolute;
    bottom: -100px;
    right: 566px;
    z-index: 121;
}

.ar-section-01 .sphere-bottom-02 img {
    width: 82px;
    animation: ball02 4s ease-in-out infinite;
    transform: rotate(35deg);
}

@keyframes ball {
    0% { transform: translateY(0); filter: invert(0); }
    40% { filter: invert(0); }
    45% { filter: invert(1); }
    55% { transform: translateY(-20px); filter: invert(1); }
    90% { filter: invert(1); }
    95% { filter: invert(0); }
    100% { transform: translateY(0); filter: invert(0); }
}

@keyframes ball02 {
    0% { transform: translateY(0) rotate(45deg); filter: invert(0); }
    40% { filter: invert(0); }
    45% { filter: invert(1); }
    55% { transform: translateY(-20px); filter: invert(1); }
    90% { filter: invert(1); }
    95% { filter: invert(0); }
    100% { transform: translateY(0) rotate(45deg); filter: invert(0); }
}

/* =========================================
   7. Responsive Design
   ========================================= */

/* Tablet / Mobile (max-width: 960px) */
@media (max-width: 960px) {
    #main-layout {
        flex-direction: column;
        overflow-y: auto; /* Enable scrolling */
        pointer-events: auto; /* Allow interaction */
        -webkit-overflow-scrolling: touch;
    }

    .sidebar {
        flex: 0 0 auto;
        width: 100%;
        padding: 20px;
        padding-top: 30px; /* Space for social icons */
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;;
        background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
        text-align: center;
        min-width: unset;
    }

    .clock {
        font-size: 70px;
        margin-bottom: 0px;
        margin-left: 20px;
    }

    .projects-container {
        text-align: start;
        width: 100%;
    }
    
    .projects-container h3 {
        display: inline-block;
        margin-left: 20px;
    }

    .project-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 20px;
        justify-content: flex-start;
        padding-left: 20px;
    }

    .content-area {
        /* padding: 10px; */
        overflow: visible;
        height: auto;
        display: block;
    }

    .content-area.hidden {
        display: none;
    }

    /* Removed .content-backdrop override */

    .project-content {
        padding: 20px;
        overflow: visible;
        height: auto;
    }

    .project-list li {
        margin-bottom: 0px;
    }

    .content-image {
        float: none;
        margin: 0 auto 20px auto;
        display: block;
    }

    .ar-section-01 .sphere-bottom-01,
    .ar-section-01 .sphere-bottom-02 {
        display: none;
    }
}

/* Small Mobile (max-width: 600px) */
@media (max-width: 600px) {
    .sidebar {
        flex-direction: column;
        align-items: flex-start;
        text-align: center;
        padding-top: 30px;
    }

    .projects-container {
        text-align: start;
    }
    
    .clock {
        font-size: 58px;
        margin-left: 20px;
    }
}
.project-links {
    display: flex;
}

.icon-link {
    width: 30px;
    height: 30px;
    transition: transform 0.2s;
    filter: brightness(0) invert(1);
}

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

/* =========================================
   8. App Cards (for Liceo, Meludus, etc.)
   ========================================= */
.app-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.app-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.app-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-card-info h3 {
    margin: 0;
    font-size: 22px;
    color: #fff;
}

.app-store-links {
    display: flex;
    gap: 12px;
}

.app-store-links .icon-link {
    width: 26px;
    height: 26px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.app-store-links .icon-link:hover {
    opacity: 1;
    transform: scale(1.15);
}

.app-card p {
    font-size: 16px;
    line-height: 1.6;
    color: #bbb;
    margin: 0 0 20px 0;
}

.app-card .gallery {
    margin-top: 16px;
}

.app-card .gallery img {
    max-height: 120px;
}

/* Responsive adjustments for app cards */
@media (max-width: 600px) {
    .app-card {
        padding: 16px;
    }

    .app-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .app-icon {
        width: 64px;
        height: 64px;
    }

    .app-card-info h3 {
        font-size: 18px;
    }

    .app-card .gallery img {
        max-height: 100px;
    }
}
