/* CSS Design System */
:root {
    --primary-color: #61432b;
    --secondary-color: #92817A;
    --bg-light: #f1e3d3;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #3e2819;
    --text-muted: #775d4d;
    --glass-border: rgba(54, 36, 23, 0.1);
    --font-family: 'Outfit', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--secondary-color));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden;
}

nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 10vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(209, 150, 83, 0.804);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 42px;
    width: auto;
    border-radius: 6px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

header {
    min-height: 95vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-light);
    text-align: center;
    padding: 80px 20px 40px;
}

.hero-image-container {
    perspective: 1200px;
    margin-bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    will-change: transform, opacity;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s cubic-bezier(0.23, 1, 0.32, 1) 0.5s forwards;
}

.hero-image-reel {
    display: flex;
    gap: 20px;
    align-items: center;
    transform-style: preserve-3d;
    transform: rotateX(10deg);
}

.hero-img-wrapper {
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: z-index 0s; /* Instant pop to front */
    border-radius: 20px;
    overflow: hidden;
    background: transparent;
    border: none;
    backface-visibility: hidden;
}

.hero-img-wrapper:hover {
    z-index: 50;
}

.hero-img {
    width: 380px;
    height: 240px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    background: white;
    pointer-events: none; /* Let wrapper handle interactions */
    display: block;
}

.hero-img-wrapper:nth-child(1) .hero-img {
    transform: translateZ(-30px) rotateY(20deg);
}

.hero-img-wrapper:nth-child(2) .hero-img {
    transform: translateZ(20px) scale(1.05);
}

.hero-img-wrapper:nth-child(3) .hero-img {
    transform: translateZ(-30px) rotateY(-20deg);
}

.hero-img-wrapper:hover .hero-img {
    transform: translateZ(120px) scale(1.2) rotate(0) !important;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.25);
}

@media (max-width: 1100px) {
    .hero-image-reel {
        gap: -100px;
    }

    .hero-img {
        width: 320px;
        height: auto;
        aspect-ratio: 16/10;
    }

    /* Pull side images toward center on hover for better visibility when overlapped */
    .hero-img-wrapper:nth-child(1):hover .hero-img {
        transform: translateZ(120px) scale(1.1) translateX(60px) rotate(0) !important;
    }

    .hero-img-wrapper:nth-child(3):hover .hero-img {
        transform: translateZ(120px) scale(1.1) translateX(-60px) rotate(0) !important;
    }
}

@media (max-width: 768px) {
    .hero-image-reel {
        flex-direction: column;
        gap: 20px;
        transform: none;
    }
    
    .hero-img {
        width: 80vw;
        height: auto;
        aspect-ratio: 16/10;
        transform: none !important;
    }
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 10px 0 15px;
    padding: 20px 0 0;
}

.typewriter-prompt {
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 5px;
}

.typewriter-cursor {
    font-weight: 300;
    color: var(--primary-color);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 600px;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s ease 0.3s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    padding: 70px 10vw;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    margin-top: 30px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

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

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

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card-bg);
    font-size: 1.0rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 24px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.5s ease,
        border-color 0.5s ease;
    overflow: hidden;
    position: relative;
    cursor: default;
    will-change: transform, box-shadow;
}

/* Scroll Reveal States */
.reveal-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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



.card:hover:not(.expanded) {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

/* Expansion Logic */
/* Expansion Logic - FLIP / Overlay */
.project-card {
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: var(--card-bg);
    z-index: 1;
}

/* The placeholder that keeps the grid structure intact */
.project-card-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* The expanding card in its fixed state */
.project-card.fixed-expanding {
    position: fixed;
    z-index: 1000;
    margin: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    /* Prevent text glitching during transition */
    will-change: top, left, width, height, border-radius, transform;
    transition: top 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        left 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        border-radius 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Overlay backdrop */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(241, 218, 191, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Inner content transition */
.case-study-content {
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease 0.2s;
    /* Delayed fade in */
}

.project-card.expanded .case-study-content {
    opacity: 1;
    height: auto;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--glass-border);
    /* Allow content to scroll if needed within the fixed card */
    overflow-y: auto;
    max-height: calc(70vh - 150px);
}

.case-study-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .case-study-grid {
        grid-template-columns: 1fr;
    }
}

.case-study-info h4,
.case-study-tech h4 {
    margin-bottom: 10px;
    color: var(--text-main);
}

.case-study-info p {
    margin-bottom: 20px;
    color: var(--text-muted);
}

.case-study-tech {
    margin-top: 20px;
}

.case-study-info ul,
.case-study-tech ul {
    list-style: none;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.case-study-info ul li,
.case-study-tech ul li {
    background: var(--bg-light);
    border: 1px solid var(--glass-border);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 20px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 10px 20px rgba(54, 36, 23, 0.3);
}

footer {
    padding: 50px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
}