/* ---------- Theme ---------- */
:root {
  --bg: #fdfdfc;
  --fg: #1a1a18;
  --text: #3d3d39;
  --muted: #6f6f69;
  --line: #cfcfc8;
  --soft: #ececE7;
  --card: #ffffff;
  --c1: #ff6b3d; --c2: #3d7bff; --c3: #a855f7; --c4: #16a36a; --c5: #e0a800; --c6: #e8467c;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hand: "Architects Daughter", "Segoe Print", cursive;
  --w: 720px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --fg: #ededea; --text: #c4c4bf; --muted: #85857f; --line: #34342f; --soft: #1c1c1a; --card: #181816;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --fg: #ededea; --text: #c4c4bf; --muted: #85857f; --line: #34342f; --soft: #1c1c1a; --card: #181816;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font: 15px/1.75 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); }
.dim { color: var(--muted); }
:focus-visible { outline: 2px solid var(--c2); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--fg); color: var(--bg); }

/* ---------- Grid scaffolding: full-width dotted rows, framed column ---------- */
.band { border-bottom: 1px dotted var(--line); }
.col {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 24px;
  border-left: 1px dotted var(--line);
  border-right: 1px dotted var(--line);
  position: relative;
}
.hatch .col {
  height: 32px;
  background-image: radial-gradient(var(--line) 1px, transparent 1.2px);
  background-size: 6px 6px;
  opacity: .8;
}

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.logo { font: italic 24px/1 var(--serif); color: var(--fg); }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--fg); }
.sep { width: 1px; height: 16px; background: var(--line); }
.icon-btn { display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); margin-left: -8px; }
.icon-btn:hover { color: var(--fg); }
.icon-btn + .icon-btn { margin-left: -4px; }
.icon-btn .off, :root[data-sound="off"] .icon-btn .on, :root[data-vol="off"] .icon-btn .on { display: none; }
:root[data-sound="off"] .icon-btn .off, :root[data-vol="off"] .icon-btn .off { display: block; }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }

/* ---------- Hero ---------- */
.hero-band .col { padding: 0 0 28px; }
.banner { position: relative; height: 240px; }
#field { display: block; width: 100%; height: 100%; background-color: var(--soft); background-image: radial-gradient(var(--line) 1px, transparent 1.2px); background-size: 16px 16px; cursor: crosshair; touch-action: pan-y; border-bottom: 1px dotted var(--line); }
.hint { position: absolute; left: 12px; top: 10px; font-size: 11px; color: var(--muted); opacity: 0; transition: opacity .3s; pointer-events: none; }
.banner:hover .hint { opacity: 1; }
@media (hover: none) { .hint { opacity: 1; } }
.chip { position: absolute; right: 10px; bottom: 10px; font: 11px var(--mono); color: var(--fg); background: var(--card); border: 1px solid var(--line); pointer-events: none; padding: 3px 8px; border-radius: 5px; letter-spacing: .02em; }
.note { position: absolute; left: calc(100% + 32px); top: 64px; width: 150px; font: 14px/1.35 var(--hand); color: var(--muted); transform: rotate(-4deg); }
.note svg { display: block; width: 44px; height: 30px; margin-top: 8px; stroke-width: 1.4; }

.profile { display: flex; gap: 18px; align-items: flex-end; padding: 0 24px; margin-top: -40px; position: relative; }
.avatar { width: 116px; height: 116px; border-radius: 22px; background: #fff; border: 1px solid var(--line); box-shadow: 0 0 0 4px var(--bg); display: grid; place-items: center; flex: none; overflow: hidden; }
.avatar-wrap { position: relative; flex: none; cursor: default; -webkit-tap-highlight-color: transparent; }
.avatar { transition: transform .25s cubic-bezier(.3,1.5,.5,1); }
.avatar-wrap.say .avatar { transform: rotate(-3deg); }
.bubble {
  position: absolute; left: calc(100% - 22px); bottom: calc(100% - 12px); z-index: 2;
  font: 16px/1 var(--hand); color: var(--fg); white-space: nowrap;
  background: var(--card); border: 1.5px solid var(--fg); border-radius: 12px; padding: 7px 11px 5px;
  opacity: 0; transform: scale(.5) translate(-6px, 10px); transform-origin: 0% 100%;
  transition: opacity .15s, transform .25s cubic-bezier(.3,1.6,.5,1); pointer-events: none;
}
.bubble::after {
  content: ""; position: absolute; left: 8px; bottom: -6px; width: 9px; height: 9px;
  background: var(--card); border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg);
  transform: rotate(45deg) skew(10deg, 10deg);
}
.avatar-wrap.say .bubble { opacity: 1; transform: none; }
/* longer answers: wraps, grows upward over the banner, slightly tilted like a note */
.bubble.long {
  white-space: normal; width: max-content; max-width: min(320px, calc(100vw - 120px));
  font-size: 16px; line-height: 1.35; padding: 9px 15px 8px; border-radius: 14px; min-height: 1.35em;
}
.avatar-wrap.say .bubble.long { transform: rotate(-1.5deg); }
.bubble .tcaret, .w-bubble .tcaret { display: inline-block; width: 1.5px; height: 1em; background: var(--fg); margin-left: 2px; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.avatar img, .avatar svg { display: block; width: 100%; height: 100%; }
/* the drawing keeps its own ink, whatever the theme (overrides the icon defaults above) */
#face { fill: none; stroke: #1a1a18; stroke-width: 2; color: #1a1a18; }
h1 { font: 400 40px/1.1 var(--serif); color: var(--fg); letter-spacing: -.01em; }
.name-btn { font: inherit; color: inherit; letter-spacing: inherit; text-align: left; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sub { font-size: 13px; color: var(--muted); min-height: 1.6em; margin-top: 4px; letter-spacing: .02em; }
.caret { display: inline-block; width: 7px; height: 14px; background: var(--muted); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.meta { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; padding: 24px 24px 0; font-size: 13px; color: var(--fg); }
.meta li { display: flex; align-items: center; gap: 10px; }
.meta svg { color: var(--muted); width: 14px; height: 14px; }
.meta .dim { margin-left: 8px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 20px 24px 0; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg); padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); transition: border-color .15s, transform .15s; }
.pill svg { width: 13px; height: 13px; color: var(--muted); }
.pill .ext { color: var(--muted); font-size: 11px; }
.pill:hover { border-color: var(--muted); transform: translateY(-1px); }
.pill:active { transform: translateY(0) scale(.98); }
button.pill { font-family: var(--sans); cursor: pointer; }
.pill[aria-expanded="true"] { background: var(--soft); border-color: var(--muted); }

/* "more about me" questions */
.ask { padding: 18px 24px 0; }
.ask[hidden] { display: none; }
.ask.open { animation: askIn .3s ease both; }
@keyframes askIn { from { opacity: 0; transform: translateY(-4px); } }
.ask-hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.questions { display: flex; flex-wrap: wrap; gap: 8px; }
.q {
  font: 13px/1.3 var(--sans); color: var(--text); background: transparent; cursor: pointer;
  border: 1px dashed var(--line); border-radius: 999px; padding: 7px 14px; text-align: left;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.q:hover { border-color: var(--muted); color: var(--fg); transform: translateY(-1px); }
.q:active { transform: scale(.97); }
.q[aria-pressed="true"] { border-style: solid; border-color: var(--fg); color: var(--fg); background: var(--card); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Sections ---------- */
section { scroll-margin-top: 56px; }
.head { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; padding-bottom: 10px; }
h2 { font: 400 28px/1.3 var(--serif); color: var(--fg); min-height: 1.3em; }
h2[data-type] { cursor: default; -webkit-tap-highlight-color: transparent; }
.count { font-size: 12px; color: var(--muted); }
.body { padding-top: 24px; padding-bottom: 28px; }
.body p + p { margin-top: 14px; }
.ul { color: var(--fg); border-bottom: 1px solid var(--line); transition: border-color .15s; }
.ul:hover { border-color: var(--fg); }

/* Projects */
.projects { list-style: none; padding: 8px 0; }
.projects li + li { border-top: 1px dotted var(--line); }
.projects a { display: grid; grid-template-columns: 10px 1fr auto; gap: 16px; align-items: baseline; padding: 16px 12px; margin: 0 -12px; border-radius: 10px; position: relative; transition: transform .45s cubic-bezier(.22,1,.36,1); }
.projects .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c); transform: translateY(1px); transition: transform .25s; }
.p-main { display: flex; flex-direction: column; }
.p-name { font: 400 22px/1.25 var(--serif); color: var(--fg); transition: color .15s; }
.p-desc { font-size: 14px; color: var(--muted); }
.p-url { font-size: 12px; color: var(--muted); white-space: nowrap; }
.p-url i { font-style: normal; display: inline-block; transition: transform .2s; }
.projects a:hover { transform: scale(1.025); z-index: 1; }
.projects a:active { transform: scale(1.01); transition-duration: .15s; }
.projects a:hover .p-name { color: var(--c); }
.projects a:hover .dot { transform: translateY(1px) rotate(45deg); }
.projects a:hover .p-url i { transform: translate(2px, -2px); }

/* Books */
.books { list-style: none; padding: 12px 0 16px; }
.books li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; }
.books li + li { border-top: 1px dotted var(--line); }
.b-title { font: italic 19px var(--serif); color: var(--fg); }
.b-author { font-size: 12px; color: var(--muted); text-align: right; }

/* Footer */
.foot { border-bottom: 0; }
.foot .col { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); padding-top: 18px; padding-bottom: 40px; }
.linkish { font-size: 12px; font-family: var(--mono); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) { .note { display: none; } }
@media (max-width: 640px) {
  .col { padding-left: 16px; padding-right: 16px; }
  .nav-links { gap: 14px; font-size: 13px; }
  .banner { height: 180px; }
  .profile { padding: 0 16px; gap: 12px; margin-top: -32px; flex-direction: column; align-items: flex-start; }
  .avatar { width: 84px; height: 84px; border-radius: 18px; }
  h1 { font-size: 31px; }
  .meta { grid-template-columns: 1fr; padding: 20px 16px 0; }
  .pills { padding: 18px 16px 0; }
  .ask { padding: 16px 16px 0; }
  .bubble.long { font-size: 14px; line-height: 1.3; padding: 8px 12px 7px; max-width: calc(100vw - 96px); }
  .projects a { grid-template-columns: 10px 1fr; margin: 0 -8px; padding: 14px 8px; }
  .p-url { display: none; }
  .books li { flex-direction: column; gap: 0; }
  .b-author { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Welcome screen (first visit only) ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 36px;
  background-color: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1.2px); background-size: 16px 16px;
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  transition: opacity .5s ease, transform .5s ease;
}
:root[data-welcomed] .welcome { display: none; }
:root:not([data-welcomed]) body:has(> #welcome) { overflow: hidden; }   /* only while the welcome screen is showing */
.welcome.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }
.w-stage { position: relative; padding: 70px 0 0; }
.w-avatar {
  width: 168px; height: 168px; border-radius: 32px; overflow: hidden; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 0 0 6px var(--bg), 0 18px 40px -24px rgba(0,0,0,.35);
  animation: wPop .6s cubic-bezier(.3,1.5,.5,1) both;
}
.w-avatar svg { display: block; width: 100%; height: 100%; fill: none; stroke: #1a1a18; stroke-width: 2; }
.w-bubble {
  position: absolute; left: calc(100% - 34px); bottom: calc(100% - 92px); z-index: 1;
  font: 22px/1.25 var(--hand); color: var(--fg); white-space: nowrap;
  background: var(--card); border: 1.5px solid var(--fg); border-radius: 16px; padding: 10px 16px 8px;
  transform-origin: 0% 100%; animation: wBubble .45s .45s cubic-bezier(.3,1.6,.5,1) both;
}
.w-bubble::after {
  content: ""; position: absolute; left: 12px; bottom: -8px; width: 12px; height: 12px;
  background: var(--card); border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg);
  transform: rotate(45deg) skew(10deg, 10deg);
}
.w-hint { font-size: 12px; color: var(--muted); letter-spacing: .04em; animation: wHint 2.4s 1.6s ease-in-out infinite both; }
.w-touch { display: none; }
@media (hover: none) { .w-mouse { display: none; } .w-touch { display: inline; } }
@keyframes wPop { from { opacity: 0; transform: scale(.85) translateY(10px); } }
@keyframes wBubble { from { opacity: 0; transform: scale(.4) translate(-10px, 14px) rotate(-6deg); } to { transform: rotate(-2deg); } }
@keyframes wHint { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (max-width: 640px) {
  .w-avatar { width: 128px; height: 128px; border-radius: 26px; }
  .w-bubble { font-size: 17px; left: -58px; bottom: calc(100% - 66px); white-space: nowrap; padding: 9px 14px 7px; }
  .w-bubble::after { left: auto; right: 34%; }
  .welcome { padding: 0 16px; }
}

/* ---------- "me" page: one plain, readable piece of writing ---------- */
.nav-links a.here { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.back { font-size: 12px; color: var(--muted); }
.back:hover { color: var(--fg); }
.prose { border-bottom: 0; }
.prose .col { padding-top: 32px; padding-bottom: 72px; }
.hey { font: italic 400 46px/1.1 var(--serif); color: var(--fg); margin: 28px 0 22px; min-height: 1.1em; }
.prose p { font: 17px/1.95 var(--sans); color: var(--text); max-width: 64ch; margin-bottom: 26px; }
.prose a.dot { color: var(--fg); border-bottom: 1px dashed var(--muted); transition: border-color .15s; }
.prose a.dot:hover { border-bottom-style: solid; border-color: var(--fg); }
/* quotes that fill in, word by word, from left to right as they scroll into view */
.fill { margin: 40px 0 40px; padding: 2px 0 2px 22px; border-left: 2px solid var(--line); font: italic 400 32px/1.35 var(--serif); color: var(--fg); max-width: 30ch; }
.fill .w { opacity: var(--o, .2); transition: opacity .12s linear; }
.sign { font: italic 400 24px/1 var(--serif) !important; color: var(--fg) !important; margin-top: 36px; }
@media (max-width: 640px) {
  .prose .col { padding-bottom: 56px; }
  .hey { font-size: 38px; }
  .prose p { font-size: 16px; line-height: 1.85; }
  .fill { font-size: 25px; padding-left: 16px; margin: 32px 0; }
}

/* ---------- terminal page ---------- */
.here-icon { color: var(--fg); }
.term-page { border-bottom: 0; }
.term-page .col { padding-top: 32px; padding-bottom: 64px; }
.term {
  margin-top: 24px; border-radius: 12px; overflow: hidden; background: #1c1c1e; color: #e5e5e7;
  border: 1px solid rgba(0,0,0,.35); box-shadow: 0 0 0 .5px rgba(255,255,255,.08) inset, 0 24px 60px -28px rgba(0,0,0,.55), 0 4px 14px -6px rgba(0,0,0,.25);
  font: 13.5px/1.6 "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: margin .35s ease, transform .35s ease;
}
.term.big { margin-left: calc((100vw - min(var(--w), 100vw)) / -2 + 16px); margin-right: calc((100vw - min(var(--w), 100vw)) / -2 + 16px); }
.term.min .term-body { display: none; }
.term-bar { position: relative; display: flex; align-items: center; height: 30px; padding: 0 12px; background: linear-gradient(#323234, #2a2a2c); border-bottom: 1px solid #111; }
.lights { display: flex; gap: 12px; position: relative; z-index: 1; }
.light { position: relative; width: 12px; height: 12px; border-radius: 50%; border: .5px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.light::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; } /* bigger tap area */
.light.red { background: #ff5f57; } .light.yellow { background: #febc2e; } .light.green { background: #28c840; }
.term-title { position: absolute; inset: 0; display: grid; place-items: center; font: 500 12px var(--sans); color: #a1a1a6; pointer-events: none; white-space: nowrap; }
.term-body { height: min(62vh, 520px); overflow-y: auto; padding: 10px 14px 14px; cursor: text; scrollbar-width: thin; scrollbar-color: #48484a transparent; }
.term.big .term-body { height: min(76vh, 760px); }
.term-line { display: block; white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.term-input-line { display: flex; gap: 8px; }
.prompt { white-space: nowrap; flex: none; }
.p-user { color: #63d471; } .p-path { color: #6ab0ff; }
#termIn { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: inherit; font: inherit; padding: 0; caret-color: #e5e5e7; }
.term .dim { color: #8e8e93; } .term .hl { color: #fff; font-weight: 500; } .term .err { color: #ff6b6b; }
.term .g { color: #63d471; } .term .b { color: #6ab0ff; } .term .y { color: #febc2e; } .term .m { color: #d58cff; }
.term a { color: #6ab0ff; text-decoration: underline; text-underline-offset: 3px; }
.term a:hover { color: #9ccaff; }
.term-tip { margin-top: 14px; font-size: 12px; color: var(--muted); }
.term-tip b { color: var(--fg); font-weight: 500; }
@media (hover: none) { .t-mouse { display: none; } }
@media (max-width: 640px) {
  .term { font-size: 12.5px; }
  .term-body { height: 64vh; padding: 8px 10px 12px; }
  .term-title { font-size: 11px; }
}
@media (max-width: 360px) { .t-long { display: none; } }

/* ---------- Volume card ---------- */
.vol-wrap { position: relative; display: inline-grid; }
.vol-wrap .icon-btn { margin-left: 0; }
.vol-card {
  position: absolute; top: calc(100% + 12px); right: -14px; z-index: 30; width: 214px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 10px;
  box-shadow: 0 18px 40px -22px rgba(0,0,0,.35), 0 2px 6px -2px rgba(0,0,0,.08);
  color: var(--fg); transform-origin: calc(100% - 26px) 0;
}
.vol-card::before {   /* little notch pointing at the speaker */
  content: ""; position: absolute; top: -6px; right: 22px; width: 10px; height: 10px; background: var(--card);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg);
}
.vol-card.in { animation: volIn .28s cubic-bezier(.3,1.5,.5,1); }
@keyframes volIn { from { opacity: 0; transform: translateY(-6px) scale(.94); } }
.vol-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.vol-label { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.vol-num { font: 18px/1 var(--hand); color: var(--fg); }
.vol-bars {
  display: flex; align-items: flex-end; justify-content: space-between; height: 46px; padding: 0 2px 4px; cursor: pointer;
  border-bottom: 1px dotted var(--line); touch-action: none; outline: none; border-radius: 4px;
}
.vol-bars:focus-visible { box-shadow: 0 0 0 2px var(--c2); }
.vol-bars i {
  display: block; width: 3px; height: var(--h); border-radius: 3px; background: var(--line);
  transform-origin: 50% 100%; transform: rotate(-4deg); transition: background .15s, transform .25s cubic-bezier(.3,1.6,.5,1);
}
.vol-bars i:nth-child(even) { transform: rotate(3deg); }
.vol-bars i.on { background: var(--fg); }
.vol-bars i.pop { animation: volPop .35s cubic-bezier(.3,1.7,.5,1); }
@keyframes volPop { 40% { transform: scaleY(1.18) rotate(0deg); } }
.vol-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.vol-mute { font-size: 11px; color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: transparent; cursor: pointer; }
.vol-mute:hover { border-color: var(--muted); }
.vol-hint { font-size: 10px; color: var(--muted); }
@media (hover: none) { .vol-hint { display: none; } }
@media (max-width: 640px) { .vol-card { right: -34px; transform-origin: calc(100% - 46px) 0; } .vol-card::before { right: 42px; } }

/* ---------- Project previews ---------- */
.peek {
  position: fixed; left: 0; top: 0; z-index: 40; width: 300px; padding: 6px 6px 10px; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 22px 46px -24px rgba(0,0,0,.45), 0 3px 10px -4px rgba(0,0,0,.12);
  opacity: 0; scale: .92; transition: opacity .18s ease, scale .28s cubic-bezier(.3,1.5,.5,1);
  will-change: transform;
}
.peek.on { opacity: 1; scale: 1; }
.peek-bar { display: flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; }
.peek-bar i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.peek-bar i:first-child { background: var(--c, var(--line)); }
.peek-url { margin-left: 6px; font: 10px var(--mono); color: var(--muted); }
.peek img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); background: var(--soft); }
.peek-cap { display: block; margin: 7px 4px 0; font: 16px/1 var(--hand); color: var(--fg); }
.p-thumb { display: none; }
@media (hover: none), (pointer: coarse) {
  .projects a { grid-template-columns: 10px 1fr 76px; align-items: center; }
  .p-url { display: none; }
  .p-thumb { display: block; grid-column: 3; grid-row: 1; width: 76px; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); background: var(--soft); transform: rotate(2deg); }
  .projects .dot { align-self: baseline; transform: translateY(6px); }
}
@media (prefers-reduced-motion: reduce) { .peek { transition: opacity .1s; } }

/* ---------- Sleepy avatar (11pm–6am in India) ---------- */
.zzz { position: absolute; left: calc(100% - 14px); top: -6px; pointer-events: none; display: none; font: 22px/1 var(--hand); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
:root[data-mood="sleepy"] .avatar-wrap:not(.say) .zzz { display: block; }
.zzz i { position: absolute; left: 0; bottom: 0; font-style: normal; opacity: 0; animation: zzz 3.6s ease-in infinite; }
.zzz i:nth-child(2) { animation-delay: 1.2s; font-size: 17px; }
.zzz i:nth-child(3) { animation-delay: 2.4s; font-size: 13px; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0) rotate(-8deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(26px, -34px) rotate(10deg); } }
@media (prefers-reduced-motion: reduce) { .zzz i { animation: none; opacity: 1; } .zzz i:nth-child(2) { transform: translate(10px,-12px); } .zzz i:nth-child(3) { transform: translate(20px,-24px); } }

/* ---------- 404 page ---------- */
.nf { border-bottom: 0; }
.nf .col { padding-top: 56px; padding-bottom: 72px; display: flex; flex-direction: column; align-items: center; }
.nf-stage { margin-bottom: 40px; }
.nf-term { width: 100%; max-width: 560px; margin-top: 0; }
.nf-term .term-body { height: auto; min-height: 240px; max-height: 50vh; cursor: text; }
.nf-term .err { color: #ff6b6b; }
.nf-links a { margin-right: 14px; }
.nf-cursor { display: inline-block; width: 8px; height: 15px; background: #e5e5e7; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@media (max-width: 640px) { .nf .col { padding-top: 40px; } }

/* confused 404 face: tilted head and floating question marks */
.confused .w-avatar { rotate: -4deg; }
.qq { position: absolute; left: 0; top: 70px; width: 168px; height: 168px; z-index: 2; pointer-events: none; font: 36px/1 var(--hand); color: var(--fg); }
.qq i { position: absolute; font-style: normal; opacity: 0; animation: qq 3.2s ease-out infinite; }
.qq i:nth-child(1) { left: -44px; top: 34px; }
.qq i:nth-child(2) { left: calc(100% + 14px); top: 78px; font-size: 30px; animation-delay: 1.05s; }
.qq i:nth-child(3) { left: -30px; top: -6px; font-size: 24px; animation-delay: 2.1s; }
@keyframes qq { 0% { opacity: 0; transform: translateY(8px) rotate(-12deg) scale(.7); } 20% { opacity: 1; } 60% { opacity: 1; transform: translateY(-14px) rotate(10deg) scale(1); } 100% { opacity: 0; transform: translateY(-30px) rotate(-6deg) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .qq i { animation: none; opacity: .8; } }
@media (max-width: 640px) { .qq { width: 128px; height: 128px; font-size: 30px; } .qq i:nth-child(1) { left: -38px; } .qq i:nth-child(2) { top: 60px; font-size: 26px; } }

/* ---------- Draggable avatar ---------- */
.avatar-wrap { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; will-change: transform; z-index: 3; }
.avatar-wrap.dragging { cursor: grabbing; z-index: 60; }
.avatar-wrap.dragging .avatar { box-shadow: 0 0 0 4px var(--bg), 0 26px 40px -18px rgba(0,0,0,.45); transform: scale(1.06); }
.avatar-wrap.dragging .zzz { display: none !important; }

/* ---------- Page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtOut .2s ease both; }
::view-transition-new(root) { animation: vtIn .32s cubic-bezier(.2,.8,.2,1) both; }
.nav { view-transition-name: site-nav; }     /* the top bar stays put while the page changes */
@keyframes vtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(8px); } }
:root.fade-in body { animation: vtIn .32s cubic-bezier(.2,.8,.2,1) both; }
:root.leaving body { opacity: 0; transform: translateY(-6px); transition: opacity .17s ease, transform .17s ease; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---------- GitHub activity (ink dots) ---------- */
.gh-only[hidden] { display: none; }
.gh { padding: 18px 0 22px; }
.gh-total { font: 20px/1.2 var(--hand); color: var(--fg); margin-bottom: 14px; min-height: 1.2em; }
.gh-total b { font-weight: 400; }
.gh-grid-wrap { position: relative; }
.gh-grid { display: block; width: 100%; height: auto; overflow: visible; stroke: none; }
.gh-grid circle { transition: r .15s; }
.gh-grid .l0 { fill: var(--line); opacity: .55; }
.gh-grid .l1 { fill: var(--fg); opacity: .22; }
.gh-grid .l2 { fill: var(--fg); opacity: .45; }
.gh-grid .l3 { fill: var(--fg); opacity: .7; }
.gh-grid .l4 { fill: var(--fg); opacity: .95; }
.gh-grid circle.on { r: 5.2; opacity: 1; }
.gh-grid .m { font: 9px var(--mono); fill: var(--muted); }
.gh-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; pointer-events: none;
  font-size: 11px; color: var(--bg); background: var(--fg); padding: 3px 8px; border-radius: 6px; }
.gh-tip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: var(--fg); transform: translateX(-50%) rotate(45deg); }
.gh-legend { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: 10px; font-size: 10px; color: var(--muted); }
.gh-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.gh-legend .l0 { background: var(--line); } .gh-legend .l1 { background: color-mix(in srgb, var(--fg) 22%, transparent); }
.gh-legend .l2 { background: color-mix(in srgb, var(--fg) 45%, transparent); } .gh-legend .l3 { background: color-mix(in srgb, var(--fg) 70%, transparent); }
.gh-legend .l4 { background: var(--fg); }
.gh-legend span:first-child { margin-right: 3px; } .gh-legend span:last-child { margin-left: 3px; }

/* ---------- Phone menu: text links fold into a card ---------- */
.menu-btn, .menu-card { display: none; }
@media (max-width: 640px) {
  .nav-links > a:not(.icon-btn) { display: none; }
  .menu-btn { display: inline-flex; align-items: center; gap: 7px; font: 13px var(--mono); color: var(--fg); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
  .menu-btn i { position: relative; width: 12px; height: 8px; display: inline-block; }
  .menu-btn i::before, .menu-btn i::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform .25s ease, top .25s ease; }
  .menu-btn i::before { top: 0; } .menu-btn i::after { top: 6.5px; }
  .menu-btn[aria-expanded="true"] i::before { top: 3.25px; transform: rotate(45deg); }
  .menu-btn[aria-expanded="true"] i::after { top: 3.25px; transform: rotate(-45deg); }
  .nav-inner { position: relative; }
  .menu-card {
    display: block; position: absolute; top: calc(100% + 8px); right: 12px; left: 12px; z-index: 30;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 8px;
    box-shadow: 0 22px 44px -22px rgba(0,0,0,.4), 0 2px 6px -2px rgba(0,0,0,.08);
    transform-origin: calc(100% - 40px) 0;
  }
  .menu-card[hidden] { display: none; }
  .menu-card.in { animation: volIn .28s cubic-bezier(.3,1.5,.5,1); }
  .menu-card a { display: flex; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--fg); }
  .menu-card a:active { background: var(--soft); }
  .menu-card a .mn { font: 11px var(--mono); color: var(--muted); width: 18px; }
  .menu-card a .mt { font: 400 24px/1.1 var(--serif); }
  .menu-card a .mh { margin-left: auto; font: 11px var(--mono); color: var(--muted); }
  .menu-card a[aria-current="page"] .mt { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
  .menu-card hr { border: 0; border-top: 1px dotted var(--line); margin: 4px 12px; }
}

/* ---------- "read the long version" ---------- */
.body .more { margin-top: 14px; font: 13px var(--mono); }

/* ---------- "tap for sound" hint (returning visitors, audio still blocked) ---------- */
.sound-hint {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translateX(-50%);
  font-size: 12px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; box-shadow: 0 10px 30px -14px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap;
  animation: shIn .4s cubic-bezier(.3,1.5,.5,1) both;
}
.sound-hint[hidden] { display: none; }
.sound-hint.out { animation: shOut .3s ease both; }
.sh-touch { display: none; }
@media (hover: none) { .sh-mouse { display: none; } .sh-touch { display: inline; } }
@keyframes shIn { from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.95); } }
@keyframes shOut { to { opacity: 0; transform: translateX(-50%) translateY(8px); } }
