/* ==========================================================================
   /project/* — one page per project. Chrome comes from site.css.
   ========================================================================== */

/* ---- Top bar ----------------------------------------------------- */
.project-top {
    display: flex;
    justify-content: space-between;
    padding: 8rem var(--gutter) 1.6rem;
}
.project-top a { text-decoration: none; color: var(--mid); }
.project-top a:hover { color: var(--fg); }

/* ---- Project ----------------------------------------------------- */
/* Number, name at scale, the capture full width, then the reading in two
   columns, closing on links and "next". The page sets the counter so the
   number matches the project's place on /projects. */
.project-list {
    padding: 0 var(--gutter) 6rem;
}
.project-item {
    counter-increment: project;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.8rem var(--gutter);
    padding: 1.4rem 0 7rem;
    border-top: 1px solid var(--border);
}
.project-item > * { min-width: 0; }

.project-head {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: 0.2rem var(--gutter);
    align-items: baseline;
}
.project-head::before {
    content: counter(project, decimal-leading-zero);
    grid-row: 1;
    font-size: 11px;
    color: var(--mid);
}
.project-name {
    grid-column: 2;
    grid-row: 1 / span 3;
    font-size: 9vw;
    font-weight: 400;
    letter-spacing: -0.055em;
    line-height: 0.92;
    text-wrap: balance;
}
.featured .project-name { font-size: 4.4vw; line-height: 1; max-width: 18em; letter-spacing: -0.04em; }
/* A title with a subtitle (the thesis): the subtitle drops to its own line
   at half the size, never under body-reading size on phones. */
.project-subtitle {
    display: block;
    margin-top: 0.3em;
    font-size: max(0.5em, 1.05rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-wrap: balance;
}
.project-year,
.project-status,
.project-badge {
    grid-column: 3;
    justify-self: end;
    color: var(--mid);
    white-space: nowrap;
}
.project-year { color: var(--fg); }

.project-preview {
    grid-column: 1 / -1;
    display: block;
    overflow: hidden;
    border-radius: 4px;
    background: var(--border);
    outline-offset: 4px;
}
.project-preview img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (hover: hover) {
    .project-preview:hover img { transform: scale(1.02); }
}
/* Theme-matched captures: the dark shot in the dark theme, the light
   shot in the light one, following the same switch as the tokens. */
.project-preview .shot-light { display: none; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .project-preview .shot-dark { display: none; }
    :root:not([data-theme="dark"]) .project-preview .shot-light { display: block; }
}
:root[data-theme="light"] .project-preview .shot-dark { display: none; }
:root[data-theme="light"] .project-preview .shot-light { display: block; }

.project-summary {
    font-size: clamp(1.25rem, 2.1vw, 2rem);
    letter-spacing: -0.025em;
    line-height: 1.12;
    max-width: 18em;
}
.project-desc {
    color: var(--fg-mid);
    line-height: 1.5;
    max-width: 36em;
    padding-top: 0.35em;
}

/* With a capture, it sits as a figure in the right column beside the
   summary and description rather than running full width: these are
   engineering projects, the screenshot supports the text. */
/* The capture spans the summary and description rows; the last of them
   takes up any extra height so the description follows the summary. */
.project-item:has(> .project-preview) { grid-template-rows: auto auto 1fr; }
.project-item:has(> .project-preview) > .project-preview {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: start;
}
.project-item:has(> .project-preview) > .project-summary { grid-column: 1; grid-row: 2; }
.project-item:has(> .project-preview) > .project-desc { grid-column: 1; grid-row: 3; }
.project-preview img { max-height: 70vh; object-fit: contain; }

/* A project with a walkthrough video shows it in the capture's place, on
   the same plate; youtube-nocookie keeps cookies off until it plays. */
.project-video { aspect-ratio: 16 / 9; }
.project-video iframe { display: block; width: 100%; height: 100%; border: 0; }

.project-item > div:has(> .project-highlights) { grid-column: 1; }
.project-item > div:has(> .project-metrics) { grid-column: 2; }

.section-label {
    font-size: inherit;
    font-weight: 400;
    color: var(--mid);
    margin-bottom: 1rem;
}
.section-label::before { content: '[ '; }
.section-label::after { content: ' ]'; }

.project-highlights,
.architecture-list {
    list-style: none;
    counter-reset: point;
}
.project-highlights li,
.architecture-list li {
    counter-increment: point;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: var(--gutter);
    padding: 0.9rem 0;
    border-top: 1px solid var(--border);
    line-height: 1.4;
}
.project-highlights li::before,
.architecture-list li::before {
    content: counter(point, decimal-leading-zero);
    font-size: 11px;
    color: var(--mid);
    padding-top: 0.25em;
}

.project-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1.6rem var(--gutter);
}
.metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
}
.metric-value {
    font-size: clamp(1.8rem, 3.2vw, 3.2rem);
    letter-spacing: -0.045em;
    line-height: 1;
}
.metric-label { color: var(--mid); }

.architecture {
    grid-column: 1 / -1;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.architecture-list {
    columns: 2;
    column-gap: var(--gutter);
    padding-bottom: 1rem;
}
.architecture-list li { break-inside: avoid; }

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.3rem;
    align-content: start;
}
.project-tags::before {
    content: '[ Stack ]';
    flex-basis: 100%;
    color: var(--mid);
    margin-bottom: 0.25rem;
}
.project-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}
/* Tools link to their own sites; concepts stay plain text. */
a.project-tag {
    position: relative;
    text-decoration: none;
    transition: color 0.2s ease;
}
a.project-tag::after { content: ''; position: absolute; inset: -6px -4px; }
a.project-tag:hover { color: var(--accent); }
a.project-tag:active { opacity: 0.6; }
/* Brand marks in one ink, so they sit with the text in either theme. */
.tech-logo {
    width: 14px;
    height: 14px;
    flex: none;
    filter: brightness(0) invert(1) opacity(0.75);
}
:root[data-theme="light"] .tech-logo { filter: brightness(0) opacity(0.75); }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .tech-logo { filter: brightness(0) opacity(0.75); }
}

/* Links sit in the head, under the name, so they're there on arrival. */
.project-links {
    grid-column: 2 / -1;
    grid-row: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.6rem;
    margin-top: 1.4rem;
}
.project-tags { grid-column: 1 / -1; }
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font: inherit;
    color: var(--fg);
    background: none;
    border: 0;
    padding: 0;
    text-decoration: none;
    cursor: pointer;
    transition: gap 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.project-link::before { content: '→'; }
.project-link:hover { gap: 0.7rem; }
.project-link:active { opacity: 0.6; }
.project-link svg { display: none; }
.project-link[aria-disabled="true"] { color: var(--mid); cursor: default; }
.project-link[aria-disabled="true"]:hover { gap: 0.4rem; }

.project-next {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--gutter);
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
}
.next-link {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    text-decoration: none;
    font-size: clamp(1.4rem, 3vw, 3rem);
    letter-spacing: -0.035em;
    line-height: 1;
}
.next-label { font-size: 15px; letter-spacing: 0; color: var(--mid); }
.next-label::before { content: '[ '; }
.next-label::after { content: ' ]'; }
.next-arrow { transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.next-link:hover .next-arrow { transform: translateX(0.25em); }
.index-link { color: var(--mid); text-decoration: none; white-space: nowrap; }
.index-link:hover { color: var(--fg); }


@keyframes rise { from { transform: translateY(105%); } }
.project-name { animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
.project-name { cursor: default; transition: color 0.35s ease; }
@media (hover: hover) {
    .project-name:hover { color: var(--accent); }
}
.project-head { overflow: hidden; padding-bottom: 0.08em; }

@media (max-width: 900px) {
    .project-item { grid-template-columns: 1fr; gap: 2rem; padding-bottom: 5rem; }
    .project-item > div:has(> .project-highlights),
    .project-item > div:has(> .project-metrics) { grid-column: 1; }
    .project-head { grid-template-columns: 2rem minmax(0, 1fr); }
    .project-name { grid-row: 1; font-size: 12vw; }
    .featured .project-name { font-size: 7vw; }
    .project-year,
    .project-status,
    .project-badge { grid-column: 2; justify-self: start; }
    .project-links { grid-column: 2; grid-row: auto; }
    .architecture-list { columns: 1; }
    .project-item:has(> .project-preview) > .project-preview,
    .project-item:has(> .project-preview) > .project-summary,
    .project-item:has(> .project-preview) > .project-desc { grid-column: 1; grid-row: auto; }
}


@media (max-width: 720px) {
    .project-top { padding-top: 6rem; }
    .project-next { flex-direction: column; align-items: flex-start; }
}
