/* Dark theme. Light stays the site's own look. Switched by html[data-theme="dark"] (set before paint by the inline head script). */
html[data-theme="dark"]{
  color-scheme:dark;
  --color-paper:#141412;--color-paper-deep:#1c1c19;--color-surface:#1e1e1b;
  --color-ink:#ecebe6;--color-ink-soft:#a8a8a1;--color-ink-muted:#8f8f88;
  --color-line:#ecebe61f;
  --color-night:#2b2b28;
  --color-contrast:#2b2b28;--color-on-contrast:#fff;
  --color-tech:#4664ff;
}
html[data-theme="light"]{color-scheme:light}
/* text sitting straight on the sky photo stays dark so it reads on the light painting */
html[data-theme="dark"] [class*="heroText"]{--color-ink:#111;--color-ink-soft:#3a3a3d;--color-ink-muted:#4a4a4f;--color-tech:#2F55FF;color:#111}
/* chips and buttons filled with the (now light) ink keep dark text */
html[data-theme="dark"] :is(.cursor-label,.brand-module__9BPywa__included b[data-terms=in],.agent-module__8h91GG__send,.agent-module__8h91GG__devLink,.agent-module__8h91GG__switcher button[aria-checked=true]){color:var(--color-paper)}
/* single-colour case logos (img svgs drawn in black) turn off-white */
html[data-theme="dark"] img[src*="/logos/ink-"]{filter:brightness(0) invert(1);opacity:.92}
html,body{transition:background-color .3s cubic-bezier(.16,1,.3,1),color .3s cubic-bezier(.16,1,.3,1)}
@media (prefers-reduced-motion:reduce){html,body,.sp-theme,.sp-theme svg{transition:none!important}}

/* toggle */
.site-header>.mode-switch{margin-left:auto}
.sp-theme{appearance:none;background:transparent;border:0;margin:0 0 0 4px;padding:0;width:44px;height:44px;flex:none;display:inline-grid;place-items:center;border-radius:50%;color:var(--color-ink-soft,#6e6e73);cursor:pointer;transition:color .3s cubic-bezier(.16,1,.3,1),background-color .3s cubic-bezier(.16,1,.3,1);-webkit-tap-highlight-color:transparent}
.sp-theme:hover{color:var(--color-ink,#111);background:color-mix(in srgb,var(--color-ink,#111) 8%,transparent)}
.sp-theme:focus-visible{outline:2px solid var(--color-tech,#2F55FF);outline-offset:-2px;color:var(--color-ink,#111)}
.sp-theme svg{width:20px;height:20px;display:block;transition:transform .5s cubic-bezier(.16,1,.3,1)}
.sp-theme:active svg{transform:rotate(25deg) scale(.92)}
.sp-theme .sp-moon{display:block}.sp-theme .sp-sun{display:none}
html[data-theme="dark"] .sp-theme .sp-moon{display:none}html[data-theme="dark"] .sp-theme .sp-sun{display:block}

/* dark panels inside the sky hero keep light text */
html[data-theme="dark"] [class*="heroText"] :is(.dev-module__G5ThLG__ask a,.brand-module__9BPywa__worked){--color-ink:#ecebe6;--color-ink-soft:#a8a8a1;color:#ecebe6}

/* pages that set their own page colours */
html[data-theme="dark"] body{background:var(--color-paper);color:var(--color-ink)}
html[data-theme="dark"] .post{color:var(--color-ink)}
html[data-theme="dark"] .post a,html[data-theme="dark"]:not(.nf) main a:not([class]){color:#8da4ff}
html[data-theme="dark"] .post th{background:#26261f;color:#d9d8d2}
html[data-theme="dark"] .post td,html[data-theme="dark"] .post .back{border-bottom-color:var(--color-line);border-top-color:var(--color-line)}
html[data-theme="dark"] .post code{background:#ecebe61a;color:inherit}
html[data-theme="dark"] .post pre code{background:none}
html[data-theme="dark"] .post :is(.card,.developer-card,.highlight,.tldr){background:var(--color-surface);color:var(--color-ink)}
html[data-theme="dark"] .post blockquote{background:var(--color-surface);color:var(--color-ink-soft);border-left-color:var(--color-line)}
html[data-theme="dark"] .post :is(.meta,.tier-note,.q .prep){color:var(--color-ink-soft)}
html[data-theme="dark"] .post .q .prep strong{color:var(--color-ink)}
html[data-theme="dark"] .post .q{border-left-color:var(--color-line)}
html[data-theme="dark"] .post :is(.tag,.tech-stack span,.stars){background:#2a2a25;color:#d9d8d2;border-color:#3a3a34}
html[data-theme="dark"] .post :is(.stat,.qnum){color:#8da4ff}
html[data-theme="dark"] .post :is(.check,.signal){color:#6fd08c}
html[data-theme="dark"] .post h2[style]{border-color:var(--color-line)}
html[data-theme="dark"] .post :is(.prompt,.code),html[data-theme="dark"] .post pre{background:#0e0e0d;color:#e6e6e6}

/* the saved profile page (own inline light styles) */
html[data-theme="dark"] body:not(:has(main))>h1,html[data-theme="dark"] body:not(:has(main))>p,html[data-theme="dark"] body:not(:has(main))>ul,html[data-theme="dark"] body:not(:has(main))>ol,html[data-theme="dark"] body:not(:has(main))>h3,html[data-theme="dark"] body:not(:has(main))>section,html[data-theme="dark"] body:not(:has(main))>table{color:var(--color-ink)}
html[data-theme="dark"] body:not(:has(main)) h2{color:#8da4ff;border-bottom-color:var(--color-line)}
html[data-theme="dark"] body:not(:has(main)) .subtitle,html[data-theme="dark"] body:not(:has(main)) .stat .label{color:var(--color-ink-soft)}
html[data-theme="dark"] body:not(:has(main)) .meta-grid{background:var(--color-surface)}
html[data-theme="dark"] body:not(:has(main)) .meta-item strong{color:#a8a8a1}
html[data-theme="dark"] body:not(:has(main)) .stat{background:var(--color-surface);border-color:var(--color-line)}
html[data-theme="dark"] body:not(:has(main)) .stat .num{color:#8da4ff}
html[data-theme="dark"] body:not(:has(.post)) th{background:#26261f;color:#d9d8d2}
html[data-theme="dark"] body:not(:has(.post)) td{border-bottom-color:var(--color-line)}
html[data-theme="dark"] body:not(:has(main)) .tag{background:#2a2a25;color:#d9d8d2}
html[data-theme="dark"] body:not(:has(main)) .tag.ai{background:#1d3324;color:#9be0b0}
html[data-theme="dark"] body:not(:has(main)) .tag.fe{background:#1c2a44;color:#a9c4ff}
html[data-theme="dark"] body:not(:has(main)) .tag.be{background:#40291a;color:#ffbf8f}
html[data-theme="dark"] body:not(:has(main)) blockquote{background:var(--color-surface);color:var(--color-ink-soft)}
html[data-theme="dark"] body:not(:has(main)) .links a{color:#8da4ff;border-color:#8da4ff}
html[data-theme="dark"] body:not(:has(main)) .links a:hover{background:#8da4ff;color:#141412}
html[data-theme="dark"] body:not(:has(main)) .back{border-top-color:var(--color-line)}

/* home about block */
html[data-theme="dark"] .sp-about{color:var(--color-ink)}
html[data-theme="dark"] .sp-about figure{background:var(--color-surface)}
html[data-theme="dark"] .sp-about p{color:#cfcec8}
html[data-theme="dark"] .sp-about dd{color:var(--color-ink-soft)}
html[data-theme="dark"] .sp-about a{border-color:var(--color-ink);color:var(--color-ink)}
html[data-theme="dark"] .sp-about a:first-child{background:var(--color-ink);color:var(--color-paper)}
html[data-theme="dark"] .sp-about a:hover,html[data-theme="dark"] .sp-about a:focus-visible{background:#5470ff;border-color:#5470ff;color:#fff}

/* contact panel */
html[data-theme="dark"] .sp-contact{border-color:var(--color-line);background:var(--color-surface);color:var(--color-ink)}
html[data-theme="dark"] .sp-contact .sp-c-lead{color:#cfcec8}
html[data-theme="dark"] .sp-contact :is(.sp-c-status,.sp-c-calm,dt){color:var(--color-ink-soft)}
html[data-theme="dark"] .sp-contact .sp-c-status.sp-c-err{color:#ff8a73}
html[data-theme="dark"] .sp-contact .sp-c-btn{background:var(--color-ink);border-color:var(--color-ink);color:var(--color-paper)}
html[data-theme="dark"] .sp-contact .sp-c-btn:hover{background:#5470ff;border-color:#5470ff;color:#fff}
html[data-theme="dark"] .sp-contact .sp-c-val a{color:var(--color-ink)}
html[data-theme="dark"] .sp-contact .sp-c-val a:hover{color:#8da4ff}

/* branded 404 */
html.nf[data-theme="dark"] body{background:#141412;color:#ecebe6}
html.nf[data-theme="dark"] main:after{background:linear-gradient(0deg,rgba(20,20,18,.96) 0%,rgba(20,20,18,.82) 42%,rgba(20,20,18,.1) 80%)}
html.nf[data-theme="dark"] p{color:#cfcec8}
html.nf[data-theme="dark"] a{border-color:#ecebe6;color:#ecebe6}
html.nf[data-theme="dark"] a:first-child{background:#ecebe6;color:#141412}
html.nf[data-theme="dark"] a:hover,html.nf[data-theme="dark"] a:focus-visible{background:#5470ff;border-color:#5470ff;color:#fff}
html[data-theme="dark"] body:not(:has(main))>:is(p,ul,ol,div,section,table) a:not([class]){color:#8da4ff}
html[data-theme="dark"] .dev-module__G5ThLG__copy{color:#b8b8bc}

/* phone: the nav row is already full, so the 44px hit area overlaps its neighbours instead of adding width */
@media (max-width:640px){
  .site-header:has(.sp-theme){gap:6px;padding-right:0}
  .sp-theme{margin:0 0 0 -12px;width:44px}
  .sp-theme svg{width:18px;height:18px}
}

/* Worked-at logos: off-white ink in dark, not the section accent */
html[data-theme="dark"] section[aria-labelledby="worked-at"] a{color:#ecebe6!important}

/* Built-for strip: keep the National Bank wordmark whole */
img[src*="/logos/ink-national-bank"]{width:auto!important;max-width:none!important;aspect-ratio:499.51/173.94;object-fit:contain!important}

/* Phone menu (theme.js): under 760px the header keeps only the name; links, the view switch and dark mode live in the drawer */
.sp-menu-btn,.sp-menu{display:none}
@media (max-width:760px){
  .site-header .world-nav,.site-header .mode-switch,.site-header .sp-theme,.site-header .mode-slash{display:none!important}
  .sp-menu-btn{display:inline-flex;align-items:center;gap:10px;position:fixed;top:max(14px,env(safe-area-inset-top));right:14px;z-index:2147483000;height:44px;padding:0 14px 0 18px;border-radius:999px;border:1px solid rgba(17,17,17,.14);background:rgba(243,243,241,.92);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#111;font:500 15px/1 GeistSans,"GeistSans Fallback",system-ui,sans-serif;letter-spacing:0;-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:background .3s cubic-bezier(.16,1,.3,1),transform .3s cubic-bezier(.16,1,.3,1)}
  .sp-menu-btn:active{transform:scale(.96)}
  .sp-menu-btn:focus-visible{outline:2px solid #2F55FF;outline-offset:3px}
  .sp-menu-ico{position:relative;width:18px;height:10px}
  .sp-menu-ico i{position:absolute;left:0;right:0;height:1.5px;border-radius:1px;background:currentColor;transition:transform .35s cubic-bezier(.16,1,.3,1),top .35s cubic-bezier(.16,1,.3,1)}
  .sp-menu-ico i:first-child{top:0}.sp-menu-ico i:last-child{top:8.5px}
  .sp-menu-open .sp-menu-ico i:first-child{top:4.25px;transform:rotate(45deg)}
  .sp-menu-open .sp-menu-ico i:last-child{top:4.25px;transform:rotate(-45deg)}
  .sp-menu{display:flex;flex-direction:column;position:fixed;inset:0;z-index:2147482999;background:#f3f3f1;color:#111;padding:calc(max(14px,env(safe-area-inset-top)) + 76px) 24px calc(28px + env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain;opacity:0;transform:translateY(-8px);transition:opacity .32s cubic-bezier(.16,1,.3,1),transform .32s cubic-bezier(.16,1,.3,1)}
  .sp-menu[hidden]{display:none}
  .sp-menu.on{opacity:1;transform:none}
  .sp-menu-nav{display:flex;flex-direction:column}
  .sp-menu-nav a{font:400 clamp(40px,12vw,54px)/1.08 "Instrument Serif","Instrument Serif Fallback",Georgia,serif;letter-spacing:-.01em;color:inherit;text-decoration:none;padding:6px 0;min-height:48px;display:flex;align-items:center;opacity:0;transform:translateY(14px);transition:opacity .5s cubic-bezier(.16,1,.3,1),transform .5s cubic-bezier(.16,1,.3,1),color .2s}
  .sp-menu.on .sp-menu-nav a{opacity:1;transform:none}
  .sp-menu.on .sp-menu-nav a:nth-child(2){transition-delay:.04s}.sp-menu.on .sp-menu-nav a:nth-child(3){transition-delay:.08s}.sp-menu.on .sp-menu-nav a:nth-child(4){transition-delay:.12s}.sp-menu.on .sp-menu-nav a:nth-child(5){transition-delay:.16s}
  .sp-menu-nav a[aria-current]{color:#2F55FF}
  .sp-menu-nav a:focus-visible{outline:2px solid #2F55FF;outline-offset:2px;border-radius:4px}
  .sp-menu-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;margin-top:8px;font:400 16px/1.3 GeistSans,"GeistSans Fallback",system-ui,sans-serif;color:#2a2a2a}
  .sp-menu-row:first-of-type{margin-top:auto;padding-top:28px}
  .sp-menu-row[hidden]{display:none}
  .sp-seg{display:inline-flex;padding:3px;border-radius:999px;background:rgba(17,17,17,.07)}
  .sp-seg button{min-height:40px;padding:0 14px;border:0;border-radius:999px;background:none;color:#444;font:500 14px/1 GeistSans,system-ui,sans-serif;touch-action:manipulation}
  .sp-seg button[aria-pressed="true"]{background:#111;color:#f3f3f1}
  .sp-switch{position:relative;width:52px;height:32px;border:0;border-radius:999px;background:rgba(17,17,17,.16);transition:background .25s;touch-action:manipulation}
  .sp-switch i{position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:transform .3s cubic-bezier(.16,1,.3,1)}
  .sp-switch[aria-checked="true"]{background:#2F55FF}.sp-switch[aria-checked="true"] i{transform:translateX(20px)}
  .sp-seg button:focus-visible,.sp-switch:focus-visible,.sp-menu-foot a:focus-visible{outline:2px solid #2F55FF;outline-offset:2px}
  .sp-menu-foot{display:flex;flex-wrap:wrap;gap:6px 22px;margin-top:18px;font:400 15px/1 GeistSans,system-ui,sans-serif}
  .sp-menu-foot a{color:#444;text-decoration:none;min-height:44px;display:inline-flex;align-items:center}
  html.sp-menu-open,html.sp-menu-open body{overflow:hidden!important}
  html[data-theme="dark"] .sp-menu-btn{background:rgba(20,20,18,.9);border-color:rgba(236,235,230,.18);color:#ecebe6}
  html[data-theme="dark"] .sp-menu{background:#141412;color:#ecebe6}
  html[data-theme="dark"] .sp-menu-nav a[aria-current]{color:#8da4ff}
  html[data-theme="dark"] .sp-menu-row{color:#cfcec9}
  html[data-theme="dark"] .sp-seg{background:rgba(236,235,230,.1)}
  html[data-theme="dark"] .sp-seg button{color:#cfcec9}
  html[data-theme="dark"] .sp-seg button[aria-pressed="true"]{background:#ecebe6;color:#141412}
  html[data-theme="dark"] .sp-switch{background:rgba(236,235,230,.2)}
  html[data-theme="dark"] .sp-switch[aria-checked="true"]{background:#4664ff}
  html[data-theme="dark"] .sp-menu-foot a{color:#b8b8bc}
}
@media (max-width:760px) and (prefers-reduced-motion:reduce){.sp-menu,.sp-menu-nav a,.sp-menu-ico i,.sp-menu-btn{transition:none!important}.sp-menu-nav a{opacity:1;transform:none}}
