/* The author's Foundable palette and typography are intentionally unchanged. */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.22, 0.68, 0, 1);
}
html {
  scroll-padding-top: 88px;
}
button,
input,
textarea {
  font: inherit;
}
button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  color: inherit;
}
[hidden] {
  display: none !important;
}
::selection {
  background: var(--sig);
  color: var(--paper);
}

/* Native document transitions: the browser owns navigation and scroll history. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: page-out 0.18s ease both;
}
::view-transition-new(root) {
  animation: page-in 0.48s var(--ease-out) both;
}
@keyframes page-out {
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 80;
  pointer-events: none;
}
.reading-progress i {
  display: block;
  height: 100%;
  background: var(--sig);
  transform: scaleX(var(--read, 0));
  transform-origin: left;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}
.original-link {
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.25s;
  white-space: nowrap;
  font-size: 11px;
}
.original-link:hover {
  opacity: 1;
}
nav#nav .mobile-original {
  display: none;
}
.menu-icon {
  display: none;
}
.hero-cv {
  display: inline-block;
  margin-top: 12px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.25s,
    border-color 0.25s;
}
.hero-cv:hover {
  color: var(--sig);
  border-color: currentColor;
}
.footer-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding-bottom: 28px;
}
.footer-socials a {
  color: #9a9aa0;
}
.career-date {
  margin-top: 18px;
  max-width: 17ch;
}
.career-story,
.life-link {
  margin-top: 28px;
}
.idx small {
  display: block;
  margin-top: 8px;
  font: inherit;
}
.idx a {
  transition:
    color 0.3s,
    padding 0.5s var(--ease-out);
}
.idx a:hover {
  padding-left: 12px;
}
.link {
  transition: color 0.25s;
}
.link span {
  transition: transform 0.45s var(--ease-out);
}
.contact-jump {
  margin-top: 36px;
}
.back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  z-index: 30;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 20px var(--sans);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.35s,
    transform 0.5s var(--ease-out),
    visibility 0.35s,
    background 0.25s,
    color 0.25s;
}
.back-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.back-top:hover {
  color: var(--paper);
  background: var(--sig);
  border-color: var(--sig);
}

/* Stagger on words, not whole lines. Keep the original type metrics intact. */
.motion-ready .split .w > span {
  transition: transform 0.72s var(--ease-out);
  transition-delay: var(--word-delay, 0ms);
}
.motion-ready .rv {
  transition:
    opacity 0.85s var(--ease-smooth),
    transform 0.72s var(--ease-out);
}
.motion-ready .diagram.draw .flow {
  stroke-dashoffset: 0;
}
.story {
  height: 440svh;
}
.f1 {
  height: 520svh;
}
.scene-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #9a9aa0;
  padding-top: 12px;
  white-space: nowrap;
}
.scene-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  font: 16px var(--mono);
  cursor: pointer;
  background: transparent;
  color: var(--paper);
  border: 1px solid #2a2a2e;
  transition:
    border-color 0.25s,
    color 0.25s;
}
.scene-controls button:hover {
  color: var(--sig2);
  border-color: var(--sig);
}
.scene-controls button:disabled {
  opacity: 0.25;
  cursor: default;
}
.scene-controls > span {
  font-size: 10px;
}
.scene-controls > a {
  margin-left: auto;
  font-size: 10px;
  text-decoration: none;
  border-bottom: 1px solid #3a3a40;
}
.scene-controls > a:hover {
  color: var(--sig2);
}
.f1-copy {
  position: relative;
  gap: 16px;
}
.f1-title {
  font-size: clamp(36px, 4.6vw, 72px);
}
.f1-steps li {
  padding-top: 8px;
  padding-bottom: 8px;
}
.f1-copy .scene-controls {
  margin-top: 12px;
  padding-top: 0;
}
.f1-field {
  isolation: isolate;
}
.f1-field > :not(.parsing-links) {
  z-index: 1;
}
.f1-photo {
  transform-origin: center;
  transition: transform 0.7s var(--ease-out);
}
.f1-paper {
  transition: box-shadow 1.1s var(--ease-out);
}
.f1-photo.flat .f1-paper {
  box-shadow: 0 16px 48px -22px #0009;
}
.f1-crop {
  transition:
    opacity 0.65s var(--ease-out),
    transform 0.85s var(--ease-out),
    background-color 0.5s;
  transform: scale(1.1);
}
.f1-crop.on {
  transform: scale(1);
}
.f1-crop::after {
  content: "";
  position: absolute;
  inset: -3px;
  pointer-events: none;
  background:
    linear-gradient(currentColor, currentColor) top left/7px 1px no-repeat,
    linear-gradient(currentColor, currentColor) top left/1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) top right/7px 1px no-repeat,
    linear-gradient(currentColor, currentColor) top right/1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) bottom left/7px 1px no-repeat,
    linear-gradient(currentColor, currentColor) bottom left/1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) bottom right/7px 1px no-repeat,
    linear-gradient(currentColor, currentColor) bottom right/1px 7px no-repeat;
  color: var(--sig2);
}
.f1-crop.c0::after {
  color: #c2410c;
}
.f1-crop i {
  transition: opacity 0.3s;
}
.f1-paper::after {
  content: none;
}
.f1-scan {
  position: absolute;
  inset: 3% 4%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.f1-scan i {
  display: block;
  height: 1px;
  background: var(--sig);
  box-shadow: 0 0 12px 2px #2f5bff45;
}
.f1[data-s="1"] .f1-scan {
  opacity: 0.8;
}
.f1-parsed code {
  transition:
    opacity 0.65s var(--ease-out),
    transform 0.65s var(--ease-out);
}
.f1-parsed:not(.on) code {
  opacity: 0;
  transform: translateY(7px);
}
.f1-parsed.on code:nth-child(2) {
  transition-delay: 0.05s;
}
.f1-parsed.on code:nth-child(3) {
  transition-delay: 0.12s;
}
.f1-parsed.on code:nth-child(4) {
  transition-delay: 0.19s;
}
.f1-parsed.on code:nth-child(5) {
  transition-delay: 0.26s;
}
.f1-parsed.on code:nth-child(6) {
  transition-delay: 0.33s;
}
.schema-check {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #2e2e34;
  margin-top: 9px;
  padding-top: 9px;
  font-size: 9px;
  color: var(--sig2);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.5s 0.4s,
    transform 0.5s 0.4s var(--ease-out);
}
.schema-check i {
  font-style: normal;
}
.f1-parsed.on .schema-check {
  opacity: 1;
  transform: none;
}
.chunk-check {
  padding: 4px 0 0;
  color: var(--sig2);
  font-size: 9px;
  opacity: 0;
  transition: opacity 0.5s 0.35s;
}
.f1-chunks.on .chunk-check {
  opacity: 1;
}
.f1-card {
  transition:
    opacity 0.65s var(--ease-out),
    transform 0.65s var(--ease-out),
    border-color 0.5s;
}
.f1-card.on {
  border-color: #3c466b;
}
.f1-field > svg.parsing-links {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  opacity: 1;
  transform: none;
  overflow: visible;
  z-index: 0;
  pointer-events: none;
  grid-area: auto;
  transition: none;
}
.parsing-links path {
  fill: none;
  stroke: var(--sig);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition:
    stroke-dashoffset 1s var(--ease-out),
    opacity 0.45s;
}
.parsing-links path.on {
  opacity: 0.65;
  stroke-dashoffset: 0;
}
.parsing-links circle {
  fill: var(--sig2);
  opacity: 0;
  transition: opacity 0.45s 0.3s;
}
.parsing-links circle.on {
  opacity: 0.9;
}
.f1-space .pt,
.f1-space .hit {
  transform: translate(var(--vector-x, 0px), var(--vector-y, 0px));
  transition:
    transform 0.85s var(--ease-out),
    fill 0.5s,
    opacity 0.5s;
}
.f1-space.on .pt,
.f1-space.on .hit {
  transform: none;
}
.f1-space:not(.on) svg,
.f1-space:not(.on) .f1-vec {
  opacity: 0;
}
.f1-space .q,
.f1-space text {
  opacity: 0;
  transition: opacity 0.5s;
}
.f1[data-s="5"] .f1-space .q,
.f1[data-s="5"] .f1-space text {
  opacity: 1;
}
.f1[data-s="5"] .f1-space .hit {
  filter: drop-shadow(0 0 3px var(--sig));
}
.f1-answer .f1-a {
  transition:
    opacity 0.8s 0.2s,
    transform 0.9s 0.2s var(--ease-out);
}
.f1-answer:not(.on) .f1-a {
  opacity: 0;
  transform: translateY(8px);
}

/* The only added visitor flow: a working, restrained contact form. */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(48px, 8vw, 130px);
}
.contact-grid .h2 {
  margin: 24px 0 32px;
}
.contact-grid > .wrap {
  min-width: 0;
}
.contact-grid > div > .mute {
  max-width: 35ch;
}
.email-address {
  display: inline-block;
  margin-top: 28px;
  font-size: clamp(18px, 1.9vw, 27px);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition:
    color 0.25s,
    border-color 0.25s;
}
.email-address:hover {
  color: var(--sig);
  border-color: currentColor;
}
.contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 32px;
}
.contact-socials a {
  text-decoration: none;
  transition: color 0.25s;
}
.contact-socials a:hover {
  color: var(--sig);
}
#contact-form {
  min-width: 0;
}
#contact-form label {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 26px;
  font: 500 11px/1.5 var(--mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
#contact-form input,
#contact-form textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 14px;
  background: transparent;
  color: var(--ink);
  font: 400 19px/1.5 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  outline: none;
  transition: border-color 0.25s;
}
#contact-form textarea {
  min-height: 148px;
  resize: vertical;
}
#contact-form input:focus,
#contact-form textarea:focus {
  border-color: var(--sig);
  outline: 1px solid var(--sig);
  outline-offset: 5px;
}
#contact-form input::placeholder,
#contact-form textarea::placeholder {
  color: #8c8c90;
}
.form-privacy {
  max-width: 64ch;
  font-size: 12px;
  line-height: 1.6;
}
.form-actions {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-top: 28px;
}
.solid-button {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 48px;
  padding: 17px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: 500 12px var(--mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.25s,
    border-color 0.25s;
}
.solid-button:hover {
  background: var(--sig);
  border-color: var(--sig);
}
.solid-button > span:last-child {
  transition: transform 0.5s var(--ease-out);
}
.solid-button:hover > span:last-child {
  transform: translate(3px, -3px);
}
.solid-button:disabled {
  opacity: 0.5;
  cursor: default;
}
.text-button {
  background: none;
  border: none;
  padding: 8px 0;
  font: 500 11px var(--mono);
  color: var(--mute);
  cursor: pointer;
}
.text-button:hover {
  color: var(--sig);
}
.contact-status {
  margin-top: 26px;
  max-width: 60ch;
  font-size: 14px;
  line-height: 1.6;
}
.contact-status:empty {
  display: none;
}
.contact-status.success,
.contact-status.saved {
  border-left: 2px solid var(--sig);
  padding-left: 14px;
}
.contact-status.error {
  border-left: 2px solid var(--ink);
  padding-left: 14px;
}
.contact-status small {
  display: block;
  margin-top: 10px;
  color: var(--mute);
  font-size: 9px;
}
.mail-fallback {
  margin-top: 26px;
  color: var(--mute);
  font-size: 10px;
}
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* An un-scripted page remains a readable document, including all story copy. */
html:not(.motion-ready) .rv,
html:not(.motion-ready) .split .w > span {
  opacity: 1;
  transform: none;
}
html:not(.motion-ready) .story,
html:not(.motion-ready) .f1 {
  height: auto;
}
html:not(.motion-ready) .story .stage,
html:not(.motion-ready) .f1-stage {
  height: auto;
  position: relative;
  display: block;
  padding: 96px var(--pad);
}
html:not(.motion-ready) .story .copies {
  gap: 32px;
  display: grid;
}
html:not(.motion-ready) .story .copy {
  opacity: 1;
  visibility: visible;
  transform: none;
  grid-area: auto;
  position: static;
}
html:not(.motion-ready) .story .field,
html:not(.motion-ready) .chaps,
html:not(.motion-ready) .story .pbar {
  display: none;
}
html:not(.motion-ready) .f1-steps {
  margin-top: 28px;
}
html:not(.motion-ready) .f1-steps li {
  opacity: 1;
  display: flex;
}
html:not(.motion-ready) .f1-dw {
  grid-template-rows: 1fr;
}
html:not(.motion-ready) .f1-field {
  display: none;
}
html:not(.motion-ready) .pipe-step > *,
html:not(.motion-ready) .ex-b code {
  opacity: 1;
  transform: none;
}

@media (width<=1160px) {
  .top {
    mix-blend-mode: normal;
    color: var(--ink);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }
  .menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
  }
  .menu-icon {
    display: grid;
    gap: 4px;
    width: 16px;
  }
  .menu-icon i {
    height: 1px;
    background: currentColor;
    transition: transform 0.3s;
  }
  .menu-btn[aria-expanded="true"] .menu-icon i:first-child {
    transform: translateY(2.5px) rotate(45deg);
  }
  .menu-btn[aria-expanded="true"] .menu-icon i:last-child {
    transform: translateY(-2.5px) rotate(-45deg);
  }
  nav#nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    max-height: calc(100svh - 65px);
    overflow: auto;
    flex-direction: column;
    background: var(--paper);
    padding: 12px var(--pad) 28px;
    border-bottom: 1px solid var(--line);
  }
  nav#nav.open {
    display: flex;
    animation: nav-enter 0.35s var(--ease-out);
  }
  nav#nav a {
    padding: 8px 0;
    font: 500 24px/1.3 var(--sans);
    text-transform: none;
    letter-spacing: -0.02em;
    opacity: 1;
  }
  nav#nav .mobile-original {
    display: block;
    font: 500 11px var(--mono);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-top: 14px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  @keyframes nav-enter {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
  }
}
@media (width<=900px) {
  .story {
    height: 500svh;
  }
  .f1 {
    height: 560svh;
  }
  .story .stage {
    padding-bottom: 12px;
  }
  .story .scene-controls {
    padding-top: 8px;
  }
  .scene-controls {
    gap: 10px;
  }
  .scene-controls button {
    width: 26px;
    height: 24px;
  }
  .scene-controls > a {
    font-size: 9px;
  }
  .f1-copy {
    position: static;
  }
  .f1-title {
    font-size: 24px;
  }
  .f1-steps li {
    padding: 4px 0;
  }
  .f1-copy .scene-controls {
    margin-top: 8px;
  }
  .f1-stage {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .f1-field > svg.parsing-links {
    display: none;
  }
  .f1-photo {
    transition-duration: 0.85s;
  }
  .f1-card.now {
    transform: none;
  }
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 56px;
  }
  .contact-grid .h2 {
    margin-bottom: 24px;
  }
  .back-top {
    right: 18px;
    bottom: 18px;
    width: 38px;
    height: 38px;
  }
  .foot .grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .foot .grid > span:last-child {
    text-align: left;
    justify-self: start;
  }
  .foot nav {
    justify-content: start;
  }
}
@media (width<=540px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .original-link {
    font-size: 9px;
  }
  .header-actions {
    gap: 14px;
  }
  .hero .hero-top {
    top: 96px;
  }
  .footer-socials {
    gap: 14px 24px;
  }
  .form-actions {
    flex-wrap: wrap;
    gap: 16px 24px;
  }
  .f1-stage {
    padding-top: 76px;
  }
  .f1-copy .scene-controls {
    margin-top: 6px;
  }
  .schema-check,
  .chunk-check {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
  .rv,
  .split .w > span {
    opacity: 1 !important;
    transform: none !important;
  }
  .story,
  .f1 {
    height: auto;
  }
  .f1-copy {
    padding-bottom: 0;
  }
  .schema-check,
  .chunk-check {
    opacity: 1;
    transform: none;
  }
  .f1-field > svg.parsing-links {
    display: none;
  }
  .f1-space .pt,
  .f1-space .hit {
    transform: none;
  }
  .back-top {
    transform: none;
  }
}

/* Compositor-friendly motion: decorative effects never reflow a pinned scene. */
.copy {
  filter: none;
}
.story .stage,
.f1-stage {
  contain: layout paint;
}
.f1-photo,
.f1-photo.flat,
.f1-tx {
  filter: none;
}
.f1-paper {
  box-shadow: 0 18px 35px -20px #0009;
}
.axis .fill {
  height: 100%;
  transform-origin: top;
}
.beam {
  top: 0;
  height: 100%;
  background: none;
  box-shadow: none;
  transform: translateY(calc(var(--e, 0) * 100%));
  pointer-events: none;
}
.beam::before {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sig), transparent);
}
.trajectory-art .plot-grid {
  stroke: #2a262010;
  stroke-width: 0.6;
}
.trajectory-art .plot-axis {
  stroke: #2a262080;
  stroke-width: 0.8;
}
.trajectory-art .plot-ghost {
  stroke: #2a262024;
  stroke-width: 4;
}
.trajectory-art .plot-curve {
  stroke: #2a2620;
  stroke-width: 1.8;
}
.trajectory-art .plot-guide {
  stroke: #2a262060;
  stroke-width: 0.7;
  stroke-dasharray: 2 3;
}
.trajectory-art .plot-velocity,
.trajectory-art marker path {
  stroke: #2f5bff;
  stroke-width: 1.5;
}
.trajectory-art .plot-apex {
  fill: #2f5bff;
}
.trajectory-art text {
  fill: #2f5bff;
  font: 11px var(--mono);
}
.trajectory-art .plot-label {
  fill: #2a2620a0;
  font-size: 8px;
}
.f1-fig {
  position: absolute;
  top: 48%;
  left: 9%;
  width: 60%;
  margin: 0;
}
.embedding-art .embedding-grid {
  stroke: #8fa6ff0c;
  stroke-width: 0.6;
}
.embedding-art .embedding-axis {
  stroke: #8fa6ff24;
  stroke-width: 0.6;
}
.embedding-art .embedding-neighbours {
  stroke: #8fa6ff66;
  stroke-width: 0.65;
  opacity: 0;
  transition: opacity 0.45s 0.3s;
}
.f1-space.on .embedding-neighbours {
  opacity: 1;
}
.f1-space .embedding-label {
  fill: #9a9aa0;
  font: 5px var(--mono);
  opacity: 0.7;
}
@media (width<=1160px) {
  .top {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--paper);
  }
}

/* Keep the complete scene and its controls inside ordinary laptop heights. */
@media (min-width: 901px) and (max-height: 820px) {
  .f1-title {
    font-size: clamp(32px, 3.25vw, 48px);
  }
  .f1-title > .sig {
    display: block;
    white-space: nowrap;
  }
  .f1-steps li {
    padding: 5px 0;
  }
  .f1-t {
    font-size: 14px;
    line-height: 1.25;
  }
  .f1-d {
    font-size: 12px;
    line-height: 1.4;
  }
  .f1-field {
    gap: 14px;
  }
  .f1-photo {
    width: min(100%, 240px, 30svh - 64px);
  }
  .f1-paper {
    font-size: clamp(7px, 0.95svh, 9px);
  }
  .f1-chunk {
    padding: 5px 10px;
  }
}
