@font-face {
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/assets/fonts/figtree-latin.woff2') format('woff2');
}

:root {
    --bg: #141419;
    --bg-raised: #1b1b22;
    --line: #26262e;
    --text: #ececf1;
    --muted: #a3a3ae;
    --accent: #e8833a;
    --accent-hover: #f0954f;
    --accent-ink: #1a1007;
    --radius: 6px;
    --gutter: clamp(1.25rem, 4vw, 3.5rem);
    --max: 76rem;
    color-scheme: dark;
}

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

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.6 'Figtree', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

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

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

a {
    color: inherit;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

h1,
h2,
h3 {
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-wrap: balance;
    margin: 0;
}

.icon {
    flex: none;
}

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

.topbar {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem var(--gutter);
    border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.wordmark {
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.toplinks {
    display: flex;
    gap: 1.75rem;
}

.toplinks a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease-out;
}

.toplinks a:hover {
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.5rem 1.1rem;
    border: 0;
    border-radius: var(--radius);
    font: 600 0.95rem/1 inherit;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
    transition: background-color 0.15s ease-out;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary[data-copied] {
    background: var(--text);
}

.btn-lg {
    min-height: 3rem;
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
}

.hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: min(72svh, 46rem);
    padding: 7rem var(--gutter) clamp(2.5rem, 6vh, 4.5rem);
    overflow: hidden;
    isolation: isolate;
}

.hero.has-image::before,
.hero.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
}

.hero.has-image::before {
    background: var(--hero) center / cover no-repeat;
    animation: settle 1.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero.has-image::after {
    background:
        linear-gradient(to top, var(--bg) 0%, rgb(20 20 25 / 0.55) 40%, rgb(20 20 25 / 0.2) 70%, rgb(20 20 25 / 0.6) 100%),
        linear-gradient(to right, rgb(20 20 25 / 0.85) 0%, rgb(20 20 25 / 0.2) 60%);
}

@keyframes settle {
    from {
        transform: scale(1.06);
        filter: blur(6px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero.has-image::before {
        animation: none;
    }
}

.hero-copy {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
}

.hero h1 {
    max-width: 14ch;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
}

.lede {
    max-width: 44ch;
    margin: 1rem 0 0;
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    color: #d4d4dc;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.75rem;
    margin-top: 2rem;
}

.play {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 1.05rem;
    cursor: pointer;
}

.play .icon {
    box-sizing: content-box;
    padding: 0.85rem 0.8rem 0.85rem 0.95rem;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
}

.play:hover .icon {
    background: var(--text);
    color: var(--bg);
}

.hero-credit {
    display: inline-block;
    margin-top: 2.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
}

.hero-credit::before {
    content: 'Shown: ';
}

.hero-credit:hover {
    color: var(--text);
}

.hero-module {
    min-height: min(56svh, 34rem);
}

.hero-module h1 {
    max-width: 20ch;
}

.back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: var(--muted);
    text-decoration: none;
}

.back::before {
    content: '← ';
}

.back:hover {
    color: var(--text);
}

.hero-meta {
    margin: 1.25rem 0 0;
    color: var(--muted);
}

.dot {
    margin-inline: 0.55em;
    opacity: 0.6;
}

.modules,
.module-body,
.notfound {
    max-width: calc(var(--max) + 2 * var(--gutter));
    margin-inline: auto;
    padding: 2.5rem var(--gutter) 5rem;
}

.modules-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modules h2 {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.count {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius);
    background: var(--bg-raised);
    border: 1px solid var(--line);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--muted);
}

.search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.9rem;
    min-width: min(100%, 20rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
    color: var(--muted);
}

.search:focus-within {
    border-color: var(--accent);
}

.search input {
    flex: 1;
    min-height: 2.5rem;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    outline: none;
}

.rows {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.row-link {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    text-decoration: none;
}

.thumb {
    aspect-ratio: 1200 / 630;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.thumb-empty {
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--muted);
}

.row-text {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.row-title {
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.row-desc {
    color: var(--muted);
    max-width: 60ch;
}

.row-meta {
    color: var(--muted);
    white-space: nowrap;
    font-size: 0.95rem;
}

.row-link:hover .row-title {
    text-decoration: underline;
}

.row-link:hover .thumb img {
    transform: scale(1.04);
}

.empty {
    color: var(--muted);
    padding: 2rem 0;
}

.module-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    grid-template-areas: 'main install';
    gap: 3rem;
    align-items: start;
}

.module-main {
    grid-area: main;
    min-width: 0;
}

.install {
    grid-area: install;
    position: sticky;
    top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
}

.install h2 {
    font-size: 1.25rem;
}

.install > p {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0.5rem 0 1rem;
}

.manifest {
    display: grid;
    gap: 0.75rem;
}

.manifest code {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--line);
    font: 0.8rem/1.45 ui-monospace, 'SFMono-Regular', Menlo, monospace;
    overflow-wrap: anywhere;
    user-select: all;
}

.facts {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    font-size: 0.95rem;
}

.facts li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--line);
    text-align: right;
}

.facts span {
    color: var(--muted);
    text-align: left;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin: 1rem 0 0;
    font-size: 0.95rem;
}

.links a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
}

.links a:hover {
    color: var(--text);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 3.5rem;
}

.shot {
    margin: 0;
}

.shot-video {
    grid-column: 1 / -1;
}

.shot img,
.shot video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #000;
}

.shot figcaption {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.shot figcaption::first-letter {
    text-transform: uppercase;
}

.readme {
    max-width: 72ch;
    color: #d6d6de;
}

.readme > :first-child {
    margin-top: 0;
}

.readme h1,
.readme h2,
.readme h3 {
    color: var(--text);
    margin: 2.5rem 0 0.75rem;
}

.readme h1 {
    font-size: 2rem;
}

.readme h2 {
    font-size: 1.5rem;
}

.readme h3 {
    font-size: 1.2rem;
}

.readme .markdown-heading .anchor {
    display: none;
}

.readme a {
    color: var(--accent);
}

.readme code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    font: 0.88em ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

.readme pre {
    padding: 1rem 1.25rem;
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--bg-raised);
    border: 1px solid var(--line);
}

.readme pre code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 0;
    border: 0;
    background: none;
}

.readme table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
}

.readme th,
.readme td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.readme th {
    color: var(--text);
    font-weight: 600;
}

.readme img {
    max-width: 100%;
}

.readme ul,
.readme ol {
    padding-left: 1.25rem;
}

.readme li + li {
    margin-top: 0.35rem;
}

.readme .zeroclipboard-container,
.readme clipboard-copy {
    display: none;
}

.player {
    width: min(90vw, 70rem);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: #000;
    overflow: visible;
}

.player::backdrop {
    background: rgb(8 8 10 / 0.85);
}

.player video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
}

.player-close {
    position: absolute;
    top: -2.75rem;
    right: 0;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text);
    cursor: pointer;
}

.player-close:hover {
    background: rgb(255 255 255 / 0.1);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    translate: -50% 1rem;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius);
    background: var(--text);
    color: var(--bg);
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out, translate 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.is-visible {
    opacity: 1;
    translate: -50% 0;
}

.notfound {
    min-height: 70svh;
    padding-top: 9rem;
}

.notfound h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
}

.notfound p {
    color: var(--muted);
    max-width: 50ch;
    margin: 1rem 0 2rem;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 2rem var(--gutter);
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.footer p {
    margin: 0;
}

@media (max-width: 60rem) {
    .module-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: 'install' 'main';
        gap: 2.5rem;
    }

    .install {
        position: static;
    }
}

@media (max-width: 44rem) {
    .toplinks {
        gap: 1rem;
    }

    .toplinks span {
        display: none;
    }

    .row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.9rem;
    }

    .row-link {
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 1rem;
        align-items: start;
    }

    .row-meta {
        grid-column: 2;
        white-space: normal;
        font-size: 0.9rem;
    }

    .row .btn {
        align-self: flex-start;
    }

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