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

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    overflow: hidden;
    background-color: #050508;
    color: #fff;
}

.background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

.connectors-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.connector-line {
    stroke: url(#neon-gradient);
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    filter: drop-shadow(0 0 5px rgba(0, 200, 255, 0.8));
}

.tiles-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.tile-wrapper {
    position: absolute;
    width: 280px;
    height: 280px;
    perspective: 1200px;
    z-index: 10;
    animation: float 5s ease-in-out infinite;
}

/* Positioning */
.top-left { top: 12%; left: 10%; animation-delay: 0s; }
.top-right { top: 12%; right: 10%; animation-delay: 1.2s; }
.bottom-left { bottom: 12%; left: 10%; animation-delay: 2.4s; }
.bottom-right { bottom: 12%; right: 10%; animation-delay: 3.6s; }

.tile {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

.tile:hover {
    transform: scale(1.1) translateY(-5px) translateZ(30px);
}

.tile-wrapper:hover {
    animation-play-state: paused;
}

.tile.flipped {
    transform: rotateY(180deg) scale(1.1);
}

.tile-front, .tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

.tile-back {
    transform: rotateY(180deg);
}

/* Tech Text Styles */
.metallic-text {
    color: #ffffff;
    font-family: 'Monoton', 'Megrim', cursive;
    text-shadow: 0px 3px 6px rgba(0, 0, 0, 1), 0px 0px 12px rgba(0, 200, 255, 0.8);
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    -webkit-text-fill-color: #ffffff;
    background: none;
}

h2.metallic-text {
    font-size: 32px;
    margin-bottom: 15px;
}

p.metallic-text {
    font-size: 15px;
    font-weight: 400;
    font-family: 'Wallpoet', 'Outfit', sans-serif;
    letter-spacing: 1px;
    line-height: 1.6;
    text-transform: none;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    text-shadow: 0px 2px 5px rgba(0, 0, 0, 1), 0px 0px 8px rgba(0, 200, 255, 0.6);
    background: none;
}

/* ECOSYSTEM Sub-tiles */
.sub-tiles-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 20;
}

.sub-tile {
    position: absolute;
    width: 240px;
    height: 140px;
    margin-top: -70px;
    margin-left: -120px;
    background: transparent;
    border: none;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: auto;
    cursor: pointer;
}

@keyframes shake {
  0% { transform: scale(1.1) translate(1px, 1px) rotate(0deg); }
  10% { transform: scale(1.1) translate(-1px, -2px) rotate(-1deg); }
  20% { transform: scale(1.1) translate(-3px, 0px) rotate(1deg); }
  30% { transform: scale(1.1) translate(3px, 2px) rotate(0deg); }
  40% { transform: scale(1.1) translate(1px, -1px) rotate(1deg); }
  50% { transform: scale(1.1) translate(-1px, 2px) rotate(-1deg); }
  60% { transform: scale(1.1) translate(-3px, 1px) rotate(0deg); }
  70% { transform: scale(1.1) translate(3px, 1px) rotate(-1deg); }
  80% { transform: scale(1.1) translate(-1px, -1px) rotate(1deg); }
  90% { transform: scale(1.1) translate(1px, 2px) rotate(0deg); }
  100% { transform: scale(1.1) translate(1px, -2px) rotate(-1deg); }
}

.sub-tile:hover {
    box-shadow: none;
    border: none;
    animation: shake 0.4s infinite;
}

.sub-tile h3.metallic-text {
    font-size: 20px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.sub-tile p.metallic-text {
    font-size: 13px;
    line-height: 1.4;
}

/* Active ECOSYSTEM State */
.ecosystem-active .sub-tile {
    opacity: 1;
}

.ecosystem-active .sub-tile:nth-child(1) {
    transform: translate(220px, -200px) scale(1);
}
.ecosystem-active .sub-tile:nth-child(2) {
    transform: translate(320px, 0px) scale(1);
}
.ecosystem-active .sub-tile:nth-child(3) {
    transform: translate(220px, 200px) scale(1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .tile-wrapper {
        width: 46vw;
        height: 200px;
    }
    
    .top-left { top: 5%; left: 2%; }
    .top-right { top: 5%; right: 2%; }
    .bottom-left { bottom: 5%; left: 2%; }
    .bottom-right { bottom: 5%; right: 2%; }
    
    h2.metallic-text {
        font-size: 20px;
        letter-spacing: 1px;
    }
    
    p.metallic-text {
        font-size: 10px;
        letter-spacing: 0px;
        line-height: 1.4;
    }
    
    .sub-tile {
        width: 130px;
        height: 90px;
        margin-left: -65px;
        margin-top: -45px;
        padding: 5px;
    }
    
    .sub-tile h3.metallic-text {
        font-size: 12px;
        margin-bottom: 2px;
        letter-spacing: 0px;
    }
    
    .sub-tile p.metallic-text {
        font-size: 8px;
        line-height: 1.2;
    }
    
    .ecosystem-active .sub-tile:nth-child(1) {
        transform: translate(60px, -150px) scale(1);
    }
    .ecosystem-active .sub-tile:nth-child(2) {
        transform: translate(120px, -70px) scale(1);
    }
    .ecosystem-active .sub-tile:nth-child(3) {
        transform: translate(100px, 30px) scale(1);
    }
}
