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

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-color);
    padding-bottom: 2rem;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 9rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.9) 0%, rgba(147, 197, 253, 0.7) 25%, rgba(147, 197, 253, 0.5) 50%, rgba(147, 197, 253, 0.2) 75%, transparent 90%);
    filter: blur(25px);
    animation: expandCircle 8s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes expandCircle {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.9;
    }
    50% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0.5;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.25rem;
    opacity: 0.9;
}

.hero-name {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* Portfolio Sections */
.portfolio-section {
    padding: 4rem 2rem;
    background-color: var(--bg-color);
}

.portfolio-section:nth-child(even) {
    background-color: var(--bg-light);
}

#section4 {
    padding-bottom: 5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 3rem;
}

/* Subsections */
.subsection {
    margin-bottom: 4rem;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    padding-bottom: 0.5rem;
}

.subsection:first-child .subsection-title {
    margin-top: 0;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Media Placeholder (for progressive loading) */
.media-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.placeholder-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade-in animation when media loads */
.project-image.media-loaded img,
.project-image.media-loaded video {
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.project-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.project-image {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    overflow: hidden;
    position: relative;
}

.project-image img,
.project-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.project-card-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-image-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.project-image-carousel img,
.project-image-carousel video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-image-carousel img.active,
.project-image-carousel video.active {
    opacity: 1;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    opacity: 0.6;
    font-size: 2.5rem;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-weight: 300;
}

.project-card:hover .carousel-nav {
    opacity: 1;
}

.carousel-nav:hover {
    transform: translateY(-50%) scale(1.1);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.carousel-nav.prev {
    left: 10px;
}

.carousel-nav.next {
    right: 10px;
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-indicator.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

.project-info {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.view-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-details-btn:hover {
    color: var(--secondary-color);
    transform: translateX(3px);
}

.view-details-btn:active {
    transform: translateX(1px);
}

.project-external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
}

.project-external-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.project-external-link:active {
    transform: translateY(0);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background-color: var(--bg-light);
    color: var(--text-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    transition: background-color 0.3s;
}

.close:hover {
    background-color: var(--bg-light);
}

.modal-body {
    padding: 2rem;
}

.modal-body img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.modal-body h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.modal-body p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

#modalDetails {
    margin-top: 1.5rem;
}

.detail-item {
    margin-bottom: 1rem;
}

.detail-item strong {
    color: var(--text-color);
    display: block;
    margin-bottom: 0.25rem;
}

.detail-item span {
    color: var(--text-light);
}

/* Project Detail Page */
.project-detail-section {
    padding: 4rem 2rem;
    min-height: calc(100vh - 200px);
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--secondary-color);
}

.project-detail-content {
    max-width: 900px;
    margin: 0 auto;
}

.project-detail-image {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.project-detail-image img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    display: block;
}

.project-detail-info {
    background: white;
    padding: 2rem;
    padding-bottom: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.project-detail-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.project-detail-description {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.project-detail-details {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Project Detail Sections */
.project-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.project-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.project-section.optional {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.project-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--primary-color);
    border-radius: 2px;
    display: inline-block;
}

.project-section.optional .project-section-title::before {
    background: #10b981;
}

.project-section-content {
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.8;
    margin: 0;
}

.project-bullet-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.project-bullet-list li {
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.8;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.project-bullet-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.3rem;
    line-height: 1.5;
}

.error-message {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.error-message h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.error-message p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Video support in project detail */
.project-media {
    width: 100%;
    height: 600px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.project-media[src*=".mp4"],
.project-media[src*=".webm"],
.project-media[src*=".mov"] {
    object-fit: contain;
    background: #000;
}

/* Detail page carousel */
.project-detail-carousel {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
}

.project-detail-carousel .project-media {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.project-detail-carousel .project-media.active {
    opacity: 1;
}

.project-detail-carousel .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 3rem;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    font-weight: 300;
}

.project-detail-carousel .carousel-nav:hover {
    transform: translateY(-50%) scale(1.1);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.project-detail-carousel .carousel-nav.prev {
    left: 20px;
}

.project-detail-carousel .carousel-nav.next {
    right: 20px;
}

.project-detail-carousel .carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.project-detail-carousel .carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.project-detail-carousel .carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s;
}

.project-detail-carousel .carousel-indicator.active {
    background: white;
    width: 30px;
    border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    .modal-body img {
        height: 250px;
    }

    .project-detail-image img {
        height: 400px;
    }
    
    .project-media {
        height: 400px;
    }
    
    .project-detail-carousel {
        height: 400px;
    }

    .project-detail-title {
        font-size: 2rem;
    }

    .project-detail-description {
        font-size: 1.1rem;
    }

    .project-section-title {
        font-size: 1.25rem;
    }

    .project-section-content {
        font-size: 1rem;
    }

    .project-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .project-section.optional {
        padding: 1rem;
    }
}

