/* css/main.css */
/* @font-face rules for SF Pro Display have been removed */

/* You can add more @font-face rules for other weights (Light, Semibold, Black, etc.) if needed,
   referencing the .OTF files you provided, for example:
@font-face {
    font-family: 'SF Pro Display';
    src: url('../assets/fonts/SF PRO/SFPRODISPLAYLIGHTITALIC.OTF') format('opentype');
    font-weight: 300;
    font-style: italic;
}
*/

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden; /* Prevent all scrolling */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #000; /* Fallback background */
    color: #000; /* Default text color for white background, will be overridden where needed */
    user-select: none;
    /* Default cursor */
    cursor: url('/assets/cursor/arrow.png') 1 1, auto;
    
    /* Touch device optimizations from old website */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on touch devices */
    -webkit-font-smoothing: antialiased;
    text-size-adjust: none; /* Prevent text scaling on mobile */
    -webkit-text-size-adjust: none; /* Webkit-specific text size adjust */
    -webkit-user-select: none; /* Webkit-specific user select */
}

body.is-loading {
    /* Loading state cursor */
    cursor: url('/assets/cursor/beachball.png') 12 12, progress;
}

#desktop {
    height: 100vh;
    width: 100vw;
    background-image: url('../assets/wallpapers/wallpaper.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative; /* Needed for absolute positioning of children */
    display: flex;
    flex-direction: column; 
    overflow: hidden; /* Additional safety to prevent desktop overflow */
}

/* Styles for dynamic lighting/shadow will be added later */

/* Container for desktop icons/folders */
#desktop-icons {
    position: fixed; /* Changed from absolute to fixed for viewport anchoring */
    top: 35px; /* Reduced from 50px for menu bar clearance */
    right: 15px; /* Right anchoring with padding */
    left: 15px; /* Add left constraint for grid */
    bottom: 80px; /* Bottom constraint for dock clearance */
    visibility: hidden; /* Initially hide to prevent FOUC */
    z-index: 15; /* Ensure above desktop background */
    
    /* CSS Grid system from old website for instant responsiveness */
    display: grid;
    grid-template-columns: repeat(auto-fill, 96px);
    grid-template-rows: repeat(auto-fill, 95px);
    column-gap: 15px;
    row-gap: 15px;
    margin-left: auto; /* Push grid to the right */
    direction: rtl; /* Right-to-left flow */
    grid-auto-flow: column; /* Items flow in columns */
    height: 100%;
    padding: 0; /* Remove padding, let grid handle spacing */
}

.desktop-folder {
    /* Remove JavaScript positioning - let CSS Grid handle it */
    position: relative; /* Changed back to relative for grid items */
    width: 96px; /* Explicit width to match grid column size */
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    cursor: default;
    text-align: center;
    padding: 5px 0;
    border-radius: 5px;
    z-index: 10; 
    transition: none; /* No transitions needed for grid positioning */
    pointer-events: auto; /* Re-enable pointer events for folder interactions */
    direction: ltr; /* Reset direction for folder content */
}

.desktop-folder:hover {
    /* Tighter glow: slightly darker background, no extra padding needed */
    background-color: rgba(0, 0, 0, 0.12); 
    cursor: default; /* Ensure default cursor on hover */
}

/* --- Selection State --- */
.desktop-folder.selected {
    /* Match hover background, keep transition instant */
    background-color: rgba(0, 0, 0, 0.12);
    transition: none; 
}

/* Remove specific icon styling for selected state */
/* 
.desktop-folder.selected img {
    background-color: rgba(0, 0, 0, 0.3); 
    border: 1px solid rgba(255, 255, 255, 0.7); 
    border-radius: 4px; 
    box-sizing: border-box; 
}
*/

/* Keep label styling for selected state */
.desktop-folder.selected span {
    background-color: #007aff; /* macOS selection blue */
    color: #fff; /* White text */
    border-radius: 3px; /* Standard label selection rounding */
    padding: 0px 4px; /* Minimal vertical padding, horizontal padding */
    margin-top: 4px; /* Maintain original margin */
    text-shadow: none; /* Remove shadow for selected text */
}

/* Style for when folder is being dragged */
.desktop-folder.dragging {
    cursor: grabbing;
    opacity: 0.8; 
    transition: none; /* Disable transition while dragging */
    /* z-index will be updated by JS */
    /* position: absolute; will be added by JS */
}

/* Smooth transitions only for drag snap back */
.desktop-folder.snapping {
    transition: top 0.15s ease-out, left 0.15s ease-out; /* Only for drag snap animation */
}

/* Immediate positioning class for instant feedback */
.desktop-folder.repositioning {
    transition: top 0.1s ease-out, left 0.1s ease-out; /* Faster transition for immediate adjustments */
}

.desktop-folder img {
    width: 64px; /* Fixed icon size */
    height: 64px;
    object-fit: contain;
    pointer-events: none; /* Prevent image from interfering with drag events */
}

.desktop-folder span {
    margin-top: 4px; /* Space between icon and label */
    font-size: 12px;
    color: #fff; 
    font-weight: bold; /* Changed from normal */
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5); /* Changed from directional shadow to a surrounding glow */
    word-wrap: break-word;
    max-width: 90px; 
    line-height: 1.2;
    /* Clicks on span should not initiate drag - handled in JS */
}

#finder-windows-container {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%;
    height: calc(100% - 80px); /* Adjust if dock height changes */
    pointer-events: auto; /* Changed from none to auto to allow interaction with windows */
}

/* Responsive breakpoints for desktop folders - smoother transitions */
@media (max-width: 768px) {
    #desktop-icons {
        grid-template-columns: repeat(auto-fill, 85px); /* Intermediate size */
        grid-template-rows: repeat(auto-fill, 88px);
        column-gap: 13px;
        row-gap: 13px;
        right: 12px; /* Gradual padding reduction */
        left: 12px;
    }
    
    .desktop-folder {
        width: 85px; /* Gradual size reduction */
    }
    
    .desktop-folder img {
        width: 60px; /* Gradual icon size reduction */
        height: 60px;
    }
    
    .desktop-folder span {
        font-size: 11.5px; /* Gradual text size reduction */
        max-width: 80px;
    }
}

@media (max-width: 600px) {
    #desktop-icons {
        grid-template-columns: repeat(auto-fill, 80px); /* Less dramatic reduction */
        grid-template-rows: repeat(auto-fill, 84px);
        column-gap: 11px; /* Intermediate value */
        row-gap: 11px;
        right: 11px;
        left: 11px;
    }
    
    .desktop-folder {
        width: 80px; /* Less dramatic reduction */
    }
    
    .desktop-folder img {
        width: 56px; /* Less dramatic reduction from 60px */
        height: 56px;
    }
    
    .desktop-folder span {
        font-size: 11.2px; /* Less dramatic text reduction */
        max-width: 75px;
    }
}

@media (max-width: 480px) { /* New intermediate breakpoint */
    #desktop-icons {
        grid-template-columns: repeat(auto-fill, 74px); /* Start transition */
        grid-template-rows: repeat(auto-fill, 78px);
        column-gap: 9px;
        row-gap: 9px;
        right: 9px;
        left: 9px;
    }
    
    .desktop-folder {
        width: 74px;
        padding: 4px 0; /* Start reducing padding */
    }
    
    .desktop-folder img {
        width: 51px; /* Gradual icon size reduction */
        height: 51px;
    }
    
    .desktop-folder span {
        font-size: 10.5px;
        max-width: 68px;
        margin-top: 3px; /* Start reducing margin */
    }
}

@media (max-width: 470px) { /* Another intermediate breakpoint */
    #desktop-icons {
        grid-template-columns: repeat(auto-fill, 72px);
        grid-template-rows: repeat(auto-fill, 76px);
        column-gap: 8.5px;
        row-gap: 8.5px;
        right: 8.5px;
        left: 8.5px;
    }
    
    .desktop-folder {
        width: 72px;
        padding: 3.5px 0;
    }
    
    .desktop-folder img {
        width: 49px;
        height: 49px;
    }
    
    .desktop-folder span {
        font-size: 10.2px;
        max-width: 66px;
        margin-top: 2.5px;
    }
}

@media (max-width: 460px) { /* Final mobile breakpoint */
    #desktop-icons {
        grid-template-columns: repeat(auto-fill, 70px);
        grid-template-rows: repeat(auto-fill, 75px);
        column-gap: 8px;
        row-gap: 8px;
        right: 8px;
        left: 8px;
    }
    
    .desktop-folder {
        width: 70px;
        padding: 3px 0; /* Final reduced padding */
    }
    
    .desktop-folder img {
        width: 48px;
        height: 48px;
    }
    
    .desktop-folder span {
        font-size: 10px;
        max-width: 65px;
        margin-top: 2px; /* Final reduced margin */
    }
} 