/* Shared styles for all pages. */

/* Latin subsets of Space Grotesk and LisaTerminal, and the single Saint "A" (see fonts/). */
@font-face {
    font-family: "Space Grotesk";
    font-weight: 400;
    font-display: swap;
    src: url("fonts/SpaceGrotesk-Regular-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Space Grotesk";
    font-weight: 700;
    font-display: swap;
    src: url("fonts/SpaceGrotesk-Bold-latin.woff2") format("woff2");
}

@font-face {
    font-family: "LisaTerminal";
    font-display: swap;
    src: url("fonts/LisaTerminal-latin.woff") format("woff");
}

@font-face {
    font-family: "Saint";
    font-display: swap;
    src: url("fonts/Saint-A.woff") format("woff");
}

:root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #25233a;
    --muted: #6f6d86;
    --dot: rgba(37, 35, 58, 0.2);
    --grid: rgba(37, 35, 58, 0.08);
    --card-hover: #f4f4f7;
    --gap: 1rem;
    --pad: 1.25rem;
    /* 45px splits into whole-pixel cells for both 3x3 and 5x5 glyphs. */
    --glyph: 45px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font: 400 1rem/1.55 "Space Grotesk", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* animation: unblur 0.7s cubic-bezier(0.23, 1, 0.32, 1); */
}

/* Unblur on load. No filter remains afterwards: any filter on body, even blur(0), would make body the
   containing block of the fixed .star and pin it to the page's end instead of the viewport. */
/* @keyframes unblur {
    from {
        filter: blur(60px);
    }
} */

/* Built by star.js. */
.star {
    position: fixed;
    left: 2rem;
    bottom: 2rem;
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--text);
    stroke-width: 1.5;
    pointer-events: none;
}

/* Built by dots.js or grid.js. */
.dots,
.grid {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

a {
    color: inherit;
    text-underline-offset: 0.2em;
}

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

img,
video,
iframe {
    display: block;
    width: 100%;
    height: auto;
}

ul {
    list-style: none;
}

/* Layout: info on the left third, content on the right two thirds. */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 3rem;
    max-width: 1440px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.info {
    position: sticky;
    top: 3rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* LisaTerminal is a pixel font on a 12px em: 36px (3x) keeps it on the pixel grid.
   It has one weight, so 400 avoids a blurry faux bold. */
.name {
    font-family: "LisaTerminal", monospace;
    font-size: 36px;
    font-weight: 400;
    line-height: 1;
}

.name a {
    text-decoration: none;
}

.saint {
    font-family: "Saint", "Space Grotesk", sans-serif;
    font-weight: 400;
}

.bullets {
    padding-left: 1.1em;
    list-style: disc;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.back {
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
}

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

/* Cards */

.cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
    align-content: start;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 12rem;
    padding: var(--pad);
    border: 1px solid var(--text);
    background: var(--bg);
    text-decoration: none;
    transition: background-color 0.15s;
}

.card:hover {
    background: var(--card-hover);
}

.card h2 {
    font-size: 1.25rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.card[target="_blank"] h2::after {
    content: " \2197";
    font-weight: 400;
}

.card p {
    margin-top: 0.35rem;
    color: var(--muted);
}

/* Built by glyphs3.js or glyphs5.js: "on" cells cut out of the card and outlined like its border.
   Flush with the corner inside the border; cells on the card's edge also cover the border (hence
   overflow), so their shape opens to the outside. */
.glyph {
    position: absolute;
    right: 0;
    bottom: 0;
    width: var(--glyph);
    height: var(--glyph);
    overflow: visible;
    shape-rendering: crispEdges;
}

.glyph .cut {
    fill: var(--bg);
}

.glyph .edge {
    fill: none;
    stroke: var(--text);
    stroke-width: 1px;
    stroke-linecap: square;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.75rem;
}

.card .tags {
    margin-top: auto;
    padding-top: 1.5rem;
    padding-right: var(--glyph);
}

.tags li {
    padding: 0.1rem 0.55rem;
    border: 1px solid currentColor;
    border-radius: 1rem;
}

/* Project pages */

.info h1 {
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: 1.1rem;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.project {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.project p,
.project ul,
.project h2,
.project h3,
.project h4 {
    max-width: 65ch;
}

.project h2 {
    font-size: 1.1rem;
    margin-top: 1rem;
}

.project h3,
.project h4 {
    font-size: 1rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
    align-items: start;
}

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

.embed {
    aspect-ratio: 16 / 9;
}

.embed iframe {
    height: 100%;
    border: 0;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
        padding: 2rem 1rem;
    }

    .info {
        position: static;
    }

    .star {
        left: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 560px) {

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

    .card {
        min-height: 10rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card {
        transition: none;
    }

    body {
        animation: none
    }
}