@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-primary: #38bdf8;
    --accent-secondary: #818cf8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Add a subtle background gradient mesh */
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(129, 140, 248, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Header & Navigation (Glassmorphism) */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 2rem;
    height: 70px;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

a {
    text-decoration: none;
}

/* Active Nav state */
a.active .nav-btn {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.1);
}

/* Language Selector */
.lang-selector {
    position: absolute;
    right: 2rem;
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.lang-btn {
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    background-color: var(--accent-primary);
    color: #fff;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

/* Main Content Container */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 100px 2rem 4rem; /* Top padding accounts for fixed header */
    width: 100%;
}

.content-section {
    padding: 3rem;
    width: 100%;
    max-width: 1000px;
    animation: fadeIn 0.6s ease-out forwards;
}

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

/* Profile Image */
.profile-container {
    display: flex;
    justify-content: center;
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem auto;
}

.profile-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--glass-border);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
    transition: transform 0.3s ease;
}

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

/* Typography */
h1, h2, h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to bottom right, #ffffff 20%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    width: fit-content;
}

.center-sentence {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.paragraph {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

form label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

form input, form textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

form input:focus, form textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

form textarea {
    min-height: 150px;
    resize: vertical;
}

button[type="submit"] {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-start;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--accent-secondary);
}

/* About Page Specifics */
.show-more, .show-less {
    color: var(--accent-primary);
    cursor: pointer;
    font-weight: 500;
    margin-top: 1rem;
    display: inline-block;
    transition: color 0.3s ease;
}

.show-more:hover, .show-less:hover {
    color: var(--accent-secondary);
}

#fullText p {
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.8;
}

/* Projects Page Specifics */
.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#sort-order {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-main);
    cursor: pointer;
}

#sort-order option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.project {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, background 0.3s ease;
}

.project:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.04);
}

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

.project-info {
    flex: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-info h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.project-info p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-date {
    font-size: 0.875rem !important;
    color: var(--accent-primary) !important;
    font-weight: 500;
}

.project-image-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.project-image {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    object-fit: cover;
}

.project-link-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.project-link-icon:hover {
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .lang-selector {
        position: static;
    }
    
    .project {
        flex-direction: column;
    }
    
    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .title {
        font-size: 2.5rem;
    }
}

/* --- DYNAMIC PROJECTS REDESIGN --- */

/* Projects Grid (Summary Page) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-top: 1rem;
}

@media (max-width: 992px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.app-store-card {
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Prevents card from breaking the CSS grid width */
}

.card-header {
    display: flex;
    align-items: flex-start; /* Align to top so logos stay on the same line */
    gap: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.card-header:hover {
    transform: translateX(10px);
}

.app-logo {
    width: 80px; /* Slightly smaller logo for 2-columns */
    height: 80px;
    border-radius: 22%;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    margin-top: 4px; /* Optically align with text */
}

.app-info {
    flex: 1;
}

.app-info h3 {
    margin-bottom: 0.35rem;
    font-size: 1.3rem; /* Slightly smaller to prevent excessive wrapping */
    color: var(--text-primary);
    line-height: 1.3;
}

.card-header .card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-header .view-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    align-self: center; /* Keep button vertically centered relative to header */
}

.card-header .view-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--accent-primary);
}

.card-gallery-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 auto;
    margin-top: auto; /* This forces the gallery to the bottom, aligning perfectly with other cards in the grid row! */
    max-width: 100%;
    min-width: 0; /* Prevents overflow */
}

.scroll-arrow {
    background: rgba(255, 255, 255, 0.95); /* High contrast white */
    color: #1a1a2e; /* Dark icon for contrast */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Premium drop shadow */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.scroll-arrow:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.scroll-arrow.left {
    left: -18px;
}

.scroll-arrow.right {
    right: -18px;
}

.card-gallery {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar since we have arrows now */
    scrollbar-width: none;
    user-select: none; /* Prevent text selection highlight when swiping blank areas */
}
.card-gallery::-webkit-scrollbar {
    display: none;
}

.gallery-img-wrapper {
    height: 220px; /* Fixed height so they don't get huge */
    width: auto;
    aspect-ratio: 9/16;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden; /* clip the inner img */
}

.gallery-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.gallery-img-wrapper img:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .gallery-img-wrapper {
        /* On mobile, show ~2.2 images so user knows they can scroll */
        flex: 0 0 calc(45% - 1rem);
        height: auto;
    }
    .app-logo {
        width: 70px;
        height: 70px;
    }
    .scroll-arrow {
        display: none; /* Hide arrows on touch devices, swiping is better */
    }
}

/* Project Detail Page */
.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    display: inline-block;
}
.back-btn:hover {
    color: var(--text-primary);
}

.project-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    margin-top: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .project-layout {
        grid-template-columns: 1fr;
    }
}

/* Gallery */
.project-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0; /* Prevents thumbnails from expanding the grid column and squishing text */
    position: sticky;
    top: 90px;
}

.main-img-wrapper {
    position: relative;
    /* Shrink-wrap the image so arrows always hug it tightly */
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    max-height: 500px; 
    display: flex;
}

.main-img-wrapper img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    transition: opacity 0.2s ease-in-out;
    display: block;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.gallery-controls {
    position: absolute;
    top: 50%;
    left: -22px;
    right: -22px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0;
    pointer-events: none; /* Let clicks pass through to the image below */
}

/* Allow buttons to receive clicks even though container is pointer-events: none */
.gallery-controls .lightbox-btn {
    pointer-events: auto;
}

.gallery-btn {
    background: rgba(255, 255, 255, 0.95); /* High contrast white */
    color: #1a1a2e; /* Dark icon for contrast */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); /* Premium drop shadow */
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    pointer-events: auto; /* Buttons should still be clickable */
}

.gallery-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px; /* Slightly more padding for the new scrollbar */
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Gallery Thumbnails */
.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}
.gallery-thumbnails::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}
.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.gallery-thumbnails .thumb {
    height: 60px;
    width: 40px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.gallery-thumbnails .thumb:hover, .gallery-thumbnails .thumb.active {
    opacity: 1;
    border-color: var(--accent-primary);
}

/* Action Buttons */
.project-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--accent-secondary);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}


/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem; /* Creates space between arrows and image */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 80%; /* Slightly reduced to leave room for arrows */
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    object-fit: contain;
    cursor: grab; /* Indicates that the image can be swiped */
}

.lightbox-content:active {
    cursor: grabbing;
}

.lightbox-modal.active .lightbox-content {
    transform: scale(1);
}

.lightbox-modal.zoomed .lightbox-btn {
    opacity: 0;
    pointer-events: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--accent-primary);
}

.main-img-wrapper img {
    cursor: zoom-in;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.95); /* High contrast white */
    color: #1a1a2e; /* Dark icon for contrast */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); /* Premium drop shadow */
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    z-index: 10;
    flex-shrink: 0;
}

.lightbox-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .gallery-controls {
        left: -15px;
        right: -15px;
    }
}

@media (max-width: 768px) {
    .lightbox-modal {
        gap: 0.5rem; /* Less space on mobile */
    }
    .lightbox-content {
        max-width: 75%; /* Leave space for buttons on mobile */
    }
    .lightbox-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* =========================================
   Contact Section
   ========================================= */
.contact-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.contact-btn svg {
    transition: transform 0.3s ease;
}

.contact-btn:hover svg {
    transform: scale(1.1);
}


/* Image Fade-in Illusion */
.image-fade {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}
.image-fade.loaded {
    opacity: 1;
}

/* Glass skeleton placeholder background for images */
.project-card, .main-image-container, .profile-container, .gallery-img-wrapper {
    background-color: rgba(255, 255, 255, 0.03);
}


@media (max-width: 768px) {
    html { scroll-padding-top: 130px; }
    main { 
        padding: 130px 0.5rem 0.5rem; 
    }
    .glass-card, .content-section { padding: 1.5rem; }
    .card-header { flex-wrap: wrap; gap: 1rem; }
    .card-header .view-btn { margin-top: 0.5rem; }
}


@media (max-width: 768px) {
    .project-gallery { position: static; }
    .nav-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
}

