:root {
  --paper: #f2f0ea;
  --paper-hi: #fbf9f4;
  --paper-lo: #e4e1d8;
  --ink: #111111;
  --graphite: #5d5b55;
  --line: #c7c5bf;
  --soft: #e4e2dc;
  --panel: #edebe5;
  --accent: #42433f;
  --accent-soft: rgba(66, 67, 63, 0.1);
  --rule-ink: rgba(17, 17, 17, 0.72);
  --serif: Didot, "Bodoni 72", "Bodoni Moda", "Times New Roman", serif;
  --metal: #9b9b96;

  /* fluid, borderless separation */
  --fade-rule: linear-gradient(90deg, rgba(17, 17, 17, 0) 0%, rgba(17, 17, 17, 0.14) 22%, rgba(17, 17, 17, 0.14) 78%, rgba(17, 17, 17, 0) 100%);

  /* layered elevation */
  --lift-rest:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(17, 17, 17, 0.045),
    0 1px 1px rgba(17, 17, 17, 0.035),
    0 10px 22px -14px rgba(17, 17, 17, 0.22),
    0 34px 60px -34px rgba(17, 17, 17, 0.3);
  --lift-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(17, 17, 17, 0.05),
    0 2px 2px rgba(17, 17, 17, 0.04),
    0 20px 34px -18px rgba(17, 17, 17, 0.26),
    0 54px 90px -40px rgba(17, 17, 17, 0.38);

  --ease: cubic-bezier(0.22, 0.72, 0.2, 1);

  --z-base: 0;
  --z-object: 10;
  --z-cat: 15;
  --z-header: 20;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  position: relative;
  min-width: 320px;
  background:
    radial-gradient(128% 74% at 50% -12%, var(--paper-hi) 0%, rgba(251, 249, 244, 0) 62%),
    radial-gradient(110% 62% at 50% 112%, var(--paper-lo) 0%, rgba(228, 225, 216, 0) 68%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}
/* tactile paper grain — fine tooth plus a few larger fibres */
body::before {
  content: "";
  position: fixed;
  z-index: var(--z-base);
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.09' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.34 0 0 0 0 0.24 0 0 0 2.2 -1.5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}
/* laid paper: faint horizontal wire lines, wide chain lines, and a warm
   edge like an old sheet that has sat in a drawer */
body::after {
  content: "";
  position: fixed;
  z-index: var(--z-base);
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(135% 105% at 50% 45%, rgba(170, 150, 110, 0) 58%, rgba(150, 128, 88, 0.1) 86%, rgba(120, 98, 62, 0.18) 100%),
    repeating-linear-gradient(90deg, rgba(90, 76, 52, 0) 0 118px, rgba(90, 76, 52, 0.035) 118px 119px, rgba(90, 76, 52, 0) 119px 120px),
    repeating-linear-gradient(0deg, rgba(90, 76, 52, 0.022) 0 1px, rgba(90, 76, 52, 0) 1px 4px);
}
a { color: inherit; }
.skip-link {
  position: fixed;
  z-index: var(--z-header);
  top: 10px;
  left: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- masthead ---------- */
.topbar {
  position: sticky;
  z-index: var(--z-header);
  top: 0;
  min-height: 60px;
}
.topbar-inner {
  width: min(100%, 1064px);
  min-height: 60px;
  margin: 0 auto;
  padding: 4px max(26px, 3.4vw, env(safe-area-inset-right)) 10px max(26px, 3.4vw, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.topbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1px 0 0;
  background: rgba(242, 240, 234, 0.78);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  pointer-events: none;
}
/* printer's double rule: a heavier line over a hairline */
.topbar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(min(100%, 1064px) - 2 * max(26px, 3.4vw));
  height: 5px;
  border-top: 1.5px solid var(--rule-ink);
  border-bottom: 0.5px solid var(--rule-ink);
  transform: translateX(-50%);
  pointer-events: none;
}
.site-name {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-family: Didot, "Bodoni 72", "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}
/* the dots on j and i are drawn separately so they can hop on hover.
   Metrics are Didot's; motion.js only adds .has-didot when that face renders. */
.tittled { position: relative; display: inline-block; }
.tittle { display: none; }
.has-didot .tittled .glyph { display: inline-block; clip-path: inset(0.3em -0.5em -0.5em -0.5em); }
.has-didot .tittle {
  position: absolute;
  top: 0.105em;
  left: 0.0925em;
  display: block;
  width: 0.1025em;
  height: 0.105em;
  border-radius: 50%;
  background: currentColor;
  transform-origin: 50% 100%;
}
.has-didot .site-name:hover .tittle { animation: tittle-hop 640ms var(--ease); }
.has-didot .site-name:hover .tittled + .tittled .tittle { animation-delay: 90ms; }
@keyframes tittle-hop {
  0% { transform: translateY(0); }
  32% { transform: translateY(-0.34em) scale(0.9, 1.12); }
  58% { transform: translateY(0) scale(1.3, 0.72); }
  74% { transform: translateY(-0.08em) scale(0.96, 1.04); }
  100% { transform: translateY(0); }
}
.topbar a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; }

/* ---------- shell ---------- */
.index-layout {
  position: relative;
  z-index: 1;
  width: min(100%, 1064px);
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 36px) max(26px, 3.4vw) 0;
  display: block;
}

/* ---------- about ---------- */
.profile {
  padding: clamp(14px, 2vw, 26px) 0 clamp(46px, 5vw, 72px);
  display: grid;
  grid-template-columns: minmax(104px, 0.16fr) minmax(0, 1fr);
  gap: clamp(26px, 3vw, 46px);
  align-items: start;
}
.profile h1, .work-heading h2, .row-copy strong, .project-summary h1 {
  font-weight: 640;
  letter-spacing: -0.032em;
  line-height: 1;
  text-wrap: balance;
}
.profile h1, .work-heading h2, .pi-heading h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 3.5vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.profile-heading { position: relative; padding-top: 0.34em; }
.profile-copy {
  max-width: 68ch;
  color: var(--graphite);
  font-size: clamp(1.02rem, 1.12vw, 1.16rem);
  line-height: 1.62;
  text-wrap: pretty;
}
.profile-copy p + p { margin-top: 15px; }
.inline-thought {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
.inline-thought:hover { color: inherit; text-decoration-thickness: 2px; }
.inline-thought:focus-visible { color: var(--accent); outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- illustrations ---------- */
.vignettes {
  position: relative;
  margin-top: clamp(48px, 5vw, 72px);
  display: flex;
  justify-content: center;
}
/* a single print, set slightly askew; the wiggle keeps its resting tilt */
.vignettes img {
  --x: 0px; --y: 0px; --r: -3deg; --s: 1;
  display: block;
  width: clamp(150px, 18vw, 200px);
  height: auto;
  aspect-ratio: 4 / 5;
  transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.vignettes img.is-wiggling { animation: vignette-wiggle 620ms ease-in-out; }
@keyframes vignette-wiggle {
  0%, 100% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s)); }
  18% { transform: translate(var(--x), calc(var(--y) - 6px)) rotate(calc(var(--r) - 6deg)) scale(calc(var(--s) * 1.03)); }
  38% { transform: translate(var(--x), calc(var(--y) - 3px)) rotate(calc(var(--r) + 5deg)) scale(calc(var(--s) * 1.03)); }
  58% { transform: translate(var(--x), var(--y)) rotate(calc(var(--r) - 3deg)) scale(var(--s)); }
  78% { transform: translate(var(--x), var(--y)) rotate(calc(var(--r) + 1.5deg)) scale(var(--s)); }
}

/* ---------- projects ---------- */
.work-index { min-width: 0; padding-top: clamp(10px, 1.4vw, 20px); }
.work-heading {
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(16px, 1.8vw, 24px);
}
.project-list {
  position: relative;
  border-top: 1.5px solid var(--rule-ink);
  border-bottom: 0.5px solid var(--rule-ink);
}
.project-list::after {
  content: "";
  position: absolute;
  inset: auto 0 -4px;
  height: 0;
  border-bottom: 1.5px solid var(--rule-ink);
}
.project-list .project-row:first-child { border-top: 0; }

.project-row {
  position: relative;
  min-height: 92px;
  padding: 14px 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}
.project-row:hover .row-copy strong { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }
.project-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---------- project marks ---------- */
.object-stage {
  position: relative;
  z-index: var(--z-base);
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
}
.object-3d {
  position: relative;
  z-index: var(--z-object);
  display: block;
  width: 54px;
  height: 54px;
}
.object-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--soft);
  overflow: hidden;
  box-shadow: 0 2px 5px -3px rgba(17, 17, 17, 0.35);
}

.spot-object .object-face { background: #f5f1e8; }
.spot-object img { display: block; width: 100%; height: 100%; }

/* ---------- copy ---------- */
.row-copy { display: block; min-width: 0; }
.row-copy strong {
  display: block;
  margin-bottom: 3px;
  font-family: var(--serif);
  font-size: 1.36rem;
  font-weight: 400;
  letter-spacing: -0.012em;
}
.row-copy > span {
  display: block;
  max-width: 56ch;
  color: var(--graphite);
  font-size: 0.88rem;
  line-height: 1.45;
  text-wrap: pretty;
}
.row-copy small {
  display: block;
  margin-top: 12px;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}
.row-action {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
  font-family: Arial, sans-serif;
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 160ms ease-out;
}
.project-row:hover .row-action, .project-row:focus-visible .row-action {
  transform: translateX(6px);
}

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 1;
  width: min(100%, 1064px);
  margin: clamp(40px, 5vw, 72px) auto 0;
  padding: 28px max(26px, 3.4vw) calc(36px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82rem;
}
.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--graphite);
  font: inherit;
  text-decoration: none;
}
.footer-social:hover { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.footer-social:focus-visible { color: var(--accent); outline: 2px solid var(--accent); outline-offset: 4px; }
footer::before {
  content: "✦";
  position: absolute;
  top: -0.5em;
  left: 50%;
  width: min(76%, 460px);
  color: rgba(17, 17, 17, 0.42);
  font-size: 0.62rem;
  line-height: 1;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0), rgba(17, 17, 17, 0.2)) left center / calc(50% - 14px) 1px no-repeat,
    linear-gradient(90deg, rgba(17, 17, 17, 0.2), rgba(17, 17, 17, 0)) right center / calc(50% - 14px) 1px no-repeat;
  transform: translateX(-50%);
}

/* ---------- project detail ---------- */
.project-page .index-layout { display: block; max-width: 1064px; }
.project-page-window { border-top: 0; }
.window-bar { display: none; }
.project-hero {
  padding: clamp(40px, 6vw, 84px) 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(420px, 1.28fr);
  gap: clamp(42px, 7vw, 110px);
  align-items: center;
}
.project-summary h1 { margin-bottom: 20px; font-size: clamp(2.6rem, 5vw, 4.2rem); }
.project-summary p { max-width: 46ch; color: var(--graphite); font-size: 1.05rem; text-wrap: pretty; }
.project-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 18px; }
.action-link {
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f8f6f1, #e8e5dd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px -8px rgba(17, 17, 17, 0.4);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 320ms var(--ease);
}
.action-link:hover, .action-link:focus-visible { color: var(--accent); outline: none; transform: translateY(-2px); }
.hero-screenshot, .gallery figure {
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #0c0e11;
  box-shadow: var(--lift-rest);
}
.hero-screenshot img, .gallery img { display: block; width: 100%; height: auto; }
.gallery {
  position: relative;
  padding: clamp(42px, 6vw, 80px) 0 0;
  border-top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.gallery::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(76%, 460px);
  height: 1px;
  background: var(--fade-rule);
  transform: translateX(-50%);
}
.gallery h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.gallery figure + figure { margin: 0; }

/* ---------- pi ---------- */
.pi-page { min-height: 100dvh; touch-action: manipulation; }
.pi-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1064px);
  margin: 0 auto;
  padding: clamp(34px, 4vw, 60px) max(26px, 3.4vw) clamp(28px, 3vw, 44px);
}
.pi-heading {
  padding-bottom: clamp(26px, 3vw, 40px);
  display: block;
}
.pi-heading h1 {
  font-size: clamp(2.6rem, 4.2vw, 3.9rem);
  line-height: 1;
  text-wrap: balance;
}
.pi-heading p {
  max-width: 62ch;
  margin-top: 14px;
  color: var(--graphite);
  font-size: 1.04rem;
  text-wrap: pretty;
}
.pi-console {
  display: block;
}
.pi-box {
  position: relative;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
#pi-display {
  width: 100%;
  height: clamp(240px, 42vh, 420px);
  padding: clamp(22px, 2.6vw, 36px) clamp(22px, 2.6vw, 36px) clamp(44px, 4vw, 56px);
  overflow-y: auto;
  perspective: 900px;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(2.1rem, 4.4vw, 4.6rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.pi-status {
  position: absolute;
  right: clamp(20px, 2.4vw, 32px);
  bottom: clamp(14px, 1.6vw, 20px);
  pointer-events: none;
}
.prefix { color: var(--accent); font-weight: 700; }
.current-digit {
  display: inline-block;
  padding: 0 0.06em;
  border-radius: 0.08em;
  background: var(--accent);
  color: var(--paper);
  transform-style: preserve-3d;
  box-shadow: 0 6px 16px -8px rgba(66, 67, 63, 0.62);
}
.pi-controls {
  padding: clamp(18px, 2vw, 28px) 0 0;
  display: flex;
  justify-content: center;
}
.pi-page .pi-shell { padding-bottom: 8px; }
.pi-page footer { margin-top: 18px; padding-top: 20px; }
#tap-btn {
  width: min(100%, 300px);
  min-height: 62px;
  padding: 16px 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2a2a 0%, var(--ink) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 24px -12px rgba(17, 17, 17, 0.85);
  color: var(--paper);
  cursor: pointer;
  font: 600 0.95rem/1.2 "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
}
#tap-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
#count { color: var(--graphite); font-family: "Courier New", Courier, monospace; font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .profile { grid-template-columns: minmax(110px, 0.22fr) 1fr; gap: 34px; }
  .project-hero { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar, .topbar-inner { min-height: 54px; }
  .topbar-inner { padding-inline: 20px; }
  .topbar::after { width: calc(100% - 40px); }
  .site-name { font-size: 1.58rem; }
  .index-layout { padding: 20px 20px 0; }
  .profile { display: block; padding-bottom: 40px; }
  .profile h1 { margin-bottom: 16px; font-size: 2.35rem; }
  .profile-copy { font-size: 1rem; }
  .vignettes { margin-top: 40px; }
  .work-index { padding-top: 8px; }
  .work-heading { padding-bottom: 16px; }
  .work-heading h2 { font-size: 2.35rem; }
  .project-row {
    min-height: 78px;
    padding: 12px 0;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
  }
  .object-stage, .object-3d { width: 44px; height: 44px; }
  .object-face { border-radius: 8px; }
  .row-copy strong { margin-bottom: 0; font-size: 1.18rem; line-height: 1.2; }
  .row-copy > span { display: none; }
  .row-action { width: 28px; height: 28px; font-size: 1.25rem; }
  .project-page .index-layout { padding-inline: 20px; }
  .project-summary h1 { font-size: clamp(2.2rem, 11vw, 3rem); }
  .gallery { grid-template-columns: 1fr; }
  .pi-shell { padding: 32px 20px 28px; }
  .pi-heading h1 { font-size: 2.2rem; }
  #pi-display { height: clamp(220px, 46vh, 340px); padding: 20px 18px 40px; font-size: clamp(2rem, 11vw, 3.2rem); }
  .pi-controls { padding: 20px 0 0; }
  footer { padding-inline: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
