/* projects.delattre.me
   Fonts: Bricolage Grotesque and Inter, both SIL Open Font License (see /fonts). */

@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("/fonts/jetbrains-mono.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/inter-regular.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/inter-medium.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/inter-semibold.woff2") format("woff2");
}

/* Tokens: cool porcelain paper, ink navy, one harbour-teal accent */
:root {
    color-scheme: light dark;
    --paper: #eef1f4;
    --raised: #f8fafb;
    --ink: #131b2e;
    --slate: #4b576c;     /* 6.6:1 on paper */
    --faint: #66728a;     /* 4.6:1 on paper, used for the domain suffix only */
    --rule: #c8d0db;
    --accent: #0a6767;    /* 6.1:1 on paper */
    --accent-wash: #dfeaea;
    --select: #b9dcda;
    --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
    --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --term: #131b2e;
    --term-ink: #e6ebf2;
    --term-dim: #8f9bb0;
    --term-hi: #6fd3cc;
    --term-line: transparent;
    --measure: 64ch;
    --page: min(66rem, 100% - 2 * var(--gutter));
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0e1420;
        --raised: #141c2b;
        --ink: #e6ebf2;
        --slate: #a3afc2;
        --faint: #8c99ae;
        --rule: #283447;
        --accent: #63c7c1;
        --accent-wash: #15282d;
        --select: #1f4a4a;
        --term: #0a0f18;
        --term-line: #283447;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-color: var(--rule) var(--paper);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.6 var(--text);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }

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

.sprite { position: absolute; }

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -4rem;
    padding: .6rem 1rem;
    background: var(--ink);
    color: var(--paper);
    border-radius: 6px;
    z-index: 10;
}
.skip-link:focus { top: 1rem; }

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

/* Masthead */
.masthead {
    width: var(--page);
    margin-inline: auto;
    padding-block: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .9375rem;
}
.masthead .home { font: 650 1.0625rem/1 var(--display); letter-spacing: -.01em; text-decoration: none; }
.masthead .contact { color: var(--slate); }

/* The page is one README document */
.doc {
    width: var(--page);
    margin: .25rem auto 0;
    background: var(--raised);
    border: 1px solid var(--rule);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgb(19 27 46 / .04), 0 18px 40px -28px rgb(19 27 46 / .25);
    overflow: hidden;
}
.doc-bar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem var(--pad);
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    font: 500 .75rem/1.4 var(--mono);
    color: var(--slate);
}
.doc-file { color: var(--ink); }
.doc { --pad: clamp(1rem, 3.5vw, 2.25rem); }
.doc-body { padding: clamp(1.5rem, 3.5vw, 2.25rem) var(--pad) clamp(1.25rem, 3vw, 1.75rem); }

.md {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--faint);
    margin-right: .35em;
    letter-spacing: 0;
}
h1 {
    font: 700 clamp(1.875rem, 4.4vw, 2.75rem)/1.05 var(--display);
    letter-spacing: -.028em;
    margin: 0 0 .75rem;
    text-wrap: balance;
}
h1 .md { font-size: .6em; vertical-align: .2em; }
.lede {
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--slate);
    max-width: 40em;
    margin: 0 0 1.5rem;
    text-wrap: pretty;
}

/* Terminal strip: the filter is the command */
.term {
    background: var(--term);
    color: var(--term-ink);
    border: 1px solid var(--term-line);
    border-radius: 8px;
    padding: .45rem .45rem .45rem .9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: 1.25rem;
}
.prompt { margin: 0; font: 500 .875rem/1.4 var(--mono); white-space: nowrap; }
.ps { color: var(--term-hi); }
.cmd { display: inline-block; vertical-align: bottom; }
.typed { display: inline-block; overflow: hidden; vertical-align: bottom; white-space: pre; }
.catalogue:has(#kind-web:checked) .arg::after { content: "websites/"; }
.catalogue:has(#kind-app:checked) .arg::after { content: "iphone-apps/"; }
.caret {
    display: inline-block;
    width: .55em;
    height: 1.1em;
    margin-left: .12em;
    vertical-align: -.18em;
    background: var(--term-hi);
}

.filter { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.filter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filter label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 32px;
    padding: .25rem .7rem;
    border-radius: 6px;
    color: var(--term-dim);
    font-weight: 500;
    font-size: .8125rem;
    cursor: pointer;
    transition: background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.filter label:hover { color: var(--term-ink); }
.filter .count { font: 500 .6875rem/1 var(--mono); opacity: .8; }
.filter input:checked + label { background: rgb(230 235 242 / .14); color: var(--term-ink); }
.filter input:focus-visible + label { outline: 2px solid var(--term-hi); outline-offset: 1px; }

/* Hidden groups are collapsed rather than display:none, so the load animation never replays.
   !important beats the animated visibility of the rows. */
.catalogue { position: relative; }
.catalogue:has(#kind-web:checked) .group-app,
.catalogue:has(#kind-app:checked) .group-web {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.catalogue:has(#kind-web:checked) .group-app,
.catalogue:has(#kind-web:checked) .group-app *,
.catalogue:has(#kind-app:checked) .group-web,
.catalogue:has(#kind-app:checked) .group-web * { visibility: hidden !important; }

h2 {
    font: 650 1.0625rem/1.3 var(--display);
    letter-spacing: -.01em;
    margin: 0;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--ink);
}
.group + .group { margin-top: 1.5rem; }
.catalogue:has(#kind-app:checked) .group-app { margin-top: 0; }

ul[role="list"] { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--rule); }

/* One row = one project, same grid for sites and apps */
.row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: .2rem 1.5rem;
    padding: .6rem 0;
    color: inherit;
    text-decoration: none;
}
.lead { display: grid; gap: .05rem; min-width: 0; }
.name { font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.3; transition: color .2s var(--ease-out); }
.addr { font: 400 .75rem/1.35 var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desc { color: var(--slate); font-size: .9375rem; line-height: 1.45; }
.meta { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.go { width: 1rem; height: 1rem; flex: none; color: var(--faint); transition: transform .25s var(--ease-out), color .25s var(--ease-out); }

.row:hover .name, .row:focus-within .name { color: var(--accent); }
.row:hover .go, .row:focus-within .go { color: var(--accent); transform: translate(2px, -2px); }

/* Apps: icon + name; the name link covers the row, the App Store link sits above it */
.app { grid-template-columns: 2rem minmax(0, calc(15rem - 2.75rem)) minmax(0, 1fr) auto; column-gap: .75rem; }
.app .desc { margin-left: .75rem; }
.app img {
    width: 2rem; height: 2rem;
    border-radius: 22.5%;
    background: #fff;
    box-shadow: 0 0 0 1px rgb(19 27 46 / .08);
}
.app .name::after { content: ""; position: absolute; inset: 0; }
.app .name:focus-visible { outline: none; }
.app .name:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.store {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 32px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--slate);
    text-decoration: none;
    white-space: nowrap;
}
.store svg { width: .9rem; height: .9rem; margin-top: -2px; }
.store:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }

.outro { margin: 1.5rem 0 0; color: var(--slate); font-size: .9375rem; }
.outro a { color: var(--ink); }

.colophon {
    width: var(--page);
    margin: 0 auto;
    padding: 1rem 0 2rem;
    color: var(--slate);
    font-size: .8125rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 1.5rem;
}
.colophon p { margin: 0; }
.colophon a { color: var(--ink); }
.colophon-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }

/* One authored moment: the command types itself, then the list prints line by line */
@media (prefers-reduced-motion: no-preference) {
    .typed { animation: type .9s .35s steps(12, end) both; }
    .caret { animation: blink 1.05s 1.3s steps(1, end) infinite; }
    .rows li { animation: print .01s calc(1.35s + var(--i, 0) * 75ms) both; }
    .rows li .lead { animation: wipe .45s calc(1.35s + var(--i, 0) * 75ms) var(--ease-out) both; }
    .group-web h2, .group-app h2 { animation: print .01s 1.3s both; }
}
@keyframes type { from { width: 0; } to { width: 12ch; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes print { from { visibility: hidden; } to { visibility: visible; } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

@media (max-width: 48rem) {
    .row { grid-template-columns: minmax(0, 1fr) auto; padding: .7rem 0; }
    .lead { grid-column: 1; grid-row: 1; }
    .desc { grid-column: 1 / -1; grid-row: 2; font-size: .875rem; }
    .meta { grid-column: 2; grid-row: 1; }
    .app { grid-template-columns: 2rem minmax(0, 1fr) auto; }
    .app img { grid-row: 1; }
    .app .lead { grid-column: 2; }
    .app .desc { grid-column: 2 / -1; margin-left: 0; }
    .app .meta { grid-column: 3; }
    .doc-path { display: none; }
    .term { padding: .5rem; }
    .prompt { padding-left: .35rem; }
    .filter { width: 100%; }
    .filter { flex-wrap: nowrap; gap: .2rem; }
    .filter label { flex: 1 1 auto; justify-content: center; padding-inline: .45rem; white-space: nowrap; }
    .store-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .store { width: 32px; justify-content: center; }
    .store svg { width: 1.05rem; height: 1.05rem; }
    .meta { gap: .35rem; }
}

@media (forced-colors: active) {
    .filter input:checked + label { outline: 2px solid CanvasText; }
    .caret { background: CanvasText; }
}
