@font-face {
    font-family: 'Monaspace Neon';
    src: url('../fonts/MonaspaceNeon-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Monaspace Neon';
    src: url('../fonts/MonaspaceNeon-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f8f9fc;
    --ink: #3a3d4a;
    --muted: #555a6b;
    --faint: #6f7586;
    --line: #aeb5c2;
    --surface: #ffffff;
    --accent: #1a90c4;
    --serif: 'IBM Plex Mono', 'Monaspace Neon', ui-monospace, Consolas, monospace;
    --mono: 'IBM Plex Mono', 'Monaspace Neon', ui-monospace, Consolas, monospace;
}

:root[data-theme='dark'] {
    --bg: #000000;
    --ink: #d1d5db;
    --muted: #9ca3af;
    --faint: #7f8794;
    --line: #2d333d;
    --surface: #0a0c0f;
    --accent: #74c7ec;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --bg: #000000;
        --ink: #d1d5db;
        --muted: #9ca3af;
        --faint: #7f8794;
        --line: #2d333d;
        --surface: #0a0c0f;
        --accent: #74c7ec;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

html,
body {
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 16px;
    line-height: 1.55;
    padding: 34px 18px 88px;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    text-decoration-color: var(--faint);
    transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 1px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: #b8b8b3;
}

::-webkit-scrollbar-thumb:hover {
    background: #8f8f89;
}

.page {
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 832px;
    margin: 8px auto 0;
    padding: 38px;
    border: 1px solid var(--line);
    outline: 1px solid color-mix(in srgb, var(--line) 64%, transparent);
    outline-offset: 6px;
}

.page::before {
    display: none;
}

.intro {
    display: block;
    max-width: 100%;
    margin-left: 0;
    padding: 16px 0 42px;
}

.intro.text-only {
    display: block;
}

.intro-copy,
.section,
.row,
.row > div {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding: 0 0 12px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
}

.site-id {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none;
}

.site-avatar {
    position: relative;
    display: block;
    flex: 0 0 84px;
    width: 84px;
    height: 84px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 64%, var(--line));
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 24%, var(--surface));
    box-shadow: none;
}

.site-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    mix-blend-mode: color;
    opacity: 0.34;
    pointer-events: none;
}

.site-id img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: grayscale(1) contrast(1.06);
    transition: filter 140ms ease, transform 140ms ease;
}

.site-id:hover .site-avatar {
    border-color: var(--accent);
}

.site-id:hover img {
    filter: grayscale(0.72) contrast(1.04);
    transform: scale(1.025);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav a,
.theme-toggle {
    display: grid;
    place-items: center;
    height: 34px;
    min-width: 48px;
    padding: 0 10px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
    border-color: var(--accent);
    color: var(--accent);
}

.site-nav a.active {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.theme-toggle {
    appearance: none;
    background: transparent;
    margin: 0;
    padding: 0 9px;
    color: var(--faint);
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease;
}

.theme-toggle svg {
    display: block;
    width: 15px;
    height: 15px;
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme='dark'] .theme-toggle .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .theme-toggle .icon-sun {
        display: block;
    }

    :root:not([data-theme='light']) .theme-toggle .icon-moon {
        display: none;
    }
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 1px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-family: var(--serif);
    font-size: 38px;
    line-height: 1.16;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.lede {
    max-width: 620px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.62;
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
}

.link-row a {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    min-width: 116px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    text-decoration: none;
}

.brand-icon {
    flex: 0 0 17px;
    width: 17px;
    height: 17px;
    color: color-mix(in srgb, var(--accent) 68%, var(--muted));
    transition: color 120ms ease;
}

.link-row a:hover .brand-icon {
    color: var(--accent);
}

.link-row a:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.section {
    border-top: 1px solid var(--line);
    padding: 28px 0 34px;
}

.section:not(.split) {
    display: block;
}

.section:not(.split) > h2 {
    margin-bottom: 16px;
    padding-right: 0;
    border-right: 0;
}

.section:not(.split) > :not(h2) {
    padding-left: 0;
}

.section h2 {
    margin: 0 0 16px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    text-transform: lowercase;
    letter-spacing: 0.14em;
}

.panel-grid {
    counter-reset: role;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.panel-card {
    position: relative;
    counter-increment: role;
    min-width: 0;
    min-height: 150px;
    padding: 48px 18px 18px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: none;
    transition: border-color 140ms ease, transform 140ms ease;
}

.panel-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.panel-card::before {
    content: '0' counter(role);
    position: absolute;
    top: 16px;
    left: 18px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.panel-card h3 {
    font-size: 17px;
    font-weight: 600;
}

.panel-card p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.panel-card span {
    display: block;
    margin-top: 5px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.song-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    min-height: 128px;
    padding: 17px;
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
    background:
        linear-gradient(112deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 58%);
}

.song-card::before {
    content: none;
}

.song-thumbnail {
    position: relative;
    display: block;
    width: 92px;
    height: 92px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 72%, var(--line));
    background: var(--surface);
    text-decoration: none;
}

.song-thumbnail::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent);
    transition: border-color 120ms ease;
}

.song-thumbnail:hover::after {
    border-color: var(--accent);
}

.song-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.82) contrast(1.04);
    transition: filter 140ms ease, transform 140ms ease;
}

.song-thumbnail:hover img {
    filter: saturate(1) contrast(1.02);
    transform: scale(1.025);
}

.song-copy h3 a {
    text-decoration: none;
}

.song-copy {
    min-width: 0;
    padding-right: 0;
}

.frame-mark {
    position: absolute;
    z-index: 2;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.frame-mark-nw { top: 0; left: 0; transform: translate(-50%, -50%); }
.frame-mark-ne { top: 0; right: 0; transform: translate(50%, -50%); }
.frame-mark-sw { bottom: 0; left: 0; transform: translate(-50%, 50%); }
.frame-mark-se { right: 0; bottom: 0; transform: translate(50%, 50%); }

.rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.row {
    display: block;
    min-height: 142px;
    padding: 18px;
    border: 1px solid var(--line);
    background: var(--surface);
    transition: border-color 140ms ease, background-color 140ms ease;
}

.row:hover {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
    background: var(--surface);
}

.row + .row {
    border-top: 1px solid var(--line);
}

.row > div {
    padding: 0;
}

.row h3 {
    font-size: 17px;
    line-height: 1.3;
    font-weight: 500;
    max-width: 100%;
    overflow-wrap: break-word;
}

.row h3 a {
    text-decoration: none;
}

.row h3 a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.row p {
    max-width: 620px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
}

.row > span {
    display: block;
    margin-top: 14px;
    padding: 0;
    border-left: 0;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.7;
    text-align: left;
    white-space: nowrap;
}

.project-card {
    position: relative;
    display: flex;
    min-height: 214px;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    padding: 20px;
}

.project-card::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: transparent;
    content: '';
    transition: background-color 140ms ease;
}

.project-card:hover::after,
.featured-project::after {
    background: color-mix(in srgb, var(--accent) 76%, transparent);
}

.featured-project {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 46%),
        var(--surface);
}

.project-heading {
    display: block;
}

.project-kicker {
    display: block;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
}

.project-card h3 {
    margin-top: 9px;
    font-size: 18px;
    font-weight: 600;
}

.project-card p {
    margin-top: 7px;
    line-height: 1.55;
}

.project-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.project-tags {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.project-tags li {
    padding: 3px 7px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: color-mix(in srgb, var(--surface) 88%, var(--bg));
    font-family: var(--mono);
    font-size: 10.5px;
    line-height: 1.2;
}

.project-source {
    flex: 0 0 auto;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    text-decoration: none;
    white-space: nowrap;
}

.project-source:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.home-project-card {
    min-height: 194px;
}

.compact .row {
    min-height: 92px;
}

.compact .row > div,
.compact .row > span {
    padding: 0;
}

.more-row h3 {
    font-size: 16px;
    font-style: italic;
    font-weight: 400;
}

.more-row > span {
    color: var(--faint);
}

.note-card {
    display: flex;
    flex-direction: column;
}

.note-meta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: auto;
    padding-top: 18px;
}

.note-meta time {
    color: var(--faint);
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.note-tags span {
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
    color: var(--accent);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: 0.04em;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.split > div {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    transition: border-color 140ms ease;
}

.split > div:hover {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
}

.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 16px;
}

.plain-list li {
    padding-left: 20px;
    position: relative;
}

.plain-list li::before {
    content: '\2013';
    position: absolute;
    left: 0;
    color: var(--faint);
}

.plain-list li + li {
    margin-top: 8px;
}

.tight-list {
    font-size: 16px;
    line-height: 1.45;
}

.tight-list li + li {
    margin-top: 6px;
}

.section-copy {
    max-width: 680px;
    color: var(--muted);
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding-top: 26px;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 12.5px;
}

@media (max-width: 720px) {
    body {
        font-size: 16px;
        padding: 22px 16px 64px;
    }

    .page {
        margin-top: 6px;
        padding: 24px;
    }

    .intro {
        margin-left: 0;
        padding-bottom: 32px;
    }

    h1 {
        font-size: 32px;
    }

    .lede {
        max-width: 420px;
        font-size: 18px;
    }

    .row p {
        max-width: 420px;
    }

    .rows,
    .panel-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .section:not(.split) {
        display: block;
    }

    .section:not(.split) > h2 {
        margin-bottom: 18px;
        padding-right: 0;
        border-right: 0;
    }

    .section:not(.split) > :not(h2) {
        padding-left: 0;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .split {
        gap: 34px;
    }

    .row > span { text-align: left; white-space: normal; }

    .project-card {
        min-height: 0;
    }

    .project-card-footer {
        align-items: flex-start;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .site-avatar {
        flex-basis: 68px;
        width: 68px;
        height: 68px;
    }

    .site-nav {
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }

    .song-card {
        grid-template-columns: 76px minmax(0, 1fr);
        gap: 14px;
    }

    .song-thumbnail {
        width: 76px;
        height: 76px;
    }

    .song-copy {
        padding-right: 0;
    }
}
