/* ── Project Item (detail) Page ──────────────────────────────────────────────
   Editorial, section-stacked layout — intentionally DISTINCT from the
   publication-item page (which is a two-column reading area + sticky right
   metadata card). Here the metadata sits in a horizontal facts strip under the
   header, content stacks full-width in a single comfortable measure, and the
   findings / publications / people read as card grids and chip rows. Anchored to
   the shared tokens in general.css (Outfit + Noto Sans TC, E3 palette). */

.proj-item-main {
    /* Full-width shell carrying the site's viewport gutters. The readable
       content column itself is capped and centered by .proj-item-article. */
    width: min(100%, 80rem);
    margin-inline: auto;
    padding: 3rem var(--gutter-x) 8rem;

    /* Shared width for the whole content column (text, facts strip, card grids,
       people band) — kept in one token so it's a single number to tune. */
    --proj-measure: 46rem;
}

/* Center the ENTIRE content column (not just the text) within the page, for a
   clean, minimal single-column layout. Every block inside inherits this width,
   so they all line up as one centered rail. */
.proj-item-article {
    max-width: var(--proj-measure);
    margin-inline: auto;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.proj-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1.1rem;
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-heading);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--main-color) 50%, transparent);
}

.proj-status-pill {
    font-size: var(--fs-caption);
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.7rem;
    border-radius: 2rem;
    color: var(--main-color-2);
    background: color-mix(in srgb, var(--main-color-2) 12%, transparent);
}

.proj-status-pill--ongoing {
    color: color-mix(in srgb, var(--r-green) 78%, #1a3d2e);
    background: color-mix(in srgb, var(--r-green) 14%, transparent);
}

/* Larger, tighter headline than the publication page for an editorial feel. */
.proj-item-title {
    font-size: clamp(1.875rem, 4vw, 2.75rem);
    font-weight: var(--fw-h1);
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: var(--main-color);
    margin: 0 0 0.5rem;
}

.proj-item-title:has(+ .proj-item-title-zh) {
    margin-bottom: 0.35rem;
}

.proj-item-title-zh {
    font-family: var(--font-zh);
    font-size: clamp(1.25rem, 2.5vw, 1.625rem);
    font-weight: var(--fw-light);
    line-height: 1.4;
    color: color-mix(in srgb, var(--main-color) 72%, transparent);
    margin: 0;
}

/* Horizontal facts strip — the metadata the publication page parks in a right
   rail. A hairline band of label/value cells, wrapping responsively. */
.proj-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 1.25rem 2.5rem;
    max-width: var(--proj-measure);
    margin: 2rem 0 0;
    padding-block: 1.25rem;
    border-block: 0.0625rem solid color-mix(in srgb, var(--main-color) 14%, transparent);
}

.proj-fact {
    min-width: 0;
}

.proj-fact dt {
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-heading);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--main-color) 45%, transparent);
    margin: 0 0 0.3rem;
}

.proj-fact dd {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--main-color);
}

.proj-fact dd span[lang] {
    font-family: var(--font-zh);
    font-weight: var(--fw-light);
    color: color-mix(in srgb, var(--main-color) 68%, transparent);
}

/* ── Lede ─────────────────────────────────────────────────────────────────── */

/* Size + line-height + colour from the unified prose recipe; .proj-item-lede
   only sets margin + max-width. Recipe binds font-size to --fs-prose-lede. */
.proj-item-lede {
    margin: 2.5rem 0 0;
    max-width: var(--prose-measure);
    color: color-mix(in srgb, var(--main-color) 92%, transparent);
}

/* ── Sections (generous vertical rhythm; no columns) ──────────────────────── */

.proj-section {
    margin-block-start: 3.5rem;
}

.proj-section-title {
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-heading);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--main-color);
    opacity: 0.4;
    margin: 0 0 1.25rem;
}

/* Size + weight + line-height + hyperlink inherited from the unified
   prose recipe in general.css. .proj-prose only sets layout here. */
.proj-prose {
    max-width: var(--prose-measure);

    & p { margin: 0 0 1rem; }
    & p:last-child { margin-bottom: 0; }

    /* Restore list markers inside narrative prose (the global reset strips them). */
    & ul {
        list-style: disc;
        padding-inline-start: 1.4rem;
        margin: 0 0 1rem;
        display: grid;
        gap: 0.45rem;
    }
    & li { padding-inline-start: 0.2rem; }
    & li:last-child { margin-bottom: 0; }
}

.proj-prose-zh {
    font-family: var(--font-zh);
    margin-block-start: 1.75rem;
    padding-block-start: 1.75rem;
    border-block-start: 0.0625rem solid color-mix(in srgb, var(--main-color) 10%, transparent);
    color: color-mix(in srgb, var(--main-color) 82%, transparent);
    max-width: var(--prose-measure);
}

/* ── Key findings — numbered cards ────────────────────────────────────────── */

.proj-findings-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
    max-width: var(--proj-measure);
}

.proj-finding-card {
    padding: 1.5rem 1.5rem 1.75rem;
    border: 0.0625rem solid color-mix(in srgb, var(--main-color) 14%, transparent);
    border-radius: 0.75rem;
    /* Pure outline box (no fill) — clean and minimal, consistent with pub cards. */
    background: transparent;
}

.proj-finding-num {
    display: block;
    font-size: var(--fs-heading-s);
    font-weight: var(--fw-heading);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--main-color-2);
    margin: 0 0 0.85rem;
}

.proj-finding-text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--main-color);
}

.proj-finding-text-zh {
    margin: 0.65rem 0 0;
    font-family: var(--font-zh);
    font-size: 0.875rem;
    line-height: 1.6;
    color: color-mix(in srgb, var(--main-color) 66%, transparent);
}

/* ── Research outputs — plain hairline list ───────────────────────────────── */

.proj-outputs {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: var(--proj-measure);
}

.proj-output {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.6rem;
    padding-block: 0.7rem;
    border-block-end: 0.0625rem solid color-mix(in srgb, var(--main-color) 10%, transparent);
}

.proj-output-type {
    font-size: var(--fs-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-color-2);
    background: color-mix(in srgb, var(--main-color-2) 12%, transparent);
    border-radius: 0.3rem;
    padding: 0.1rem 0.5rem;
}

.proj-output-link {
    color: var(--main-color);
    font-weight: 500;
    text-decoration: none;
    background-image: linear-gradient(var(--main-color-2), var(--main-color-2));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    transition: background-size 280ms cubic-bezier(0.16, 1, 0.3, 1), color 200ms ease-out;

    &:hover, &:focus-visible {
        background-size: 100% 1px;
        color: var(--main-color-2);
    }
}

.proj-output-note {
    width: 100%;
    font-size: 0.875rem;
    color: color-mix(in srgb, var(--main-color) 60%, transparent);
}

/* ── Related publications — card grid (vs. the bare list elsewhere) ───────── */

.proj-pubs-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 0.875rem;
    max-width: var(--proj-measure);
}

.proj-pub-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    height: 100%;
    padding: 1.1rem 1.25rem;
    border: 0.0625rem solid color-mix(in srgb, var(--main-color) 14%, transparent);
    border-radius: 0.625rem;
    text-decoration: none;
    color: var(--main-color);
    cursor: pointer;
    transition:
        border-color 200ms ease,
        background 200ms ease,
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1);

    &:hover, &:focus-visible {
        border-color: color-mix(in srgb, var(--main-color-2) 55%, transparent);
        background: color-mix(in srgb, var(--main-color-2) 6%, transparent);
        transform: translateY(-2px);
    }

    &:focus-visible {
        outline: 0.125rem solid var(--main-color-2);
        outline-offset: 0.1875rem;
    }
}

.proj-pub-card--static {
    cursor: default;
}

.proj-pub-title {
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.proj-pub-meta {
    font-size: 0.8125rem;
    color: color-mix(in srgb, var(--main-color) 62%, transparent);
    margin-block-start: auto;
}

.proj-pub-meta em {
    font-style: italic;
}

/* ── Gallery ──────────────────────────────────────────────────────────────── */

.proj-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    max-width: var(--proj-measure);
}

.proj-gallery-item {
    margin: 0;

    & img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 0.5rem;
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }
}

.proj-gallery-caption {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: color-mix(in srgb, var(--main-color) 62%, transparent);
    margin-block-start: 0.4rem;

    & span {
        display: block;
        font-family: var(--font-zh);
    }
}

/* ── People band — team chips + partners, full-width foot ─────────────────── */

.proj-people {
    margin-block-start: 4rem;
    /* This is a <footer> element, so the bare `footer{}` rule in general.css
       (white fill + 3px border + gutter padding, meant for the SITE footer)
       leaks onto it. Reset it here: the partners credit sits flush on the page
       background with only a hairline divider — same treatment as every
       section above, not a floating white card. */
    padding: 2.5rem 0 0;
    border-block-start: 0.0625rem solid color-mix(in srgb, var(--main-color) 14%, transparent);
    background: transparent;
    display: grid;
    gap: 2.75rem;
    max-width: var(--proj-measure);
}

.proj-team-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.proj-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.9rem;
    border: 0.0625rem solid color-mix(in srgb, var(--main-color) 16%, transparent);
    border-radius: 0.6rem;
    text-decoration: none;
    transition: border-color 200ms ease, background 200ms ease;
}

a.proj-chip:hover, a.proj-chip:focus-visible {
    border-color: color-mix(in srgb, var(--main-color-2) 50%, transparent);
    background: color-mix(in srgb, var(--main-color-2) 7%, transparent);
}

a.proj-chip:focus-visible {
    outline: 0.125rem solid var(--main-color-2);
    outline-offset: 0.125rem;
}

.proj-chip--static {
    background: color-mix(in srgb, var(--main-color) 4%, transparent);
}

.proj-chip-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--main-color);
}

.proj-chip-role {
    font-size: 0.75rem;
    color: color-mix(in srgb, var(--main-color) 58%, transparent);
}

.proj-partner-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.75rem;
}

.proj-partner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    /* USER REQ — stretch-click pattern. The <a> only wraps the partner
       name today; clicking on the logo or surrounding whitespace did
       nothing. position: relative anchors the stretched ::after on
       a.proj-partner-name below — that pseudo expands to cover the
       whole row so any click on the partner card activates the link. */
    position: relative;

    /* The whole row reads as interactive only when the partner has a
       URL — pointer cursor + hover treatment scoped to :has() rather
       than always. */
    &:has(a.proj-partner-name) {
        cursor: pointer;

        &:hover,
        &:focus-within {
            .proj-partner-name {
                color: var(--main-color-2);
                text-decoration: underline;
                text-underline-offset: 0.15em;
            }
        }
    }
}

/* Stretched click target for the whole .proj-partner row. */
a.proj-partner-name::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Brand-colored backing so white/transparent partner logos stay legible on the
   light page. Width hugs the logo's intrinsic aspect (wordmarks stay wide). */
.proj-partner-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.8rem;
    flex-shrink: 0;
}

.proj-partner-logo {
    height: 1.25rem;
    width: auto;
    display: block;
}

.proj-partner-text {
    display: flex;
    flex-direction: column;
}

.proj-partner-name {
    font-weight: 600;
    color: var(--main-color);
    text-decoration: none;
}

a.proj-partner-name:hover, a.proj-partner-name:focus-visible {
    color: var(--main-color-2);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

a.proj-partner-name:focus-visible {
    outline: 0.125rem solid var(--main-color-2);
    outline-offset: 0.2em;
    border-radius: 0.125rem;
}

.proj-partner-name-zh {
    font-family: var(--font-zh);
    font-size: 0.875rem;
    color: color-mix(in srgb, var(--main-color) 68%, transparent);
}

.proj-partner-role {
    font-size: 0.8125rem;
    color: color-mix(in srgb, var(--main-color) 58%, transparent);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 56rem) {
    .proj-pubs-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 37.5rem) {
    .proj-item-main {
        padding-block: 2rem 5rem;
    }
    .proj-findings-grid {
        grid-template-columns: 1fr;
    }
    .proj-gallery {
        grid-template-columns: 1fr;
    }
}

/* Respect reduced-motion: keep hover feedback, drop the transforms/animations. */
@media (prefers-reduced-motion: reduce) {
    .proj-pub-card,
    .proj-chip,
    .proj-output-link {
        transition: none;
    }
    .proj-pub-card:hover,
    .proj-pub-card:focus-visible {
        transform: none;
    }
}
