@font-face {
  font-family: "Funnel Display";
  src: url("/fonts/funnel-display-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Funnel Sans";
  src: url("/fonts/funnel-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Fragment Mono";
  src: url("/fonts/fragment-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --black: #0c0e10;
  --curve: #d5dce3;
  --slate: #a7b2be;
  --polygon: #4a5058;
  --teal: #14a39a;
  --grid-minor: #15181b;
  --grid-major: #1c2024;
  --gutter: clamp(20px, 5vw, 72px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

html, body { margin: 0; color: var(--curve); background-color: var(--black); }

/* Graph paper: 24 px cells, a heavier line every fifth, like a modeling viewport. */
body {
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  font-family: "Funnel Sans", system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--curve);
  text-decoration: underline;
  text-decoration-color: var(--polygon);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
a:hover { text-decoration-color: var(--teal); }
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
  border-radius: 2px;
  text-decoration-color: var(--teal);
}

/* ---------- header ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 2.4vw, 30px) var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: "Funnel Display", "Funnel Sans", sans-serif;
  font-weight: 500;
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}
.brand svg { width: 34px; height: 34px; flex: none; }
nav a { font-size: 1.0625rem; }

/* ---------- hero: the live curve and the work line ---------- */
.hero {
  min-height: calc(100svh - 92px);
  display: grid;
  grid-template-rows: minmax(300px, 1fr) auto;
  padding-bottom: clamp(24px, 4vw, 56px);
}
.stage-wrap {
  position: relative;
  margin: clamp(8px, 2vw, 24px) calc(var(--gutter) - 22px) 0;
}
#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  overflow: visible;
  outline: none;
}
.poly { fill: none; stroke: var(--polygon); stroke-width: 1.2; stroke-dasharray: 4 6; }
.crv { fill: none; stroke: var(--curve); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pt { cursor: grab; outline: none; }
.is-dragging, .is-dragging .pt { cursor: grabbing; }
.hit { fill: transparent; }
.sq { fill: var(--black); stroke: var(--slate); stroke-width: 1.5; }
.ring { fill: none; stroke: var(--teal); stroke-width: 1.5; opacity: 0; }
.pt.is-active .sq, .pt.is-end .sq { fill: var(--teal); stroke: var(--teal); }
.pt:focus-visible .ring { opacity: 1; }
.readout { font-family: "Fragment Mono", ui-monospace, monospace; font-size: 13px; fill: var(--teal); }

h1, h2 {
  margin: 0;
  font-family: "Funnel Display", "Funnel Sans", system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-kerning: normal;
}
.hero h1 {
  padding: clamp(20px, 3vw, 40px) var(--gutter) 0;
  max-width: calc(20ch + 2 * var(--gutter));
  font-size: clamp(2.2rem, 5.2vw, 4.75rem);
  line-height: 1.04;
}
.hero .lede {
  margin: clamp(14px, 1.6vw, 22px) 0 0;
  padding: 0 var(--gutter);
  max-width: calc(40ch + 2 * var(--gutter));
  color: var(--slate);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  line-height: 1.45;
}

/* ---------- about and contact ---------- */
.about, .contact {
  padding: clamp(56px, 9vw, 128px) var(--gutter);
  border-top: 1px solid var(--grid-major);
}
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); line-height: 1.08; max-width: 32ch; text-wrap: balance; }
.about p {
  margin: 0;
  max-width: 40ch;
  color: var(--slate);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  line-height: 1.45;
}
.contact p { margin: 1.1rem 0 0; font-size: clamp(1.05rem, 1.3vw, 1.2rem); }
.contact .email {
  margin-top: 1.6rem;
  font-family: "Funnel Display", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.01em;
}

footer {
  padding: clamp(28px, 4vw, 48px) var(--gutter) clamp(20px, 3vw, 32px);
  color: var(--slate);
  font-size: 0.875rem;
  border-top: 1px solid var(--grid-major);
}

@media (max-width: 640px) {
  .hero { min-height: auto; grid-template-rows: minmax(260px, 48svh) auto; }
}

/* ---------- 404 ---------- */
.notfound { display: block; padding: clamp(40px, 10vw, 140px) var(--gutter); min-height: 60svh; }
.notfound p { margin: 1em 0 0; color: var(--slate); font-size: 1.2rem; }
