.projects-page {
    --project-accent: var(--theme-accent, #3a6351);
    --project-text: var(--theme-text, #1a202c);
    --project-muted: var(--theme-muted, #58687a);
    --project-border: var(--theme-border, #e2e8f0);
    --project-mat: var(--theme-surface, #fcfcfa);
    max-width: 1050px;
    margin: 0 auto;
    padding: 52px 20px 64px;
    font-family: 'Inter', sans-serif;
}
.projects-page :where(h1, h2, h3, h4, p) { margin: 0; hyphens: none; }
.projects-page :where(h1, h2, h3, h4) { font-family: inherit; }
.projects-page a { color: var(--project-accent); text-underline-offset: 4px; }
.projects-page a:focus-visible { outline: 2px solid var(--project-accent); outline-offset: 4px; }
.projects-header { margin-bottom: 34px; }
.projects-header h1 {
    color: var(--project-accent);
    font-size: clamp(2.75rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.15;
}
.projects-header p {
    max-width: 58ch;
    margin-top: 10px;
    color: var(--project-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}
.projects-topics { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; }
.projects-page .projects-topics a {
    padding: 4px 0;
    font-size: .86rem;
    font-weight: 650;
    line-height: 1.45;
    text-decoration: underline;
}
.projects-section#responsible-ai { --topic-color: #9a644e; }
.projects-section#computer-vision-and-ml { --topic-color: #557fab; }
html[data-theme="dark"] .projects-section#responsible-ai { --topic-color: #d5a586; }
html[data-theme="dark"] .projects-section#computer-vision-and-ml { --topic-color: #93b5dc; }
.projects-section {
    --panel-tint: var(--topic-color, var(--project-accent));
    --panel-bg: color-mix(in srgb, var(--panel-tint) 8%, var(--theme-bg, #fdfdfd));
    --panel-line: color-mix(in srgb, var(--panel-tint) 15%, var(--project-border));
    --project-hover: color-mix(in srgb, var(--panel-bg) 55%, var(--project-mat));
    display: grid;
    grid-template-columns: minmax(135px, .92fr) minmax(0, 3.7fr);
    align-items: start;
    gap: 12px 24px;
    margin-top: 24px;
    padding: 16px 22px;
    border: 1px solid var(--project-border);
    border-color: var(--panel-line);
    border-radius: 20px;
    background: var(--project-mat);
    background: var(--panel-bg);
    scroll-margin-top: 68px;
}
.projects-section:first-of-type { margin-top: 0; }
/* Project sections use scroll-margin-top instead of the theme's anchor spacer. */
.projects-page section.projects-section:target::before { content: none; }
.projects-page .projects-section > h2 {
    padding-top: 14px;
    color: var(--project-text);
    font-size: clamp(1.15rem, 2.25vw, 1.35rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
    text-wrap: balance;
}

.project-entry + .project-entry { border-top: 1px solid var(--panel-line, var(--project-border)); }
.projects-page .project-entry-link {
    --project-thumb: clamp(110px, 17vw, 180px);
    display: grid;
    grid-template-columns: var(--project-thumb) minmax(0, 1fr) auto;
    align-items: center;
    gap: 15px;
    padding: 14px 12px;
    border-radius: 10px;
    transition: none;
}
.project-entry-link:focus-visible { background: var(--project-hover); }
.project-entry-link:focus-visible .project-entry-title { text-decoration: underline; }
.project-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1.8;
    border: 1px solid var(--project-border);
    border-radius: 7px;
    background: var(--project-mat);
}
.project-card-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.project-card-diagram, .project-card-mark { background: #f5f7f5; }
.project-card-diagram img { padding: 5px; }
.project-card-mark img { width: 52%; margin: 0 auto; }
.project-entry-copy { display: grid; gap: 4px; }
.project-entry-title {
    color: var(--project-text);
    font-size: clamp(1.04rem, 2vw, 1.25rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
}
.project-description { color: var(--project-muted); font-size: .92rem; line-height: 1.45; }
.project-tags { color: var(--project-muted); font-size: .76rem; font-weight: 600; line-height: 1.4; }
.project-entry-meta {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 10px;
    align-self: start;
    padding-top: 3px;
}
.project-year { color: var(--project-muted); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-entry-arrow { color: var(--project-accent); line-height: 1; }

.projects-experiments { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--panel-line, var(--project-border)); }
.projects-experiments > h3 { padding: 0 12px 5px; color: var(--project-muted); font-size: .88rem; font-weight: 650; }
.projects-page .projects-experiments .project-entry-link { --project-thumb: clamp(82px, 12vw, 120px); padding-block: 11px; }
.projects-experiments .project-entry-title { font-size: 1.02rem; }

.project-detail .project-detail-context {
    margin-bottom: 12px;
    color: var(--theme-accent, #3a6351);
    font-size: .9rem;
    font-weight: 600;
}
.project-detail :where(p, figcaption) { hyphens: none; }
.project-detail-figure { margin: 20px 0; }
.project-detail-figure img {
    display: block;
    max-width: 100%;
    max-height: 44rem;
    width: auto;
    height: auto;
    margin: 0 auto;
    padding: 10px;
    border: 1px solid var(--theme-border, #e2e8f0);
    border-radius: 8px;
    background: #f5f7f5;
    object-fit: contain;
}
.project-detail-figure figcaption { margin-top: 7px; text-align: center; }
.project-detail-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 22px 0; }
.project-detail-back { margin: 22px 0 32px; }
.project-detail :where(nav, .project-detail-back) a {
    color: var(--theme-accent, #3a6351);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
    .project-entry-link:hover { background: var(--project-hover); }
    .project-entry-link:hover .project-entry-title { text-decoration: underline; }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .projects-page .project-entry-link { transition: transform 180ms ease, background-color 180ms ease; }
    .project-entry-link:hover {
        position: relative;
        z-index: 1;
        transform: scale(1.012);
    }
    .project-detail figure > img {
        position: relative;
        transform-origin: center bottom;
        transition: transform 180ms ease;
    }
    .project-detail figure > img:hover {
        z-index: 1;
        transform: scale(1.12);
    }
}

@media (max-width: 740px) {
    .projects-section { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 15px 17px; }
    .projects-page .projects-section > h2 { padding-top: 0; text-wrap: wrap; }
}

@media (max-width: 540px) {
    .projects-page { padding: 36px 16px 48px; }
    .projects-header { margin-bottom: 26px; }
    .projects-section { padding-inline: 12px; border-radius: 16px; }
    .projects-page .project-entry-link, .projects-page .projects-experiments .project-entry-link {
        grid-template-columns: clamp(70px, 22vw, 106px) minmax(0, 1fr);
        gap: 4px 12px;
        padding-inline: 0;
    }
    .project-card-image { grid-area: 1 / 1 / span 2; align-self: start; }
    .project-entry-copy { grid-area: 2 / 2; }
    .project-entry-meta { grid-area: 1 / 2; justify-content: space-between; padding-top: 0; }
    .projects-experiments > h3 { padding-inline: 0; }
}
