:root {
    /* New Palette */
    --bg-color: #8CB4A4;       /* Main Background */
    --bg-secondary: #EBE0DC;   /* Lighter Background for cards/sections */
    --text-primary: #1F1A19;   /* Almost Black for good contrast */
    --text-secondary: #4D403D; /* Dark Brown-Grey */
    --accent-color: #4A6E60;   /* Darker Accent */
    --border-color: #6D9183;   /* Darker border */
    
    --spacing-unit: 20px;
    --transition-slow: 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-fast: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-color);
    line-height: 1.8;
    hyphens: auto; /* Improve text block layout */
    font-weight: 400; /* Increased weight slightly for better readability on darker bg */
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 5%;
    background-color: transparent;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.4s ease, padding 0.4s ease;
}

header.scrolled {
    background-color: rgba(140, 180, 164, 0.95); /* Matches bg-color */
    padding: 20px 5%;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.logo {
    font-size: 1.4rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 40px;
}

nav a {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 2px;
    position: relative;
    color: var(--text-primary); /* Darker text for visibility */
    font-weight: 500;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--text-primary);
    transition: width var(--transition-fast);
}

nav a:hover, nav a.active {
    color: var(--text-primary);
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

/* Main Layout */
main {
    padding-top: 140px; /* Space for fixed header */
    padding-left: 5%;
    padding-right: 5%;
    padding-bottom: 2%;
    max-width: 1800px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: white;
    padding: 8px;
    z-index: 2000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Accessibility Focus States */
a:focus, button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Typography Helpers */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    padding-bottom: 20px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
}

/* Hero Section */
.hero {
    margin-bottom: 100px;
    position: relative;
}

.hero-image {
    width: 100%;
    height: 80vh;
    overflow: hidden;
    position: relative;
    border-radius: 8px; /* Slight rounding like in PDF cards */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Initial state handled by JS for parallax compatibility */
    transform: scale(1.1); 
    will-change: transform;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px; /* Increased gap for cleaner look */
    margin-bottom: 60px;
}

.project-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    opacity: 0;
    animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-radius: 12px;
    background-color: var(--bg-secondary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Stagger delays */
.project-item:nth-child(1) { animation-delay: 0.2s; }
.project-item:nth-child(2) { animation-delay: 0.4s; }
.project-item:nth-child(3) { animation-delay: 0.6s; }
.project-item:nth-child(4) { animation-delay: 0.8s; }
.project-item:nth-child(5) { animation-delay: 1.0s; }
.project-item:nth-child(6) { animation-delay: 1.2s; }
.project-item:nth-child(7) { animation-delay: 1.4s; }
.project-item:nth-child(8) { animation-delay: 1.6s; }
.project-item:nth-child(9) { animation-delay: 1.8s; }

.project-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.project-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    filter: grayscale(0%);
}

.project-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

.project-item:hover img {
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(140, 180, 164, 0.7); /* Colored overlay instead of dark */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-item:hover .overlay {
    opacity: 1;
}

.overlay h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    letter-spacing: 2px;
    font-weight: 600;
    transform: translateY(10px);
    transition: transform 0.4s ease;
}

.project-item:hover .overlay h3 {
    transform: translateY(0);
}

/* Resume Page */
.resume-section {
    max-width: 900px;
    margin: 0 auto 80px auto;
    background-color: var(--bg-secondary); /* Replaced white */
    padding: 60px;
    border-radius: 16px; /* Rounded corners */
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.resume-block {
    margin-bottom: 50px;
    border-left: 3px solid var(--accent-color);
    padding-left: 30px;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

.resume-block:nth-child(1) { animation-delay: 0.2s; }
.resume-block:nth-child(2) { animation-delay: 0.4s; }
.resume-block:nth-child(3) { animation-delay: 0.6s; }

.resume-block h2 {
    font-size: 1.6rem;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    font-weight: 600;
}

.resume-entry {
    margin-bottom: 30px;
}

.resume-entry:last-child {
    margin-bottom: 0;
}

.resume-subtitle {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-top: 5px;
    font-style: italic;
}

.skills-category {
    font-size: 1.3rem;
    margin-bottom: 15px;
    margin-top: 30px;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
    display: inline-block;
}

.skills-category:first-of-type {
    margin-top: 0;
}

.skills-list {
    list-style-type: none;
    padding-left: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.skills-list li {
    position: relative;
    padding-left: 20px;
    font-weight: 500;
}

.skills-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 1.2em;
    line-height: 1;
}

/* Contact Page */
.contact-container {
    max-width: 700px;
    margin: 60px auto;
    text-align: center;
    padding: 60px;
    background-color: var(--bg-secondary); /* Replaced white/cream */
    opacity: 0;
    animation: fadeIn 0.8s ease 0.2s forwards;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.contact-info {
    margin-top: 50px;
}

.contact-info p {
    margin-bottom: 25px;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.contact-info strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.contact-info a {
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color); /* Thicker line */
    transition: all 0.3s ease;
    font-weight: 500;
}

.contact-info a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background-color: rgba(255,255,255,0.2);
}

/* Project Detail Page */
.project-header {
    margin-bottom: 60px;
    text-align: center;
}

.project-title {
    font-size: 3.5rem;
    margin-bottom: 40px; /* Increased margin */
    font-weight: 600;
    opacity: 0;
    animation: fadeIn 1s ease 0.2s forwards;
    color: var(--text-primary);
    letter-spacing: -1px;
    text-align: center; /* Ensure centering without wrapper */
}

.project-hero {
    margin-bottom: 80px;
    opacity: 0;
    animation: fadeIn 1s ease 0.4s forwards;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    position: relative;
    height: 70vh; /* Fixed height for consistent look */
}

.project-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-description {
    max-width: 100%;
    margin: 0 auto 100px auto;
    font-size: 1.15rem;
    line-height: 1.9;
    text-align: justify;
    columns: 2;
    column-gap: 80px;
    opacity: 0;
    animation: fadeIn 1s ease 0.6s forwards;
    background-color: var(--bg-secondary);
    padding: 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.project-description p {
    margin-bottom: 1.5em;
    break-inside: avoid; /* Prevent paragraphs from splitting awkwardly */
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 100px;
}

.gallery-item {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

/* Add stagger for gallery items */
.gallery-item:nth-child(odd) { animation-delay: 0.2s; }
.gallery-item:nth-child(even) { animation-delay: 0.4s; }

.gallery-item h3 {
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 3px solid var(--accent-color);
    padding-left: 10px;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.full-width {
    grid-column: 1 / -1;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--bg-secondary); /* Match cards */
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
    margin-top: 40px;
}

/* Animations Keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        background-color: var(--bg-color); /* Solid bg on mobile */
    }

    main {
        padding-top: 160px; /* Increased padding for mobile header */
    }

    .project-description {
        columns: 1;
        padding: 20px;
        text-align: left; /* Justify can be hard to read on narrow screens */
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 30px; /* Smaller gap on mobile */
    }
    
    .hero-image {
        height: 50vh; /* Smaller hero on mobile */
    }
    
    .project-hero {
        height: 40vh; /* Smaller project hero on mobile */
    }
    
    .section-title {
        font-size: 2rem; /* Smaller section title */
    }

    .project-gallery {
        grid-template-columns: 1fr;
    }
    
    .project-title {
        font-size: 2rem;
    }

    .skills-list {
        grid-template-columns: 1fr;
    }
}
