/* ======== GLOBAL STYLES & VARIABLES ======== */
:root {
    --primary-color: #007bff;
    /* Bright Blue */
    --secondary-color: #333;
    /* Dark/Text Color */
    --background-color: #ffffff;
    --text-color: #444;
    --light-gray: #f4f4f4;
    --dark-button-bg: #1a1a1a;
    /* Dark background for primary CTA */
    --form-bg: #f5f5f5;
    /* Light gray background for form inputs */
}

/* ======== CURSOR RESTORATION & GLOBAL RESET ======== */
body {
    cursor: default;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    /* Prevent horizontal scrollbars */
}

/* Smooth scrolling setup */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

.page-section {
    padding: 60px 20px;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

h1,
h2,
h3 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.section-title-new {
    margin-bottom: 10px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* ======== NAVBAR & MENU ======== */
.navbar {
    background-color: var(--background-color);
    border-bottom: 1px solid var(--light-gray);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-left: 25px;
}

.nav-link {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

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

.hamburger {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
}

/* ======== HERO SECTION & CTA GROUP ======== */
.hero-section {
    height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    background-color: var(--light-gray);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Button Group Styling */
.hero-cta-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.cta-button {
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    min-height: 44px;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

/* Primary Button (View My Work) */
.primary-btn {
    background-color: var(--dark-button-bg);
    color: white;
    border: 2px solid var(--dark-button-bg);
}

.primary-btn:hover {
    background-color: rgb(255, 255, 255);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    color: rgb(0, 0, 0);
}

/* Secondary Button (Contact Me) */
.secondary-btn {
    background-color: var(--background-color);
    color: var(--dark-button-bg);
    border: 2px solid #ccc;
}

.secondary-btn:hover {
    color: white;
    background-color: #000000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Social Icon Styling */
.hero-social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
}

.social-icon {
    font-size: 1.8rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.social-icon:hover {
    color: var(--primary-color);
}

/* =================================== */
/* ===== UPDATED ABOUT SECTION CSS ===== */
/* =================================== */
.section-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto 40px;
}

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

/* 1. The container that sets up the 3D perspective */
.flip-card-container {
    perspective: 1000px;
    /* This creates the 3D effect */
    min-height: 250px;
    /* Give the card a fixed height */
    cursor: pointer;
}

/* 2. Modify the original .about-card to be the rotating element */
.about-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: none;
    padding: 0;
    border: none;
    box-shadow: none;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
}

/* 3. The "tap" (focus) or hover action that flips the card */
.flip-card-container:hover .about-card,
.flip-card-container:focus .about-card {
    transform: rotateY(180deg);
}

/* 4. Style for BOTH faces (front and back) */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    /* Hides the back of the element */
    backface-visibility: hidden;
    background-color: white;
    padding: 30px;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    /* Ensures padding doesn't break layout */
}

/* 5. Style the front face (already facing forward) */
.card-front {
    color: var(--secondary-color);
}

.card-front i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
}

.card-front h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

/* 6. Style the back face (start it flipped) */
.card-back {
    transform: rotateY(180deg);
    background-color: var(--light-gray);
    /* Optional: different bg for back */
    color: var(--secondary-color);
}

.card-back h3 {
    font-size: 1.25rem;
}

.card-back p {
    font-size: 1rem;
    margin: 0;
    /* Remove default paragraph margin */
}

/* 7. Hint text for the user */
.tap-hint {
    font-size: 0.8rem;
    color: #999;
    margin-top: 15px;
    font-style: italic;
}

/* Hide the tap hint on desktop (where hover works) */
@media (min-width: 769px) {
    .tap-hint {
        display: none;
    }
}

/* =================================== */
/* ===== END OF UPDATED SECTION ===== */
/* =================================== */


/* ======== SKILLS SECTION ======== */
#skills {
    background-color: var(--light-gray);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    text-align: center;
    margin-top: 50px;
}

.skill-category {
    text-align: center;
}

.skill-category h3 {
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
    display: inline-block;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
}

.skill-pill {
    background-color: #e9ecef;
    color: #495057;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* =================================== */
/* ===== UPDATED PROJECTS SECTION ===== */
/* =================================== */

/* === ONE-LINE CHANGE HERE === */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

/* Changed minmax(280px, 1fr) to minmax(350px, 1fr) */

.project-card {
    background-color: var(--background-color);
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: grid;
}

.project-card h3 {
    padding: 20px 20px 0;
}

.project-card p {
    padding: 0 20px;
    min-height: 2.5em;
    /* Gives space even if description is short */
    margin-bottom: 15px;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px 20px;
}

.project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    background-color: var(--background-color);
    color: var(--dark-button-bg);
    border: 2px solid #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-btn:hover {
    background-color: var(--dark-button-bg);
    color: white;
    border-color: var(--dark-button-bg);
}

.project-card a {
    text-decoration: none;
}

/* =================================== */
/* === END OF UPDATED PROJECTS SECTION === */
/* =================================== */


/* ======== CONTACT SECTION STYLES ======== */
.contact-container {
    display: flex;
    justify-content: space-between;
    text-align: left;
    gap: 40px;
    margin-top: 40px;
}

.contact-info {
    flex-basis: 35%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.info-card i {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.info-card h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.info-card p {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
}

.info-card a {
    color: #666;
}

.contact-form-wrapper {
    flex-basis: 65%;
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#contact-form input,
#contact-form textarea {
    background-color: var(--form-bg);
    border: none;
    padding: 15px;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-submit-btn {
    width: 100%;
    justify-content: center;
    background-color: var(--dark-button-bg);
    color: white;
    border: none;
}

.form-submit-btn i {
    margin-right: 8px;
    font-size: 1rem;
}

/* ======== FOOTER ======== */
footer {
    text-align: center;
    padding: 20px;
    background-color: var(--secondary-color);
    color: var(--light-gray);
    margin-top: 40px;
}

/* ======== WORD ROTATION ANIMATION ======== */
#rotating-text .word:nth-child(1) {
    color: #000000;
}

#rotating-text .word:nth-child(2) {
    color: #81c48f;
}

#rotating-text .word:nth-child(3) {
    color: #b8a87a;
}

#rotating-text .word:nth-child(4) {
    color: #b9837e;
}

#rotating-text .word:nth-child(5) {
    color: #966ca8;
}

#rotating-text .word:nth-child(6) {
    color: #6c4e47;
}

#rotating-text .word:nth-child(7) {
    color: #8caac9;
}

.typing-container {
    font-size: 2rem;
    margin-bottom: 9px;
    display: flex;
    justify-content: center;
}

.rotating-words-wrapper {
    height: 1.1em;
    overflow: hidden;
    display: inline-block;
    padding-left: 0.5em;
    font-weight: bold;
    transform: translateY(8px);
}

#rotating-text {
    display: inline-block;
    animation: word-slide 10s infinite;
}

.word {
    display: block;
    line-height: 1.1em;
    text-align: left;
}

@keyframes word-slide {
    0% {
        transform: translateY(0);
    }

    10% {
        transform: translateY(0);
    }

    /* Word 1 */
    15% {
        transform: translateY(-1.1em);
    }

    25% {
        transform: translateY(-1.1em);
    }

    /* Word 2 */
    30% {
        transform: translateY(-2.2em);
    }

    40% {
        transform: translateY(-2.2em);
    }

    /* Word 3 */
    45% {
        transform: translateY(-3.3em);
    }

    55% {
        transform: translateY(-3.3em);
    }

    /* Word 4 */
    60% {
        transform: translateY(-4.4em);
    }

    70% {
        transform: translateY(-4.4em);
    }

    /* Word 5 */
    75% {
        transform: translateY(-5.5em);
    }

    85% {
        transform: translateY(-5.5em);
    }

    /* Word 6 */
    90% {
        transform: translateY(-6.6em);
    }

    95% {
        transform: translateY(-6.6em);
    }

    /* Word 7 */
    100% {
        transform: translateY(0);
    }
}


/* ======== RESPONSIVE STYLES (MOBILE OPTIMIZATION) ======== */
@media (max-width: 768px) {

    /* --- Layout Stacking --- */
    .contact-container {
        flex-direction: column;
        gap: 30px;
    }

    .contact-form-wrapper {
        flex-basis: 100%;
        padding: 20px;
    }

    .contact-info {
        flex-basis: 100%;
    }

    .hero-cta-group {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 30px;
    }

    .cta-button {
        width: 100%;
        max-width: 300px;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* --- Mobile Navigation Menu --- */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--background-color);
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 0;
    }

    .nav-menu .nav-link {
        display: block;
        padding: 15px 0;
    }

    .hamburger {
        display: block;
    }

    /* --- Font Size & Readability --- */
    .hero-content h1 {
        font-size: 2rem;
    }

    .typing-container {
        font-size: 1.5rem;
        flex-wrap: wrap;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .page-section h2 {
        font-size: 1.8rem;
    }

    .page-section {
        padding: 40px 15px;
    }

    /* --- Disable Hover Effects on Touch --- */
    .project-card:hover {
        transform: none;
        box-shadow: 0 4px 8px rgba(0, 0, L0.1);
    }

    /* --- Scroll Animation --- */
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(30px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }

    .animate-on-scroll.show {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 👈 This closes the @media query properly */

/* ======== TYPEWRITER EFFECT ======== */
.typewriter-text {
    display: inline-block;
    font-size: 3rem;
    font-weight: bold;
    color: var(--secondary-color);
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    letter-spacing: 1px;
    width: 0;
    animation: typing 3s steps(21, end) forwards, blink 0.8s step-end infinite;
}

/* Smooth typing animation */
@keyframes typing {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

/* Clean blinking cursor */
@keyframes blink {

    0%,
    100% {
        border-color: transparent;
    }

    50% {
        border-color: var(--primary-color);
    }
}

/* Mobile font adjustment */
@media (max-width: 768px) {
    .typewriter-text {
        font-size: 1.5rem;
        /* Reduced from 2rem to fit screen */
        white-space: nowrap;
        animation: typing 3s steps(20, end) forwards, blink 0.8s step-end infinite;
    }

    .typing-container {
        min-height: 2rem;
        /* Prevent layout shift */
    }
}

/* ========================================= */
/* ===== NEW PREMIUM ANIMATIONS ADDED ====== */
/* ========================================= */

/* --- 1. Global Keyframes --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@media (max-width: 768px) {
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translate3d(0, 20px, 0);
            /* Reduced movement for mobile */
        }

        to {
            opacity: 1;
            transform: translate3d(0, 0, 0);
        }
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulseSoft {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.8;
    }
}

@keyframes floatBackground {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-20px, 20px);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* --- 2. Scroll Reveal Classes --- */
.reveal-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays handled in JS or via nth-child if needed, 
   but JS is more robust for dynamic lists. 
   Here are some helper classes for manual staggering if needed. */
.delay-100 {
    transition-delay: 100ms;
}

.delay-200 {
    transition-delay: 200ms;
}

.delay-300 {
    transition-delay: 300ms;
}

/* --- 3. Scroll To Top Button --- */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

#scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scroll-top-btn:hover {
    background-color: var(--dark-button-bg);
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* --- 4. Navbar Premium Effects --- */
.navbar {
    transition: padding 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    padding: 0;
    /* Shrink slightly if original had padding, or just rely on height change */
    background-color: rgba(255, 255, 255, 0.9);
    /* Translucent */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

.nav-link:hover::after {
    width: 100%;
}

/* --- 5. Hero Section Enhancements --- */
.hero-section {
    position: relative;
    overflow: hidden;
    /* Contain the background blobs */
}

/* Subtle animated background blobs */
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 123, 255, 0.03), transparent 60%),
        radial-gradient(circle at 20% 80%, rgba(0, 123, 255, 0.02), transparent 50%);
    animation: floatBackground 15s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Hero Text Animations (Applied via JS classes on load) */
.hero-animate-init {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-delay-1 {
    animation-delay: 0.2s;
}

.hero-delay-2 {
    animation-delay: 0.4s;
}

.hero-delay-3 {
    animation-delay: 0.6s;
}

/* Hero Buttons */
.cta-button {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.3s ease,
        background-color 0.3s ease,
        color 0.3s ease;
}

.cta-button:hover {
    transform: scale(1.05);
}

.cta-button:active {
    transform: scale(0.95);
}

/* --- 6. Skills & Micro-interactions --- */
.skill-pill {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.3s ease,
        background-color 0.3s ease;
    display: inline-block;
    /* Ensure transform works */
}

.skill-pill:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: white;
    /* Slight contrast */
}

.skill-pill:active {
    transform: scale(0.95);
}

/* --- 7. Project Cards Premium Hover --- */
.project-card {
    /* Existing transition is good, enhancing it */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.project-card img {
    transition: transform 0.5s ease;
}

.project-card:hover img {
    transform: scale(1.03);
}

.project-btn {
    transition: all 0.3s ease;
}

.project-btn:active {
    transform: scale(0.95);
}

/* --- 8. Contact & Footer --- */
.social-icon {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-3px) rotate(8deg);
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    border: 1px solid var(--primary-color);
    /* Fallback if no border originally */
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background-color: white;
    transition: all 0.3s ease;
}

/* --- 9. Mobile Optimizations --- */
@media (max-width: 768px) {
    .project-card:hover {
        transform: none;
        /* Disable heavy hover on mobile */
    }

    .project-card:active {
        transform: scale(0.98);
        /* Subtle tap effect */
    }

    .skill-pill:hover {
        transform: none;
    }

    .skill-pill:active {
        transform: scale(0.95);
    }
}

/* ========================================= */
/* ===== PROJECTS SECTION PREMIUM ANIMATIONS ===== */
/* ========================================= */

/* --- A) Scroll Reveal Setup --- */
/* Ensure card is ready for reveal animation */
.project-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.3s ease;
    /* Ensure relative positioning for overlay */
    position: relative;
    /* Ensure overflow hidden for image zoom */
    overflow: hidden;
    will-change: opacity, transform;
}

/* The visible state added by JS */
.project-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- B) Desktop Hover & C) Mobile Active Effects --- */

/* 1. Gradient Overlay */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.1) 60%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
    /* Let clicks pass through */
}

.project-card:hover::before,
.project-card.active-card::before {
    opacity: 1;
}

/* 2. Card Scale & Lift */
.project-card:hover,
.project-card.active-card {
    transform: scale(1.04) translateY(-5px);
    /* Combine scale with existing lift if needed, or just scale */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 2;
    /* Bring to front */
}

/* 3. Image Zoom */
.project-card img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    /* Ensure width is stable */
    display: block;
}

.project-card:hover img,
.project-card.active-card img {
    transform: scale(1.06);
}

/* 4. CTA Button Micro-animations */
/* Target buttons inside the card */
.project-card .project-links {
    position: relative;
    z-index: 3;
    /* Above overlay */
}

.project-card .project-btn {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s ease,
        background-color 0.3s ease,
        color 0.3s ease;
}

.project-card:hover .project-btn,
.project-card.active-card .project-btn {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Desktop Hover specific for buttons */
@media (min-width: 769px) {
    .project-card .project-btn:hover {
        transform: scale(1.05) translateY(-3px);
    }
}

/* Mobile Tap specific for buttons */
@media (max-width: 768px) {
    .project-card .project-btn:active {
        transform: scale(0.95);
    }
}

/* --- Mobile Specific Adjustments --- */
@media (max-width: 768px) {
    .project-card {
        /* Reset any conflicting hover transforms from previous CSS if necessary, 
           but the new classes should take precedence due to specificity or order */
    }

    /* Ensure active state looks good on mobile */
    .project-card.active-card {
        transform: scale(1.02);
        /* Slightly less scale on mobile */
    }
}

/* ========================================= */
/* ===== NEW PROJECT ANIMATIONS (APPENDED) ===== */
/* ========================================= */

/* Initial hidden state */
.project-card {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease;
    will-change: opacity, transform;
}

/* Visible state */
.project-card.project-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Desktop Hover Effects */
@media (min-width: 769px) {
    .project-card:hover {
        transform: translateY(-5px) scale(1.02);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        z-index: 10;
    }

    .project-card:hover img {
        transform: scale(1.05);
        transition: transform 0.5s ease;
    }
}
/* ========================================= */
/* ===== FLIP CARD FIX (MOBILE/DESKTOP) ===== */
/* ========================================= */

/* 1. Outer Container Perspective */
.flip-card-container {
    perspective: 1000px;
}

/* 2. Inner Wrapper 3D Settings */
.about-card {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* 3. Faces Common Styles */
.card-front,
.card-back {
    position: absolute;
    inset: 0; /* Ensures full coverage */
    -webkit-backface-visibility: hidden; /* Safari fix */
    backface-visibility: hidden;
    /* Ensure backgrounds are opaque to prevent bleed-through */
    background-color: white; 
}

/* 4. Front Face (No Rotation) */
.card-front {
    transform: rotateY(0deg) !important;
    z-index: 2;
}

/* 5. Back Face (Pre-rotated) */
.card-back {
    transform: rotateY(180deg) !important;
    z-index: 1;
    background-color: var(--light-gray); /* Restore original bg color */
}

/* 6. Flip State (Class-based) */
.flip-card-container.is-flipped .about-card {
    transform: rotateY(180deg);
}

/* ========================================= */
/* ===== ROBUST FLIP CARD FIX v2 (MOBILE MIRROR FIX) ===== */
/* ========================================= */

/* A) Outer Container */
.flip-card-container {
  perspective: 1800px !important;
  -webkit-perspective: 1800px !important;
  transform-style: preserve-3d !important;
  -webkit-transform-style: preserve-3d !important;
}

/* B) Inner Wrapper */
.about-card {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s ease;
  transform-style: preserve-3d !important;
  -webkit-transform-style: preserve-3d !important;
}

/* C) Faces */
.card-front,
.card-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  transform-style: preserve-3d !important;
  -webkit-transform-style: preserve-3d !important;
}

.card-front {
  transform: rotateY(0deg) !important;
  z-index: 2;
}

.card-back {
  transform: rotateY(180deg) !important;
  z-index: 1;
}

/* D) Enable Flip */
.flip-card-container.is-flipped .about-card {
  transform: rotateY(180deg) !important;
}

/* E) Fix Nested Elements (Safari Mirror Fix) */
.flip-card-container *,
.flip-card-container *::before,
.flip-card-container *::after {
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
}

/* F) Prevent Parent Flattening */
.page-section,
.about-grid {
  transform-style: preserve-3d !important;
  -webkit-transform-style: preserve-3d !important;
}

/* ========================================= */
/* ===== RESTORED ABOUT FLIP CARDS (FIXED) ===== */
/* ========================================= */

/* Grid Layout */
.services-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2.5rem;
    /* Default to 1 column on mobile */
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Card Container */
.service-card {
    background: transparent; /* Inner has bg */
    border-radius: 16px;
    /* box-shadow handled by inner faces or wrapper if needed, 
       but let's put it on the faces or inner to avoid flat look */
    position: relative;
    perspective: 1600px;
    -webkit-perspective: 1600px;
    height: 220px; /* Fixed height for consistency */
    cursor: pointer;
}

/* Inner Wrapper */
.service-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    border-radius: 16px;
}

/* Faces */
.service-card-front,
.service-card-back {
    position: absolute;
    inset: 0;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

.service-card-front {
    transform: rotateY(0deg);
    z-index: 2;
}

.service-card-back {
    transform: rotateY(180deg);
    background: #f8f9fa; /* Slightly different bg for back */
    z-index: 1;
}

/* Icon & Text Styling */
.service-icon {
    font-size: 2.5rem;
    color: var(--primary-color, #007bff);
    margin-bottom: 1rem;
}

.service-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.service-hint {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Flip State */
.service-card.is-flipped .service-card-inner {
    transform: rotateY(180deg);
}

/* Mobile Mirror Fix (Global for this component) */
.service-card *,
.service-card *::before,
.service-card *::after {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
