@font-face {
  font-family: "Recursive";
  src: url("/fonts/recursive-casl-latin.woff2") format("woff2-variations"),
       url("/fonts/recursive-casl-latin.woff2") format("woff2");
  font-weight: 300 1000;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --cloud: #f1f5fb;
  --ink: #101a3a;
  --ink-2: #46516b;
  --line: #d6deea;
  --sky: #a9d4ff;
  --sky-soft: #e3f0ff;
  --sky-dot: #8cc0f7;
  --link: #2347d6;
  --primary: #2347d6;
  --on-primary: #ffffff;
  --sun: #ffd23f;
  --focus: #2347d6;

  --kind-desktop: #2347d6;
  --kind-apple: #8b5cf6;
  --kind-web: #0f9a6c;
  --kind-chain: #5b6478;
  --kind-early: #e0a100;

  --display: "Recursive", ui-rounded, system-ui, sans-serif;
  --body: "Recursive", system-ui, sans-serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 48px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1430;
    --cloud: #131c3f;
    --ink: #eaf0ff;
    --ink-2: #b2bdd8;
    --line: #2a3561;
    --sky: #1f3d7a;
    --sky-soft: #1a2a57;
    --sky-dot: #2e4f92;
    --link: #a9bdff;
    --primary: #a9bdff;
    --on-primary: #0d1430;
    --focus: #ffd23f;

    --kind-desktop: #8fa8ff;
    --kind-apple: #c4a8ff;
    --kind-web: #4fd1a1;
    --kind-chain: #a3acc2;
    --kind-early: #ffd23f;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "CASL" 0;
  font-weight: 400;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--display);
  font-variation-settings: "CASL" 1;
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }

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

::selection { background: var(--sun); color: #101a3a; }

img { display: block; max-width: 100%; height: auto; }

code { font-family: var(--code); font-size: 0.86em; }

.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* Top bar */

.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; flex-wrap: wrap; }
.brand {
  font-family: var(--display); font-variation-settings: "CASL" 1; font-weight: 800;
  font-size: 1.15rem; color: var(--ink); text-decoration: none;
}
.topbar nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; list-style: none; margin: 0; padding: 0; }
.topbar nav a { color: var(--ink); font-weight: 560; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

/* Buttons */

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 10px 20px; border-radius: 999px; border: 2px solid var(--ink);
  color: var(--ink); background: transparent; text-decoration: none;
  font-weight: 650; line-height: 1.2; text-align: center;
}
.button:hover { background: var(--ink); color: var(--paper); }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.button-large { min-height: 60px; padding: 14px 28px; font-size: 1.15rem; overflow-wrap: anywhere; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Hero */

.hero { display: grid; gap: 40px; padding-block: 24px 32px; align-items: center; }
@media (min-width: 960px) { .hero { grid-template-columns: 1.02fr 1fr; gap: 56px; padding-block: 40px 48px; } }

.hero-copy { display: grid; gap: 22px; }
.hero h1 { font-weight: 900; font-size: clamp(2.9rem, 7.4vw, 5.6rem); line-height: 0.95; letter-spacing: -0.025em; }
.lead { font-size: clamp(1.25rem, 2vw, 1.45rem); line-height: 1.45; font-variation-settings: "CASL" 0.35; font-weight: 560; max-width: 34ch; }
.hero-copy > p:not(.lead):not(.actions) { color: var(--ink-2); max-width: 46ch; }

/* The desk: the apps, laid out like icons on a desktop */

.desk {
  background-color: var(--sky);
  background-image: radial-gradient(var(--sky-dot) 1.6px, transparent 1.8px);
  background-size: 26px 26px;
  border-radius: 26px;
  padding: 14px clamp(14px, 3vw, 26px) 22px;
}
.desk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--sky-soft); border-radius: 12px; padding: 8px 14px;
}
.desk-bar h2 { font-size: 1rem; font-weight: 800; letter-spacing: 0; }
.clock { font-size: 0.95rem; font-weight: 560; font-variant-numeric: tabular-nums; }

.desk-apps {
  list-style: none; margin: 0; padding: 26px 0 10px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px;
}
.app {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 10px 4px 8px; border: 0; border-radius: 16px; background: transparent; cursor: pointer;
  color: var(--ink); font: inherit; font-weight: 640; font-size: 0.95rem; line-height: 1.25; text-align: center;
}
.app:hover { background: rgb(255 255 255 / 0.28); }
.app:active .icon { transform: scale(0.94); }
.icon { width: 96px; height: 96px; box-shadow: 0 8px 18px rgb(16 26 58 / 0.22); transition: transform 0.18s ease; }
.icon-windows { border-radius: 14px; }
.icon-apple { border-radius: 23%; }
.app:hover .icon { transform: translateY(-3px); }
@media (max-width: 520px) {
  .icon { width: 72px; height: 72px; }
  .icon-windows { border-radius: 11px; }
  .app { font-size: 0.86rem; }
}
.desk-hint { font-size: 0.95rem; font-weight: 560; text-align: center; padding-top: 6px; }

@media (prefers-reduced-motion: no-preference) {
  .desk-apps li { animation: pop-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
  .desk-apps li:nth-child(2) { animation-delay: 0.07s; }
  .desk-apps li:nth-child(3) { animation-delay: 0.14s; }
  .desk-apps li:nth-child(4) { animation-delay: 0.21s; }
  .desk-apps li:nth-child(5) { animation-delay: 0.28s; }
  .desk-apps li:nth-child(6) { animation-delay: 0.35s; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.7); }
  to { opacity: 1; transform: none; }
}

/* App windows */

.window {
  padding: 0; border: 0; border-radius: 18px;
  width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgb(8 14 36 / 0.4);
  transform-origin: var(--origin, 50% 50%);
}
.window::backdrop { background: rgb(8 14 36 / 0.42); }
.window-inner { display: flex; flex-direction: column; max-height: inherit; }
.window-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 22px; background: var(--sky-soft); border-bottom: 1px solid var(--line);
}
.window-bar h2 { font-size: 1.2rem; font-weight: 800; }
.window-bar form { margin: 0; }
.window-close {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer;
}
.window-close:hover { background: rgb(16 26 58 / 0.08); }
.window-close svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.window-body { display: grid; gap: 16px; padding: 22px 24px 26px; overflow-y: auto; }
.window-body .icon { width: 64px; height: 64px; }
.window-lead { font-size: 1.25rem; line-height: 1.4; font-variation-settings: "CASL" 0.35; font-weight: 620; }
.facts { margin: 0; padding-left: 1.15em; color: var(--ink-2); display: grid; gap: 6px; }
.window-links { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .window {
    opacity: 0; transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.08), overlay 0.32s allow-discrete, display 0.32s allow-discrete;
  }
  .window[open] { opacity: 1; transform: none; }
  @starting-style { .window[open] { opacity: 0; transform: scale(0.5); } }
  .window::backdrop { transition: background-color 0.25s ease, overlay 0.32s allow-discrete, display 0.32s allow-discrete; }
  @starting-style { .window[open]::backdrop { background-color: rgb(8 14 36 / 0); } }
}

@media (max-width: 560px) {
  .window { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 88dvh; }
}

/* Sections */

.section { padding-block: clamp(56px, 7vw, 88px); }
.section > h2, .section .wrap > h2, .subsection-title { font-weight: 850; font-size: clamp(2rem, 4.2vw, 3rem); }
.subsection-title { margin-top: clamp(56px, 7vw, 88px); }
.section-intro { margin-top: 12px; font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.section-tinted { background: var(--cloud); }

/* Selected work */

.project { display: grid; gap: 20px 56px; padding-block: 40px; border-top: 1px solid var(--line); }
.project:first-of-type { margin-top: 36px; }
@media (min-width: 900px) { .project { grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr); } }
.project-head { display: grid; gap: 6px; align-content: start; }
@media (min-width: 900px) { .project-head { position: sticky; top: 24px; align-self: start; } }
.project-head h3 { font-weight: 850; font-size: clamp(1.6rem, 2.6vw, 2rem); }
.project-when { color: var(--ink-2); font-weight: 560; }
.project-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-weight: 640; }
.project-note { color: var(--ink-2); max-width: 30ch; margin-top: 6px; }
.project-body { display: grid; gap: 20px; }
.project-summary { font-size: 1.22rem; line-height: 1.5; font-variation-settings: "CASL" 0.3; font-weight: 520; max-width: 62ch; }
.project-body > p:not(.project-summary) { max-width: 66ch; }

.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.flow li { position: relative; display: grid; gap: 4px; padding: 14px 16px; background: var(--cloud); border-radius: 14px; }
.flow strong { font-family: var(--display); font-variation-settings: "CASL" 1; font-weight: 800; font-size: 1.05rem; }
.flow span { color: var(--ink-2); font-size: 0.95rem; line-height: 1.45; }
.flow li:not(:last-child)::after {
  content: ""; position: absolute; left: 50%; bottom: -12px; width: 10px; height: 10px;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: translateX(-50%) rotate(45deg); z-index: 1;
}
@media (min-width: 760px) {
  .flow { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .flow li:not(:last-child)::after { left: auto; right: -13px; bottom: auto; top: 50%; transform: translateY(-50%) rotate(-45deg); }
}

.notes { margin: 0; padding-left: 1.15em; display: grid; gap: 8px; color: var(--ink-2); max-width: 66ch; }

.tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tools li { background: var(--sky-soft); border-radius: 8px; padding: 3px 9px; }
.tools code { font-size: 0.85rem; }

.mini { margin: 0; display: grid; gap: 22px 40px; }
@media (min-width: 720px) { .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini dt { font-family: var(--display); font-variation-settings: "CASL" 1; font-weight: 800; font-size: 1.15rem; }
.mini dt span { font-family: var(--body); font-variation-settings: "CASL" 0; font-weight: 500; font-size: 0.95rem; color: var(--ink-2); margin-left: 6px; }
.mini dd { margin: 4px 0 0; color: var(--ink-2); }

/* History */

.legend { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 560; }
.legend li, .timeline .kind { display: inline-flex; align-items: center; gap: 8px; }
.legend li::before, .timeline ul li::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--dot, var(--ink-2)); flex: none;
}
.kind-desktop { --dot: var(--kind-desktop); }
.kind-apple { --dot: var(--kind-apple); }
.kind-web { --dot: var(--kind-web); }
.kind-chain { --dot: var(--kind-chain); }
.kind-early { --dot: var(--kind-early); }

.timeline { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 30px; }
.timeline .year { display: grid; gap: 10px; }
@media (min-width: 760px) { .timeline .year { grid-template-columns: 130px minmax(0, 1fr); gap: 32px; } }
.timeline h3 {
  font-weight: 900; font-size: clamp(1.8rem, 3vw, 2.3rem); font-variant-numeric: tabular-nums;
  align-self: start; position: sticky; top: 16px;
}
@media (max-width: 759px) { .timeline h3 { position: static; } }
.timeline ul { list-style: none; margin: 0; padding: 0 0 0 26px; border-left: 2px solid var(--line); display: grid; gap: 18px; }
.timeline ul li { position: relative; display: grid; gap: 2px; }
.timeline ul li::before { position: absolute; left: -33px; top: 0.45em; width: 12px; height: 12px; box-shadow: 0 0 0 4px var(--cloud); }
.timeline .kind { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.timeline p { max-width: 70ch; }
.timeline p a { font-weight: 600; }
.timeline p a.proof { margin-left: 6px; white-space: nowrap; }

/* Open source and writing */

.prs { margin: 36px 0 0; display: grid; gap: 20px; }
.prs > div { display: grid; gap: 8px; }
@media (min-width: 760px) { .prs > div { grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: baseline; } }
.prs dt { font-family: var(--display); font-variation-settings: "CASL" 1; font-weight: 800; font-size: 1.2rem; }
.prs dd { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.prs a {
  display: inline-block; padding: 4px 12px; border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 560; font-size: 0.95rem;
}
.prs a:hover { border-color: var(--ink); background: var(--sky-soft); }

.writing { margin: 24px 0 0; padding-left: 1.15em; display: grid; gap: 10px; max-width: 72ch; }
.writing a { font-weight: 640; }

/* Contact */

.contact { background: var(--ink); color: var(--paper); }
.contact-inner { display: grid; gap: 24px; }
.contact h2 { color: var(--sky); font-weight: 900; font-size: clamp(2.4rem, 6vw, 4.4rem); }
.contact .lead { max-width: 44ch; }
.contact .button-primary { background: var(--sun); border-color: var(--sun); color: #101a3a; }
.contact .button-primary:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.contact :focus-visible { outline-color: var(--sun); }
.elsewhere { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-weight: 640; }
.elsewhere a { color: var(--paper); }

/* Footer */

.footer { padding-block: 32px 40px; color: var(--ink-2); font-size: 0.92rem; }
.footer .wrap { display: grid; gap: 6px; }

.not-found-actions { margin-top: 28px; }

@media print {
  .topbar nav, .desk-hint, .window, .skip-link { display: none !important; }
  .contact { background: none; color: inherit; }
  .contact h2 { color: inherit; }
}
