:root {
    /* Material Design 3 Dark Theme Tokens */
    --md-sys-color-background: #121212;
    --md-sys-color-on-background: #E3E3E3;
    --md-sys-color-surface: #1E1E1E;
    --md-sys-color-surface-variant: #2C2C2C; /* Slightly lighter for cards/sections */
    --md-sys-color-on-surface: #E3E3E3;
    --md-sys-color-on-surface-variant: #C4C7C5;
    --md-sys-color-primary: #A8C7FA; /* Google Blue-ish */
    --md-sys-color-on-primary: #062E6F;
    --md-sys-color-primary-container: #0842A0;
    --md-sys-color-on-primary-container: #D3E3FD;
    --md-sys-color-secondary: #7Cacf8;
    --md-sys-color-outline: #8E918F;
    
    /* Typography */
    --font-family-base: 'Roboto', sans-serif;
    --font-family-display: 'Google Sans', 'Roboto', sans-serif;

    /* Spacing & Layout */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --spacing-xxl: 96px;
    
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 28px;
}

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

/* Custom Scrollbar - Google Style Discrete Dark */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent; 
}

::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1); /* Very subtle */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    font-family: var(--font-family-base);
    line-height: 1.8;
    overflow-x: hidden;
}

/* Text with primary color */
.text-violet-smoke {
    color: var(--md-sys-color-primary);
    display: inline-block;
    margin: 0 4px; /* Added spacing around blue text */
}

/* Typography Classes */
.display-large {
    font-family: var(--font-family-display);
    font-size: 64px;
    line-height: 72px;
    font-weight: 400;
    letter-spacing: -0.25px;
    margin-bottom: var(--spacing-md);
}

.display-medium {
    font-family: var(--font-family-display);
    font-size: 48px;
    line-height: 56px;
    font-weight: 400;
    margin-bottom: var(--spacing-md);
}

.headline-small {
    font-family: var(--font-family-display);
    font-size: 28px;
    line-height: 36px;
    font-weight: 400;
    margin-bottom: var(--spacing-sm);
}

.title-large {
    font-family: var(--font-family-display);
    font-size: 24px;
    line-height: 32px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.title-medium {
    font-family: var(--font-family-display);
    font-size: 18px;
    line-height: 26px;
    font-weight: 500;
    letter-spacing: 0.15px;
}

.body-large {
    font-size: 18px;
    line-height: 28px;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.body-medium {
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.25px;
}

.body-small {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.4px;
}

.label-large {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.section-padding {
    padding: var(--spacing-xxl) 0;
}

.text-muted {
    color: var(--md-sys-color-on-surface-variant);
}

.mt-2 { margin-top: var(--spacing-sm); }
.mt-4 { margin-top: var(--spacing-md); }
.mt-6 { margin-top: var(--spacing-xl); }
.mb-4 { margin-bottom: var(--spacing-md); }

/* Header / App Bar */
.top-app-bar {
    background-color: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    transition: box-shadow 0.3s ease;
}

.top-app-bar.scrolled {
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.top-app-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-family-display);
    font-size: 24px;
    font-weight: 500;
    color: var(--md-sys-color-on-background);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-link {
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--md-sys-color-primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--md-sys-color-on-background);
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    padding-top: 130px;
    /* Reserve exactly the image height + a small gap so the art starts right
       after the buttons and ends just before the next section */
    padding-bottom: calc(min(900px, 100%) * 0.3889 - 5*var(--spacing-md));
    min-height: initial;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative; /* Make sure we can position the background */
    overflow: hidden;
}

/* Background illustration anchored to the bottom of hero */
.hero-section::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(900px, 100%);
    height: calc(min(900px, 100%) * 0.3889); /* 900x350 ratio */
    background-image: url('back.png');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: contain;
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

.hero-section .container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    align-items: center;
    max-width: 900px;
    z-index: 1; /* Ensure content is above background */
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 100px;
    font-family: var(--font-family-base);
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.1px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-filled:hover {
    box-shadow: 0 1px 3px 1px rgba(0,0,0,0.3);
    filter: brightness(1.1);
}

.btn-outlined {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-outlined:hover {
    background-color: rgba(168, 199, 250, 0.08);
    border-color: var(--md-sys-color-primary);
}

.btn-text {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    padding: 10px 12px;
}

.btn-text:hover {
    background-color: rgba(168, 199, 250, 0.08);
}

/* Cards & Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Slightly smaller min-width for better mobile fit */
    gap: var(--spacing-lg); /* Reduced gap for better density */
    margin-top: var(--spacing-xl);
}

.card {
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); /* Default subtle shadow */
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.1);
}

.card-media {
    height: 180px; /* Reduced height for shorter cards */
    background-color: #2A2A2A;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-media img {
    transform: scale(1.05);
}

.placeholder-img {
    width: 100%;
    height: 100%;
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    font-weight: bold;
    position: relative;
}

.placeholder-img::after {
    content: attr(data-label);
}

.img-contain {
    object-fit: contain !important;
    padding: 24px; /* Increased padding for cleaner look */
    background-color: #222; /* Slightly darker for icons */
}

.card-content {
    padding: var(--spacing-md); /* Reduced padding */
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm); /* Reduced gap */
    flex-grow: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-header .title-large {
    font-size: 20px; /* Slightly smaller title */
    margin-bottom: 0;
}

.badge {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    white-space: nowrap;
    margin-left: var(--spacing-sm);
}

.card-actions {
    margin-top: auto;
    padding-top: var(--spacing-xs);
    display: flex;
    justify-content: flex-end;
}

/* About Section */
.surface-variant {
    background-color: #1A1A1A;
}

.about-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
}

.accent-text {
    color: var(--md-sys-color-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.feature-list {
    list-style: none;
    margin-top: var(--spacing-lg);
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    color: var(--md-sys-color-on-surface-variant);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.stat-card {
    background-color: var(--md-sys-color-surface);
    padding: var(--spacing-lg); /* Reduced padding */
    border-radius: var(--border-radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card:hover {
    transform: scale(1.02);
}

.stat-card .display-medium {
    color: var(--md-sys-color-primary);
    font-size: 36px; /* Adjusted size */
    margin-bottom: var(--spacing-xs);
}

/* Contact Section */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    margin-top: var(--spacing-xl);
}

.contact-item {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-size: 18px;
    margin-top: 4px;
    display: inline-block;
}

.link:hover {
    text-decoration: underline;
}

.social-links-grid {
    display: grid;
    gap: var(--spacing-md);
}

.social-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    background-color: var(--md-sys-color-surface-variant);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    transition: background-color 0.2s, transform 0.2s;
}

.social-card:hover {
    background-color: #333;
    transform: translateX(8px);
}

.social-icon {
    width: 56px;
    height: 56px;
    background-color: var(--md-sys-color-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-primary);
    flex-shrink: 0;
}

/* Footer */
.footer {
    background-color: #000000;
    padding: var(--spacing-xxl) 0;
    margin-top: var(--spacing-xxl);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-links ul, .footer-projects ul {
    list-style: none;
    margin-top: var(--spacing-md);
}

.footer-links li, .footer-projects li {
    margin-bottom: var(--spacing-sm);
}

.footer a {
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 16px;
}

.footer a:hover {
    color: var(--md-sys-color-primary);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    color: var(--md-sys-color-on-surface-variant);
}

.heart-icon {
    font-size: 16px;
    vertical-align: middle;
    color: #E25555;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    padding: var(--spacing-md);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--md-sys-color-surface);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: var(--border-radius-lg);
    position: relative;
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-overlay.open .modal-container {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: rgba(0,0,0,0.3);
    border: none;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
}

.modal-close-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.modal-content {
    padding: var(--spacing-xl);
    overflow-y: auto;
}

/* Modal Content Styling */
.modal-header-section {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-icon {
    width: 96px;
    height: 96px;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    overflow: hidden;
}

.modal-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-icon .placeholder-img {
    font-size: 10px;
}

.modal-title-group h2 {
    font-family: var(--font-family-display);
    font-size: 42px;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface);
    line-height: 1.1;
}

.modal-year {
    color: var(--md-sys-color-primary);
    font-weight: 500;
    font-size: 18px;
    margin-top: 4px;
    display: block; /* Separate from other inline elements if needed */
    margin-bottom: 8px; /* Spacing below year */
}

.modal-description {
    white-space: pre-line;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--spacing-xl);
    font-size: 18px;
    line-height: 1.7;
}

.modal-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.gallery-item {
    aspect-ratio: 16/9;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    font-size: 14px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-features h3 {
    color: var(--md-sys-color-on-surface);
    margin-bottom: var(--spacing-md);
    font-family: var(--font-family-display);
    font-size: 22px;
}

.modal-features ul {
    list-style: none;
    margin-bottom: var(--spacing-xl);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-sm);
}

.modal-features li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
}

.modal-features li::before {
    content: 'check_circle';
    font-family: 'Material Icons Round';
    color: var(--md-sys-color-primary);
    font-size: 24px;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: var(--spacing-lg);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 32px;
        --spacing-xxl: 64px;
        --spacing-lg: 20px;
    }

    .display-large { font-size: 36px; line-height: 44px; }
    .display-medium { font-size: 30px; line-height: 38px; }
    .headline-small { font-size: 24px; line-height: 32px; }
    
    .top-app-bar { padding: var(--spacing-sm) 0; }
    
    .nav-links {
        display: none; 
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: #1E1E1E;
        flex-direction: column;
        padding: var(--spacing-md);
        box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    }
    
    .nav-links.open {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-section .container {
        padding: 0 var(--spacing-md);
    }
    /* Ensure background starts after buttons on small screens */
    .hero-section {
        padding-bottom: calc(100vw * 0.3889 + var(--spacing-xl));
    }
    
    /* Projects Grid Mobile */
    .projects-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
        gap: var(--spacing-md);
    }
    
    .card-media {
        height: 160px; /* Even shorter images on mobile */
    }
    
    /* About & Contact Mobile */
    .about-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .contact-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .stats-grid {
        gap: var(--spacing-sm);
    }
    
    /* Modal Mobile */
    .modal-container {
        max-height: 95vh;
    }
    
    .modal-gallery {
        grid-template-columns: 1fr;
    }
    
    .modal-header-section {
        flex-direction: column;
        text-align: center;
    }
    
    .modal-title-group h2 {
        font-size: 28px; /* Smaller modal title */
    }
    
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Close Button Adjustment on Mobile */
    .modal-close-btn {
        width: 36px;
        height: 36px;
        top: 12px;
        right: 12px;
    }
    
    .modal-close-btn .material-icons-round {
        font-size: 20px;
    }
    
    .modal-content {
        padding: var(--spacing-md); /* Reduced padding inside modal */
    }
}
