@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --bg-base: #F6F5F2; /* Raw Plaster / Tracing Paper */
    --text-primary: #1A1A1A; /* Graphite / Ink */
    --text-secondary: #666666; /* Light Pencil */
    --structural-lines: #E0DDD5; /* Faint Drafting Lines */
    --accent-rosa: #E60067;
    --accent-terra: #C2452D;
    --ease-tectonic: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    line-height: 1.4;
    overflow-x: hidden;
    text-transform: uppercase;
}

/* Typography Hierarchy */
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.data-caps {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Scroll Progress */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--accent-rosa);
    z-index: 1000;
    transition: width 0.1s linear;
}

/* Container & Layout */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .container {
        flex-direction: row;
    }
}

/* Left Column */
.left-column {
    width: 100%;
    padding: 24px;
    border-bottom: 1px solid var(--structural-lines);
    background-color: var(--bg-base);
    z-index: 100;
}

@media (min-width: 1024px) {
    .left-column {
        width: 32%;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        overflow-y: auto;
        border-bottom: none;
        border-right: 1px solid var(--structural-lines);
    }
}

.atelier-header {
    margin-bottom: 3rem;
}

.atelier-title {
    display: block;
    width: max-content;
    font-size: clamp(2.5rem, 12vw, 3.5rem);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 900;
}

.phonetic {
    font-size: 0.4em;
    color: var(--text-secondary);
    margin-left: 0.5rem;
    font-weight: 400;
    text-transform: lowercase;
}

.about-button {
    display: block;
    width: max-content;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.3s var(--ease-tectonic);
}

.about-button:hover {
    color: var(--accent-rosa);
    border-color: var(--accent-rosa);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-pill {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color 0.3s var(--ease-tectonic);
    padding: 0.25rem 0;
}

.filter-pill:hover, .filter-pill.active {
    color: var(--accent-rosa);
}

/* Index Table */
.index-table-container {
    overflow-x: auto;
}

.index-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.index-table th {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--structural-lines);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.index-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--structural-lines);
    cursor: pointer;
    transition: background-color 0.3s var(--ease-tectonic), padding-left 0.3s var(--ease-tectonic);
}

.index-table tr {
    position: relative;
    transition: opacity 0.4s var(--ease-tectonic), transform 0.4s var(--ease-tectonic);
}

.index-table tr.filtering {
    opacity: 0;
    transform: translateY(10px);
}

.index-table tbody tr:hover td {
    background-color: #EFEFEF; /* slight highlight */
}

.index-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 0 var(--accent-rosa);
}

/* Right Column */
.right-column {
    width: 100%;
    padding: 24px;
}

@media (min-width: 1024px) {
    .right-column {
        width: 68%;
        margin-left: 32%;
        padding: 24px;
        padding-left: 48px;
    }
}


.project-card {
    height: calc(100vh - 48px); /* Strict fit when closed */
    margin-bottom: 48px;
    display: flex;
    flex-direction: column;
    transition: opacity 0.5s var(--ease-tectonic), transform 0.5s var(--ease-tectonic);
}

@media (max-width: 767px) {
    .project-card {
        height: auto; /* Fixes massive white space on tall phone screens */
    }
}

.project-card.dossier-open {
    height: auto; /* Grows when dossier opens */
    min-height: calc(100vh - 48px);
}

.project-card.filtering {
    opacity: 0;
    transform: translateY(20px);
}

.project-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem; /* Compressed spacing */
}

.project-title {
    font-size: clamp(1.5rem, 6vw, 2rem); /* Compressed size, scales on mobile */
    margin-bottom: 0;
}

.project-meta-top {
    color: var(--text-secondary);
    font-size: 0.75rem; /* Compressed */
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.1rem;
}

.project-typology {
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* Image Container */
.image-container {
    position: relative;
    width: 100%;
    flex-grow: 1; /* Takes up remaining space perfectly */
    min-height: 0; /* CRITICAL: ensures flex item respects container bounds */
    max-height: calc(100vh - 200px); /* CRITICAL: Prevents 6k image from exploding the container when card height is auto */
    background-color: var(--bg-base);
    margin-bottom: 0.75rem; /* Compressed */
}

@media (max-width: 767px) {
    .image-container {
        max-height: none;
        flex-grow: 0; /* Prevents stretching */
    }
}

.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* ensures the full image is visible without cropping */
    display: block;
    mix-blend-mode: multiply; /* Fixes pure white backgrounds on off-white plaster canvas */
}

@media (max-width: 767px) {
    .project-image {
        position: relative; /* Crucial: lets the image dictate the container height naturally */
        height: auto; 
    }
}

.wip-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--structural-lines);
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

@media (max-width: 767px) {
    .wip-placeholder {
        position: relative;
        height: auto;
        aspect-ratio: 4 / 3; /* Fallback shape on mobile when there's no image */
    }
}

/* Technical Spec Bar */
.spec-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: center; /* Centered instead of space-between */
    gap: 4rem; /* Wide gap to maintain elegance */
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--structural-lines);
    border-bottom: 1px solid var(--structural-lines);
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@media (max-width: 767px) {
    .spec-bar {
        display: flex;
        justify-content: space-around; /* Distribute evenly on mobile */
        gap: 0;
    }
    .spec-separator {
        display: none;
    }
}

.spec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.spec-item span {
    color: var(--text-primary);
    font-weight: 700;
    margin-top: 0.25rem;
}

.spec-separator {
    color: var(--structural-lines);
    align-self: center;
}

/* Accordion Dossier */
.project-details {
    flex-shrink: 0;
}
.accordion-trigger {
    background: none;
    border: none;
    color: var(--accent-rosa);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accordion-trigger::after {
    content: "+";
    font-size: 1rem;
}

.accordion-trigger.open::after {
    content: "-";
}

.accordion-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.6s var(--ease-tectonic);
}

.accordion-wrapper.open {
    grid-template-rows: 1fr;
}

.accordion-content {
    overflow: hidden;
}

.accordion-wrapper.open .accordion-content {
    padding-top: 1rem;
    padding-bottom: 2rem;
}

.accordion-content p {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.footnote {
    display: block;
    font-size: 0.7em;
    opacity: 0.7;
    margin-top: 1rem;
    border-top: 1px solid var(--structural-lines);
    padding-top: 0.5rem;
}

/* Dossier Gallery Grid */
.project-gallery {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.span-full { grid-column: 1 / -1; }
.span-half { grid-column: span 3; }
.span-third { grid-column: span 2; }
.span-twothirds { grid-column: span 4; }

@media (max-width: 767px) {
    .project-gallery {
        grid-template-columns: 1fr; /* Forces all images to stack naturally on phones */
    }
    
    .span-full, .span-half, .span-third, .span-twothirds {
        grid-column: 1 / -1 !important; /* Prevents spans from breaking the 1-column mobile grid */
    }
}

.dossier-gallery img {
    width: 100%;
    height: auto;
    /* Removed aspect-ratio and object-fit to let plans stay natural */
    mix-blend-mode: multiply; 
    filter: contrast(1.05); /* Helps blow out dirty whites in renders so multiply blending works perfectly */
}

