/* Base Styles */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

:root {
    --primary: #8be9fd;
    --secondary: #ff79c6;
    --accent: #bd93f9;
    --background: #121212;
    --surface: #1e1e2e;
    --text: #f8f8f2;
    --text-secondary: #aaa;

    --black: #242424;
    --black2: #393e46;
    --green: var(--primary);
    --white: var(--text);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    font-family: "Montserrat", serif;
}

body {
    background: linear-gradient(135deg, var(--background), var(--surface));
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
}

/* Enhanced Header Styles */
header {
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    width: 100%; /* Full width header */
    max-width: 1200px; /* Limit header width on larger screens */
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
            circle at top right,
            rgba(139, 233, 253, 0.1),
            transparent 50%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(189, 147, 249, 0.1),
            transparent 50%
        );
    z-index: -1;
}

.header-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(
        45deg,
        var(--primary),
        var(--secondary),
        var(--accent)
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-shift 6s ease infinite;
    background-size: 200% 200%;
}

.header-description {
    font-size: 1.4rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 3rem;
}

.header-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.btn {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--accent));
    color: var(--surface);
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    -webkit-tap-highlight-color: transparent;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--accent), var(--primary));
    z-index: -1;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.btn:hover::before {
    opacity: 1;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 3D Stats Container (Modified) */
.stats-section {
    padding: 4rem 0;
    perspective: 1200px; /* Increased perspective for better 3D effect */
    width: 100%; /* Full width section */
    display: flex;
    justify-content: center;
}

.stats-container {
    display: flex;
    transform-style: preserve-3d;
    transform: rotateY(30deg) rotateX(15deg); /* Adjusted rotation */
    gap: 20px; /* Increased gap between stat boxes */
    scale: 0.8; /* Slightly smaller scale */
    max-width: 1200px; /* Limit container width */
    width: 90%; /* Take up most of the section width */
    justify-content: center; /* Center stats boxes horizontally */
}

.stat-block {
    /* Container for each statistic (requests, features, etc.) */
    display: flex;
    gap: 5px; /* Gap between digit boxes within a stat */
    flex-direction: row; /* Arrange digit boxes horizontally */
    transform-style: preserve-3d;
    align-items: center; /* Align items vertically in the stat block */
}

.stats-box {
    position: relative;
    width: 50px; /* Width for each digit box */
    aspect-ratio: 1;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out; /*Smoother and faster transition*/
    /*Set a default transform, avoids initial flash*/
    transform: rotateX(0deg);
}

.stats-box::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--black);
    transform-origin: left;
    transform: rotateY(90deg) translateX(-50%); /*Corrected translateX*/
}
.stats-box::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--black);
    transform-origin: bottom;
    transform: rotateX(90deg) translateY(50%); /*Corrected translateY*/
}

.stats-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        360deg,
        var(--black2),
        var(--black)
    ); /* Darker surface */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /*Still needed*/
    font-size: 2rem;
    font-weight: bold;
    color: var(--white);
    transform-style: preserve-3d;
    /* Corrected transform.  Now uses consistent translateZ */
    transform: rotateX(calc(var(--i) * 90deg)) translateZ(calc(0.5 * 50px));
}

.stats-face span {
    font-size: 0.8rem; /* Smaller font size for label */
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: normal; /* Adjust font weight for label */
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: 10px; /* Space between digits and label */
    white-space: nowrap; /* Prevent label from wrapping */
}
/* Enhanced Features Section */
.features {
    padding: 6rem 0;
    background: linear-gradient(to bottom, transparent, rgba(30, 30, 46, 0.5));
    width: 100%; /* Full width section */
    max-width: 1200px; /* Limit section width on larger screens */
    margin: 0 auto; /* Center section horizontally */
}

.features-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
}

.feature-card {
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* Enhanced Projects Section */
.projects {
    padding: 6rem 0;
    background: linear-gradient(to top, transparent, rgba(30, 30, 46, 0.5));
    width: 100%; /* Full width section */
    max-width: 1200px; /* Limit section width on larger screens */
    margin: 0 auto; /* Center section horizontally */
}

.projects-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    background: linear-gradient(45deg, var(--secondary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
}

.project-card {
    background: rgba(30, 30, 46, 0.8);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--secondary);
}

.project-title {
    font-size: 1.5rem;
    color: var(--primary);
}

.project-description {
    color: var(--text-secondary);
    flex-grow: 1;
}

.project-link {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    border-radius: 10px;
    color: var(--surface);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center; /* Center text in link */
    -webkit-tap-highlight-color: transparent;
}

.project-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Footer Section */
footer {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8rem;
    width: 100%; /* Full width footer */
    max-width: 1200px; /* Limit footer width on larger screens */
    margin-left: auto;
    margin-right: auto; /* Center footer horizontally */
}

footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary);
}

/* Animations */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-title {
        font-size: 3rem;
    }

    .header-description {
        font-size: 1.2rem;
        padding: 0 1rem;
    }

    .header-buttons {
        flex-direction: column;
        padding: 0 2rem;
    }

    .stats-container {
        flex-direction: column; /* Stack stats on smaller screens */
        align-items: center; /* Center items when stacked */
        transform: none; /* Remove rotation on smaller screens */
    }
    .stat-block {
        flex-direction: row; /* Keep digits in a row */
        margin-bottom: 20px; /* Add spacing between stat blocks */
    }
    .stats-box {
        width: 40px; /* Smaller digit boxes for smaller screens */
        /* height: 40px; No need to set height, as aspect-ratio is 1*/
    }
    .stats-box::before {
        transform: rotateY(90deg) translateX(-50%); /* Adjusted translateX */
    }

    .stats-box::after {
        transform: rotateX(90deg) translateY(50%); /* Adjusted translateY */
    }

    .stats-face {
        font-size: 1.6rem; /* Smaller digit font size */
        transform: rotateX(calc(var(--i) * 90deg)) translateZ(20px); /* Adjusted translateZ */
    }

    .stats-face span {
        font-size: 0.7rem; /* Smaller label font size */
    }

    .features-grid,
    .projects-grid {
        grid-template-columns: 1fr;
        padding: 0 2rem;
    }
}

@media (max-width: 480px) {
    .stats-box {
        width: 30px;
        /* Removed height because aspect-ratio handles it */
    }

    .stat-block .stat-label {
        font-size: 0.9rem; /* Potentially reduce font size further */
    }

    .stats-face {
        font-size: 1.4rem;
        transform: rotateX(calc(var(--i) * 90deg)) translateZ(15px); /* Adjusted translateZ */
    }

    .stats-box::before {
        transform: rotateY(90deg) translateX(-50%);
    }

    .stats-box::after {
        transform: rotateX(90deg) translateY(50%);
    }
}
