/* Google Material Inspired Design System */
:root {
    /* Fonts */
    --font-main: 'Open Sans', system-ui, -apple-system, sans-serif;

    /* Light Mode Colors (Default) */
    --bg-body: #ffffff;
    --bg-surface: #f8f9fa;
    /* Google Grey 50 */
    --bg-card: #ffffff;
    --text-main: #202124;
    /* Google Grey 900 */
    --text-muted: #5f6368;
    /* Google Grey 700 */
    --primary: #1a73e8;
    /* Google Blue 600 */
    --primary-hover: #174ea6;
    --accent-gradient: linear-gradient(135deg, #1a73e8, #8ab4f8);
    --card-grad-start: #e8eaed;

    /* Shadows & Radius */
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-full: 9999px;

    /* Transition */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-body: #202124;
    /* Google Dark Background */
    --bg-surface: #303134;
    /* Google Dark Surface */
    --bg-card: #303134;
    --text-main: #e8eaed;
    --text-muted: #9aa0a6;
    --primary: #8ab4f8;
    /* Lighter blue for dark mode */
    --primary-hover: #aecbfa;
    --accent-gradient: linear-gradient(135deg, #8ab4f8, #c58af9);
    --card-grad-start: #202124;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    /* Bold */
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 5rem 0;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease;
}

[data-theme="dark"] header {
    background: rgba(32, 33, 36, 0.8);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    /* Above modal */
}

.hamburger span {
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 2px;
}

/* Hamburger Animation */
.hamburger.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    transform: translateY(-8.5px) rotate(-45deg);
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.theme-toggle:hover {
    background-color: var(--bg-surface);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hero Section */
.hero {
    min-height: 90vh;
    /* Increased height for globe space */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 1100px;
    z-index: 1;
    animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Old hero styles removed (hero-image) */

.hero-title {
    margin-bottom: 1.5rem;
    background: var(--text-main);
    background-clip: text;
    -webkit-background-clip: text;
    font-size: 4rem;
    /* Slightly larger */
}

.hero-subtitle {
    font-size: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Project Grid */
.projects-grid {
    display: grid;
    /* Adjusted to 400px for better balance */
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    margin-top: 4rem;
    perspective: 1000px;
}

.project-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    display: block;
    position: relative;
    opacity: 0;
    /* JS will trigger fade in */
    animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background-color: var(--bg-surface);
    transition: transform 0.5s ease;
}

.project-card:hover .card-image {
    transform: scale(1.03);
}

.card-content {
    padding: 1.5rem 2rem;
}

.card-category {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* About Page */
.about-hero {
    text-align: center;
}

.about-hero h1,
.about-hero p {
    margin-left: auto;
    margin-right: auto;
}

.expertise-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.expertise-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.expertise-item {
    background: linear-gradient(to bottom left, var(--card-grad-start), var(--bg-surface));
    padding: 2rem;
    border-radius: var(--radius-lg);
    transition: transform var(--transition-fast);
}

.expertise-item:hover {
    transform: translateY(-5px);
}

.expertise-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-body);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {

    h1,
    .hero-title {
        font-size: 2.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile Navigation Modal */
    .nav-links {
        display: flex;
        /* Force flex display */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        /* Explicit viewport height */
        background-color: var(--bg-body);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        /* Slightly reduced gap */
        z-index: 1000;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
    }

    .nav-link {
        font-size: 2rem;
        font-weight: 700;
        text-transform: uppercase;
        /* Match user request for capitalized vibe if needed */
        letter-spacing: 0.05em;
    }

    .hamburger {
        display: flex;
    }

    /* Adjust theme toggle in modal */
    .theme-toggle svg {
        width: 32px;
        height: 32px;
    }

    /* Reduce Language Toggle size on mobile so it's not huge like the menu links */
    #lang-toggle {
        font-size: 1.125rem;
        /* 18px */
        font-weight: 600;
    }
}

/* --- Portfolio Case Study System --- */

/* Section Layouts */
.case-section {
    padding: 6rem 0;
    width: 100%;
}

.case-header {
    padding-top: 8rem;
    padding-bottom: 4rem;
}

.case-container {
    max-width: 1100px;
    /* Increased for larger images */
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

.text-center {
    text-align: center;
}

/* Typography for Cases */
.case-title {
    font-size: 4rem;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.case-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 4rem auto;
    font-weight: 400;
}

.case-section-title {
    font-size: 2.5rem;
    /* Distinct from global h2 */
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.case-text p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    /* Optimal reading width handled by parent */
}

.case-content-block {
    margin-bottom: 4rem;
}

/* Image Layouts */
.full-width-image-container {
    width: 100%;
    overflow: hidden;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.full-width-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.large-image-container {
    width: 100%;
    margin-top: 2rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.case-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
}

.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 3rem;
}

.two-col-grid .case-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4/3;
    /* Consistent aspect ratio */
}

/* Mobile Responsiveness for Cases */
@media (max-width: 768px) {
    .case-title {
        font-size: 2.5rem;
    }

    .case-subtitle {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }

    .two-col-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 1.5rem;
    }

    .case-section {
        padding: 4rem 0;
    }
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays handled via nth-child logic if needed, 
   but for now we'll just let them trigger naturally on scroll 
   or add specific classes if we need strict staggering. 
   Natural scroll usually provides enough stagger. */

/* Reduce Motion Preference */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .hero-content,
    .project-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}