/* Work Layout */
.work-layout {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.work-layout>.content-viewport {
    flex: 1;
    min-width: 0;
    padding: 2rem;
    overflow-y: auto;
    /* Scrollbar returns to viewport edge */
    height: 100%;
    position: relative;
    scroll-behavior: smooth;
}

/* Filter Bar Pill Redesign */
.filter-spacer {
    width: 44px;
    height: 44px;
    margin-bottom: 2rem;
    position: relative;
}

.filter-wrapper {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    z-index: 50;
    background: var(--bg-color);
    border: 1px solid var(--text-color);
    border-radius: 999px;
    height: 44px;
    width: max-content;
    overflow: hidden;
}

#work-filter-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    width: 42px; /* Leaves space for the 1px wrapper border */
    height: 42px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 22;
    transition: opacity 0.2s ease;
    border-radius: 50%;
}

#work-filter-toggle:focus-visible {
    outline-offset: -2px;
}

#work-filter-toggle:hover {
    opacity: 0.7;
}

#work-filter-toggle svg {
    display: block;
}

.work-filter {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 500px;
    padding-left: 1.5rem;
    padding-right: 0.5rem;
    overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), padding 0.4s ease, visibility 0.4s ease;
    visibility: visible;
}

.work-filter.collapsed {
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    pointer-events: none;
    visibility: hidden;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    width: max-content; /* Prevents wrap during animation */
}

.filter-divider {
    width: 1px;
    height: 20px;
    background-color: var(--text-color);
    opacity: 0.3;
}

.work-filter input,
.work-filter select {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    outline: none;
    padding: 0;
    margin: 0;
    transition: var(--page-color-transition);
}

.work-filter input:focus-visible,
.work-filter select:focus-visible {
    outline: 2px dashed var(--text-color);
    outline-offset: -2px;
    border-radius: 2px;
}

.work-filter input {
    width: 150px;
}

.work-filter input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

.work-filter select {
    cursor: pointer;
    appearance: none;
    padding-right: 1.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

[data-theme="dark"] .work-filter select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Project Cards */
.project-card {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 4rem;
}

.project-card img {
    flex: 1 1 300px;
    min-width: 0;
    max-width: 600px;
    height: auto;
    align-self: flex-start;
}

.project-info {
    flex: 1 1 200px;
    max-width: 60ch;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

.project-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-info h2 {
    font-family: 'VT323', monospace;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-color);
}

.share-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.3;
    transition: opacity 0.15s ease;
    padding: 0;
    color: var(--text-color);
    position: relative;
}

.share-btn:hover,
.share-btn:focus-visible {
    opacity: 1;
}

.share-btn.copied::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    padding: 0.2rem 0.5rem;
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    background: var(--text-color);
    color: var(--bg-color);
    white-space: nowrap;
    pointer-events: none;
}

.project-meta {
    display: flex;
    gap: 1rem;
    font-family: 'VT323', monospace;
    font-size: clamp(0.8rem, 2vw, 1rem);
    opacity: 0.7;
    color: var(--text-color);
}

.project-meta dd {
    margin: 0;
}

.project-info p {
    font-family: 'VT323', monospace;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    line-height: 1.4;
    color: var(--text-color);
}

/* Sidebar Column */
.sidebar-column {
    position: absolute;
    top: 2rem;
    right: 2rem;
    height: calc(100% - 4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    z-index: 100;
    pointer-events: none; /* Let clicks pass through empty space */
}

.sidebar-column > * {
    pointer-events: auto; /* Re-enable for spacer and timeline */
}

/* Timeline Sidebar */
.year-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    overflow-y: auto;
    padding: 0.5rem 0;
    margin: -0.5rem 0;
}

.year-timeline a {
    display: block;
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.4;
    text-decoration: none;
    padding: 0.5rem 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.year-timeline a.active {
    opacity: 1;
    transform: scale(1.2);
    color: var(--text-color);
    font-weight: 700;
}

@media (max-width: 768px) {
    #work-content .content-viewport {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .sidebar-column {
        position: absolute;
        top: 2rem;
        left: 2rem;
        right: 2rem;
        width: auto;
        height: 0;
        margin: 0;
        padding: 0;
        z-index: 100;
        pointer-events: none;
        container-type: inline-size;
    }

    .year-timeline {
        display: none;
    }

    .filter-spacer {
        position: absolute;
        right: -22px; /* Center horizontally on the padding edge / image right corner */
        top: -22px; /* Center vertically on the image top edge */
        margin: 0;
        pointer-events: auto;
    }

    .work-filter {
        max-width: 100cqw !important;
    }

    .work-filter.collapsed {
        max-width: 0 !important;
    }

    .filter-controls {
        width: calc(100cqw - 2rem); /* Expand controls to fill the pill minus padding */
    }

    .work-filter input {
        width: 100%;
        flex: 1;
        min-width: 0;
    }
}

