/* 
 * Marcel Beerden - Artistic Virtual Environment Styles
 * 3D Floating Objects CSS with original color palette
 */

/* CSS Custom Properties (Variables) */
:root {
    /* Original color palette from mySketch.js */
    --color-orange: #ffb000;
    --color-red-orange: #ff4200;
    --color-green: #7da030;
    --color-pink: #ff99cc;
    --color-dark: #1d1d1b;
    --color-light: #f2f2e7;
    
    /* Additional colors for environment */
    --bg-primary: var(--color-dark);
    --bg-secondary: rgba(29, 29, 27, 0.95);
    --accent: var(--color-light);
    --accent-transparent: rgba(242, 242, 231, 0.1);
    
    /* Animation variables */
    --animation-speed: 1s;
    --perspective-distance: 1000px;
    --blur-distance: 300px;
    
    /* Spacing */
    --header-height: 80px;
    --control-size: 50px;
    --panel-width: 300px;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: var(--bg-primary);
    color: var(--accent);
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    animation: loadingPulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--accent-transparent);
    border-top: 3px solid var(--color-orange);
    border-radius: 50%;
    animation: loadingSpin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--accent);
}

.loading-content p {
    color: var(--color-orange);
    font-size: 1rem;
}

@keyframes loadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Main Container */
#main-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

/* Header */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(29, 29, 27, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--accent-transparent);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 30px;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 300;
    color: var(--accent);
    margin-bottom: 5px;
}

.tagline {
    font-size: 0.9rem;
    color: var(--color-orange);
    font-style: italic;
}

/* 3D Environment Container */
#environment-container {
    width: 100%;
    height: 100vh;
    position: relative;
    padding-top: var(--header-height);
}

.floating-space {
    width: 100%;
    height: calc(100vh - var(--header-height));
    position: relative;
    perspective: var(--perspective-distance);
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    overflow: hidden;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 176, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 66, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(125, 160, 48, 0.05) 0%, transparent 50%);
}

/* Depth Layers for 3D Effect */
.depth-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Floating Objects Base Styles */
.floating-object {
    position: absolute;
    transform-style: preserve-3d;
    transition: none;
    pointer-events: auto;
    cursor: grab;
    filter: drop-shadow(0 0 10px rgba(242, 242, 231, 0.3));
    user-select: none; /* Prevent text selection on click */
}

.floating-object:hover {
    filter: drop-shadow(0 0 20px rgba(255, 176, 0, 0.6));
    animation: hoverPulse 0.3s ease-in-out;
}

/* 3D Shape Container */
.shape-3d {
    position: relative;
    transform-style: preserve-3d;
    margin: 0 auto;
}

/* 3D Face Styles */
.face {
    position: absolute;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.face.front {
    z-index: 10;
}

.face.back {
    z-index: 1;
}

/* Sphere specific styles */
.sphere {
    transform-style: preserve-3d;
}

.sphere-surface {
    position: relative;
    transform-style: preserve-3d;
}

.sphere-highlight {
    position: absolute;
    pointer-events: none;
    animation: sphereShine 3s ease-in-out infinite;
}

@keyframes sphereShine {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.1); }
}

/* Diamond specific styles */
.diamond {
    transform-style: preserve-3d;
}

.diamond-facet {
    position: absolute;
    pointer-events: none;
    animation: diamondSparkle 2s ease-in-out infinite;
}

@keyframes diamondSparkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Star 3D sides */
.star-side {
    transform-style: preserve-3d;
    opacity: 0.8;
}

/* Complex shape 3D grid */
.nested-grid-3d {
    position: relative;
    transform-style: preserve-3d;
}

.grid-cell-3d {
    transform-style: preserve-3d;
}

.cell-face {
    backface-visibility: hidden;
}

/* Enhanced 3D lighting effects */
.floating-object .shape-3d {
    animation: float3D 6s ease-in-out infinite;
}

/* 3D Text Styles */
.text-3d {
    transform-style: preserve-3d;
}

.text-face {
    backface-visibility: hidden;
}

.text-content {
    transform-style: preserve-3d;
    user-select: none;
}

.text-edge {
    transform-style: preserve-3d;
}

/* Number specific styles */
.number-object .text-content {
    background-clip: text;
    -webkit-background-clip: text;
}

/* Letter specific styles */
.letter-object .text-content {
    background-clip: text;
    -webkit-background-clip: text;
}

.letter-content {
    position: relative;
}

.letter-highlight {
    animation: letterShine 4s ease-in-out infinite;
}

@keyframes letterShine {
    0%, 100% { opacity: 0.3; transform: translateZ(var(--depth)) scale(1); }
    50% { opacity: 0.7; transform: translateZ(var(--depth)) scale(1.2); }
}

/* Enhanced animations for text objects */
.number-object .shape-3d,
.letter-object .shape-3d {
    animation: textFloat3D 8s ease-in-out infinite;
}

@keyframes textFloat3D {
    0%, 100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
    25% { 
        transform: translateY(-15px) rotateX(10deg) rotateY(15deg) rotateZ(5deg); 
    }
    50% { 
        transform: translateY(-25px) rotateX(0deg) rotateY(30deg) rotateZ(0deg); 
    }
    75% { 
        transform: translateY(-15px) rotateX(-10deg) rotateY(15deg) rotateZ(-5deg); 
    }
}

/* Text drag effects */
.number-object.being-dragged .shape-3d,
.letter-object.being-dragged .shape-3d {
    animation: textDragged3D 0.5s ease-in-out infinite alternate;
}

@keyframes textDragged3D {
    0% { 
        transform: scale(1.4) rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
    100% { 
        transform: scale(1.5) rotateX(15deg) rotateY(15deg) rotateZ(10deg); 
    }
}

/* Text throw effects */
.number-object.just-thrown .shape-3d,
.letter-object.just-thrown .shape-3d {
    animation: textThrown3D 1.2s ease-out;
}

@keyframes textThrown3D {
    0% { 
        transform: scale(1.3) rotateX(1080deg) rotateY(1080deg) rotateZ(720deg); 
    }
    50% {
        transform: scale(1.1) rotateX(540deg) rotateY(540deg) rotateZ(360deg); 
    }
    100% { 
        transform: scale(1) rotateX(0deg) rotateY(0deg) rotateZ(0deg); 
    }
}

/* Text hover effects */
.number-object:hover .text-content,
.letter-object:hover .text-content {
    text-shadow: 
        0 0 10px rgba(255, 176, 0, 0.8),
        3px 3px 6px rgba(0,0,0,0.6);
}

.number-object:hover .shape-3d,
.letter-object:hover .shape-3d {
    animation: textHover3D 0.6s ease-in-out infinite alternate;
}

@keyframes textHover3D {
    0% { transform: scale(1.05) rotateY(0deg); }
    100% { transform: scale(1.1) rotateY(10deg); }
}

@keyframes float3D {
    0%, 100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg); 
    }
    25% { 
        transform: translateY(-10px) rotateX(5deg) rotateY(5deg); 
    }
    50% { 
        transform: translateY(-20px) rotateX(0deg) rotateY(10deg); 
    }
    75% { 
        transform: translateY(-10px) rotateX(-5deg) rotateY(5deg); 
    }
}

/* Drag states */
.floating-object.being-dragged {
    cursor: grabbing;
    filter: drop-shadow(0 0 25px rgba(255, 176, 0, 0.8)) 
            drop-shadow(0 0 40px rgba(255, 66, 0, 0.6));
    z-index: 1000;
    animation: draggedPulse 0.5s ease-in-out infinite alternate;
}

.floating-object.being-dragged .shape-3d {
    animation: dragged3D 0.5s ease-in-out infinite alternate;
}

@keyframes dragged3D {
    0% { 
        transform: scale(1.3) rotateX(0deg) rotateY(0deg); 
    }
    100% { 
        transform: scale(1.4) rotateX(10deg) rotateY(10deg); 
    }
}

.floating-object.just-thrown {
    filter: drop-shadow(0 0 20px rgba(125, 160, 48, 0.7)) 
            drop-shadow(0 0 15px rgba(255, 153, 204, 0.5));
    animation: thrownTrail 1s ease-out;
}

.floating-object.just-thrown .shape-3d {
    animation: thrown3D 1s ease-out;
}

@keyframes thrown3D {
    0% { 
        transform: scale(1.2) rotateX(720deg) rotateY(720deg); 
    }
    100% { 
        transform: scale(1) rotateX(0deg) rotateY(0deg); 
    }
}

/* Click feedback animation */
.floating-object.clicked-feedback {
    animation: clickedPulse 0.6s ease-out;
    filter: drop-shadow(0 0 30px rgba(255, 176, 0, 0.9)) 
            drop-shadow(0 0 15px rgba(255, 66, 0, 0.7));
}

@keyframes hoverPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes draggedPulse {
    0% { 
        filter: drop-shadow(0 0 25px rgba(255, 176, 0, 0.8)) 
                drop-shadow(0 0 40px rgba(255, 66, 0, 0.6));
    }
    100% { 
        filter: drop-shadow(0 0 35px rgba(255, 176, 0, 1)) 
                drop-shadow(0 0 50px rgba(255, 66, 0, 0.8));
    }
}

@keyframes thrownTrail {
    0% { 
        filter: drop-shadow(0 0 20px rgba(125, 160, 48, 0.7)) 
                drop-shadow(0 0 15px rgba(255, 153, 204, 0.5));
    }
    100% { 
        filter: drop-shadow(0 0 10px rgba(242, 242, 231, 0.3));
    }
}

@keyframes clickedPulse {
    0% { 
        transform: scale(1); 
        filter: drop-shadow(0 0 30px rgba(255, 176, 0, 0.9)) 
                drop-shadow(0 0 15px rgba(255, 66, 0, 0.7));
    }
    25% { 
        transform: scale(1.3) rotate(10deg); 
        filter: drop-shadow(0 0 40px rgba(255, 176, 0, 1)) 
                drop-shadow(0 0 25px rgba(255, 66, 0, 0.9));
    }
    50% { 
        transform: scale(1.1) rotate(-5deg); 
        filter: drop-shadow(0 0 35px rgba(255, 176, 0, 0.8)) 
                drop-shadow(0 0 20px rgba(255, 66, 0, 0.6));
    }
    75% { 
        transform: scale(1.15) rotate(3deg); 
        filter: drop-shadow(0 0 25px rgba(255, 176, 0, 0.6)) 
                drop-shadow(0 0 15px rgba(255, 66, 0, 0.4));
    }
    100% { 
        transform: scale(1); 
        filter: drop-shadow(0 0 15px rgba(255, 176, 0, 0.4));
    }
}

/* Environment Controls */
#environment-controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

.control-btn {
    width: var(--control-size);
    height: var(--control-size);
    border: 2px solid var(--accent);
    background: rgba(29, 29, 27, 0.9);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--color-orange);
    color: var(--bg-primary);
    border-color: var(--color-orange);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.5);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Info Panel */
#info-panel {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: var(--panel-width);
    background: rgba(29, 29, 27, 0.9);
    border: 1px solid var(--accent-transparent);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
    z-index: 200;
    max-height: 300px;
    overflow-y: auto;
}

.info-content h3 {
    color: var(--color-orange);
    font-size: 1.2rem;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--accent-transparent);
    padding-bottom: 5px;
}

.info-content p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
    color: var(--accent);
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    font-size: 0.8rem;
    color: var(--accent);
    padding: 3px 0;
    position: relative;
    padding-left: 15px;
}

.features-list li::before {
    content: "◦";
    position: absolute;
    left: 0;
    color: var(--color-orange);
}

.interaction-hint {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 176, 0, 0.1);
    border: 1px solid rgba(255, 176, 0, 0.3);
    border-radius: 5px;
    text-align: center;
}

.interaction-hint small {
    color: var(--color-orange);
    font-weight: bold;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Performance Stats */
#performance-stats {
    position: fixed;
    top: var(--header-height);
    right: 30px;
    background: rgba(29, 29, 27, 0.9);
    border: 1px solid var(--accent-transparent);
    border-radius: 5px;
    padding: 10px;
    font-size: 0.8rem;
    color: var(--accent);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    gap: 15px;
}

#performance-stats.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --control-size: 40px;
        --panel-width: 250px;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.8rem;
    }
    
    #info-panel {
        width: calc(100vw - 60px);
        max-width: var(--panel-width);
    }
    
    #environment-controls {
        bottom: 20px;
        right: 20px;
        flex-direction: row;
        gap: 8px;
    }
    
    .floating-object {
        /* Reduce complexity on mobile */
        filter: drop-shadow(0 0 5px rgba(242, 242, 231, 0.2));
    }
}

@media (max-width: 480px) {
    #site-header {
        padding: 0 15px;
    }
    
    #info-panel {
        bottom: 15px;
        left: 15px;
        padding: 15px;
    }
    
    #environment-controls {
        bottom: 15px;
        right: 15px;
    }
    
    .control-btn {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .floating-object,
    .control-btn,
    .loading-content {
        animation: none;
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --accent: #ffffff;
        --bg-primary: #000000;
    }
    
    .control-btn {
        border-width: 3px;
    }
    
    .floating-object {
        filter: drop-shadow(0 0 2px #ffffff);
    }
}

/* Print styles (hide interactive elements) */
@media print {
    #environment-controls,
    #info-panel,
    #performance-stats,
    #loading-screen {
        display: none;
    }
    
    #main-container {
        background: white;
        color: black;
    }
}

/* Additional animations for enhanced 3D effect */
@keyframes floatAnimation {
    0%, 100% { transform: translateY(0px) rotateX(0deg); }
    50% { transform: translateY(-20px) rotateX(5deg); }
}

.floating-object.enhanced-float {
    animation: floatAnimation 4s ease-in-out infinite;
}

/* Particle effect for background ambiance */
.floating-space::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20% 30%, rgba(255, 176, 0, 0.3), transparent),
        radial-gradient(1px 1px at 40% 70%, rgba(255, 66, 0, 0.2), transparent),
        radial-gradient(1px 1px at 90% 40%, rgba(125, 160, 48, 0.2), transparent),
        radial-gradient(1px 1px at 80% 80%, rgba(255, 153, 204, 0.1), transparent);
    background-size: 100px 100px, 150px 150px, 120px 120px, 200px 200px;
    animation: particleMovement 20s linear infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes particleMovement {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10px, -10px); }
    50% { transform: translate(10px, -20px); }
    75% { transform: translate(-20px, 10px); }
    100% { transform: translate(0, 0); }
}