/* Base styles with mobile-first approach */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    max-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    overflow-x: hidden;
    background-color: #f8f8f8;
    color: #333;
}

/* Page layout - mobile first */
.page-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Departments section */
.departments-container {
    width: 100%;
    height: 75vh;
    background-color: #000;
    position: relative;
    overflow: hidden;
}

.departments-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 1rem;
    gap: 1rem;
    animation: slowScroll 60s linear infinite;
}

@keyframes slowScroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

.departments-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
}

.department-card {
    flex: 1;
    min-height: 180px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.department-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.department-card.active {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.department-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

.department-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    z-index: 2;
}

/* Wide card */
.department-card.wide {
    flex: 2;
}

/* Mobile handle for clicking */
.handle-wrapper {
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.mobile-handle {
    width: 40px;
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
    cursor: pointer;
}

/* Project info section */
.project-info-container {
    width: 100%;
    height: 25vh;
    background-color: white;
    border-radius: 24px 24px 0 0;
    margin-top: -20px;
    padding: 1.5rem;
    overflow-y: auto;
    transition: height 0.3s ease;
    z-index: 10;
}

/* Expanded state */
.project-info-container.expanded {
    height: 70vh;
}

.logo-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.logo {
    width: 90px;
    height: auto;
}

.content-container {
    width: 100%;
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.subtitle-container {
    margin-bottom: 1rem;
    position: relative;
}

.subtitle {
    font-size: 1.75rem;
    font-weight: 500;
    color: #666;
}

/* Project list and items */
.project-list {
    margin-top: 1.5rem;
}

.project-item {
    background-color: #f8f8f8;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.project-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.project-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.project-item p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #666;
    margin-bottom: 1rem;
}

.view-project-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-project-btn:hover {
    background-color: #333;
    transform: translateY(-2px);
}

/* Project modal */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.project-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background-color: white;
    border-radius: 20px;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.modal-image {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.6;
}

.modal-description h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
}

.modal-description h4:first-child {
    margin-top: 0;
}

.modal-description p {
    margin-bottom: 1rem;
}

/* Desktop styles */
@media (min-width: 769px) {
    .page-container {
        flex-direction: row;
    }

    .departments-container {
        width: 50%;
        height: 100vh;
    }

    .departments-grid {
        padding: 2rem;
        gap: 1.5rem;
    }

    .department-card {
        min-height: 220px;
    }

    .project-info-container {
        width: 50%;
        height: 100vh;
        padding: 2.5rem;
        margin-top: 0;
        border-radius: 0;
    }
    
    .handle-wrapper {
        display: none;
    }

    .logo {
        width: 110px;
    }

    .title {
        font-size: 3rem;
        margin-bottom: 2rem;
    }

    .subtitle {
        font-size: 2.25rem;
    }

    .project-item {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .project-item h3 {
        font-size: 1.4rem;
    }

    .project-item p {
        font-size: 1rem;
    }

    .modal-content {
        max-width: 700px;
        padding: 3rem;
    }

    .modal-image {
        height: 300px;
    }
}

@media (min-width: 1024px) {
    .departments-grid {
        padding: 2.5rem;
    }

    .project-info-container {
        padding: 3rem;
    }

    .department-card {
        min-height: 240px;
    }
}