:root {
    --bg: #000;
    --text: #d4d4d4;
    --white: #fff;
    --dim: #8a8a8a;
    --faint: #4a4a4a;
    --line: #2a2a2a;
    --rule: #1f1f1f;
    --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

    --name-start: .2s;
    --letter-gap: .09s;
    --info-start: 1.35s;
    --projects-start: 1.7s;
    --project-gap: .15s;
    --intro-end: 3.8s;
    --text-fade: .8s;
    --banner-speed: 60s;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.7 var(--mono);
    -webkit-font-smoothing: antialiased;

    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img, video {
    display: block;
}

.dim {
    color: var(--dim);
}

.pixel {
    image-rendering: pixelated;
}

html:has(dialog[open]) {
    overflow: hidden;
}

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 0 56px;
    text-align: center;
}

header p {
    margin: 0;
    color: var(--white);
    font-size: 15px;
}

.pxname {
    --k: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--k) * 3);
    margin: 0;
}

.pxname .line {
    display: flex;
    gap: calc(var(--k) * 2);
}

.pxname .line:first-child {
    margin-top: calc(var(--k) * -3);
}

.pxname img {
    width: calc(var(--k) * var(--w));
    image-rendering: pixelated;
}

.contact {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 20px;
    color: var(--dim);
    font-size: 15px;
}

.contact a:hover {
    color: var(--white);
}

#featured {
    padding-bottom: 112px;
}

.featured {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    align-items: center;
    gap: 32px 48px;
}

.gallery {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 0;
    padding: 0;
    background: var(--bg);
    cursor: pointer;
}

.frame > :is(img, video) {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.thumb {
    aspect-ratio: 16 / 10;
    min-height: 44px;
    border: 0;
    padding: 0;
    background: var(--bg);
    outline: 1px solid var(--line);
    outline-offset: 2px;
    cursor: pointer;
}

.thumb[aria-pressed="true"] {
    outline-color: var(--c);
}

.thumb > * {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    padding: 1px 8px;
    border: 1px solid var(--c);
    background: var(--bg);
    color: var(--c);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .15em;
    line-height: 1.6;
    text-transform: uppercase;
}

.side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.meta {
    margin: 0;
    color: var(--dim);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
}

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

.desc {
    margin: 0;
    text-wrap: pretty;
}

.bullets {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bullets li {
    display: flex;
    gap: 12px;
}

.bullets li::before {
    content: "";
    flex: none;
    width: 4px;
    height: 4px;
    margin-top: 10px;
    background: var(--c);
}

.stack {
    margin: 0;
    color: var(--dim);
    font-size: 13px;
}

.stack-sep {
    color: var(--c);
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
}

.links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--c);
}

.links a:hover {
    text-decoration: underline;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 56px;
    padding-bottom: 112px;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 20px;
}

.section-head::before, .section-head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.section-head h2 {
    margin: 0;
    color: var(--dim);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: .25em;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 72px 48px;
}

.grid.small {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.grid.small .card {
    width: min(400px, 100%);
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.card-art {
    position: relative;
    width: 100%;
    margin-bottom: 2px;
    aspect-ratio: 16 / 10;
}

.grid.small .card-art {
    margin-bottom: 10px;
}

.card-art > :is(img, video) {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.summary {
    display: -webkit-box;
    max-width: 380px;
    margin: 0;
    overflow: hidden;
    text-wrap: pretty;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.card .stack {
    max-width: 380px;
}

#about {
    align-items: center;
    gap: 40px;
    padding-bottom: 96px;
}

#about .section-head {
    align-self: stretch;
}

.about {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 560px;
    font-size: 15px;
    line-height: 1.8;
    text-align: center;
}

.about p {
    margin: 0;
    text-wrap: pretty;
}

.about .cta {
    color: var(--white);
}

.about a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

footer {
    padding: 24px 0 80px;
}

.project-view {
    width: min(1040px, calc(100% - 48px));
    max-width: none;
    max-height: calc(100% - 64px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--line);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    color: var(--text);
}

.project-view::backdrop {
    background: rgb(0 0 0 / .75);
}

.project-view[open], .project-view[open]::backdrop {
    animation: fade .2s ease;
}

.view-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 40px 56px;
}

.view-close {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border: 0;
    padding: 0;
    background: none;
    color: var(--dim);
    font: 14px var(--mono);
    letter-spacing: .1em;
    cursor: pointer;
}

.view-close:hover {
    color: var(--white);
}

.view-close:focus {
    outline: none;
}

.view-close:focus-visible {
    outline: 1px solid var(--line);
    outline-offset: 4px;
}

.view-body {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.view-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 48px 72px;
}

.view-media {
    flex: 1 1 420px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.view-media .frame {
    cursor: zoom-in;
}

.view-info {
    flex: 1 1 360px;
    min-width: 0;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.view-info .desc {
    color: var(--white);
    font-size: 16px;
    line-height: 1.75;
}

.view-info .bullets {
    gap: 8px;
}

.details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 32px;
    margin: 8px 0 0;
    font-size: 13px;
}

.details dt {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: .2em;
    line-height: 22px;
    text-transform: uppercase;
}

.details dd {
    margin: 0;
}

.view-sections {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.view-section {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 72px;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
}

.view-section h2 {
    flex: 1 1 420px;
    min-width: 0;
    margin: 0;
    color: var(--dim);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .2em;
    line-height: 27px;
    text-transform: uppercase;
}

.view-section p {
    flex: 1 1 360px;
    min-width: 0;
    max-width: 520px;
    margin: 0;
    font-size: 15px;
    line-height: 1.8;
    text-wrap: pretty;
}

.track {
    position: absolute;
    inset: 0;
    display: flex;
    transform: translateX(calc(var(--i, 0) * -100%));
    transition: transform .5s cubic-bezier(.7, 0, .2, 1);
}

.track > * {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-out;
}

.arrow {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 28px;
    height: 40px;
    margin-top: -20px;
    border: 0;
    padding: 0;
    background: rgb(0 0 0 / .6);
    cursor: pointer;
}

.arrow::before {
    content: "";
    position: absolute;
    inset: 12px 9px;
    background: var(--c);
}

.arrow.prev {
    left: 0;
}

.arrow.prev::before {
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.arrow.next {
    right: 0;
}

.arrow.next::before {
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.arrow:hover {
    background: rgb(0 0 0 / .85);
}

.count {
    position: absolute;
    right: 16px;
    bottom: 12px;
    z-index: 1;
    padding: 0 4px;
    background: rgb(0 0 0 / .6);
    color: var(--c);
    font-size: 13px;
}

@media (hover: none) {
    .track {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        transform: none;
    }

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

    .track > * {
        scroll-snap-align: start;
    }

    .arrow {
        display: none;
    }
}

.viewer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 48px 56px;
    border: 0;
    background: rgb(0 0 0 / .92);
    color: var(--text);
    cursor: zoom-out;
}

.viewer[open] {
    display: flex;
}

.viewer::backdrop {
    background: transparent;
}

.viewer-media {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: clip;
}

.viewer.single .arrow, .viewer.single .count {
    display: none;
}

.viewer-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: 0;
    padding: 0;
    background: none;
    color: var(--c);
    font: 13px var(--mono);
    cursor: pointer;
}

.viewer-close:hover {
    color: var(--white);
}

.banner {
    --k: 3px;
    position: fixed;
    width: 100vh;
    height: calc(var(--k) * 14);
    overflow: hidden;
    opacity: .3;
    pointer-events: none;
    transform-origin: top left;
}

.banner.left {
    top: 100%;
    left: 16px;
    transform: rotate(-90deg);
}

.banner.right {
    top: 0;
    left: calc(100% - 16px);
    transform: rotate(90deg);
}

.banner-track {
    display: flex;
    width: max-content;
    animation: banner var(--banner-speed) linear infinite;
}

.banner-name {
    display: flex;
    gap: calc(var(--k) * 2);
    padding-right: calc(var(--k) * 12);
}

.banner-name img {
    width: calc(var(--k) * var(--w));
    image-rendering: pixelated;
}

.banner-space {
    width: calc(var(--k) * 2);
}

@media (max-width: 1040px) {
    .banner {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .banner-track, .project-view[open], .project-view[open]::backdrop {
        animation: none;
    }
}

@media (max-width: 760px) {
    .pxname {
        --k: 3.5px;
    }

    .viewer {
        padding: 40px 0;
    }

    .project-view {
        width: calc(100% - 24px);
        max-height: calc(100% - 24px);
    }

    .view-inner {
        padding: 8px 20px 40px;
    }
}

@keyframes fade {
    from { opacity: 0; }
}

@keyframes pop {
    from { visibility: hidden; }
}

@keyframes banner {
    to { transform: translateX(-50%); }
}

.anim .pxname img {
    animation: pop .01s steps(1) calc(var(--name-start) + var(--i) * var(--letter-gap)) both;
}

.anim header p, .anim header .contact, .anim .banner {
    animation: fade .4s ease var(--info-start) both;
}

.anim .project:not(.seen) > * {
    visibility: hidden;
}

.anim .project.seen > :is(.gallery, .card-art) {
    animation: fade .4s steps(4) var(--d) both;
}

.anim .project.seen > :not(.gallery, .card-art) {
    animation: fade var(--text-fade) ease calc(var(--d) + .35s) both;
}
