:root{
  --bg:#ffffff; --canvas:#ececec; --ink:#141414; --mute:#6f6f6f; --line:#d2d2d2; --dash:#a9a9a9;
  --cell:#e4e4e4; --group:#f6f6f6; --faint:#ececec; --accent:#2f54eb; --tint:#e6ebff;
  --sheet-w:1100px; --sheet-h:660px; --pad:56px;
  color-scheme:light dark;
}
@media (prefers-color-scheme:dark){
  :root{ --bg:#141414; --canvas:#262626; --ink:#ededed; --mute:#9a9a9a; --line:#3a3a3a; --dash:#6a6a6a;
    --cell:#2a2a2a; --group:#1c1c1c; --faint:#222222; --accent:#7b93ff; --tint:#1f2a52; }
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:var(--ink);background:var(--bg);-webkit-font-smoothing:antialiased;font-weight:400}
a{color:inherit;text-decoration:none}
a:hover{color:var(--accent)}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
p,h1,h2,h3{margin:0}

/* ---------- Home canvas ---------- */
.home{background:var(--canvas);height:100%;overflow:hidden;position:relative}
.minimap{position:absolute;top:28px;left:0;right:0;display:flex;justify-content:center;align-items:flex-end;gap:12px;height:16px;z-index:2}
.minimap button{width:1px;height:10px;background:var(--dash);padding:0 6px;background-clip:content-box;box-sizing:content-box;transition:height 160ms,background-color 160ms}
.minimap button[aria-current="true"]{width:2px;height:16px;background-color:var(--accent)}
.track{height:100%;display:flex;align-items:center;gap:80px;padding:0 80px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x proximity;scrollbar-width:none;cursor:grab}
.track::-webkit-scrollbar{display:none}
.track.dragging{cursor:grabbing;scroll-snap-type:none;user-select:none}
.sheet{flex:0 0 var(--sheet-w);width:var(--sheet-w);height:var(--sheet-h);background:var(--bg);padding:var(--pad);scroll-snap-align:center;display:flex;justify-content:space-between;gap:48px;position:relative}
.sheet.enter{opacity:0;transform:translateY(16px)}
.sheet.in{opacity:1;transform:none;transition:opacity 480ms cubic-bezier(.2,0,0,1),transform 480ms cubic-bezier(.2,0,0,1)}
.sheet-col{display:flex;flex-direction:column;justify-content:space-between;flex:1 1 auto;min-width:0}
.eyebrow{font-size:14px;line-height:20px;color:var(--mute);letter-spacing:-.01em}
.sheet-text{display:flex;flex-direction:column;gap:16px;max-width:440px}
.sheet h2{font-size:48px;line-height:1.02;letter-spacing:-.04em;font-weight:400}
.sheet .desc{font-size:18px;line-height:26px;color:var(--mute);letter-spacing:-.01em}
.sheet .role{font-size:14px;line-height:20px;color:var(--mute);margin-top:8px}
.sheet .more{font-size:16px;line-height:22px;letter-spacing:-.01em;margin-top:8px;display:inline-block}
.sheet .diagram-slot{align-self:flex-end;flex:0 0 480px}
.sheet:has(a.more){cursor:pointer}
.sheet:has(a.more):hover .more{text-decoration:underline;text-underline-offset:3px}
.sheet .more:focus-visible{outline:2px solid currentColor;outline-offset:3px}
.intro h1{font-size:64px;line-height:1.02;letter-spacing:-.04em;font-weight:400}
.intro h1 span{display:block;white-space:nowrap}
.intro h1 span:nth-child(2){padding-left:64px}
.intro h1 span:nth-child(3){padding-left:128px}
.intro h1 span:nth-child(4){padding-left:64px}
.intro .top{display:flex;justify-content:space-between;align-items:flex-start;gap:40px}
.grid6{display:grid;grid-template-columns:repeat(6,36px);gap:8px;flex-shrink:0;position:absolute;right:var(--pad);bottom:104px}
.grid6 i{display:block;width:36px;height:36px;border:1px solid var(--line);cursor:pointer}
.grid6 i.on{background:var(--accent);border-color:var(--accent)}
.foot{display:flex;justify-content:space-between;align-items:flex-end;font-size:14px;line-height:20px;color:var(--mute);letter-spacing:-.01em}
.contact{flex-direction:column;justify-content:center}
.contact .stack{display:flex;flex-direction:column;font-size:64px;line-height:1.02;letter-spacing:-.04em;margin-top:-20px}
.contact .stack>*{align-self:flex-start}
.contact .stack>:nth-child(2){padding-left:128px}
.contact .stack>:nth-child(3){padding-left:64px;display:flex;align-items:baseline;gap:24px}
.contact .stack button{font-size:64px;line-height:1.02;letter-spacing:-.04em}
.contact .hint{font-size:14px;line-height:20px;letter-spacing:-.01em;color:var(--mute)}
.contact .hint.copied{color:var(--accent)}
.contact .foot{position:absolute;left:var(--pad);right:var(--pad);bottom:var(--pad)}
.placeholder{color:var(--mute)}

/* ---------- Diagram frames ---------- */
.frame{width:480px;height:340px;padding:24px;background:var(--bg);color:var(--ink);display:flex;flex-direction:column;justify-content:space-between;position:relative}
.frame .cap{font-size:13px;line-height:18px;color:var(--mute);margin-top:20px}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.printbtn{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.sw{transition:transform 120ms cubic-bezier(.2,0,0,1);will-change:transform}
@media (prefers-reduced-motion:reduce){.sw{transition:none}.sheet.enter{opacity:1;transform:none}.sheet.in{transition:none}}

/* ---------- Case study page ---------- */
.page{padding:56px 0 96px}
.wrap{max-width:1100px;margin:0 auto;padding:0 32px;display:flex;flex-direction:column;gap:160px}
.topbar{display:flex;justify-content:space-between;align-items:center;font-size:14px;line-height:20px;color:var(--mute)}
header.open{display:flex;flex-direction:column;gap:32px}
header.open h1{font-size:72px;line-height:1;letter-spacing:-.04em;font-weight:400;margin-top:120px}
header.open .lede{font-size:22px;line-height:32px;letter-spacing:-.015em;color:var(--mute);max-width:640px}
.meta{display:flex;flex-wrap:wrap;gap:40px;border-top:1px solid var(--line);padding-top:20px;margin-top:80px;font-size:14px;line-height:20px}
.meta div{display:flex;flex-direction:column;gap:4px;min-width:200px}
.meta div :first-child{color:var(--mute)}
section.row{display:flex;flex-wrap:wrap;gap:40px}
section.row h2{font-size:14px;line-height:20px;font-weight:400;color:var(--mute);flex:1 1 200px;max-width:240px}
section.row .body{flex:999 1 420px;max-width:760px}
.challenge{font-size:22px;line-height:32px;letter-spacing:-.015em}
.scrolly{display:flex;flex-wrap:wrap;gap:48px;align-items:flex-start}
.stage{flex:1 1 480px;max-width:480px;position:sticky;top:24px;display:flex;flex-direction:column;gap:12px}
.stage .window{width:480px;max-width:100%;height:340px;overflow:hidden;border:1px solid var(--line)}
.stage .note{font-size:12px;line-height:16px;color:var(--mute)}
@media (min-width:908px){.stage{--grow:0;transform-origin:100% 0;transition:transform 80ms linear;will-change:transform;transform:translateY(calc(var(--sy,0px) * var(--grow))) scale(calc(1 + .28 * var(--grow)))}}
@media (min-width:908px) and (prefers-reduced-motion:reduce){.stage{transition:none}}
.steps{flex:999 1 380px;min-width:0;display:flex;flex-direction:column}
.step{text-align:left;border-top:1px solid var(--line);padding:32px 0;min-height:300px;display:flex;flex-direction:column;gap:12px;width:100%}
.step:last-child{border-bottom:1px solid var(--line)}
.step .n{font-size:14px;line-height:20px;color:var(--mute);transition:color 160ms}
.step[aria-current="true"] .n{color:var(--accent)}
.step .t{font-size:22px;line-height:30px;letter-spacing:-.015em;max-width:480px}
.items>div{border-top:1px solid var(--line);padding:20px 0;display:flex;flex-direction:column;gap:6px}
.items>div:last-child{border-bottom:1px solid var(--line)}
.items h3{font-size:20px;line-height:28px;letter-spacing:-.015em;font-weight:400}
.items p{font-size:16px;line-height:24px;color:var(--mute)}
.methods{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 40px;font-size:16px;line-height:24px}
.methods div{display:flex;flex-direction:column;gap:4px}
.methods div :last-child{color:var(--mute)}
nav.pn{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding-top:24px;padding-bottom:100px;font-size:16px;line-height:22px}

/* ---------- Phone ---------- */
@media (max-width:700px){
  :root{--sheet-w:330px;--sheet-h:540px;--pad:24px}
  .track{gap:16px;padding:0 20px;scroll-snap-type:x mandatory}
  .sheet{flex-direction:column;justify-content:space-between;gap:16px}
  .sheet h2{font-size:28px;line-height:1.05;letter-spacing:-.03em}
  .sheet .desc{font-size:15px;line-height:21px}
  .sheet .role{font-size:13px;line-height:18px}
  .sheet .more{font-size:15px;line-height:20px}
  .sheet .diagram-slot{align-self:flex-start;flex:0 0 auto;width:282px;height:200px;overflow:hidden;order:2}
  .sheet .diagram-slot .frame{transform:scale(.5875);transform-origin:0 0}
  .sheet-col{order:1}
  .sheet-col.after{order:3}
  .intro h1{font-size:28px;line-height:1.04;letter-spacing:-.03em}
  .intro h1 span:nth-child(2){padding-left:24px}
  .intro h1 span:nth-child(3){padding-left:48px}
  .intro h1 span:nth-child(4){padding-left:24px}
  .intro .top{flex-direction:column}
  .grid6{grid-template-columns:repeat(6,24px);gap:6px;position:static}
  .intro h1 span{white-space:normal}
  .grid6 i{width:24px;height:24px}
  .foot{flex-direction:column;align-items:flex-start;gap:4px;font-size:13px;line-height:18px}
  .contact .stack{font-size:30px;margin-top:0}
  .contact .stack button{font-size:30px}
  .contact .stack>:nth-child(2){padding-left:48px}
  .contact .stack>:nth-child(3){padding-left:24px;flex-direction:column;gap:6px}
  .minimap{top:24px}
  .wrap{padding:0 24px;gap:112px}
  header.open h1{font-size:44px;margin-top:64px}
  header.open .lede{font-size:19px;line-height:28px}
  .stage{top:0;background:var(--bg);padding:12px 0 16px;z-index:1;gap:8px}
  .stage .window{width:326px;height:231px}
  .stage .window .frame{transform:scale(.68);transform-origin:0 0}
  .step{min-height:0;padding:28px 0}
  .step .t{font-size:19px;line-height:28px}
  .methods{grid-template-columns:1fr}
}

/* ---------- Stacked scrolly (tablet / narrow): steps slide under the opaque stage ---------- */
@media (max-width:907px){
  .stage{top:0;background:var(--bg);padding:24px 0 16px;z-index:2;gap:8px}
  .steps{position:relative;z-index:1;margin-top:-176px}
  /* the stage releases 176px before the scrolly ends, so the final step parks fully visible beneath it */
  .stage{margin-bottom:176px}
  .step:last-child{min-height:176px;box-sizing:border-box}
}

/* ---------- Resume ---------- */
.resume .items .job{gap:10px}
.resume .jobhead{display:flex;justify-content:space-between;align-items:baseline;gap:24px}
.resume .when{font-size:14px;line-height:20px;color:var(--mute);white-space:nowrap}
.resume .role{font-size:16px;line-height:24px;color:var(--mute)}
.resume .job ul{margin:8px 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:10px}
.resume .job li{font-size:16px;line-height:24px;color:var(--ink)}
.resume .job li strong{font-weight:400;color:var(--ink)}
.resume ul.plain{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 40px;font-size:16px;line-height:24px}
@media (max-width:700px){.resume ul.plain{grid-template-columns:1fr}.resume .jobhead{flex-direction:column;gap:2px}}
@media print{.topbar,nav.pn,.meta div:last-child{display:none}.wrap{gap:40px}header.open h1{margin-top:0;font-size:40px}body{color:#000;background:#fff}}
