@font-face {
    font-family: 'JBM';
    src: url('../fonts/jbm-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'JBM';
    src: url('../fonts/jbm-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #0b0a10;
    --panel: #0e0d14;
    --fg: #e7e4f2;
    --dim: #8d89a3;
    --faint: #55526a;
    --line: rgba(231, 228, 242, .2);
    --acc: #a78bfa;
    --acc-soft: rgba(167, 139, 250, .14);
    --ok: #5ee0a0;
    --mono: 'JBM', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --ease: cubic-bezier(.16, 1, .3, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 50px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    font-variant-ligatures: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

pre {
    margin: 0;
    font-family: var(--mono);
}

h1,
h2,
h3 {
    margin: 0;
    font: inherit;
}

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

:focus-visible {
    outline: 1px solid var(--acc);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.wrap {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

.blink {
    animation: blink 1.1s steps(2, jump-none) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* character art: rows must tile, so line height is set per element in js */
.fig,
.ascii {
    line-height: 1.32;
    white-space: pre;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.fig {
    color: var(--acc);
}

/* ───────── cursor: a block that becomes focus brackets ───────── */
.has-cursor,
.has-cursor * {
    cursor: none !important;
}

#cur {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 9px;
    height: 18px;
    pointer-events: none;
    display: none;
    transition: width .22s var(--ease), height .22s var(--ease), opacity .2s;
    will-change: transform, width, height;
}

.has-cursor #cur {
    display: block;
}

#cur::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--acc);
    transition: opacity .15s;
}

#cur i {
    position: absolute;
    width: 7px;
    height: 7px;
    border: 0 solid var(--acc);
    opacity: 0;
    transition: opacity .15s;
}

#cur i:nth-child(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
#cur i:nth-child(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
#cur i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
#cur i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

#cur.lock::before {
    opacity: 0;
}

#cur.lock i {
    opacity: 1;
}

#cur.down {
    scale: .94;
}

#cur.out {
    opacity: 0;
}

.trail {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99;
    pointer-events: none;
    color: var(--acc);
    font-size: 15px;
    line-height: 18px;
    opacity: 0;
}

.trail.go {
    animation: trail .55s steps(4) forwards;
}

@keyframes trail {
    from {
        opacity: .7;
    }

    to {
        opacity: 0;
    }
}

/* ───────── header: a shell prompt ───────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 2.2ch;
    height: 34px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px dashed var(--line);
    white-space: nowrap;
}

.ps1 {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps1 b {
    color: var(--acc);
}

.ps1 i {
    font-style: normal;
    color: var(--faint);
}

.ps1 em {
    font-style: normal;
    color: var(--acc);
}

#cwd {
    color: var(--fg);
}

#cmd {
    color: #cbbcff;
}

.ps1 .blink {
    color: var(--acc);
}

.ls {
    display: flex;
    gap: 2ch;
    color: var(--dim);
}

.ls a::after {
    content: '/';
    color: var(--faint);
}

.ls a:hover,
.ls a.active {
    color: var(--fg);
}

.ls a.active span {
    box-shadow: 0 1px 0 var(--acc);
}

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

.langs {
    display: flex;
    gap: .4ch;
}

.langs button {
    padding: 0 .5ch;
    color: var(--dim);
}

.langs button:hover {
    color: var(--fg);
}

.langs button[aria-pressed="true"] {
    background: var(--acc);
    color: var(--bg);
}

.out {
    position: absolute;
    top: 100%;
    left: 24px;
    max-width: calc(100% - 48px);
    margin-top: 6px;
    padding: 8px 12px;
    background: #14121d;
    border: 1px solid var(--line);
    color: var(--fg);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ───────── hero ───────── */
.hero {
    position: relative;
    overflow: hidden;
}

#field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-in {
    position: relative;
    padding-top: 22px;
    padding-bottom: 30px;
}

.meta {
    display: flex;
    justify-content: space-between;
    gap: 6px 16px;
    flex-wrap: wrap;
    margin: 0;
    color: var(--dim);
}

.on {
    color: var(--fg);
}

.on::before {
    content: '■ ';
    color: var(--ok);
    animation: blink 1.4s steps(2, jump-none) infinite;
}

.hero h1 {
    padding-top: clamp(40px, 7vh, 76px);
    padding-bottom: 12px;
}

/* the name is laid out here for size and position, then drawn glyph by glyph on the canvas */
#name {
    visibility: hidden;
}

.hero-in {
    pointer-events: none;
}

.prompt {
    margin: 16px 0 0;
    font-size: clamp(15px, 1.7vw, 21px);
    line-height: 1.3;
    min-height: 1.3em;
}

.gt,
.prompt .blink {
    color: var(--acc);
}

#typed {
    color: #cbbcff;
}

/* ───────── panes ───────── */
.block {
    padding-top: 22px;
}

.tui {
    display: grid;
    grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
    border: 1px solid var(--line);
    background: var(--panel);
}

.tui.two {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.tui>.pane:only-child {
    grid-column: 1 / -1;
}

.pane {
    min-width: 0;
}

.pane+.pane {
    border-left: 1px solid var(--line);
}

.bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--dim);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.bar>span:first-child {
    color: var(--acc);
}

.bar>span:first-child::before {
    content: '┤ ';
    color: var(--faint);
}

.bar>span:first-child::after {
    content: ' ├';
    color: var(--faint);
}

.bar button[aria-pressed="true"] {
    color: var(--acc);
}

.pad {
    padding: 16px 16px 18px;
}

/* project list */
.list {
    display: flex;
    flex-direction: column;
}

#list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

#list li {
    display: grid;
    grid-template-columns: 2ch 3ch minmax(0, 1fr) auto;
    gap: 0 1ch;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--dim);
}

#list li .mark {
    color: var(--acc);
    opacity: 0;
}

#list li .kind {
    color: var(--faint);
    font-size: 12px;
}

#list li:hover {
    color: var(--fg);
}

#list li[aria-selected="true"] {
    background: var(--acc-soft);
    color: var(--fg);
}

#list li[aria-selected="true"] .mark {
    opacity: 1;
}

#list li[aria-selected="true"] .kind {
    color: var(--acc);
}

.keys {
    margin: auto 0 0;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 12px;
}

/* preview */
.shot {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1.958; /* exactly 112 x 26 character cells, so scenes are never cropped */
    width: 100%;
    overflow: hidden;
    background: #08070c;
    color: var(--acc);
    border-bottom: 1px solid var(--line);
}

.shot .ascii {
    grid-area: 1 / 1;
    transition: opacity .3s;
}

.shot .ascii b {
    font-weight: 400;
    background: var(--acc);
    color: #08070c;
}

/* the TGG mark keeps the colours of the real logo: the one place other colours are allowed */
.shot .ascii i,
.fig i {
    font-style: normal;
}

/* a slightly lighter, warmer purple than the site's accent: clearly family, just told apart */
.tgw { color: #f3eeff; }
.tgl { color: #ebe3ff; }
.tgg { color: #b596ff; }
.tgn { color: #4b3a9e; }

.shot .fx {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.info {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 28px;
    padding: 16px 16px 18px;
    align-items: start;
}

.lead {
    margin: 10px 0 0;
    font-size: 15px;
}

.lead::before {
    content: '> ';
    color: var(--acc);
}

.desc {
    margin: 10px 0 0;
    max-width: 66ch;
    color: var(--dim);
}

.points {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.points li {
    padding-left: 2ch;
    text-indent: -2ch;
}

.points li::before {
    content: '+ ';
    color: var(--acc);
}

.table>div {
    display: grid;
    grid-template-columns: 12ch minmax(0, 1fr);
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
}

.table>div:first-child {
    border-top: 1px dashed var(--line);
}

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

.table p {
    margin: 0;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 14px;
}

.btn {
    display: inline-block;
    white-space: nowrap;
}

.btn::before {
    content: '[ ';
    color: var(--acc);
}

.btn::after {
    content: ' ]';
    color: var(--acc);
}

.btn:hover {
    color: var(--acc);
}

/* ───────── about ───────── */
.about-text p {
    margin: 0 0 1em;
    color: var(--dim);
}

.about-text p:last-child {
    margin-bottom: 0;
}

.about-text .big {
    color: var(--fg);
    font-size: 15px;
}

.about-text .big::before {
    content: '> ';
    color: var(--acc);
}

.dog {
    float: right;
    width: 132px;
    margin: 0 0 10px 18px;
}

.dog .shot {
    aspect-ratio: 1;
    border: 1px solid var(--line);
}

.dog figcaption {
    margin-top: 4px;
    color: var(--faint);
    font-size: 11.5px;
}

/* ───────── contact ───────── */
.contact .fig {
    margin-bottom: 14px;
}

.mail {
    font-size: clamp(15px, 2vw, 22px);
    line-height: 1.3;
    text-align: left;
}

.mail::before {
    content: '> ';
    color: var(--acc);
}

.mail:hover {
    color: var(--acc);
}

/* ───────── footer ───────── */
.foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 22px;
    color: var(--faint);
    font-size: 12px;
}

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

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

/* ───────── responsive ───────── */
@media (max-width: 900px) {

    .tui,
    .tui.two {
        grid-template-columns: minmax(0, 1fr);
    }

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

    .keys,
    .clock {
        display: none;
    }

    .shot {
        max-height: none;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 13px;
    }

    .wrap {
        padding-left: 12px;
        padding-right: 12px;
    }

    .nav {
        padding: 0 12px;
        gap: 1.4ch;
    }

    .ps1 i,
    .ps1 em,
    #cmd,
    .ps1 .blink,
    #cwd {
        display: none;
    }

    .ls {
        gap: 1.4ch;
    }

    .info {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .dog {
        width: 104px;
    }

    .foot {
        flex-direction: column;
        gap: 2px;
    }
}
