:root {
    color-scheme: light;
    --page-bg: #eef0f3;
    --surface: #ffffff;
    --surface-active: #f2f2f2;
    --text: #202124;
    --muted: #666a70;
    --border: rgba(25, 28, 32, 0.14);
    --shadow: 0 14px 34px rgba(24, 28, 34, 0.09);
}

[data-theme="dark"] {
    color-scheme: dark;
    --page-bg: #181818;
    --surface: #2c2c2c;
    --surface-active: #3a3a3a;
    --text: #f4f4f4;
    --muted: #c2c2c2;
    --border: rgba(255, 255, 255, 0.14);
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem 4rem;
    background: var(--page-bg);
    color: var(--text);
    font-family: 'Raleway', sans-serif;
}

.project-files-header,
.project-files-main {
    width: min(100%, 900px);
    margin-inline: auto;
}

.back-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    margin-bottom: 3rem;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.project-kicker,
.project-date {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

h1 {
    max-width: 760px;
    margin: 0.65rem 0 0.8rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.12;
    letter-spacing: 0;
}

.project-files-main {
    margin-top: 4rem;
}

.file-section + .file-section {
    margin-top: 3rem;
}

h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    letter-spacing: 0;
}

.file-list {
    display: grid;
    gap: 0.75rem;
}

.visualization-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-link {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 1rem;
    min-height: 76px;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.file-link:hover {
    transform: translateY(-2px);
    background: var(--surface-active);
}

.file-link strong,
.file-link small {
    display: block;
}

.file-link small {
    margin-top: 0.3rem;
    color: var(--muted);
    line-height: 1.45;
}

.file-type {
    display: inline-flex;
    width: 56px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-active);
    font-size: 0.72rem;
    font-weight: 700;
}

.script-viewer-header,
.script-viewer-main {
    width: min(100%, 1180px);
    margin-inline: auto;
}

.script-viewer-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}

.script-viewer-heading h1 {
    margin-bottom: 0;
}

.raw-file-link {
    display: inline-flex;
    min-height: 42px;
    flex: 0 0 auto;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.raw-file-icon {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.script-viewer-main {
    margin-top: 2.5rem;
}

.code-viewer {
    max-height: calc(100vh - 230px);
    margin: 0;
    padding: 1.25rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.65;
    text-align: left;
    tab-size: 2;
    white-space: pre;
}

@media (max-width: 640px) {
    body {
        padding-top: 1.25rem;
    }

    .back-link {
        margin-bottom: 2rem;
    }

    .project-files-main {
        margin-top: 3rem;
    }

    .visualization-list {
        grid-template-columns: 1fr;
    }

    .file-link {
        transition: none;
    }

    .file-link:hover,
    .file-link:active {
        transform: none;
    }

    .script-viewer-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .raw-file-link {
        width: 100%;
        justify-content: center;
    }

    .code-viewer {
        max-height: none;
        padding: 1rem;
        font-size: 0.8rem;
    }
}
