/* ==========================================================================
   Nikhil Sinha — portfolio
   Bootstrap 5 handles grid + components. Everything below is hand-written:
   the palette, the ambient layers, the motion system and the card effects.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --bg:        #070a12;
  --bg-2:      #0b101c;
  --panel:     #101725;
  --panel-2:   #141d2e;
  --line:      #1e293f;
  --line-2:    #2a3550;

  --ink:       #e8eefc;
  --ink-2:     #a6b4d0;
  --ink-3:     #6b7a99;

  --brand:     #5b8cff;
  --brand-2:   #22d3ee;
  --accent:    #a78bfa;
  --good:      #34d399;
  --warn:      #fbbf24;
  --bad:       #fb7185;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;

  --shadow:    0 10px 40px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --nav-h: 68px;
}

:root[data-theme="light"] {
  --bg:      #f7f9fc;
  --bg-2:    #ffffff;
  --panel:   #ffffff;
  --panel-2: #f2f6fc;
  --line:    #dfe7f3;
  --line-2:  #c9d6ea;
  --ink:     #0c1626;
  --ink-2:   #43536e;
  --ink-3:   #7b8aa5;
  --brand:   #2f6bff;
  --brand-2: #0891b2;
  --accent:  #7c3aed;
  --shadow:    0 10px 40px -16px rgba(20, 40, 80, .18);
  --shadow-lg: 0 30px 70px -24px rgba(20, 40, 80, .22);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.022em; line-height: 1.15; }

code, .mono { font-family: var(--mono); font-size: .9em; }

::selection { background: color-mix(in srgb, var(--brand) 35%, transparent); color: #fff; }

/* Bootstrap container width tuned to the design */
.wrap { width: min(1180px, 92vw); margin-inline: auto; }

/* --------------------------------------------------------- ambient layers */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .grain { opacity: .05; }

/* GPU flowing-gradient backdrop (WebGL). Sits at the very back; the grain and
   mesh layer over it. Resolution-independent, so crisp at any size, and it
   fades to the page background in the centre to keep text readable. If WebGL
   is unavailable the canvas is removed and the CSS mesh below carries the look. */
.bg-flow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; display: block;
  width: 100%; height: 100%; opacity: .78;
}
:root[data-theme="light"] .bg-flow { opacity: .5; }

/* slow animated mesh gradient */
.mesh {
  position: fixed; inset: -30vh -20vw; z-index: 0; pointer-events: none;
  filter: blur(90px); opacity: .5;
}
.mesh span {
  position: absolute; display: block; border-radius: 50%;
  animation: drift 26s var(--ease) infinite alternate;
}
.mesh span:nth-child(1) { width: 46vw; height: 46vw; left: 2%;  top: 6%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 55%, transparent), transparent 68%); }
.mesh span:nth-child(2) { width: 40vw; height: 40vw; right: 4%; top: 18%; animation-delay: -8s;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 50%, transparent), transparent 68%); }
.mesh span:nth-child(3) { width: 38vw; height: 38vw; left: 32%; bottom: 2%; animation-delay: -16s;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-2) 45%, transparent), transparent 68%); }
:root[data-theme="light"] .mesh { opacity: .28; }

@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(4vw,-3vh,0) scale(1.12); }
  100% { transform: translate3d(-3vw,4vh,0) scale(.95); }
}

/* cursor spotlight — desktop only */
.spot {
  position: fixed; z-index: 1; pointer-events: none; width: 480px; height: 480px;
  border-radius: 50%; opacity: 0; transition: opacity .5s var(--ease);
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 12%, transparent), transparent 62%);
  transform: translate(-50%, -50%);
}
body.has-pointer .spot { opacity: 1; }

/* scroll progress */
.scroll-bar {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 60; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--brand-2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 60%, transparent);
}

main, .site-nav, .site-footer { position: relative; z-index: 2; }

/* ------------------------------------------------------------------- nav */
.site-nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-nav.scrolled { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; font-size: .82rem; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--brand) 70%, transparent);
}

.nav-link-x {
  position: relative; color: var(--ink-2); font-weight: 500; font-size: .95rem;
  padding: .35rem 0; transition: color .2s;
}
.nav-link-x::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width .28s var(--ease);
}
.nav-link-x:hover, .nav-link-x.active { color: var(--ink); }
.nav-link-x:hover::after, .nav-link-x.active::after { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-2); cursor: pointer; transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); transform: translateY(-1px); }

/* ---------------------------------------------------------------- buttons */
.btn-x {
  --btn-bg: var(--panel);
  --btn-fg: var(--ink);
  position: relative; display: inline-flex; align-items: center; gap: .55rem;
  padding: .72rem 1.25rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: .94rem; cursor: pointer; overflow: hidden;
  transition: transform .18s var(--ease), border-color .2s, box-shadow .25s;
}
.btn-x:hover { color: var(--btn-fg); transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn-x:active { transform: translateY(0); }

.btn-x.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--brand) 80%, transparent);
}
.btn-x.primary:hover { color: #fff; box-shadow: 0 16px 40px -12px color-mix(in srgb, var(--brand) 85%, transparent); }

.btn-x.run {
  border-color: transparent; color: #04140d;
  background: linear-gradient(135deg, var(--good), #10b981);
  box-shadow: 0 10px 30px -12px rgba(52, 211, 153, .6);
}
.btn-x.run:hover { color: #04140d; }

/* shine sweep */
.btn-x::before {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
}
.btn-x:hover::before { animation: shine .75s var(--ease); }
@keyframes shine { to { transform: translateX(120%); } }

/* ------------------------------------------------------------------ hero */
.hero { padding: clamp(4rem, 11vw, 8rem) 0 clamp(3rem, 7vw, 5rem); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .38rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 70%, transparent);
  color: var(--ink-2); font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.pin { width: 7px; height: 7px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 70%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-name {
  margin: 1.1rem 0 .3rem; font-size: clamp(2.9rem, 8.5vw, 5.4rem); font-weight: 800;
  letter-spacing: -.045em; line-height: 1;
  background: linear-gradient(115deg, var(--ink) 8%, var(--brand) 42%, var(--accent) 64%, var(--ink) 96%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: 220% 0; } }

.hero-role {
  font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.3rem);
  color: var(--brand-2); min-height: 1.7em; font-weight: 500;
}
.caret { display: inline-block; width: 2px; height: 1.05em; vertical-align: -.16em;
  background: var(--brand-2); margin-left: 3px; animation: blink 1.05s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-pitch { max-width: 62ch; color: var(--ink-2); font-size: 1.06rem; margin-top: 1.4rem; }
.hero-pitch em { color: var(--ink); font-style: normal; font-weight: 600; }

/* ----------------------------------------------------------------- stats */
.stat {
  padding: 1.15rem 1.25rem; border-radius: var(--r);
  border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 60%, transparent);
  backdrop-filter: blur(10px); height: 100%;
  transition: transform .25s var(--ease), border-color .25s;
}
.stat:hover { transform: translateY(-4px); border-color: var(--line-2); }
.stat-v { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--ink), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-k { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }

/* -------------------------------------------------------------- sections */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section.alt { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg-2) 55%, transparent), transparent); }

.kicker { font-family: var(--mono); font-size: .8rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--brand-2); font-weight: 600; }
.section h2 { font-size: clamp(1.7rem, 4.4vw, 2.6rem); margin: .55rem 0 .8rem; }
.sec-sub { color: var(--ink-2); max-width: 68ch; }

/* ----------------------------------------------------------------- cards */
.card-x {
  position: relative; height: 100%; padding: 1.5rem;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(12px);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
  overflow: hidden;
}
.card-x::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%),
              color-mix(in srgb, var(--brand) 12%, transparent), transparent 42%);
  pointer-events: none;
}
.card-x:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.card-x:hover::after { opacity: 1; }

/* 3D tilt wrapper */
.tilt { transform-style: preserve-3d; will-change: transform; }

.num-badge {
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  color: var(--brand-2); letter-spacing: .12em;
}

/* project card */
.pcard { display: block; color: inherit; cursor: pointer; }
.pcard:hover { color: inherit; }
.pcard-title { font-size: 1.12rem; font-weight: 700; margin: .5rem 0 .45rem; }
.pcard-pitch { color: var(--ink-2); font-size: .92rem; min-height: 3.1em; }

.chip {
  display: inline-block; padding: .24rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--panel-2) 80%, transparent);
  color: var(--ink-2); font-size: .74rem; font-weight: 600; margin: .18rem .18rem 0 0;
  transition: all .2s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--brand); transform: translateY(-1px); }
.chip.role { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }

.metric-row {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: .5rem 0; border-bottom: 1px dashed var(--line);
}
.metric-row:last-child { border-bottom: 0; }
.metric-k { color: var(--ink-2); font-size: .88rem; }
.metric-v { font-family: var(--mono); font-weight: 700; font-size: .95rem; text-align: right; }
.metric-v.hi { color: var(--good); }

/* filters */
.fbtn {
  padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 60%, transparent); color: var(--ink-2);
  font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .2s var(--ease);
}
.fbtn:hover { color: var(--ink); transform: translateY(-1px); }
.fbtn.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--accent)); }

.search-x {
  width: 100%; padding: .72rem 1rem .72rem 2.6rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-family: var(--sans); font-size: .94rem; transition: border-color .2s, box-shadow .2s;
}
.search-x:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; }

/* --------------------------------------------------------- run / terminal */
.term {
  border-radius: var(--r); border: 1px solid var(--line); overflow: hidden;
  background: #060910; font-family: var(--mono); font-size: .84rem;
}
:root[data-theme="light"] .term { background: #0b1020; }
.term-bar {
  display: flex; align-items: center; gap: .45rem; padding: .6rem .9rem;
  background: color-mix(in srgb, #0b1220 90%, transparent); border-bottom: 1px solid var(--line);
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; }
.term-title { margin-left: .5rem; color: #7c8aa8; font-size: .78rem; }
.term-body { padding: 1rem 1.1rem; max-height: 460px; overflow: auto; color: #cfe0ff; }
.term-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: inherit; }
.term-body .c-dim { color: #6b7a99; }
.term-body .c-ok  { color: #34d399; }
.term-body .c-warn{ color: #fbbf24; }
.term-body .c-key { color: #7dd3fc; }
.term-body::-webkit-scrollbar { width: 9px; }
.term-body::-webkit-scrollbar-thumb { background: #22304d; border-radius: 9px; }

/* ---------------------------------------------------------------- books */
.book {
  display: block; height: 100%; padding: 1.35rem; color: inherit;
  border-radius: var(--r); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  position: relative; overflow: hidden;
  transition: transform .28s var(--ease), border-color .28s, box-shadow .28s;
}
.book:hover { color: inherit; transform: translateY(-5px); border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.book-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--brand), var(--accent)); }
.book.soon { opacity: .55; }
.book-t { font-weight: 700; font-size: .98rem; margin-bottom: .3rem; }
.book-m { color: var(--ink-3); font-size: .8rem; font-family: var(--mono); }
.book-cta { margin-top: .8rem; color: var(--brand); font-size: .86rem; font-weight: 600; }

/* --------------------------------------------------------------- reveal */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.in { opacity: 1; transform: none;
  transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.d1.in { transition-delay: .07s; }
.reveal.d2.in { transition-delay: .14s; }
.reveal.d3.in { transition-delay: .21s; }
.reveal.d4.in { transition-delay: .28s; }

/* --------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; color: var(--ink-3); font-size: .9rem; }

/* --------------------------------------------------------------- charts */
.chart-box { border-radius: var(--r); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 60%, transparent); padding: .5rem; }

/* -------------------------------------------------------------- utility */
.text-ink   { color: var(--ink) !important; }
.text-ink-2 { color: var(--ink-2) !important; }
.text-ink-3 { color: var(--ink-3) !important; }
.text-grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }

.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: .5rem; width: max-content; animation: slide 42s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }

/* --------------------------------------------------------- accessibility */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .mesh span, .hero-name, .marquee-track, .pin, .caret { animation: none !important; }
  * { transition-duration: .01ms !important; }
}

@media (max-width: 767.98px) {
  .spot { display: none; }
  .hero { padding-top: 3rem; }
  .card-x { padding: 1.2rem; }
}

/* ------------------------------------------------- tabs (project view) */
.tabbar { display: flex; gap: .25rem; border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabx { appearance: none; background: none; border: 0; color: var(--ink-3);
  font: inherit; font-weight: 600; font-size: .95rem; padding: .6rem .95rem;
  cursor: pointer; position: relative; border-radius: 8px 8px 0 0;
  transition: color .2s, background .2s; }
.tabx:hover { color: var(--ink); background: color-mix(in srgb, var(--brand) 7%, transparent); }
.tabx.active { color: var(--ink); }
.tabx.active::after { content: ""; position: absolute; left: .6rem; right: .6rem;
  bottom: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent)); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: tabin .4s var(--ease); }
@keyframes tabin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------- terminal replay (run tab) */
.run-head { display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-start; gap: 1rem; }
.run-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.term-badge { margin-left: .5rem; font-size: .66rem; font-family: var(--mono);
  color: #9fb0d0; border: 1px solid #22304d; border-radius: 999px; padding: .06rem .5rem; }
.term-ctl { margin-left: auto; display: flex; gap: .4rem; }
.term-run, .term-skip { appearance: none; font: inherit; font-size: .74rem;
  font-weight: 700; border-radius: 7px; padding: .26rem .7rem; cursor: pointer;
  border: 1px solid #2b3a5c; background: #132037; color: #cfe0ff; transition: .2s; }
.term-run:hover { border-color: var(--brand); color: #fff; }
.term-run:disabled { opacity: .5; cursor: default; }
.term-skip { background: transparent; color: #9fb0d0; }
.term-lines { font: inherit; color: #cfe0ff; }
.tl { white-space: pre; line-height: 1.5; min-height: 1.25em; }
.tl.hint { color: #6b7a99; white-space: normal; }
.tl.done { color: #34d399; margin-top: .45rem; white-space: normal; font-weight: 600; }
.tl .c-cmd { color: #eaf1ff; }
.term-cursor { display: inline-block; width: .55em; height: 1.05em; vertical-align: -2px;
  background: var(--brand-2); margin-left: 1px; animation: blink 1.05s steps(2) infinite; }

/* "Run on this machine" row — shown only when the local runner is detected */
.runner-row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  margin-top: .85rem; padding: .7rem .9rem; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--good) 40%, var(--line));
  background: color-mix(in srgb, var(--good) 9%, transparent); }
.runner-chk { display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; color: var(--ink-2); cursor: pointer; }
.runner-note { font-size: .72rem; color: var(--good); margin-left: auto; }

/* ------------------------------------------------------ ⌘K command palette */
.cmdk { position: fixed; inset: 0; z-index: 120; display: flex;
  align-items: flex-start; justify-content: center; }
.cmdk[hidden] { display: none; }
.cmdk-backdrop { position: absolute; inset: 0;
  background: color-mix(in srgb, #05070e 72%, transparent);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: cmdkfade .2s var(--ease); }
.cmdk-panel { position: relative; margin-top: 11vh; width: min(640px, 92vw);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: cmdkpop .22s var(--ease); }
@keyframes cmdkfade { from { opacity: 0; } }
@keyframes cmdkpop { from { opacity: 0; transform: translateY(-10px) scale(.985); } }
.cmdk-input-row { display: flex; align-items: center; gap: .6rem;
  padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.cmdk-input { flex: 1; background: none; border: 0; outline: none;
  color: var(--ink); font: inherit; font-size: 1.05rem; }
.cmdk-input::placeholder { color: var(--ink-3); }
.cmdk-esc { font-family: var(--mono); font-size: .68rem; color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 6px; padding: .1rem .4rem; }
.cmdk-list { max-height: 54vh; overflow: auto; padding: .4rem; }
.cmdk-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem;
  border-radius: 10px; cursor: pointer; }
.cmdk-item.active { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.cmdk-type { font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .08em; padding: .18rem .45rem; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-3); flex: none; width: 66px; text-align: center; }
.cmdk-type.t-project { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.cmdk-type.t-book { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cmdk-type.t-area { color: var(--brand-2); border-color: color-mix(in srgb, var(--brand-2) 45%, var(--line)); }
.cmdk-type.t-action { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; }
.cmdk-label { color: var(--ink); font-weight: 600; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-sub { color: var(--ink-3); font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-ext { margin-left: auto; color: var(--ink-3); }
.cmdk-empty { padding: 1.4rem; text-align: center; color: var(--ink-3); }
.cmdk-foot { display: flex; gap: 1rem; align-items: center; padding: .55rem 1rem;
  border-top: 1px solid var(--line); color: var(--ink-3); font-size: .74rem; }
.cmdk-foot kbd { font-family: var(--mono); font-size: .7rem; border: 1px solid var(--line-2);
  border-radius: 5px; padding: 0 .3rem; margin: 0 .05rem; }
.cmdk-foot .ms-auto { margin-left: auto; }
body.cmdk-open { overflow: hidden; }

/* -------------------------------------------------- location pill + clock */
.loc-pill { display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem;
  background: color-mix(in srgb, var(--panel) 60%, transparent); font-size: .82rem; }
.loc-city { font-weight: 600; }
.loc-sep { opacity: .5; margin: 0 .12rem; }
.loc-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.loc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent);
  animation: locpulse 2.4s infinite; }
@keyframes locpulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ------------------------------------------------- hero: avatar + availability */
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
@media (min-width: 992px) { .hero-grid { grid-template-columns: 1.55fr .95fr; gap: 3rem; } }
.hero-side { display: flex; flex-direction: column; align-items: center; gap: 1.3rem; }
.hero-avatar-wrap { display: flex; justify-content: center; }

.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex: none; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--accent)); }
.avatar-ini { font-family: var(--sans); letter-spacing: .02em; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-xl { width: clamp(150px, 22vw, 220px); height: clamp(150px, 22vw, 220px); font-size: 3.2rem;
  border: 3px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  box-shadow: 0 24px 70px -20px color-mix(in srgb, var(--brand) 60%, transparent); }
.avatar-lg { width: 112px; height: 112px; font-size: 2.1rem;
  border: 2px solid color-mix(in srgb, var(--brand) 30%, var(--line)); }

.avail-card { width: 100%; max-width: 350px; padding: 1.1rem 1.2rem; border-radius: var(--r);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--panel) 78%, transparent); }
.avail-head { display: flex; align-items: center; gap: .5rem; font-weight: 700;
  color: var(--ink); font-size: .95rem; }
.avail-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: locpulse 2.4s infinite; }
.avail-headline { color: var(--brand-2); font-size: .9rem; margin-top: .4rem; font-weight: 600; }
.avail-line { color: var(--ink-2); font-size: .85rem; margin-top: .3rem; }
.avail-points { margin: .65rem 0 0; padding-left: 1.1rem; color: var(--ink-2); font-size: .82rem; }
.avail-points li { margin-bottom: .22rem; }

.cmdk-trigger-inline { display: inline-flex; align-items: center; gap: .15rem; }
.cmdk-trigger-inline kbd { font-family: var(--mono); font-size: .72rem;
  border: 1px solid var(--line-2); border-radius: 5px; padding: 0 .32rem; }

/* ----------------------------------------------------------------- timeline */
.timeline { position: relative; margin: 1rem 0 0; padding-left: 1.7rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: .4rem; bottom: .4rem;
  width: 2px; background: linear-gradient(180deg, var(--brand), var(--accent), transparent); }
.tl-item { position: relative; padding-bottom: 1.7rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1.7rem + 1px); top: .3rem;
  width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.tl-year { font-family: var(--mono); font-size: .75rem; color: var(--brand-2); letter-spacing: .05em; }
.tl-title { font-weight: 700; margin: .15rem 0 .1rem; }
.tl-place { color: var(--ink-3); font-size: .82rem; margin-bottom: .4rem; }
.tl-body { color: var(--ink-2); font-size: .9rem; margin: 0; }

/* ------------------------------------------------------------- about intro */
.about-intro { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.about-intro .avatar-lg { flex: none; }

/* --------------------------------------------- explore: constellation + tour */
#explore { position: relative; }
.tour-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 .4rem; }
.tour-pill { appearance: none; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  color: var(--ink-2); background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid var(--line-2); border-radius: 999px; padding: .42rem .9rem; transition: .2s; }
.tour-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  margin-right: .45rem; vertical-align: middle; background: var(--c, var(--ink-3)); }
.tour-pill.all { --c: var(--ink-3); }
.tour-pill.r0 { --c: var(--brand); } .tour-pill.r1 { --c: var(--brand-2); }
.tour-pill.r2 { --c: var(--accent); } .tour-pill.r3 { --c: var(--good); } .tour-pill.r4 { --c: var(--warn); }
.tour-pill:hover { color: var(--ink); border-color: var(--brand); transform: translateY(-1px); }
.tour-pill.active { color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--accent)); }
.tour-pill.active::before { background: #fff; }
.tour-intro { color: var(--ink-2); font-size: 1.02rem; max-width: 72ch; min-height: 3em; margin: .4rem 0 1rem; }

.constellation-wrap { position: relative; border-radius: var(--r); border: 1px solid var(--line);
  background: radial-gradient(60% 70% at 50% 45%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%),
              color-mix(in srgb, var(--panel) 42%, transparent); overflow: hidden; }
.cst-svg { width: 100%; height: auto; display: block; }
.cst-edge { stroke-width: 1; opacity: .13; transition: opacity .3s; }
.cst-svg.sel .cst-edge { opacity: .035; }
.cst-svg.sel .cst-edge.on { opacity: .5; }
.cst-node { cursor: pointer; transition: opacity .3s; stroke: var(--bg); stroke-width: 1.5; }
.cst-node:hover { stroke: var(--ink); stroke-width: 2; }
.cst-svg.sel .cst-node { opacity: .15; }
.cst-svg.sel .cst-node.on { opacity: 1; }
.cst-hub { cursor: pointer; transition: opacity .3s; }
.cst-hub circle { stroke: var(--bg); stroke-width: 2; }
.cst-hub text { font-family: var(--mono); font-size: 12px; font-weight: 700; fill: #0a1020; pointer-events: none; }
.cst-svg.sel .cst-hub { opacity: .35; }
.cst-svg.sel .cst-hub.on { opacity: 1; }
.cst-hub:focus-visible circle { stroke: var(--ink); stroke-width: 3; }
.cst-edge.r0 { stroke: var(--brand); } .cst-edge.r1 { stroke: var(--brand-2); }
.cst-edge.r2 { stroke: var(--accent); } .cst-edge.r3 { stroke: var(--good); } .cst-edge.r4 { stroke: var(--warn); }
.cst-node.r0 { fill: var(--brand); } .cst-node.r1 { fill: var(--brand-2); }
.cst-node.r2 { fill: var(--accent); } .cst-node.r3 { fill: var(--good); } .cst-node.r4 { fill: var(--warn); }
.cst-hub.r0 circle { fill: var(--brand); } .cst-hub.r1 circle { fill: var(--brand-2); }
.cst-hub.r2 circle { fill: var(--accent); } .cst-hub.r3 circle { fill: var(--good); } .cst-hub.r4 circle { fill: var(--warn); }
.cst-tip { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -145%);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: .3rem .6rem;
  font-size: .8rem; color: var(--ink); white-space: nowrap; box-shadow: var(--shadow); }
