/* ============================================================
   Cards — outlined, sharp corners, spec-sheet aesthetic
   ============================================================ */

.project-card {
    display: flex;
    align-items: stretch;
    min-width: 540px;
    /* Fixed height: image column and text column both fill this exactly */
    height: 300px;
    border: 1px solid var(--border-bright) !important;
    border-radius: 0 !important;
    padding: 0;
    background: var(--bg);
    position: relative;
    transition: border-color var(--t-med), background var(--t-med);
    flex-shrink: 0;
    cursor: pointer;
}

.project-card:hover {
    border-color: var(--accent) !important;
    background: var(--bg-secondary);
}

/* Replace fieldset legend with monospace tag */
.project-card legend {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 4px 10px;
    border: 1px solid currentColor !important;
    border-radius: 0;
    background: var(--bg);
    margin-left: calc(var(--unit) * 1.5);
    /* subtle accent tint on hover via parent */
    transition: color var(--t-med);
}

/* Media wrapper — fills full card height */
.project-card a {
    display: block;
    flex-shrink: 0;
    height: 100%;
}

.project-card a img,
.project-card a video {
    display: block;
    height: 100%;
    width: auto;
    object-fit: cover;
    border-radius: 0;
    transition: opacity var(--t-med);
    user-select: none;
    pointer-events: none;
    filter: saturate(0.85);
}

.project-card:hover a img,
.project-card:hover a video {
    filter: saturate(1);
    opacity: 0.92;
}

/* Text section */
.project-card section {
    width: 220px;
    padding: calc(var(--unit) * 2);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    /* overflow hidden so text never pushes the card taller */
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--unit);
}

/* Spec-row decoration above description */
.project-card section::before {
    content: '— DESC';
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    display: block;
    flex-shrink: 0;
}

.project-card section p {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 200;
    line-height: 1.6;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    /* clamp lines to fit the fixed height — (300px card - legend - padding - label) / line-height */
    -webkit-line-clamp: 7;
    line-clamp: 7;
    overflow: hidden;
}

.project-card section p a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Card index marker */
.project-card::before {
    content: attr(data-index);
    position: absolute;
    top: 0;
    right: 0;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 4px 6px;
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    user-select: none;
}

/* ---- Mobile ---- */
@media screen and (max-width: 768px) {
    .project-card {
        flex-direction: column;
        min-width: 0;
        width: 100%;
        height: auto;
    }

    .project-card a {
        height: auto;
        width: 100%;
        display: block;
    }

    .project-card a img,
    .project-card a video {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        /* video elements ignore aspect-ratio if they have an intrinsic size conflict —
           min-height: 0 forces the constraint to win */
        min-height: 0;
        max-width: 100%;
    }

    .project-card section {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        height: auto;
        overflow: visible;
    }

    .project-card section p {
        -webkit-line-clamp: 5;
        line-clamp: 5;
    }
}
