/* SEARCH OVERLAY STYLES */
#project-search-input { width: 80%; max-width: 800px; font-size: clamp(1.6rem, 8vw, 4.6rem); font-weight: bold; font-family: inherit; color: inherit; text-transform: uppercase; border: none; outline: none; background: transparent; text-align: center; border-bottom: 2px solid rgba(0,0,0,0.1); padding-bottom: 1rem; margin-bottom: 4rem; }
#project-search-input::placeholder { color: rgba(0,0,0,0.2); }
#search-results-grid { position: absolute; top: calc(50% + 5rem); left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 3rem; justify-content: center; width: 90%; max-width: 1200px; overflow-y: visible; padding-bottom: 5rem; }
.search-result-card { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: 0.3s; width: 200px; }
.search-result-card:hover { transform: scale(1.05); }
.search-result-card img { width: 100%; height: 260px; object-fit: cover; filter: drop-shadow(0 0.5rem 1rem rgba(0,0,0,0.1)); margin-bottom: 1rem; border-radius: 2px; }
.search-result-title { font-size: 1rem; font-weight: bold; text-align: center; text-transform: uppercase; }
.mobile-only-close { display: none; }


.audio-mobile-footer { display: none; }

/* ---------------------------------------------------- 
   AUDIO LIBRARY (Split Column)
   ---------------------------------------------------- */
.audio-library-wrapper {
    width: 100%;
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    padding: 0 5%;
    box-sizing: border-box;
}

.audio-left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: right;
}

.audio-right-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    transform-origin: center center;
    animation: popInMiddle 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

@keyframes popInMiddle {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.audio-category {
    font-size: 2.2rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 0.5rem;
}
.audio-category:hover { opacity: 0.6; }

.audio-sublist {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.audio-category.expanded + .audio-sublist { display: flex; }

.audio-track-link {
    font-size: 1.2rem;
    text-transform: lowercase;
    cursor: pointer;
    transition: 0.2s;
    opacity: 0.7;
}
.audio-track-link:hover, .audio-track-link.active-track { opacity: 1; font-weight: bold; }

.audio-player-ui {
    position: relative;
    background-color: #F1EED7; 
    backdrop-filter: none; -webkit-backdrop-filter: none; 
    box-shadow: 0 0.5rem 2.5rem rgba(0,0,0,0.1); 
    padding: 2.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 25vw;
    height: 35vw;
    overflow-y: auto;
}
.audio-player-ui::before {
    content: ""; position: absolute; inset: 0;
    background-image: url('../assets/textures/texture%20paper.jpg'); background-size: cover;
    opacity: 0.25; z-index: 0; pointer-events: none;
}
.audio-player-ui > * { position: relative; z-index: 1; }
.audio-player-ui::-webkit-scrollbar { display: none; }

.audio-player-title {
    font-size: 2.5rem;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1.1;
}

.audio-player-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.8;
}

.audio-controls-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* ---------------------------------------------------- 
   HISTORY — ENDLESS TRACING PAPER ROLL
   ---------------------------------------------------- */
.history-pile-wrapper {
    width: 100vw;
    height: 100vh;
    height: 100svh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 10vw;
    box-sizing: border-box;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.history-pile-wrapper::-webkit-scrollbar { display: none; }

.history-endless-roll {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 70vh;
    min-width: min-content;
}

.history-paper-strip {
    display: flex; /* Back to flex */
    flex-direction: row;
    height: 100%;
    background-color: white; /* Matches .paper-card-bg */
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.15);
    position: relative;
    padding-right: 10vw; /* extend paper past the last column so date markers aren't clipped */
    
    /* Punch holes using mask-image */
    -webkit-mask-image: 
        radial-gradient(circle at 1.5rem 1.05rem, transparent 0.32rem, black 0.37rem),
        radial-gradient(circle at 1.5rem 1.05rem, transparent 0.32rem, black 0.37rem),
        linear-gradient(black, black);
    -webkit-mask-size: 
        3rem 2.1rem, 
        3rem 2.1rem, 
        100% calc(100% - 4.2rem);
    -webkit-mask-position: 
        top left, 
        bottom left, 
        center;
    -webkit-mask-repeat: 
        repeat-x, 
        repeat-x, 
        no-repeat;

    mask-image: 
        radial-gradient(circle at 1.5rem 1.05rem, transparent 0.32rem, black 0.37rem),
        radial-gradient(circle at 1.5rem 1.05rem, transparent 0.32rem, black 0.37rem),
        linear-gradient(black, black);
    mask-size: 
        3rem 2.1rem, 
        3rem 2.1rem, 
        100% calc(100% - 4.2rem);
    mask-position: 
        top left, 
        bottom left, 
        center;
    mask-repeat: 
        repeat-x, 
        repeat-x, 
        no-repeat;
}

/* Texture for tracing paper */
.history-paper-strip::before {
    content: ""; position: absolute; inset: 0;
    background-image: url('../assets/textures/texture%20paper.jpg'); background-size: cover;
    opacity: 0.15; z-index: 0; pointer-events: none;
}

/* Tear/rabbet shadow separating the punchhole tracks from the main paper body */
.history-paper-strip::after {
    content: "";
    position: absolute;
    top: 2.1rem; /* slightly below holes */
    bottom: 2.1rem;
    left: 0;
    right: 0;
    pointer-events: none;
    border-top: 1px solid rgba(0,0,0,0.06);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    box-shadow: 
        inset 0 0.3rem 0.5rem -0.3rem rgba(0,0,0,0.06),
        inset 0 -0.3rem 0.5rem -0.3rem rgba(0,0,0,0.06);
    z-index: 2;
}

.history-partition {
    width: 22.5vw;
    flex: 0 0 22.5vw;
    height: 100%; 
    position: relative;
    padding: 4.5rem 3rem; 
    box-sizing: border-box;
    
    display: flex; 
    flex-direction: column;
    justify-content: center; /* Ensures fallback centering */
    gap: 0.5rem; /* Replaces padding on individual elements to maintain even spacing regardless of order */
    /* border-right removed */
}

.history-partition:last-child {
    /* border-right removed */
}

.history-partition-image-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    padding-bottom: 0; /* managed by parent gap now */
    position: relative;
    width: 12vw;
    margin: 0 auto;
}

/* Exact Apollo Blue Tint Overlay - now tightly wrapped to the image */
.image-tint-wrapper::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #A6BBD1; /* Apollo Blue */
    mix-blend-mode: color;
    pointer-events: none;
    z-index: 5;
}

.title-marker {
    background-color: #000;
    color: #fff;
    padding: 0.1rem 0.3rem;
    display: none; /* titles removed */
}

.history-partition > * { position: relative; z-index: 3; }

.history-partition-title {
    display: none; /* titles removed entirely from layout flow */
}

.history-caption {
    font-size: 0.75rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    text-align: center;
    padding: 0;
    margin: 0.5rem 0 0 0;
    width: 100%;
    position: relative;
    z-index: 6; /* stay above the blue tint */
}

.history-partition-image {
    display: block;
    margin: 0 auto; /* center image in wrapper */
    width: 12vw; /* force exact match to text body */
    max-height: 18vh; /* cap height to prevent massive vertical scaling */
    object-fit: cover; /* cleanly fill the box if capped */
    border: none;
    filter: grayscale(100%); /* automatically make images black and white */
}

.history-partition-text {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    font-size: clamp(0.5rem, 1.2vw, 0.7rem);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #444;
    text-align: justify; /* 'blocksatz' restored */
    
    width: 12vw;
    margin: 0 auto;
    padding-top: 0;
    min-height: 0; 
}

body.spread-open .title-wrapper { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }

@media (max-width: 900px) {
    .history-pile-wrapper {
        padding: 0 5vw;
        scroll-snap-type: x mandatory;
    }
    .history-partition {
        width: 85vw;
        flex: 0 0 85vw;
        min-width: 85vw;
        scroll-snap-align: center;
        padding: 4.5rem 2rem;
    }
    .history-partition-text,
    .history-partition-title,
    .history-partition-image-wrapper {
        width: 40vw;
    }
    .history-partition-image {
        width: 40vw; /* match mobile text width exactly */
    }
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    color: rgba(0,0,0,0.5);
    cursor: pointer;
    user-select: none;
    padding: 2rem;
    z-index: 1000001;
    transition: color 0.2s, transform 0.2s;
}
.lightbox-nav:hover {
    color: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
}
.lightbox-prev {
    left: 2vw;
}
.lightbox-next {
    right: 2vw;
}

/* ---------------------------------------------------- 
   MOBILE AUDIO LIBRARY OVERRIDES
   ---------------------------------------------------- */
@media (max-width: 900px) {
    .audio-library-wrapper {
        flex-direction: column;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    .audio-left-col {
        display: none !important;
    }
    .audio-right-col {
        align-items: center;
        width: 100%;
        margin-top: -5rem; /* Shift post-it up slightly */
    }
    .audio-player-ui {
        width: 85vw;
        height: 120vw; /* Keep proportional to project post-its */
        max-width: none;
        padding: 2rem;
    }
    .audio-mobile-footer {
        position: fixed;
        bottom: 2rem;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 100003;
        pointer-events: auto;
    }
    .audio-mobile-chapters {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        max-width: 90rem;
    }
    body.audio-library-open #main-footer,
    body.audio-library-open #filter-bar {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}
