:root {
    --color-text: #333;
    --color-background: #fff;
}

body {
    max-width: 80vw;
    margin: 150px auto 0px auto;
    line-height: 1.6;
    background: var(--color-background);
    color: var(--color-text);
}

* {
    /* font-family: Arial, sans-serif; */
    font-family: Atlas Grotesk, sans-serif;
}
a{
    text-decoration: underline;
    font-style: normal;
    color: var(--color-text);
}
a:hover{
    font-style: italic;
}
h1 {
    text-align: center;
    color: var(--color-text);
    margin-bottom: 30px;
}
h3{
    margin: 0;
    padding: 0;
}
p{
    margin: 0;
    padding: 0;
}

.flex {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
}

.filter-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 50px 10vw 25px 10vw;
    background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgb(255, 255, 255) 100%);
    backdrop-filter: blur(30px);
}
.filter-placeholder {
    cursor: pointer;
}
#intro-text {
    width: 50% !important;
}

.library-header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: start;
    gap: 10px;
}

.library-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: normal;
    text-transform: uppercase;
    
}

.library-title img {
    height: 1em;
    width: auto;
    vertical-align: middle;
}

.library-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 24px; /* base size for header controls */
    color: var(--color-text);
}
.selected-tags{
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-text);
}
.dropdown-selected {
    color: var(--color-text);
    display: inline;
    border-bottom: 1px solid var(--color-text);
    font-style: italic;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    white-space: nowrap;
    text-wrap: wrap;
    /* margin-left: 8px; */
}

.dropdown-menu.show {
    display: block;
}

.dropdown-option {
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    color: var(--color-text);
    font-style: normal;
    transition: all 0.2s ease;
    display: inline;
    border-bottom: 1px solid transparent;
    margin: 0 4px;
}

.dropdown-option:hover {
    font-style: italic;
    border-bottom: 1px solid var(--color-text);
}

.dropdown-option.selected {
    color: var(--color-text);
    font-weight: bold;
}

#projects-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 30px 80px;
    /* max-width: 80vw; */
    margin: 50px auto 50px auto;
    /* padding: 0 20px; */
}


.project-card {
    /* Card styling handled by grid layout */
    display: block;
    cursor: pointer;
}

.project-name {
    margin: 15px 0 0 0 !important;
    color: var(--color-text);
    font-size: 1em;
    font-weight: normal;
    text-align: left;
    text-transform: uppercase;
}

.project-card.expanded .project-name {
    font-size: 1em;
    font-weight: bold;
    /* margin: 0; */
}

.project-meta {
    font-size: 0.75em;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
}

.project-made-with,
.project-team {
    margin: 0;
    color: var(--color-text);
}

.project-year {
    margin: 0;
    color: var(--color-text);
}

.project-brief {
    font-size: 0.75em;
    line-height: 1.6;
    color: var(--color-text);
    margin-top: 5px;
    width: 80%;
}


.project-video-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.project-video, .project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Specific styling for iframe videos */
.project-video[src*="dropbox.com"] {
    border: none;
}

.project-video p {
    color: white;
    padding: 10px;
    font-size: 12px;
    word-break: break-all;
}


.no-video {
    color: var(--color-text);
    font-style: italic;
    text-align: center;
}

/* In-place expansion styles */
.project-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top left;
}

.project-card.expanded {
    grid-column: span 2;
    grid-row: span 2;
    /* display: grid; */
    grid-template-rows: auto auto auto auto;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transform: scale(1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: stretch;
    animation: expandCard 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes expandCard {
    0% {
        transform: scale(0.6);
        /* opacity: 0.5; */
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.project-card.collapsing {
    animation: collapseCard 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes collapseCard {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.6);
        opacity: 0.8;
    }
}

.project-card.expanded .project-video-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    grid-row: 1;
    align-self: stretch;
    margin: 0;
}

.project-card.expanded .project-name {
    grid-row: 2;
    font-size: 1em;
    margin: 0;
}

.project-card.expanded .project-info {
    grid-row: 3;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.project-card.expanded .project-meta {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto; /* left label, right year */
    grid-template-rows: auto auto; /* two rows */
    column-gap: 20px;
    row-gap: 6px;
    align-items: baseline;
}

.project-card.expanded .project-brief {
    grid-row: 4;
}

/* Expanded meta layout: first row left/right, second row full width */
.project-card.expanded .project-team { 
    grid-column: 1; 
    grid-row: 1; 
}
.project-card.expanded .project-year { 
    grid-column: 2; 
    grid-row: 1; 
    justify-self: end; 
}
.project-card.expanded .project-made-with { 
    grid-column: 1 / -1; 
    grid-row: 2; 
}

#project-counter {

    text-align: right;
    margin-bottom: 100px;
}
.loading-indicator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: var(--color-text);
    background: var(--color-background );
    border-radius: 8px;
    margin: 20px 0;
}

@media (max-width: 1600px) {
    body {
        margin-top: 200px;
    }
}

/* Responsive adjustments for expanded cards */
@media (max-width: 1280px) {
    body {
        margin-top: 400px;
    }
    .project-card.expanded {
        grid-column: span 3;
        gap: 15px;
    }
    
    .project-card.expanded .project-video-container {
        aspect-ratio: 4 / 3;
    }
    
    .project-card.expanded .project-name {
        font-size: 1em;
    }
    
    body {
        margin-top: 200px;
    }
    .library-header {
        flex-direction: row; /* closed: row */
        align-items: center;
    }
    .library-header:has(.dropdown-menu.show) {
        flex-direction: column; /* open: column */
        align-items: flex-start;
    }

    #projects-container {
        grid-template-columns: repeat(3, 1fr);
    }

    .library-title {
        font-size: 20px; /* keep in sync with nav */
        gap: 8px;
    }

    .library-nav {
        font-size: 20px; /* in sync with title */
        gap: 8px;
    }
    #intro-text {
        width: 80% !important;
    }
}

@media (max-width: 600px) {
    .project-card.expanded {
        grid-column: span 2;
        gap: 10px;
    }
    
    .project-card.expanded .project-video-container {
        aspect-ratio: 4 / 3;
    }
    
    .project-card.expanded .project-name {
        font-size: 1em;
    }
    .filter-container {
        width: 80%; /*error*/
    }
    .library-header {
        flex-direction: row; /* closed: row */
        align-items: center;
    }
    .library-header:has(.dropdown-menu.show) {
        flex-direction: column; /* open: column */
        align-items: flex-start;
    }
    #projects-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .library-title {
        font-size: 18px; /* keep in sync with nav */
        gap: 5px;
        line-height: 1.4;
    }

    .library-title img {
        height: 0.8em;
    }

    .library-nav {
        font-size: 18px; /* in sync with title */
        gap: 5px;
    }

    #intro-text {
        width: 100% !important;
        font-size: 14px;
        line-height: 1.5;
    }

    .dropdown-option {
        font-size: inherit; /* follow .library-nav */
        margin: 0 2px;
    }
}

@media (max-width: 480px) {
    .library-title {
        font-size: 16px; /* keep in sync with nav */
    }

    .library-nav {
        font-size: 16px; /* in sync with title */
    }

    .dropdown-option {
        font-size: inherit; /* follow .library-nav */
    }

    intro-text {
        font-size: 13px;
    }
}
