:root {
    --color-bg: #000;
    --color-surface: #0a0a0a;
    --color-text: #fff;
    --color-muted: rgba(255, 255, 255, 0.55);
    --color-faint: rgba(255, 255, 255, 0.32);
    --color-line: rgba(255, 255, 255, 0.12);
    --color-link-underline: rgba(255, 255, 255, 0.3);
    --color-link-underline-hover: rgba(255, 255, 255, 0.8);
    --color-bracket: rgba(255, 255, 255, 0.7);
    --color-body-text: rgba(255, 255, 255, 0.8);
    --color-accent: #4ade80;

    --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --sidebar-width: 264px;
    --content-max-width: 1280px;
    --page-padding: 40px;
    --content-gutter: clamp(64px, 7.5vw, 136px);
    --bracket-size: 10px;
    --bracket-weight: 1px;
    --frame-gap: 10px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    line-height: 1.5;
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-link-underline);
    transition: border-color 0.2s;
}

a:hover,
a:focus-visible {
    border-color: var(--color-link-underline-hover);
}

:focus-visible {
    outline: 1px solid var(--color-link-underline-hover);
    outline-offset: 3px;
}

p {
    margin: 8px 0;
}

/* Layout */

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    padding: var(--page-padding) 32px;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.name {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px;
    letter-spacing: -0.01em;
}

.toc h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 40px 0 12px;
}

.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc li {
    margin: 6px 0;
}

.toc a {
    color: var(--color-muted);
    border-bottom-color: transparent;
    transition: color 0.2s, border-color 0.2s;
}

.toc a:hover,
.toc a:focus-visible,
.toc a[aria-current="true"] {
    color: var(--color-text);
    border-bottom-color: var(--color-link-underline);
}

/* Main content */

.content {
    width: 100%;
    max-width: var(--content-max-width);
    margin-inline: auto;
    padding: var(--page-padding) var(--content-gutter);
}

.section + .section {
    margin-top: 88px;
}

.section-head {
    margin-bottom: 32px;
}

.section-head h2 {
    margin: 0 0 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-rule {
    height: 1px;
    background: linear-gradient(to right, var(--color-text) 0%, var(--color-text) 35%, transparent 100%);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px 28px;
}

/* Card */

.card {
    position: relative;
    scroll-margin-top: var(--page-padding);
}

.frame {
    position: relative;
    padding: var(--frame-gap);
}

.frame::before,
.frame::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--bracket-size);
    border: var(--bracket-weight) solid var(--color-bracket);
    pointer-events: none;
    transition: transform 0.35s var(--ease), border-color 0.35s var(--ease);
}

.frame::before {
    left: 0;
    border-right: 0;
}

.frame::after {
    right: 0;
    border-left: 0;
}

.card:hover .frame::before,
.card:focus-within .frame::before {
    transform: translateX(-3px);
    border-color: var(--color-text);
}

.card:hover .frame::after,
.card:focus-within .frame::after {
    transform: translateX(3px);
    border-color: var(--color-text);
}

.screen {
    display: block;
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--color-surface);
    border: 0;
    container-type: inline-size;
}

.screen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    filter: grayscale(0.35) brightness(0.82);
    transform: scale(1.001);
    transition: filter 0.4s var(--ease), transform 0.6s var(--ease);
}

.card:hover .screen img,
.card:focus-within .screen img {
    filter: none;
    transform: scale(1.025);
}

/* Placeholder art for projects without a public site */

.screen-art {
    display: grid;
    background-image: radial-gradient(var(--color-line) 1px, transparent 1px);
    background-size: 14px 14px;
    background-color: var(--color-surface);
}

.art-terminal {
    align-self: center;
    justify-self: center;
    font-family: var(--font-mono);
    font-size: clamp(11px, 4.6cqw, 15px);
    color: var(--color-text);
}

.art-terminal p {
    margin: 5px 0;
}

.art-prompt {
    color: var(--color-faint);
}

.art-status {
    margin-left: 8px;
    color: var(--color-accent);
}

.art-status::before {
    content: "● ";
}

.art-title {
    align-self: center;
    justify-self: center;
    display: grid;
    gap: 6px;
    text-align: center;
    font-size: clamp(24px, 11cqw, 44px);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.art-dim {
    font-family: var(--font-mono);
    font-size: clamp(9px, 3.2cqw, 11px);
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-faint);
}

.card-body {
    padding: 16px var(--frame-gap) 0;
}

.card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
}

.card-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Stretches the title link over the whole card so any click opens the project page. */
.card-title h3 a::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.card-title h3 a::after {
    content: " →";
    font-size: 0.8em;
    color: var(--color-faint);
    transition: color 0.2s;
}

.card:hover .card-title h3 a::after,
.card-title h3 a:focus-visible::after {
    color: var(--color-text);
}

.years {
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--color-text);
}

.meta {
    margin: 4px 0 0;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--color-text);
}

.desc {
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--color-muted);
}

.footer {
    margin-top: 120px;
    padding-top: 20px;
    border-top: 1px solid var(--color-line);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-faint);
}

/* Project detail pages */

.detail {
    max-width: 800px;
    margin-inline: auto;
    padding: var(--page-padding) 24px;
}

.detail-nav {
    margin-bottom: 64px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.detail-nav a {
    color: var(--color-muted);
    border-bottom-color: transparent;
    transition: color 0.2s, border-color 0.2s;
}

.detail-nav a:hover,
.detail-nav a:focus-visible {
    color: var(--color-text);
    border-bottom-color: var(--color-link-underline);
}

.detail-kicker {
    margin: 0 0 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-faint);
}

.detail-head h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 14px;
}

.detail-meta .years,
.detail-meta .meta {
    margin: 0;
}

.detail-lead {
    margin: 22px 0 0;
    font-size: 17px;
    color: var(--color-muted);
}

.detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 13px;
}

.detail-links a::after {
    content: " ↗";
    color: var(--color-faint);
}

.detail-shot {
    margin-top: 48px;
}

.detail-shot .screen img {
    filter: none;
}

.detail-section {
    margin-top: 72px;
}

.detail-section p,
.detail-section li {
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-body-text);
}

.subproject {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    scroll-margin-top: var(--page-padding);
}

.subproject + .subproject {
    margin-top: 48px;
}

.subproject-body p {
    margin: 10px 0 0;
}

.subproject .detail-links {
    margin-top: 14px;
}

@media (max-width: 640px) {
    .subproject {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.todo {
    font-style: italic;
    color: var(--color-faint);
}

.detail .footer {
    margin-top: 104px;
}

/* Reveal on scroll (only when JS is running, so content is never hidden without it) */

.js .card {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.js .card.is-visible {
    opacity: 1;
    transform: none;
}

/* Responsive */

@media (max-width: 1360px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 30px 24px 0;
    }

    .toc {
        display: none;
    }

    .content {
        padding: 48px 24px 40px;
    }
}

@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }

    .js .card {
        opacity: 1;
        transform: none;
    }
}
