:root {
    --primary-color: #00aaff;
    --background-color: #12181b;
    --card-background: #1e272e;
    --font-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --body-font: 'Poppins', sans-serif;
}

body {
    font-family: var(--body-font);
    background-color: var(--background-color);
    color: var(--font-color);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body:has(.card-scene) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    z-index: -1;
    filter: brightness(0.2) blur(3px);
    transform: scale(1.05);
}

.grid-item {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.background-grid .grid-item:nth-child(1) { background-image: url('./assets/bgp1.jpeg'); }
.background-grid .grid-item:nth-child(2) { background-image: url('./assets/bgp4.jpg'); }
.background-grid .grid-item:nth-child(3) { background-image: url('./assets/bgp5.png'); }
.background-grid .grid-item:nth-child(4) { background-image: url('./assets/bgp8.jpg'); }
.background-grid .grid-item:nth-child(5) { background-image: url('./assets/bgp2.jpg'); }
.background-grid .grid-item:nth-child(6) { background-image: url('./assets/bgp6.png'); }
.background-grid .grid-item:nth-child(7) { background-image: url('./assets/bgp7.png'); }
.background-grid .grid-item:nth-child(8) { background-image: url('./assets/bgp3.png'); }

.card-scene {
    perspective: 2000px;
    margin: 20px;
}

.business-card {
    width: 600px;
    height: 450px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0;
    transform: translateY(20px);
}

.business-card.loaded {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 1.2s ease-out, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.business-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, #2c3e50, #1e272e);
    box-shadow: 0 15px 35px var(--shadow-color);
    display: flex;
    flex-direction: column;
    padding: 30px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: box-shadow 0.4s ease;
}

.card-face:hover {
    box-shadow: 0 20px 45px var(--shadow-color);
}

.card-front {
    justify-content: space-evenly;
    align-items: center;
    text-align: center;
}

.card-back {
    transform: rotateY(180deg);
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
}

.profile-picture {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    object-fit: cover;
    margin-bottom: 0;
}

.name {
    font-family: var(--body-font);
    font-weight: 700;
    margin: 0;
    font-size: 2.5rem;
    line-height: 1.1;
    color: var(--font-color);
}

.headline {
    margin: 0;
    font-size: 1rem;
    color: #bdc3c7;
}

.click-prompt {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #7f8c8d;
    font-style: italic;
}

.back-text-content {
    width: 100%;
}

.back-text-content h2 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 600;
}

.bio {
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 300;
    margin-bottom: 20px;
}

.highlights {
    width: 100%;
}

.highlights h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--font-color);
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.highlights ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.highlights li {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.highlights li strong {
    font-weight: 600;
    color: #bdc3c7;
}

.button-container {
    display: flex;
    gap: 25px;
    width: 100%;
}

.btn {
    font-family: var(--body-font);
    text-decoration: none;
    background: transparent;
    color: var(--primary-color);
    padding: 10px 5px;
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    flex-grow: 0;
    border: none;
    box-shadow: none;
    transition: color 0.3s ease;
    position: relative;
}

.btn::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
}


.btn:hover {
    color: #fff;
    text-decoration: underline;
    transform: none;
    background: transparent;
}

.page-container {
    padding: 40px 20px;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.page-container h1 {
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5rem;
}

.back-link {
    color: #bdc3c7;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--primary-color);
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}
.projects-header h1 {
    margin: 0;
}
.projects-header .social-links {
    margin: 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.project-card-scene {
    perspective: 1500px;
    height: 450px;
}

.project-card {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.project-card-scene:hover .project-card:not(.is-flipped) {
    transform: scale(1.02) rotateY(-3deg);
}

.project-card.is-flipped {
    transform: rotateY(180deg);
}
.project-card .card-face {
    padding: 0;
    overflow: hidden;
}

.project-image-header {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.project-image-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-text-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100% - 180px);
    box-sizing: border-box;
}
.project-text-content h3 {
    margin-top: 0;
    color: var(--primary-color);
}
.project-text-content p {
    font-size: 0.9rem;
    line-height: 1.6;
    height: 115px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.project-front {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}

.project-back {
    transform: rotateY(180deg);
    justify-content: center;
    align-items: center;
    text-align: center;
}
.project-back .button-container {
    flex-direction: column;
    gap: 15px;
    padding-top: 0;
    align-items: center;
}
.project-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: var(--font-color);
    background-color: #2b3942;
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    transition: all 0.3s ease;
    width: 220px;
    box-sizing: border-box;
}
.project-link-btn i {
    font-size: 1.1rem;
    color: var(--primary-color);
}
.project-link-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
}
.project-link-btn:hover i {
    color: #fff;
}

.tech-stack {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 600;
    margin-top: auto;
    padding-top: 15px;
}

.direct-contact {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: var(--font-color);
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    transition: all 0.3s ease;
    width: 220px;
    text-align: center;
    box-sizing: border-box;
}

.contact-item i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.contact-item span {
    font-size: 1.1rem;
    font-weight: 600;
}
.contact-item small {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.contact-item:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 170, 255, 0.2);
}

.contact-item:hover i {
    color: #fff;
    transform: scale(1.1);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--font-color);
    background-color: var(--card-background);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    transition: all 0.3s ease;
}

.social-btn i {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.social-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
}

.social-btn:hover i {
    color: #fff;
    transform: scale(1.1);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 30px auto;
    color: #7f8c8d;
    max-width: 600px;
}

.divider span {
    padding: 0 15px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
}


.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #444;
}

.contact-intro {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 40px;
}
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #bdc3c7;
}
.form-group input,
.form-group textarea {
    background-color: #2b2b2b;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
    color: var(--font-color);
    font-family: var(--body-font);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.3);
}
.form-btn {
    align-self: center;
    margin-top: 10px;
    cursor: pointer;
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-weight: 600;
}
#form-status {
    text-align: center;
    margin-top: 20px;
    font-weight: 600;
}
#form-status.success {
    color: #2ecc71;
}
#form-status.error {
    color: #e74c3c;
}

@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .background-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }
    .business-card {
        width: 90vw;
        height: 70vw;
        max-width: 500px;
        max-height: 400px;
    }
    .name { font-size: 2rem; }
    .headline { font-size: 0.9rem; }
    .profile-picture { width: 100px; height: 100px; }
    .bio, .highlights li { font-size: 0.85rem; }
    .projects-grid {
        grid-template-columns: 1fr;
    }
    .projects-header {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .business-card {
        height: 80vw;
    }
    .business-card .button-container {
        flex-direction: column;
        gap: 0;
        align-items: flex-start;
    }
    .business-card .btn {
        width: 100%;
        text-align: left;
    }
    .back-text-content h2 {
        font-size: 1.4rem;
    }
    .highlights {
        display: none;
    }
    .bio {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    .direct-contact {
        flex-direction: column;
        align-items: stretch;
    }
    .contact-item {
        width: auto;
    }
}
