:root {
    --bg: #0a0b0f;
    --ink: #14161c;
    --text: #f2f3f7;
    --soft: #c5c9d6;
    --muted: #9a9fb0;
    --faint: #6b7080;
    --glass: rgb(255 255 255 / 0.045);
    --glass-hi: rgb(255 255 255 / 0.08);
    --hairline: rgb(255 255 255 / 0.09);
    --hairline-hi: rgb(255 255 255 / 0.2);
    /* the only colour on the page: the light under the pointer and the three l's */
    --accent: #5b8cff;
    --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --tape-size: min(25vh, 35vw);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* background tape; rows are built in js/tape.js */

.tape {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    z-index: -1;
    overflow: hidden;
    contain: strict;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    font: 900 var(--tape-size)/1.02 var(--font);
    letter-spacing: -0.04em;
}

.tape__layer {
    position: absolute;
    inset: 0;
}

.tape__layer--dim {
    color: var(--ink);
    animation: tape-in 1.2s var(--ease) both;
}

/* coloured copy of the same rows, visible only inside the lens */
.tape__layer--lit {
    color: var(--accent);
    --lens-r: clamp(180px, 30vmax, 460px);
    opacity: var(--lens-a, 0);
    -webkit-mask-image: radial-gradient(circle var(--lens-r) at var(--lens-x, 50%) var(--lens-y, 50%), #000 0%, rgb(0 0 0 / 0.45) 40%, transparent 100%);
    mask-image: radial-gradient(circle var(--lens-r) at var(--lens-x, 50%) var(--lens-y, 50%), #000 0%, rgb(0 0 0 / 0.45) 40%, transparent 100%);
}

.tape__rows {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
}

.tape__row {
    white-space: pre;
    will-change: transform;
}

.tape__probe {
    position: absolute;
    visibility: hidden;
    white-space: pre;
}

@keyframes tape-in {
    from { opacity: 0; }
}

/* layout */

.page {
    width: min(100%, 44rem);
    margin: auto;
    padding: clamp(1rem, 4vw, 2.5rem) max(1rem, env(safe-area-inset-right)) clamp(1rem, 4vw, 2.5rem) max(1rem, env(safe-area-inset-left));
    display: grid;
    gap: 0.625rem;
}

/* frosted glass: the tape and the lens glow show through, blurred */
.panel {
    background: linear-gradient(180deg, var(--glass-hi), var(--glass));
    border: 1px solid var(--hairline);
    border-radius: 1.25rem;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 24px 48px -28px rgb(0 0 0 / 0.7);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    backdrop-filter: blur(28px) saturate(1.5);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .panel {
        background: #121419;
    }
}

/* hero */

.hero {
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border-radius: 1.75rem;
}

.hero__inner {
    container-type: inline-size;
}

.nick {
    font-size: clamp(3.5rem, 18vw, 8.5rem);
    font-size: min(28cqi, 8.5rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.055em;
    margin-left: -0.04em;
    white-space: nowrap;
}

.nick__l {
    display: inline-block;
    color: var(--accent);
    transform-origin: 50% 88%;
    animation: nick-bounce 0.7s cubic-bezier(0.3, 1.5, 0.5, 1) calc(0.5s + var(--i) * 0.09s) both;
}

.nick:hover .nick__l {
    animation-name: nick-bounce-again;
    animation-delay: calc(var(--i) * 0.09s);
}

@keyframes nick-bounce {
    35% { transform: scaleY(1.22); }
}

@keyframes nick-bounce-again {
    35% { transform: scaleY(1.22); }
}

.hero__tag {
    margin-top: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font: 400 0.8125rem/1.5 var(--mono);
}

.hero__tag::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgb(91 140 255 / 0.5);
    animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
    70%, 100% { box-shadow: 0 0 0 0.5rem rgb(91 140 255 / 0); }
}

.hero__about {
    margin-top: 0.625rem;
    max-width: 31rem;
    color: var(--soft);
    font-size: 1.0625rem;
    line-height: 1.5;
    text-wrap: pretty;
}

.links {
    margin-top: 1.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 1rem 0 0.75rem;
    background: var(--glass);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    color: var(--soft);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.pill svg {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
}

.icon-cut {
    fill: #17191e;
}

.pill--text {
    padding-left: 1rem;
}

.pill:hover {
    color: var(--text);
    background: var(--glass-hi);
    border-color: var(--hairline-hi);
}

/* projects */

.grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 1.25rem 1.25rem 1.125rem;
    transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.card--wide {
    grid-column: 1 / -1;
}

.card:hover {
    border-color: var(--hairline-hi);
    transform: translateY(-2px);
}

.card__title {
    padding-right: 2rem;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* the title link covers the whole card */
.card__link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.card__link:focus-visible {
    outline: none;
}

.card:has(.card__link:focus-visible) {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}

.card__arrow {
    position: absolute;
    top: 1.25rem;
    right: 1.125rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--faint);
    pointer-events: none;
    transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.card:hover .card__arrow {
    color: var(--text);
    transform: translate(2px, -2px);
}

.card__text {
    color: var(--muted);
    font-size: 0.9375rem;
    text-wrap: pretty;
}

.card__meta {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font: 400 0.75rem/1.4 var(--mono);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.tag {
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--hairline);
    border-radius: 0.375rem;
    color: var(--muted);
}

.card__extra {
    position: relative;
    padding: 0.5rem 0.25rem;
    margin: -0.5rem -0.25rem;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: var(--faint);
    text-underline-offset: 0.25em;
}

.card__extra:hover {
    color: var(--text);
    text-decoration-color: currentColor;
}

/* 404 */

.lost {
    text-align: center;
}

.lost .nick {
    font-size: clamp(4rem, 24vw, 8.5rem);
    margin-left: 0;
}

.lost .hero__tag::before {
    content: none;
}

.lost .links {
    justify-content: center;
}

@media (max-width: 34rem) {
    .grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* less to blur on phones */
    .panel {
        -webkit-backdrop-filter: blur(18px) saturate(1.5);
        backdrop-filter: blur(18px) saturate(1.5);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tape__layer--dim,
    .nick__l,
    .nick:hover .nick__l,
    .hero__tag::before {
        animation: none;
    }

    .pill,
    .card,
    .card__arrow {
        transition: none;
    }

    .card:hover,
    .card:hover .card__arrow {
        transform: none;
    }
}
