/* Custom Properties for Light and Dark Modes */
:root {
    --bg-color: #f5f5f7;
    --bg-card: #ffffff;
    --bg-nav: rgba(245, 245, 247, 0.8);
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #0066cc;
    --accent-hover: #0044aa;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.04);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
    --transition-speed: 0.4s;
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --bg-color: #000000;
    --bg-card: #1c1c1e;
    --bg-nav: rgba(0, 0, 0, 0.8);
    --text-color: #f5f5f7;
    --text-secondary: #86868b;
    --accent-color: #2997ff;
    --accent-hover: #54a9ff;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.5;
    transition: background-color var(--transition-speed) var(--transition-curve), 
                color var(--transition-speed) var(--transition-curve);
    overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.1;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* Container */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header & Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-speed) var(--transition-curve),
                border-color var(--transition-speed) var(--transition-curve);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}

nav a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

nav a:hover {
    color: var(--text-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text-color);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Hero Section */
.hero {
    min-height: calc(100vh - 52px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 6rem;
    padding-bottom: 8rem;
    position: relative;
}

.hero-subtitle {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    font-weight: 600;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    max-width: 900px;
    margin-bottom: 2.5rem;
    letter-spacing: -0.03em;
}

.hero-description {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 760px;
    line-height: 1.4;
    letter-spacing: -0.015em;
    margin-bottom: 5rem;
}

/* Scroll Indicator */
.hero-scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: color 0.3s ease, opacity 0.3s ease;
    z-index: 10;
}

.hero-scroll-indicator:hover {
    color: var(--text-color);
}

.hero-scroll-indicator svg {
    width: 20px;
    height: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Safety for small height layouts */
@media (max-height: 680px) {
    .hero {
        min-height: auto;
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
    .hero-scroll-indicator {
        position: relative;
        bottom: auto;
        margin-top: 3rem;
    }
}

/* Section Header */
.section-header {
    margin-bottom: 3.5rem;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Work / Projects Grid */
.work-section {
    padding: 6rem 0;
    border-top: 1px solid var(--border-color);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
}

.project-card {
    background-color: var(--bg-card);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 380px;
    box-shadow: 0 4px 30px var(--shadow-color);
    transition: transform var(--transition-speed) var(--transition-curve),
                border-color var(--transition-speed) var(--transition-curve),
                box-shadow var(--transition-speed) var(--transition-curve);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--text-secondary);
    box-shadow: 0 10px 40px var(--shadow-color);
}

/* Mesh Gradient Backgrounds for Cards to look like Apple pages */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.project-card:hover::before {
    opacity: 0.08;
}

/* Custom gradients for each project card */
.card-cid::before { background: radial-gradient(circle at top right, #ff3b30, transparent 60%); }
.card-evtol::before { background: radial-gradient(circle at top right, #34c759, transparent 60%); }
.card-robot::before { background: radial-gradient(circle at top right, #af52de, transparent 60%); }
.card-sickness::before { background: radial-gradient(circle at top right, #5ac8fa, transparent 60%); }
.card-quartier::before { background: radial-gradient(circle at top right, #ffcc00, transparent 60%); }
.card-rehab::before { background: radial-gradient(circle at top right, #00c7be, transparent 60%); }

/* Dynamic Card Background Images */
.project-card.card-has-bg {
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-card.card-has-bg .project-tag,
.project-card.card-has-bg h3,
.project-card.card-has-bg p,
.project-card.card-has-bg .project-org,
.project-card.card-has-bg .project-link {
    color: #ffffff !important;
}

.project-card.card-has-bg .project-link svg {
    stroke: #ffffff !important;
}

.card-robot-bg {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.75) 100%), url('assets/Project_SoundOfSilence/Project_the_sound_of_silence.jpeg');
    background-size: cover;
    background-position: center;
}

.card-sickness-bg {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.75) 100%), url('assets/Project_SimulatorSusceptibility/Project_Simulator_Sickness.jpg');
    background-size: cover;
    background-position: center;
}

.card-cid-bg {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.75) 100%), url('assets/Project_VerticalCID/Project_vertical_CID.png');
    background-size: cover;
    background-position: center;
}

.project-card-header {
    z-index: 1;
}

.project-tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: inline-block;
}

.project-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.project-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 90%;
}

.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    z-index: 1;
}

.project-link {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.project-link svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.project-card:hover .project-link svg {
    transform: translateX(4px);
}

.project-org {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Experience Section */
.experience-section {
    padding: 6rem 0;
    border-top: 1px solid var(--border-color);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    height: 100%;
    width: 1px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 3.5rem;
    padding-left: 50px;
}

.timeline-dot {
    position: absolute;
    left: 16px;
    top: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--bg-color);
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.timeline-item h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.timeline-item h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.timeline-item ul {
    list-style-type: none;
}

.timeline-item li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 15px;
}

.timeline-item li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.sub-roles {
    margin-top: 1.5rem;
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
}

.sub-role {
    margin-bottom: 1.5rem;
}

.sub-role:last-child {
    margin-bottom: 0;
}

/* About Section */
.about-section {
    padding: 6rem 0;
    border-top: 1px solid var(--border-color);
}

.about-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 4rem;
    align-items: start;
}

.about-image-wrapper {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px var(--shadow-color);
}

.about-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform var(--transition-speed) var(--transition-curve);
}

.about-image-wrapper:hover .about-image {
    transform: scale(1.03);
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.about-text p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Skills Grid */
.skills-container {
    margin-top: 2.5rem;
}

.skills-container h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tag {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.skill-tag:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Contact / Footer Section */
.contact-section {
    padding: 8rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.contact-section h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.contact-section p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem auto;
}

.contact-email {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-color);
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 0.25rem;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.contact-email:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.contact-details {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

footer {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: none;
    opacity: 0;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 1160px;
    max-height: 85vh;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    overflow-y: auto;
    z-index: 210;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s var(--transition-curve);
}

.modal.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Content Wrapper to keep text reading width centered */
.modal-content-wrapper {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}

/* Modal Navigation Arrows */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    z-index: 220;
    padding: 0;
}

.modal-nav:hover {
    background-color: var(--border-color);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav svg {
    width: 20px;
    height: 20px;
    fill: none;
}

.modal-nav-prev {
    left: 2rem;
}

.modal-nav-next {
    right: 2rem;
}

/* Nav Label tooltip */
.modal-nav .nav-label {
    position: absolute;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    top: 50%;
    transform: translateY(-50%);
}

.modal-nav-prev .nav-label {
    left: 60px;
    transform: translateY(-50%) translateX(-10px);
}

.modal-nav-next .nav-label {
    right: 60px;
    transform: translateY(-50%) translateX(10px);
}

.modal-nav:hover .nav-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.modal-close:hover {
    transform: scale(1.1);
    background-color: var(--border-color);
}

.modal-close svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Modal Content Layout */
.modal-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.modal-tag {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    display: inline-block;
}

.modal-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.modal-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-body {
    font-size: 1.05rem;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-body h4 {
    font-size: 1.25rem;
    margin: 2rem 0 1rem 0;
    font-weight: 700;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-body ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.modal-body li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Grid within modal for case study */
.modal-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.modal-grid-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
}

.modal-grid-card h5 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Blockquote */
.modal-quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.2rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-color);
}

/* Scrollbar for modal */
.modal-container::-webkit-scrollbar {
    width: 8px;
}

.modal-container::-webkit-scrollbar-track {
    background: transparent;
}

.modal-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Responsive Styles */
@media (max-width: 900px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .about-image-wrapper {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .hero h1 {
        font-size: 2.8rem;
    }

    .modal-nav {
        width: 40px;
        height: 40px;
    }
    
    .modal-nav-prev {
        left: 1rem;
    }
    
    .modal-nav-next {
        right: 1rem;
    }
    
    .modal-nav .nav-label {
        display: none !important;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 14px;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero-description {
        font-size: 1.25rem;
    }
    
    .project-card {
        padding: 1.8rem;
        min-height: 320px;
    }
    
    .project-card h3 {
        font-size: 1.5rem;
    }
    
    .modal-container {
        padding: 3rem 1.5rem 5rem 1.5rem;
        width: 95%;
    }
    
    .modal-header h2 {
        font-size: 1.8rem;
    }
    
    .modal-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .modal-nav {
        top: auto !important;
        bottom: 1.5rem;
        transform: none !important;
    }
    
    .modal-nav-prev {
        left: 1.5rem;
    }
    
    .modal-nav-next {
        right: 1.5rem;
    }
    
    .modal-nav:hover {
        transform: scale(1.05) !important;
    }
    
    .contact-email {
        font-size: 1.6rem;
    }
}

/* Video Showcase Styles */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
