/* ===== RUASIS PORTFOLIO - TRIANGLES STYLES ===== */

:root {
    --primary-light: #F3F3F3;
    --primary-dark: #3C3C3C;
    --accent-gray: #646464;
    --light-gray: #B5B5B5;
    --dark-gray: #131313;
    --text-light: #F3F3F3;
    --text-dark: #3C3C3C;
    --text-muted: #B5B5B5;
}

/* ===== CENTER TRIANGLE - 3D CLICK TO BLAST ===== */
.center-triangle {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: min(500px, 80vw);
    height: min(750px, 80vh);
    cursor: pointer;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
    
    /* TRIANGLE IMAGE BACKGROUND */
    background-image: url('../images/triangle-large.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.4));
}

.center-triangle:hover {
    transform: translate(-50%, -50%) scale(1.05) rotateX(5deg) rotateY(5deg);
    filter: drop-shadow(0 25px 80px rgba(0, 0, 0, 0.6)) brightness(1.1);
}

.center-triangle.blast {
    animation: centerTriangleBlast 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes centerTriangleBlast {
    0% {
        transform: translate(-50%, -50%) scale(1) rotateX(0deg) rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotateX(45deg) rotateY(45deg);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0) rotateX(180deg) rotateY(180deg);
        opacity: 0;
    }
}

/* CENTER TRIANGLE TEXT - RESPONSIVE SIZE */
.center-triangle-text {
    font-size: clamp(18px, 4vw, 22px);
    margin-bottom: 10px;
    text-shadow: 
        0 0 50px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(60, 60, 60, 0.7),
        0 3px 6px rgba(0, 0, 0, 0.9),
        0 0 35px rgba(243, 243, 243, 0.3);
    transform: translateZ(10px);
    color: var(--text-light);
    font-weight: 700;
    margin-top: clamp(30px, 8vw, 50px);
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.8));
}

.center-triangle-subtitle {
    font-size: clamp(12px, 3vw, 14px);
    opacity: 0.9;
    font-weight: 400;
    text-shadow: 
        0 0 40px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(60, 60, 60, 0.7),
        0 2px 4px rgba(0, 0, 0, 0.8);
    transform: translateZ(5px);
    color: var(--light-gray);
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.7));
}

/* ===== CORNER TRIANGLES - NAVIGATION ===== */
.navigation-triangles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
}

.triangle {
    position: absolute;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    padding: 0;
    opacity: 0;
    transform: scale(0);
    overflow: visible;
    
    /* 3D ENHANCED TRIANGLES */
    transform-style: preserve-3d;
    perspective: 1000px;
    
    /* TRIANGLE IMAGE BACKGROUND */
    background-image: url('../images/triangle-medium.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.3));
}

/* DESKTOP TRIANGLE SIZES */
@media (min-width: 769px) {
    .triangle {
        width: 280px;
        height: 420px;
    }
}

/* Triangle slide-in animations from center */
.triangle.slide-in {
    animation: triangleSlideIn 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes triangleSlideIn {
    0% {
        opacity: 0;
        transform: translate(var(--start-x), var(--start-y)) scale(0.5) rotateX(90deg) rotateY(45deg);
    }
    50% {
        opacity: 0.8;
        transform: translate(calc(var(--start-x) * 0.5), calc(var(--start-y) * 0.5)) scale(0.8) rotateX(45deg) rotateY(22deg);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotateX(0deg) rotateY(0deg);
    }
}

/* DESKTOP Corner positioning */
@media (min-width: 769px) {
    .triangle.top-left {
        top: 20px;
        left: 20px;
        transform-origin: top left;
        --start-x: calc(50vw - 20px - 140px);
        --start-y: calc(50vh - 20px - 210px);
    }

    .triangle.top-right {
        top: 20px;
        right: 20px;
        transform-origin: top right;
        --start-x: calc(-50vw + 20px + 140px);
        --start-y: calc(50vh - 20px - 210px);
    }

    .triangle.bottom-left {
        bottom: 20px;
        left: 20px;
        transform-origin: bottom left;
        --start-x: calc(50vw - 20px - 140px);
        --start-y: calc(-50vh + 20px + 210px);
    }

    .triangle.bottom-right {
        bottom: 20px;
        right: 20px;
        transform-origin: bottom right;
        --start-x: calc(-50vw + 20px + 140px);
        --start-y: calc(-50vh + 20px + 210px);
    }
}

.triangle:hover {
    transform: scale(1.05) rotateX(5deg) rotateY(5deg);
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.triangle.show {
    opacity: 1;
    transform: scale(1);
}

/* TRIANGLE TEXT - RESPONSIVE SIZE */
.triangle h3 {
    color: var(--text-light);
    margin: 0;
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 700;
    text-shadow: 
        0 0 40px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(60, 60, 60, 0.7),
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(243, 243, 243, 0.3);
    transform: translateZ(5px);
    margin-top: clamp(15px, 5vw, 25px);
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.7));
    letter-spacing: 0.5px;
}

/* ===== TRIANGLE FRAGMENTS FOR BLAST ANIMATION ===== */
.triangle-fragment {
    position: absolute;
    width: 80px;
    height: 120px;
    background-image: url('../images/triangle-small.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transform: translate(-50%, -50%) scale(0);
}

/* ===== BLAST OVERLAY ===== */
.blast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, transparent 0%, transparent 100%);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.blast-overlay.active {
    opacity: 1;
    animation: blastExpand3D 2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes blastExpand3D {
    0% {
        background: radial-gradient(circle at center, 
            rgba(60, 60, 60, 1) 0%, 
            rgba(100, 100, 100, 0.8) 5%, 
            transparent 10%);
        transform: scale(0) rotateZ(0deg);
    }
    50% {
        background: radial-gradient(circle at center, 
            rgba(60, 60, 60, 0.8) 0%, 
            rgba(100, 100, 100, 0.6) 40%, 
            transparent 80%);
        transform: scale(1.5) rotateZ(180deg);
    }
    100% {
        background: radial-gradient(circle at center, 
            transparent 0%, 
            transparent 50%, 
            transparent 100%);
        transform: scale(2) rotateZ(360deg);
    }
}

/* ===== RESPONSIVE DESIGN - FIXED MOBILE OVERLAPPING ===== */
@media (max-width: 768px) {
    .triangle {
        width: min(140px, 25vw);
        height: min(210px, 35vh);
    }

    .center-triangle {
        width: min(300px, 70vw);
        height: min(450px, 70vh);
    }
    
    /* TABLET positioning - more spacing */
    .triangle.top-left {
        top: 15px;
        left: 15px;
        transform-origin: top left;
        --start-x: calc(50vw - 15px - 70px);
        --start-y: calc(50vh - 15px - 105px);
    }

    .triangle.top-right {
        top: 15px;
        right: 15px;
        transform-origin: top right;
        --start-x: calc(-50vw + 15px + 70px);
        --start-y: calc(50vh - 15px - 105px);
    }

    .triangle.bottom-left {
        bottom: 15px;
        left: 15px;
        transform-origin: bottom left;
        --start-x: calc(50vw - 15px - 70px);
        --start-y: calc(-50vh + 15px + 105px);
    }

    .triangle.bottom-right {
        bottom: 15px;
        right: 15px;
        transform-origin: bottom right;
        --start-x: calc(-50vw + 15px + 70px);
        --start-y: calc(-50vh + 15px + 105px);
    }
}

@media (max-width: 480px) {
    .triangle {
        width: min(120px, 30vw);
        height: min(180px, 40vh);
    }

    .center-triangle {
        width: min(240px, 75vw);
        height: min(360px, 75vh);
    }
    
    /* MOBILE positioning - maximum spacing */
    .triangle.top-left {
        top: 10px;
        left: 10px;
        transform-origin: top left;
        --start-x: calc(50vw - 10px - 60px);
        --start-y: calc(50vh - 10px - 90px);
    }

    .triangle.top-right {
        top: 10px;
        right: 10px;
        transform-origin: top right;
        --start-x: calc(-50vw + 10px + 60px);
        --start-y: calc(50vh - 10px - 90px);
    }

    .triangle.bottom-left {
        bottom: 10px;
        left: 10px;
        transform-origin: bottom left;
        --start-x: calc(50vw - 10px - 60px);
        --start-y: calc(-50vh + 10px + 90px);
    }

    .triangle.bottom-right {
        bottom: 10px;
        right: 10px;
        transform-origin: bottom right;
        --start-x: calc(-50vw + 10px + 60px);
        --start-y: calc(-50vh + 10px + 90px);
    }

    .triangle-fragment {
        width: 60px;
        height: 90px;
    }
}

/* ===== LANDSCAPE MOBILE ADJUSTMENTS ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .triangle {
        width: min(100px, 20vw);
        height: min(150px, 30vh);
    }

    .center-triangle {
        width: min(200px, 40vw);
        height: min(300px, 60vh);
    }
    
    /* LANDSCAPE positioning - compact */
    .triangle.top-left {
        top: 5px;
        left: 5px;
        --start-x: calc(50vw - 5px - 50px);
        --start-y: calc(50vh - 5px - 75px);
    }

    .triangle.top-right {
        top: 5px;
        right: 5px;
        --start-x: calc(-50vw + 5px + 50px);
        --start-y: calc(50vh - 5px - 75px);
    }

    .triangle.bottom-left {
        bottom: 5px;
        left: 5px;
        --start-x: calc(50vw - 5px - 50px);
        --start-y: calc(-50vh + 5px + 75px);
    }

    .triangle.bottom-right {
        bottom: 5px;
        right: 5px;
        --start-x: calc(-50vw + 5px + 50px);
        --start-y: calc(-50vh + 5px + 75px);
    }
}

/* ===== VERY SMALL SCREENS (iPhone SE, etc.) ===== */
@media (max-width: 375px) {
    .triangle {
        width: min(100px, 35vw);
        height: min(150px, 45vh);
    }

    .center-triangle {
        width: min(200px, 80vw);
        height: min(300px, 80vh);
    }
    
    /* EXTRA SMALL positioning - prevent overlap */
    .triangle.top-left {
        top: 5px;
        left: 5px;
        --start-x: calc(50vw - 5px - 50px);
        --start-y: calc(50vh - 5px - 75px);
    }

    .triangle.top-right {
        top: 5px;
        right: 5px;
        --start-x: calc(-50vw + 5px + 50px);
        --start-y: calc(50vh - 5px - 75px);
    }

    .triangle.bottom-left {
        bottom: 5px;
        left: 5px;
        --start-x: calc(50vw - 5px - 50px);
        --start-y: calc(-50vh + 5px + 75px);
    }

    .triangle.bottom-right {
        bottom: 5px;
        right: 5px;
        --start-x: calc(-50vw + 5px + 50px);
        --start-y: calc(-50vh + 5px + 75px);
    }
}

/* ===== ACCESSIBILITY ===== */
.triangle:focus,
.center-triangle:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 4px;
}

/* ===== PERFORMANCE ===== */
.triangle,
.center-triangle {
    will-change: transform, filter, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .triangle,
    .center-triangle {
        animation: none;
        transition: opacity 0.3s ease;
    }
    
    .triangle:hover,
    .center-triangle:hover {
        transform: scale(1.02);
    }
}