@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("fonts/commitmono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --sky: #d8ecfb;
  --sky-low: #e9f5ea;
  --cloud: #f6fbff;
  --ink: #14301f;
  --ink-soft: #33503f;
  --trunk: #2f7d4f;
  --trunk-deep: #1d5c38;
  --lime: #8ccf3f;
  --blossom: #ff7aa2;
  --maple: #ff9f43;
  --mint: #4fc39c;
  --danger: #a3123a;

  --display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --text: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: 176px;
  --trunk-x: 40px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  background: var(--sky);
  color: var(--ink);
  font-family: var(--text);
  font-size: 106.25%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--trunk) var(--sky);
  caret-color: var(--trunk);
  accent-color: var(--trunk);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(var(--sky) 0, var(--sky) 55%, var(--sky-low) 100%) fixed;
}

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

a {
  color: var(--trunk-deep);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--ink); text-decoration-thickness: 2.5px; }

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

h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.blade { fill: currentColor; }
.rib { stroke: var(--ink); stroke-opacity: 0.55; stroke-width: 1.2; stroke-linecap: round; }
.leaf-lime { color: var(--lime); }
.leaf-blossom { color: var(--blossom); }
.leaf-maple { color: var(--maple); }
.leaf-mint { color: var(--mint); }
.tip-lime .twig { color: var(--lime); }
.tip-blossom .twig { color: var(--blossom); }
.tip-maple .twig { color: var(--maple); }
.tip-mint .twig { color: var(--mint); }

.wind {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

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

/* Top bar */
.bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  font-size: 0.94rem;
}
.home { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--ink); text-decoration: none; }
a.home:hover { text-decoration: underline; }
.leafmark { width: 1.6rem; height: 1rem; color: var(--lime); transform: rotate(-24deg); }
.tools { display: flex; align-items: center; gap: 0.35rem 1.1rem; flex-wrap: wrap; }
.tools form { margin: 0; }
.lang { font-weight: 600; }

.button, .quiet {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: 600 1rem/1.2 var(--text);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.button {
  background: var(--ink);
  color: var(--cloud);
  border: 0;
  padding: 0.8rem 1.35rem;
  box-shadow: 0 6px 18px -8px rgb(20 48 31 / 0.55);
}
.button:hover { background: var(--trunk-deep); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgb(20 48 31 / 0.6); }
.button:active { transform: translateY(0); box-shadow: 0 3px 10px -6px rgb(20 48 31 / 0.6); }
.button .icon { transition: transform 0.25s var(--ease); }
.button:hover .icon { transform: translateX(2px); }
.button.wide { width: 100%; justify-content: center; padding-block: 0.95rem; }
.quiet {
  background: none;
  border: 0;
  color: var(--trunk-deep);
  padding: 0.5rem 0.2rem;
  font-size: 0.94rem;
}
.quiet:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }

/* The tree: one trunk down the page, every section hangs off it */
.tree {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 2.5rem) 0 calc(clamp(1rem, 4vw, 2.5rem) + var(--gutter));
}
.tree::before {
  content: "";
  position: absolute;
  left: calc(clamp(1rem, 4vw, 2.5rem) + var(--trunk-x) - 2.5px);
  top: calc(clamp(1.5rem, 5vw, 4rem) + 2.1rem + 62px);
  bottom: 66px;
  width: 5px;
  border-radius: 3px;
  background: var(--trunk);
}

.hero { position: relative; padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.sprout {
  position: absolute;
  left: calc(var(--trunk-x) - var(--gutter) - 60px);
  top: 2.1rem;
  width: 120px;
  height: 120px;
  overflow: visible;
}
.stem, .twig-line { fill: none; stroke: var(--trunk); stroke-width: 5; stroke-linecap: round; }
.hero h1 {
  font-size: clamp(2.5rem, 10.5vw, 6rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.hero h1 span { display: block; }
.label {
  margin-top: 1.4rem;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 600;
  color: var(--trunk-deep);
}
.headline { margin-top: 1.1rem; font-size: 1.12rem; font-weight: 600; max-width: 38rem; }
.headline span { display: block; }
.summary { margin-top: 0.9rem; max-width: 38rem; color: var(--ink-soft); }
.contact {
  margin-top: 1.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
  font-size: 0.97rem;
}
.contact li { display: inline-flex; align-items: center; gap: 0.5rem; }
.contact .icon { color: var(--trunk); }
.contact a { color: var(--ink); font-weight: 500; }
.handle { color: var(--ink-soft); font-weight: 400; }

.tree h2 {
  position: relative;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
/* Section headings sit on the trunk as open rings */
.experience > h2::before, .skills > h2::before, .roots #h-education::before {
  content: "";
  position: absolute;
  left: calc(var(--trunk-x) - var(--gutter) - 11px);
  top: 0.32em;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sky);
  border: 5px solid var(--trunk);
}

.graph { display: grid; gap: clamp(1.9rem, 4vw, 2.8rem); }
.commit { position: relative; }
.rail { position: absolute; left: calc(-1 * var(--gutter)); top: 0; width: var(--gutter); height: 4.6rem; }
.twig { position: absolute; left: var(--trunk-x); top: -0.35rem; width: 120px; height: 56px; overflow: visible; }
.twig-line { stroke-width: 4; }
.node {
  position: absolute;
  left: calc(var(--trunk-x) - 9px);
  top: calc(-0.35rem + 27px);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--trunk);
  box-shadow: 0 0 0 4px var(--sky);
}
.commit.open .node { background: var(--sky); border: 4px solid var(--trunk); }
.commit.open .twig-line { stroke-dasharray: 2 9; }
.year {
  position: absolute;
  left: calc(var(--trunk-x) + 20px);
  top: 2.75rem;
  font: 400 0.8rem/1 var(--mono);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.commit h3 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.org { margin-top: 0.2rem; font-size: 1.05rem; }
.org a, .org strong { font-weight: 700; color: var(--ink); }
.where { color: var(--ink-soft); }
.where::before { content: ", "; }
.dates { font: 400 0.82rem/1.5 var(--mono); color: var(--ink-soft); margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
.highlights { margin-top: 0.7rem; max-width: 40rem; display: grid; gap: 0.3rem; }
.highlights li { position: relative; padding-left: 1.3rem; }
.highlights li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.62em;
  width: 0.62rem;
  height: 0.36rem;
  border-radius: 100% 0;
  background: var(--trunk);
  transform: rotate(-18deg);
}

.skills { margin-top: clamp(3.5rem, 8vw, 6rem); }
.skills dl { display: grid; gap: 1rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.skills dt { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.skills dd ul { display: flex; flex-wrap: wrap; gap: 0.15rem 0; margin-top: 0.15rem; color: var(--ink-soft); }
.skills dd li:not(:last-child)::after { content: ","; margin-right: 0.4em; }

.roots {
  position: relative;
  margin-top: clamp(3.5rem, 8vw, 6rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 2rem 2.5rem;
}
.roots h2 { font-size: 1.35rem; margin-bottom: 0.6rem; }
.school span, .plain span { display: block; color: var(--ink-soft); }
.school strong, .plain strong { display: block; }
.plain { display: grid; gap: 0.5rem; }
.rootlines {
  position: absolute;
  left: calc(var(--trunk-x) - var(--gutter) - 80px);
  bottom: 0;
  width: 160px;
  height: 90px;
  fill: none;
  stroke: var(--trunk);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foot {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem calc(clamp(1rem, 4vw, 2.5rem) + var(--gutter));
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.foot p { margin-top: 1.4rem; }

/* Gate */
.gate { display: flex; flex-direction: column; }
.gate .bar { width: 100%; }
.gate-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 4rem;
}
.gate-card {
  width: min(100%, 27.5rem);
  background: var(--cloud);
  border-radius: 28px;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  box-shadow: 0 1px 0 #fff inset, 0 30px 60px -30px rgb(20 48 31 / 0.45), 0 8px 20px -12px rgb(20 48 31 / 0.3);
}
.gate-mark { display: block; width: 160px; height: 96px; margin: -0.25rem 0 0.9rem -0.4rem; overflow: visible; }
.gate-mark .stem { stroke-width: 5; }
.gate-mark .ring { fill: var(--cloud); stroke: var(--trunk); stroke-width: 5; }
.gate-mark .lock { color: var(--ink); fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.gate-card h1 { font-size: clamp(1.7rem, 6vw, 2.15rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; }
.gate-body { margin-top: 0.7rem; color: var(--ink-soft); }
.gate-card label { display: block; margin-top: 1.5rem; font-weight: 700; font-size: 0.95rem; }
.field {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.field:focus-within { border-color: var(--trunk); box-shadow: 0 0 0 4px rgb(140 207 63 / 0.55); }
.field.invalid { border-color: var(--danger); }
.field.invalid:focus-within { border-color: var(--danger); box-shadow: 0 0 0 4px rgb(163 18 58 / 0.22); }
.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0.85rem 1rem;
  font: 400 1.05rem/1.3 var(--mono);
  color: var(--ink);
  border-radius: 12px;
}
.field input:focus { outline: none; }
.reveal {
  border: 0;
  background: none;
  font: 600 0.88rem/1 var(--text);
  color: var(--trunk-deep);
  padding: 0.7rem 0.9rem;
  margin-right: 0.2rem;
  border-radius: 10px;
  cursor: pointer;
}
.reveal:hover { color: var(--ink); background: var(--sky); }
.gate-error { margin-top: 0.6rem; color: var(--danger); font-weight: 600; font-size: 0.95rem; }
.gate-hint { margin-top: 0.6rem; color: var(--ink-soft); font-size: 0.9rem; }
.gate-card .button { margin-top: 1.4rem; }

/* Landing */
.landing { overflow: hidden; height: 100vh; height: 100dvh; background: var(--sky); }
.village {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.village.ready { opacity: 1; }
.village.grab { cursor: grab; }
.village.grabbing { cursor: grabbing; }
.village.point { cursor: pointer; }
.landing .bar { position: fixed; inset: 0 0 auto 0; max-width: none; pointer-events: none; }
.landing .bar > * { pointer-events: auto; }
.welcome {
  position: fixed;
  left: clamp(0.75rem, 3vw, 2rem);
  bottom: clamp(0.75rem, 3vw, 2rem);
  z-index: 2;
  width: min(24rem, calc(100vw - 1.5rem));
  background: var(--cloud);
  border-radius: 28px;
  padding: clamp(1.25rem, 4vw, 1.9rem);
  box-shadow: 0 1px 0 #fff inset, 0 30px 60px -30px rgb(20 48 31 / 0.5), 0 8px 20px -12px rgb(20 48 31 / 0.35);
}
.welcome h1 {
  font-size: clamp(2.1rem, 7vw, 3rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.welcome h1 span { display: block; }
.welcome p { margin-top: 0.8rem; color: var(--ink-soft); }
.welcome .button { margin-top: 1.2rem; }
.welcome .hint { font-size: 0.88rem; margin-top: 0.9rem; }
.welcome .nowebgl { font-size: 0.92rem; color: var(--ink-soft); }
.house-label {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  background: var(--cloud);
  color: var(--ink);
  font: 700 1rem/1 var(--display);
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgb(20 48 31 / 0.6);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  will-change: transform;
}
.house-label::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 3px;
  height: 22px;
  margin-left: -1.5px;
  background: var(--cloud);
  border-radius: 0 0 2px 2px;
}
.house-label:hover, .house-label.hot { background: var(--ink); color: var(--cloud); }
.house-label:hover::after, .house-label.hot::after { background: var(--ink); }

@media (max-width: 760px) {
  :root { --gutter: 50px; --trunk-x: 18px; }
  .rail { height: 3.4rem; }
  .node { top: 0.5rem; }
  /* No room for the branch: the tinted leaf sits right on the node. */
  .twig { width: 66px; height: 31px; left: calc(var(--trunk-x) - 33px); top: 0.52rem; }
  .twig-line { display: none; }
  .year {
    left: calc(var(--trunk-x) - 1.05rem);
    top: 2.15rem;
    width: 2.1rem;
    padding: 0.15rem 0;
    text-align: center;
    font-size: 0.62rem;
    background: var(--sky);
    border-radius: 4px;
  }
  .sprout { width: 64px; height: 64px; left: calc(var(--trunk-x) - var(--gutter) - 32px); top: 0.2rem; }
  .tree::before { top: calc(clamp(1.5rem, 5vw, 4rem) + 0.2rem + 33px); bottom: 36px; }
  .hero { padding-bottom: 2.25rem; }
  .label { margin-top: 0.9rem; }
  .contact { margin-top: 1.2rem; gap: 0.35rem 1.2rem; }
  .roots { grid-template-columns: 1fr; }
  .rootlines { width: 90px; height: 50px; left: calc(var(--trunk-x) - var(--gutter) - 45px); }
  .bar { font-size: 0.9rem; }
  .button { padding: 0.7rem 1.1rem; }
  .resume .tools { width: 100%; justify-content: space-between; gap: 0.25rem 0.75rem; }
  .resume .tools .button { padding: 0.65rem 0.95rem; font-size: 0.94rem; }
  .skills dl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Print: the same tree on white A4. Headless Chrome turns this into the PDFs. */
@page { size: A4; margin: 13mm 14mm 13mm 12mm; }
@media print {
  :root { --gutter: 21mm; --trunk-x: 4mm; --sky: #fff; }
  html { font-size: 9.4pt; line-height: 1.42; background: #fff; }
  body { background: #fff; min-height: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar, .wind, .foot, .skip { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .tree { max-width: none; padding: 0 0 0 var(--gutter); }
  .tree::before { left: calc(var(--trunk-x) - 0.5mm); width: 1mm; top: 8mm; bottom: 8.8mm; }
  .sprout { width: 17mm; height: 17mm; left: calc(var(--trunk-x) - var(--gutter) - 8.5mm); top: -1mm; }
  .hero { padding-bottom: 6mm; display: grid; grid-template-columns: 1fr 52mm; column-gap: 8mm; }
  .hero h1 { font-size: 27pt; line-height: 1; grid-column: 1; }
  .hero h1 span { display: inline; }
  .label { font-size: 11.5pt; margin-top: 1.5mm; grid-column: 1; }
  .headline { font-size: 9.4pt; margin-top: 2.5mm; grid-column: 1; max-width: none; }
  .summary { margin-top: 1.5mm; grid-column: 1; max-width: none; }
  .contact { grid-column: 2; grid-row: 1 / span 4; align-self: start; flex-direction: column; gap: 1.3mm; margin-top: 1.5mm; font-size: 8.8pt; }
  .tree h2 { font-size: 14pt; margin-bottom: 3mm; break-after: avoid; }
  .experience > h2::before, .skills > h2::before, .roots #h-education::before { width: 3.6mm; height: 3.6mm; border-width: 0.9mm; left: calc(var(--trunk-x) - var(--gutter) - 1.8mm); top: 0.25em; }
  .graph { gap: 3.6mm; }
  .commit { break-inside: avoid; }
  .rail { height: 8mm; }
  .twig { display: none; }
  /* The node's white ring reaches the top of the entry, so a page that starts here shows no stub of trunk above it. */
  .node { width: 2.8mm; height: 2.8mm; left: calc(var(--trunk-x) - 1.4mm); top: 0.7mm; box-shadow: 0 0 0 0.7mm #fff; }
  .commit article { padding-top: 0; }
  .commit.open .node { border-width: 0.7mm; background: #fff; }
  .year { display: block; left: calc(var(--trunk-x) + 3mm); top: 0.9mm; font-size: 7.4pt; width: auto; padding: 0; background: none; }
  .commit article { display: grid; grid-template-columns: 1fr auto; column-gap: 6mm; }
  .commit h3 { font-size: 10.8pt; grid-column: 1; }
  .org { font-size: 9.4pt; margin-top: 0; grid-column: 1; }
  .dates { font-size: 7.6pt; grid-column: 2; grid-row: 1; margin-top: 0.6mm; text-align: right; }
  .highlights { grid-column: 1 / -1; margin-top: 1mm; gap: 0.3mm; max-width: none; }
  .highlights li { padding-left: 3.6mm; }
  .highlights li::before { width: 1.9mm; height: 1.1mm; top: 0.58em; left: 0; }
  .skills { margin-top: 7mm; break-inside: avoid; }
  .skills dl { display: block; columns: 2; column-gap: 8mm; }
  .skills dl > div { break-inside: avoid; margin-bottom: 2mm; }
  .skills dt { font-size: 9.6pt; }
  .skills dd ul { color: var(--ink-soft); margin-top: 0; }
  .roots { margin-top: 7mm; padding-bottom: 9mm; grid-template-columns: 1.5fr 1fr 1fr; gap: 4mm 8mm; break-inside: avoid; }
  .roots h2 { font-size: 11.5pt; margin-bottom: 1.2mm; }
  .plain { gap: 0.8mm; }
  .school .dates { text-align: left; margin-top: 0.4mm; }
  .rootlines { width: 22mm; height: 12mm; left: calc(var(--trunk-x) - var(--gutter) - 11mm); stroke-width: 7; }
}
