/* ==========================================================================
   xiaoci.dev — design system v7
   Clean white canvas, one indigo accent, top-to-bottom reading flow.
   Personal intro first, then sections; the AI models/agents scroll in two
   full-bleed rows.

   Icons are CSS masks (not <img>): an <img>-loaded SVG resolves currentColor
   inside its own document, which renders near-black brand marks invisible on
   the dark theme.  A mask paints with background-color instead.
   ========================================================================== */

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --bg:        #ffffff;
  --bg-soft:   #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #f6f7f9;
  --line:      rgba(16, 20, 30, .11);
  --line-soft: rgba(16, 20, 30, .06);
  --line-hard: rgba(16, 20, 30, .24);
  --text:      #0e1017;
  --text-2:    #3c424f;
  --muted:     #626a7a;
  --dim:       #686d79;
  --accent:    #3a5ce4;
  --accent-2:  #2b48c9;
  --accent-ink:#ffffff;
  --accent-bg: #eef1fe;
  --ok:        #17a05e;
  --dot:       rgba(16, 20, 40, .10);
  --glow:      rgba(58, 92, 228, .16);
  --ok-soft:   rgba(23, 160, 94, .15);
  --ok-ring:   rgba(23, 160, 94, .18);
  --glass:     rgba(255, 255, 255, .86);
  --light-core: rgba(58, 92, 228, .10);
  --sh-1: 0 1px 2px rgba(16, 20, 40, .04);
  --sh-2: 0 2px 8px -4px rgba(16, 20, 40, .25);
  --sh-3: 0 16px 36px -28px rgba(16, 20, 40, .5);
  --sh-4: 0 20px 42px -30px rgba(16, 20, 40, .5);
  --sh-5: 0 22px 48px -24px rgba(16, 20, 40, .55);
  --sh-6: 0 30px 70px -24px rgba(16, 20, 40, .5);
  /* Cards that don't run the full column all share this width so their right
     edges line up down the page. */
  --module: 680px;
  /* Six-step type scale. Was 17 sizes, many 0.5px apart. */
  --fs-micro: 11px;    /* mono labels, kbd, counts */
  --fs-small: 12.5px;  /* badges, terminal, notes */
  --fs-ui:    13.5px;  /* nav, chips, hosts, body-small */
  --fs-body:  15px;    /* paragraphs */
  --fs-lead:  16.5px;  /* emphasised body */
  --field-ink:    16, 20, 40;
  --field-accent: 58, 92, 228;

  --page: 900px;
  --gut: clamp(18px, 4vw, 40px);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 18px;

  --ease: cubic-bezier(.22, .68, .28, 1);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #0b0d12;
  --bg-soft:   #101319;
  --surface:   #14171e;
  --surface-2: #191d25;
  --line:      rgba(232, 238, 250, .12);
  --line-soft: rgba(232, 238, 250, .07);
  --line-hard: rgba(232, 238, 250, .26);
  --text:      #eef1f7;
  --text-2:    #c3cad6;
  --muted:     #98a0b0;
  --dim:       #80899c;
  --accent:    #7b93ff;
  --accent-2:  #9aadff;
  --accent-ink:#0a0e1c;
  --accent-bg: #1a2033;
  --ok:        #35c37d;
  --dot:       rgba(232, 238, 250, .09);
  --glow:      rgba(123, 147, 255, .18);
  --ok-soft:   rgba(53, 195, 125, .16);
  --ok-ring:   rgba(53, 195, 125, .20);
  --glass:     rgba(11, 13, 18, .86);
  --light-core: rgba(123, 147, 255, .13);
  /* On a near-black page a navy shadow is invisible, so cards lose all sense of
     elevation. Dark theme gets deeper, cooler-black shadows plus a faint top
     highlight, which is what actually reads as "lifted" on dark surfaces. */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .55);
  --sh-2: 0 2px 10px -4px rgba(0, 0, 0, .7);
  --sh-3: 0 16px 36px -26px rgba(0, 0, 0, .85);
  --sh-4: 0 22px 46px -28px rgba(0, 0, 0, .9);
  --sh-5: 0 24px 52px -24px rgba(0, 0, 0, .92);
  --sh-6: 0 34px 76px -22px rgba(0, 0, 0, .95);
  --field-ink:    232, 238, 250;
  --field-accent: 123, 147, 255;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  /* Reserve the scrollbar track so locking the page doesn't shift the layout. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
/* `html { overflow-x: clip }` makes the root's overflow non-visible, so the
   viewport takes its scrolling behaviour from <html> — a plain
   `body { overflow: hidden }` does nothing. Both must be locked. */
html.locked,
body.locked { overflow: hidden; }
/* `overflow: hidden` on the root stops the document from being a scroll
   container, which makes `position: sticky` on the bar resolve against the
   initial containing block instead — the bar jumps back to its document
   position (above the viewport) and vanishes. Pin it while anything is open. */
html.locked .bar {
  position: fixed;
  top: 0; left: 0; right: 0;
}

img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol, h1, h2, h3, p, dl, dd, dt, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
b, strong { font-weight: 620; }

kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 3px 5px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--dim);
}

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--dim); }

/* Inline accent link inside body copy. */
.link {
  color: var(--text);
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 1px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.link:hover { color: var(--accent); }

/* Green presence dot used by the status strip. */
.live {
  display: inline-block; flex: 0 0 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-ring);
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 300;
  padding: 9px 13px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  font-size: 13.5px; font-weight: 600;
  transform: translateY(-220%); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: none; }

.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 200; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }

/* ── cover (full-screen opening) ────────────────────────────────────────── */
.cover {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;              /* fallback */
  min-height: 100svh;             /* avoids the mobile URL-bar jump */
  padding: 92px var(--gut) 104px;
  overflow: hidden;
}
.cover-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  /* A radial mask was tried here to focus attention, but it only exposed the
     longer, straighter runs at the edges and read as scratches. Fading the
     whole layer is what actually keeps it as texture. */
  /* .68 since the depth pass: far particles now sit at ~0.42 alpha, so the
     layer needs a slightly higher ceiling for near trails to still pop. */
  opacity: .68;
  /* Fade the field in with the cover instead of popping it in. `backwards`
     only — never `both`: a both-filled animation keeps overriding opacity
     after it ends, the trap documented in the README's animation section. */
  animation: fieldIn 1.1s var(--ease) .15s backwards;
}
@keyframes fieldIn { from { opacity: 0; } }

/* Soft drifting gradient mesh. This carries the "premium" weight — large,
   low-saturation colour fields that move slowly — while the canvas supplies
   fine detail and the pointer interaction. Pure CSS, so it costs no JS. */
/* Soft light that follows the pointer. Transform-only so it stays on the
   compositor; no layout work per frame. */
.cover-light {
  position: absolute; left: 0; top: 0;
  width: 460px; height: 460px;
  margin: -230px 0 0 -230px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(closest-side, var(--light-core), transparent 100%);
  transition: opacity .45s var(--ease);
  will-change: transform, opacity;
}
.cover:hover .cover-light { opacity: 1; }
@media (hover: none) { .cover-light { display: none; } }

.cover-glow {
  position: absolute; inset: -18%;
  pointer-events: none;
  background:
    radial-gradient(38% 42% at 30% 30%, rgba(58, 92, 228, .13), transparent 62%),
    radial-gradient(34% 38% at 73% 64%, rgba(124, 92, 214, .10), transparent 65%),
    radial-gradient(30% 34% at 54% 20%, rgba(86, 176, 214, .09), transparent 68%);
  animation: drift 30s var(--ease) infinite alternate;
  will-change: transform;
}
/* Dark theme gets a brighter, cooler bloom — the same three fields, lifted so
   they still read against a near-black page. (This used to sit behind a
   mis-scoped selector, so the dark gradient applied to the light theme too.) */
[data-theme="dark"] .cover-glow {
  background:
    radial-gradient(38% 42% at 30% 30%, rgba(123, 147, 255, .16), transparent 62%),
    radial-gradient(34% 38% at 73% 64%, rgba(158, 124, 255, .12), transparent 65%),
    radial-gradient(30% 34% at 54% 20%, rgba(96, 190, 230, .10), transparent 68%);
}
@keyframes drift {
  from { transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 2%, 0) scale(1.07); }
}
@media (prefers-reduced-motion: reduce) {
  .cover-glow { animation: none; }
  /* Calm visitors get one painted frame; no entrance animation for it. */
  .cover-canvas { animation: none; }
}
/* Static fallback texture. Shown when the flow field is unavailable: JS off,
   canvas unsupported, or a machine so slow that `cover-field.js` switched
   itself off via .field-off. (Touch devices used to land here too; the field
   now runs on phones at a cheaper tier instead.) */
@media (hover: none) {
  .cover {
    background-image: radial-gradient(var(--dot) 1.3px, transparent 1.3px);
    background-size: 24px 24px;
  }
}
.cover.field-off {
  background-image: radial-gradient(var(--dot) 1.3px, transparent 1.3px);
  background-size: 24px 24px;
}
/* The field (live loop or the one-shot static paint) is running: the dot grid
   would only show through the transparent canvas and read as noise. */
.cover.field-on { background-image: none; }
/* soft accent bloom behind the avatar */
.cover::before {
  content: ""; position: absolute; top: 8%; left: 50%;
  width: min(600px, 92vw); aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
}

.cover-tools {
  position: absolute; top: 20px; right: var(--gut);
  display: flex; gap: 8px; z-index: 2;
}
.cbtn {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted);
  box-shadow: var(--sh-2);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.cbtn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.cbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.cover-main {
  position: relative; z-index: 1;
  display: grid; justify-items: center; text-align: center;
  /* --px/--py come from the pointer (cover-field.js); --sy/--sfade come from
     scroll position (main.js). They compose so both effects can run at once. */
  transform: translate3d(var(--px, 0px), calc(var(--py, 0px) + var(--sy, 0px)), 0);
  opacity: var(--sfade, 1);
  transition: transform .35s var(--ease), opacity .2s linear;
  will-change: transform, opacity;
}
/* The scroll hint leaves first so it never sits over a half-faded cover. */
.cover-down { opacity: calc(var(--sfade, 1) * var(--sfade, 1)); }
/* Reduced motion: no scroll-linked movement, just keep everything visible. */
@media (prefers-reduced-motion: reduce) {
  .cover-main { transform: none; opacity: 1; }
  .cover-down { opacity: 1; }
}

.cover-avatar-wrap {
  position: relative;
  display: grid; place-items: center;
  margin-bottom: 26px;
  /* Parallax (--ax/--ay, written by cover-field.js) and dragging
     (--dx/--dy/--drot, written by the avatar drag handler) compose here so the
     ring travels with the picture. */
  transform: translate3d(calc(var(--ax, 0px) + var(--dx, 0px)),
                         calc(var(--ay, 0px) + var(--dy, 0px)), 0)
             rotate(var(--drot, 0deg));
  transition: transform .4s var(--ease);
  will-change: transform;
  touch-action: none;
}
/* While dragging, follow the pointer with no easing delay. */
.cover-avatar-wrap.is-dragging { transition: none; cursor: grabbing; }

.cover-avatar-wrap::after {
  content: ""; position: absolute; inset: -9px;
  border-radius: 50%;
  border: 1px solid var(--line);
  /* Decorative only — without this the ring covers the avatar and swallows
     clicks, so the easter egg never fires for real users. */
  pointer-events: none;
}
.cover-avatar {
  width: clamp(104px, 13vw, 142px); height: auto;
  aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--sh-5);
  transition: transform .5s var(--ease);
}
.cover-avatar:hover { transform: translateY(-4px) scale(1.03); }

.cover-name {
  font-size: clamp(38px, 6.6vw, 64px);
  line-height: 1.04;
  /* +.01em, not negative: the old -.05em was latin-display tightening applied
     to hanzi, which are fixed-width — it just squeezed the glyphs 3px together
     at 64px. Hanzi headings want a hair of positive tracking or nothing. */
  letter-spacing: .01em;
  font-weight: 780;
}
.cover-line {
  margin-top: 14px;
  font-size: clamp(15px, 1.9vw, 18px);
  color: var(--muted);
}
.cover-down {
  position: absolute; bottom: 26px; left: 50%;
  display: grid; justify-items: center; gap: 5px;
  transform: translateX(-50%);
  font-size: 12.5px; color: var(--dim);
  transition: color .2s var(--ease);
}
.cover-down:hover { color: var(--accent); }
.cover-down svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Entrance. Kept short and staggered so the first paint feels composed
   rather than abrupt. */
@keyframes coverIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes coverFade { from { opacity: 0; } to { opacity: 1; } }

.cover-avatar-wrap { animation: coverFade .7s var(--ease) both .05s; }
.cover-name        { animation: coverIn .75s var(--ease) both .16s; }
.cover-line        { animation: coverIn .75s var(--ease) both .26s; }
/* `backwards`, not `both`: with `both` the finished animation keeps filling
   opacity: 1 and permanently overrides the scroll-driven fade below. */
.cover-down        { animation: coverFade .8s var(--ease) backwards .7s; }
/* Only the arrow bobs. Animating the whole link kept the click target moving
   under the cursor (and made the element perpetually "unstable" to tooling). */
.cover-down svg    { animation: bobArrow 2.4s var(--ease) 1.5s infinite; }

@keyframes bobArrow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

/* ── top bar ────────────────────────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 120;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
/* initScroll() toggles .stuck once the cover scrolls away. The flag had no
   CSS behind it; give it a job — soft elevation so the bar reads as floating
   over the content instead of a static strip. */
.bar.stuck { box-shadow: var(--sh-2); }
.bar-inner {
  display: flex; align-items: center; gap: 16px;
  width: min(var(--page), 100% - var(--gut) * 2);
  margin-inline: auto; height: 58px;
}

.bar-me { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.bar-me img {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line);
  transition: transform .3s var(--ease);
}
.bar-me:hover img { transform: rotate(-5deg) scale(1.07); }
.bar-me b { font-size: 15px; font-weight: 700; }

.bar-nav { display: flex; gap: 2px; margin-left: auto; }
.bar-nav a {
  position: relative; padding: 6px 10px;
  font-size: 13.5px; color: var(--muted);
  transition: color .18s var(--ease);
}
.bar-nav a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .22s var(--ease);
}
.bar-nav a:hover { color: var(--text); }
.bar-nav a.is-active { color: var(--text); font-weight: 600; }
.bar-nav a.is-active::after { transform: scaleX(1); }

.bar-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.bar-menu { display: none; }
.bar-menu-ico {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round;
}
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px; color: var(--muted);
  transition: color .18s var(--ease), border-color .18s var(--ease), background-color .18s var(--ease);
}
.bar-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.bar-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* ── page column ────────────────────────────────────────────────────────── */
.page { width: min(var(--page), 100% - var(--gut) * 2); margin-inline: auto; }

/* ── blocks ─────────────────────────────────────────────────────────────── */
.block { padding-block: clamp(34px, 4.6vw, 54px); border-top: 1px solid var(--line); }
.block-first { border-top: 0; padding-top: clamp(30px, 4vw, 46px); }
section { scroll-margin-top: 80px; }   /* must match html's scroll-padding-top */

h2 {
  font-size: clamp(21px, 2.7vw, 30px);
  line-height: 1.2; letter-spacing: .01em; font-weight: 730;
  text-wrap: balance;
}
.block-lead {
  /* 16px matches every other section's h2 → first-child gap. */
  margin-top: 16px;
  font-size: 15px; line-height: 1.8; color: var(--muted);
  text-wrap: pretty;
}

/* ── about ──────────────────────────────────────────────────────────────── */
.about {
  margin-top: 16px;          /* matches every other section's h2 → first gap */
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(190px, .85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.about-prose { max-width: 58ch; }
.about-lead {
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.55;
  color: var(--text); font-weight: 580;
}
/* :not(.about-lead) — `.about-prose p` is (0,1,1) and was overriding the 23px
   standfirst with 15px body text. */
.about-prose p:not(.about-lead) {
  font-size: 15px; line-height: 1.8; color: var(--muted); text-wrap: pretty;
}
.about-lead + p { margin-top: 16px; }
.about-prose p + p { margin-top: 13px; }

/* Facts read as a spec sheet: label above value, hairline between rows. */
.about-facts { border-top: 1px solid var(--line); }
.about-facts > div {
  display: grid; gap: 4px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.about-facts dt {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.about-facts dd { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.about-link {
  font: inherit; color: var(--text); padding: 0;
  border-bottom: 1px solid var(--accent);
  transition: color .18s var(--ease);
}
.about-link:hover { color: var(--accent); }

/* ── projects ────────────────────────────────────────────────────────────
   The single real project is the page's second protagonist after the cover,
   so the mark is big, the title sits at h2 scale and the description is
   lead-weight. The grid stays inside --module so every section's right edge
   still lines down the page. */
.projects { display: grid; gap: 16px; margin-top: 16px; max-width: var(--module); }

.proj {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: clamp(24px, 3.4vw, 40px);
  align-items: center;
  padding: clamp(22px, 3.2vw, 34px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease),
              transform .25s var(--ease);
}
.proj:hover {
  border-color: var(--line-hard); transform: translateY(-2px);
  box-shadow: var(--sh-4);
}

/* Soft tinted tile so the warm mark reads as a logo, not a floating cut-out. */
.proj-mark {
  display: grid; place-items: center;
  aspect-ratio: 1 / 1; padding: 20px;
  border-radius: var(--r);
  background:
    radial-gradient(120% 120% at 30% 12%, rgba(255, 176, 92, .18), transparent 62%),
    var(--surface-2);
  border: 1px solid var(--line-soft);
}
.proj-mark img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .45s var(--ease);
}
.proj:hover .proj-mark img { transform: scale(1.05) rotate(-2deg); }

.proj-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.proj-id { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.proj-id h3 { font-size: clamp(26px, 3.4vw, 32px); font-weight: 730; letter-spacing: .01em; text-wrap: balance; }
.proj-state {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 620; white-space: nowrap;
}
.proj-state i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.proj-state.is-active { background: var(--accent-bg); color: var(--accent); }
.proj-state.is-wip    { background: var(--accent-bg); color: var(--accent); }
.proj-state.is-paused { background: var(--surface-2); color: var(--dim); }
.proj-state.is-done   { background: var(--ok-soft); color: var(--ok); }

.proj-info { min-width: 0; }
.proj-desc {
  font-size: 16.5px; line-height: 1.75; color: var(--text-2);
  max-width: 40ch; text-wrap: pretty;
}
/* Tech tags: mono micro-labels, tracked within Chinese-safe limits (.06em). */
.proj-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.proj-tag {
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  color: var(--muted);
}
.proj-link {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 14px;
}
.proj-host { font-family: var(--mono); font-size: 13.5px; color: var(--text-2); }
.proj-go {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 620; color: var(--accent);
}
.proj-go i { font-style: normal; transition: transform .22s var(--ease); }
.proj-link:hover .proj-go i { transform: translate(3px, -3px); }

/* ── stack ──────────────────────────────────────────────────────────────── */
.stack-grid {
  display: grid; gap: 14px; margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.stack-col {
  padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.stack-col h3 {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 8px; padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 620; color: var(--text-2);
}
.stack-count {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--accent); font-weight: 500;
}
.stack-row {
  width: 100%; text-align: left; font: inherit; color: inherit; display: flex; align-items: center; gap: 11px; padding: 7px 0; font-size: 15px; font-weight: 550; }
.ico {
  display: block; flex: 0 0 auto;
  background-color: var(--icon-dark);
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}
[data-theme="light"] .ico { background-color: var(--icon-light); }
.stack-ico { width: 21px; height: 21px; }
.stack-name { transition: transform .2s var(--ease); }
.stack-row:hover .stack-name { transform: translateX(2px); }

/* ── AI 生态（技术栈内的子块） ───────────────────────────────────────────
   Used to be its own full-width band with its own nav entry; it now lives
   inside #stack as a sub-block. The rails keep their edge mask so chips
   dissolve at both sides instead of being cut off. */
.stack-ai { margin-top: 34px; }
.stack-ai .sub-head { margin-top: 0; padding-top: 24px; }
.stack-ai .rail { margin-top: 16px; }

.rail {
  position: relative; padding-block: 2px; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.rail + .rail { margin-top: 12px; }
/* Duration is set per-track by initRails() (px/s normalised); the fallback is
   only for the moment before JS runs. */
.rail-track { display: flex; align-items: center; gap: 10px; width: max-content; animation: rail-a var(--rail-dur, 62s) linear infinite; }
.rail-alt .rail-track { animation-name: rail-b; }
.rail:hover .rail-track, .rail:focus-within .rail-track { animation-play-state: paused; }
/* Off-screen, or while the detail dialog / a hidden tab freezes the page. */
.rail.is-off .rail-track { animation-play-state: paused; }
body.rails-paused .rail-track { animation-play-state: paused; }
@keyframes rail-a { from { transform: translateX(0); }    to { transform: translateX(-50%); } }
@keyframes rail-b { from { transform: translateX(-50%); } to { transform: translateX(0); } }

.chip {
  --brand: var(--chip-light, var(--accent));
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 19px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-family: inherit; font-size: 13.5px; color: var(--text-2); white-space: nowrap;
  cursor: pointer; text-align: left;
  box-shadow: var(--sh-1);
  transition: color .2s var(--ease), border-color .2s var(--ease),
              background-color .2s var(--ease), transform .2s var(--ease);
}
[data-theme="dark"] .chip { --brand: var(--chip-dark, var(--accent)); }
/* Tint with the brand's own colour rather than the site accent, so hovering
   Cursor feels like Cursor and not like a generic link. */
.chip:hover { color: var(--text); border-color: var(--brand); transform: translateY(-2px); }
.chip:active { transform: translateY(-2px) scale(.97); }
/* A small plus fades in on hover — the chip opens a detail dialog, and without
   a hint that reads as a dead pill. */
.chip::after {
  content: ''; flex: 0 0 auto;
  width: 10px; height: 10px; margin-right: -3px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.3px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.3px 100% no-repeat;
  opacity: 0; transform: scale(.5);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.chip:hover::after, .chip:focus-visible::after { opacity: .6; transform: none; }
.chip-ico { width: 22px; height: 22px; transition: transform .25s var(--ease); }
.chip:hover .chip-ico { transform: scale(1.08); }
.rail:hover .chip:not(:hover) { opacity: .8; }
.rail-track { transition: opacity .25s var(--ease); }

/* ── now (status strip) ──────────────────────────────────────────────────
   Editorial data band instead of three boxed cards: one hairline above,
   hairline below, hairline between. Same information, a third of the ink. */
.now-strip {
  display: flex; flex-wrap: wrap;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.now-cell {
  display: grid; gap: 3px;
  min-width: 150px;
  padding: 13px 26px;
  border-radius: 0; background: none;
}
.now-cell:first-child { padding-left: 0; }
.now-cell + .now-cell { border-left: 1px solid var(--line); }
.now-key {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.now-val { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--text-2); }
.now-val b { font-family: var(--mono); font-weight: 620; color: var(--text); font-variant-numeric: tabular-nums; }

/* sub-heading shared by merged sub-blocks */
.sub-head {
  margin-top: 34px; padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px; font-weight: 620; color: var(--text-2);
}

.stack-more {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: var(--dim);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), color .2s var(--ease);
}
.stack-row:hover .stack-more,
.stack-row:focus-visible .stack-more { opacity: 1; transform: none; color: var(--accent); }

.modal.modal-stack {
  width: min(620px, calc(100vw - 36px));
  max-width: min(620px, calc(100vw - 36px));
  max-height: min(84vh, 760px);
  padding: 0; overflow: hidden;
  text-align: left;
}
/* Bare variant: AI rail entries have no info payload — big mark, name, list. */
.modal.modal-stack.is-bare {
  width: min(400px, calc(100vw - 36px));
  max-width: min(400px, calc(100vw - 36px));
  text-align: center;
}
.si-bare {
  display: grid; justify-items: center; gap: 13px;
  padding: 34px 20px 26px;
}
.si-bare-ico {
  display: grid; place-items: center;
  width: 88px; height: 88px; margin-bottom: 4px;
  border-radius: 22px; border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: var(--sh-1);
}
.si-bare-ico .si-ico-inner { width: 50px; height: 50px; }
.si-bare h3 { font-size: 24px; font-weight: 730; letter-spacing: .01em; }
.si-bare-group {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.si-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13.5px; color: var(--dim);
  border: 1px solid transparent;
  transition: color .18s var(--ease), background-color .18s var(--ease),
              border-color .18s var(--ease);
}
.si-close:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

.si-content { padding: clamp(20px, 3.4vw, 30px); overflow-y: auto; max-height: inherit; }

.si-head { display: flex; align-items: center; gap: 15px; padding-right: 34px; }
.si-ico {
  display: grid; place-items: center;
  width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface-2);
}
.si-ico-inner { display: block; width: 27px; height: 27px; background-color: var(--text); }
.si-title { min-width: 0; }
.si-title h3 { font-size: clamp(20px, 2.6vw, 25px); font-weight: 730; letter-spacing: .01em; text-wrap: balance; }
.si-tagline {
  margin-top: 4px;
  font-size: 13.5px; line-height: 1.6; color: var(--muted);
  text-wrap: pretty;
}

.si-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  /* keep 作者 readable on one line where it fits */
  gap: 1px; margin-top: 22px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--r);
  overflow: hidden;
}
.si-facts > div { padding: 11px 14px; background: var(--surface); }
.si-facts dt {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.si-facts dd { margin-top: 3px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }

.si-body { margin-top: 20px; }
.si-body p {
  font-size: 15px; line-height: 1.8; color: var(--muted);
  text-wrap: pretty;
}
.si-body p + p { margin-top: 12px; }

.si-home {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.si-home > span:first-child { font-family: var(--mono); font-size: 13.5px; color: var(--text-2); }
.si-go {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 620; color: var(--accent);
}
.si-go i { font-style: normal; transition: transform .22s var(--ease); }
.si-home:hover .si-go i { transform: translate(3px, -3px); }

@media (max-width: 600px) {
  .si-facts { grid-template-columns: 1fr; }
  .stack-more { display: none; }
}

/* ── trips (schedule) ───────────────────────────────────────────────────── */
.trips { margin-top: 16px; border-top: 1px solid var(--line); }
.sub-head + .trips { border-top: 0; margin-top: 14px; }

.trip {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

/* Dates are the anchor of the row: monospace + tabular figures so digits
   line up column-wise down the list. */
.trip-date {
  display: grid; gap: 3px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.trip-y {
  font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
}
.trip-md { font-size: 15px; font-weight: 620; color: var(--text); }
.trip-md em { font-style: normal; margin: 0 4px; color: var(--dim); font-weight: 400; }

.trip-main { display: grid; gap: 5px; min-width: 0; }
.trip-where {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent);
}
.trip-where::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.trip-title { font-size: 16.5px; font-weight: 640; text-wrap: balance; }
.trip-note { font-size: 13.5px; line-height: 1.8; color: var(--muted); max-width: 52ch; text-wrap: pretty; }

.trip-badge {
  align-self: start; margin-top: 2px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 620; white-space: nowrap;
}
.trip-badge.is-ok   { background: var(--ok-soft); color: var(--ok); }
.trip-badge.is-plan { background: var(--accent-bg); color: var(--accent); }
.trip-badge.is-past { background: var(--surface-2); color: var(--dim); }

/* empty state — still designed, just quieter */
/* Empty state: no date column, no stray placeholder dash, one rule. */
.trip-empty {
  display: grid; gap: 7px;
  padding: 20px 0 4px;
}
.trip-empty-title { font-size: 15px; font-weight: 580; color: var(--text-2); }
.trip-empty-note {
  font-size: 13.5px; line-height: 1.8; color: var(--muted);
  max-width: 52ch; text-wrap: pretty;
}
.trip-link {
  color: var(--text); border-bottom: 1px solid var(--accent);
  padding-bottom: 1px; font: inherit; background: none;
}
.trip-link:hover { color: var(--accent); }

/* ── terminal ───────────────────────────────────────────────────────────── */
.term {
  display: flex; flex-direction: column; overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-3);
}
.term-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.term-dots { display: flex; gap: 5px; }
.term-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-hard); }
.term-dots i:first-child { background: var(--accent); }
.term-name { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.term-live {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  transition: color .2s var(--ease);
}
.term-live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-ring);
}
/* While the reader is typing, the indicator takes the accent colour. */
.term.is-typing .term-live { color: var(--accent); }
.term.is-typing .term-live i { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.term-clear { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.term-clear:hover { color: var(--accent); }
.term-out {
  /* Sizes to its content and only caps growth. A fixed floor left a large
     empty block under the two welcome lines. */
  max-height: min(46vh, 340px); overflow-y: auto;
  padding: 14px 16px 6px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.85;
  scroll-behavior: smooth;
}
.term-out::-webkit-scrollbar { width: 7px; }
.term-out::-webkit-scrollbar-thumb { background: var(--line-hard); border-radius: 4px; }
.term-line { white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.term-cmd { color: var(--accent); }
.term-ok { color: var(--ok); }
.term-dim { color: var(--dim); }
.term-keys { display: grid; gap: 2px; }
.term-keys b { color: var(--text); font-weight: 600; }
.term-in { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-top: 1px solid var(--line-soft); }
.term-prompt { color: var(--accent); font-family: var(--mono); }
.term-in input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-family: var(--mono); font-size: 12.5px;
}
.term-in input::placeholder { color: var(--dim); }
.term-slash {
  font-family: var(--mono); font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--dim);
}

/* Clickable command chips — better than a text hint the reader has to retype. */
.term-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.term-chips button {
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  transition: color .18s var(--ease), border-color .18s var(--ease),
              background-color .18s var(--ease), transform .18s var(--ease);
}
.term-chips button:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-bg); transform: translateY(-1px);
}

/* ── friends ───────────────────────────────────────────────────────────── */
.friend-body { margin-top: 16px; }
.friend-empty {
  margin-top: 4px; max-width: 52ch;
  font-size: 15px; line-height: 1.8; color: var(--muted);
}
.friend-link {
  font: inherit; color: var(--text); padding: 0;
  border-bottom: 1px solid var(--accent);
  transition: color .18s var(--ease);
}
.friend-link:hover { color: var(--accent); }

.sub-head + .friend-body { margin-top: 10px; }
.friend-list { margin-top: 4px; }
.friend-item {
  display: grid;
  /* three children: number, name, note — the old rule declared two columns,
     which split the number and the name to opposite edges. */
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  transition: padding-left .2s var(--ease);
}
.friend-list li:first-child .friend-item { border-top: 1px solid var(--line-soft); }
a.friend-item:hover { padding-left: 5px; }
.friend-no { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.friend-name { font-size: 15px; font-weight: 560; color: var(--text); }
.friend-note { font-size: 12.5px; color: var(--dim); text-align: right; }

/* ── contact ────────────────────────────────────────────────────────────── */
.contact {
  display: grid; grid-template-columns: 120px minmax(0, 1fr);
  gap: 22px; align-items: center;
  margin-top: 16px; padding: 20px; max-width: var(--module);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.qr-box {
  display: grid; place-items: center; padding: 9px;
  border-radius: var(--r-sm); background: #fff;
  border: 1px solid var(--line-soft);
}
.qr-box img { width: 100%; height: auto; }
.contact-info { display: grid; gap: 4px; }
.contact-k { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); }
.contact-v { font-family: var(--mono); font-size: 21px; font-weight: 620; }
.contact-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background-color .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: var(--accent-2); }
.btn-line { border: 1px solid var(--line-hard); color: var(--text); }
.btn-line:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ── footer ─────────────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); background: var(--bg-soft); }
.foot-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  width: min(var(--page), 100% - var(--gut) * 2);
  margin-inline: auto; padding-block: 22px;
  font-size: 12.5px; color: var(--dim);
}
.foot-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.foot-sep { opacity: .5; }
.foot-build { font-family: var(--mono); }
.foot a { color: var(--muted); border-bottom: 1px solid var(--line-hard); }
.foot a:hover { color: var(--accent); }

.theme-set {
  display: inline-flex; padding: 2px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
}
.theme-set button {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--dim);
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.theme-set button:hover { color: var(--text); }
.theme-set button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ── modal / palette / toast ────────────────────────────────────────────── */
.modal {
  width: min(392px, calc(100% - 28px)); padding: 22px;
  color: var(--text);
  border: 1px solid var(--line-hard); border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-6);
}
.modal::backdrop {
  background: rgba(14, 16, 23, .5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-ico {
  display: grid; place-items: center; width: 34px; height: 34px;
  margin-bottom: 15px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink); font-size: 15px;
}
.modal-kicker { margin-bottom: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--accent); }
.modal h2 { margin-bottom: 9px; font-size: 21px; }
.modal-copy { margin-bottom: 18px; font-size: 13.5px; line-height: 1.8; color: var(--muted); }
.modal-copy strong { color: var(--text); }
.modal-act { display: flex; justify-content: flex-end; gap: 8px; }

.palette { position: fixed; inset: 0; z-index: 250; display: grid; place-items: start center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette-bg {
  position: absolute; inset: 0;
  background: rgba(14, 16, 23, .42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.palette-box {
  position: relative; width: min(500px, calc(100% - 28px));
  border: 1px solid var(--line-hard); border-radius: var(--r-lg);
  background: var(--surface); overflow: hidden;
  box-shadow: var(--sh-6);
  animation: pop .16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-5px); } }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.palette-in > span { color: var(--dim); }
.palette-in input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 13.5px; }
.palette-in input::placeholder { color: var(--dim); }
.palette-list { max-height: 296px; overflow-y: auto; padding: 5px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px; text-align: left;
  border-radius: var(--r-sm); font-size: 13.5px;
}
.palette-kind { min-width: 42px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.palette-label { flex: 1; color: var(--text); }
.palette-item[aria-selected="true"] { background: var(--accent-bg); }
.palette-item[aria-selected="true"] .palette-kind { color: var(--accent); }
.palette-empty { padding: 22px; text-align: center; font-size: 13.5px; color: var(--dim); }
.palette-foot {
  display: flex; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 280;
  padding: 11px 15px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 600;
  opacity: 0; transform: translateY(7px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }

.confetti { position: fixed; inset: 0; z-index: 260; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 7px; height: 11px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(106vh) rotate(720deg); opacity: .1; } }

/* ── mobile / tablet nav ────────────────────────────────────────────────────
   The desktop list is hidden below 880px; this is what replaces it. */
.mob-nav {
  /* Full viewport: the element itself is the backdrop. It previously only had
     top/left/right, so it was as tall as the panel and the dimming never
     covered the page below it. */
  position: fixed; inset: 0;
  z-index: 110;
  pointer-events: none;
  /* Closed panel must not be tabbable — aria-hidden alone leaves the links in
     the tab order, so a keyboard user lands on an invisible menu. The delayed
     transition lets the fade-out finish before it leaves the a11y tree. */
  visibility: hidden;
  transition: visibility 0s .3s;
}
.mob-nav::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(14, 16, 23, .38);
  opacity: 0; transition: opacity .28s var(--ease);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.mob-nav-in {
  position: relative;
  margin-top: var(--bar-h, 57px);   /* sits flush under the bar */
  display: grid;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--sh-4);
  transform: translateY(-12px); opacity: 0;
  transition: transform .3s var(--ease), opacity .24s var(--ease);
}
.mob-nav-in a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; min-height: 52px;
  font-size: 15px; font-weight: 560; color: var(--text);
  border-bottom: 1px solid var(--line-soft);
}
.mob-nav-in a:last-child { border-bottom: 0; }
.mob-nav-in a i { font-style: normal; color: var(--dim); transition: transform .22s var(--ease), color .22s var(--ease); }
.mob-nav-in a:active { background: var(--surface-2); }
.mob-nav-in a:hover i { transform: translateX(3px); color: var(--accent); }
.mob-nav-in a.is-active { color: var(--accent); }
.mob-nav-in a.is-active i { color: var(--accent); }

.mob-nav.open { pointer-events: auto; visibility: visible; transition: visibility 0s 0s; }
.mob-nav.open::before { opacity: 1; }
.mob-nav.open .mob-nav-in { transform: none; opacity: 1; }

/* ── touch targets ──────────────────────────────────────────────────────────
   Interactive elements should offer a ≥44px hit area on touch. Several were
   about half that: the project link was 22px, inline prose links 19px, the bar
   buttons 32px, tech rows 39px.
   Inline links inside prose cannot grow to 44px without wrecking the
   paragraph's line box, so they keep their metrics and get an invisible
   expanded hit area via ::after.
  ------------------------------------------------------------------------ */
@media (hover: none), (max-width: 880px) {
  .bar-btn, .cbtn { min-width: 44px; min-height: 44px; }
  .bar-me { min-height: 44px; }

  .cover-down { min-height: 44px; align-content: center; }
  .link, .about-link, .friend-link, .trip-link { position: relative; }
  .link::after, .about-link::after, .friend-link::after, .trip-link::after {
    content: ""; position: absolute;
    left: 0; right: 0; top: 50%; transform: translateY(-50%);
    height: 44px;
  }

  .stack-row { min-height: 54px; }
  /* No hover on touch, so the affordance has to be permanent. */
  .stack-more { display: inline; opacity: .75; transform: none; }
  .proj-link {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 48px; margin-top: 8px; padding-top: 0; border-top: 0;
  }
  .term-chips button { min-height: 44px; padding-inline: 16px; }
  .term-clear { min-height: 44px; padding-inline: 10px; }
  .term-in input { min-height: 44px; }
  .theme-set button { min-height: 44px; padding-inline: 16px; }
  /* Dialog close button is the only way out on a phone; it was 30px. */
  .si-close { width: 44px; height: 44px; top: 8px; right: 8px; }
  .si-head { padding-right: 42px; }
  .modal-act .btn, .contact-act .btn { min-height: 48px; justify-content: center; }
}

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .bar-nav { display: none; }
  .bar-menu { display: grid; place-items: center; }
  .bar-tools { margin-left: auto; }
}

/* Short viewports (phone in landscape): the cover must still fit on screen,
   so drop the forced full height and tighten the stack. */
@media (max-height: 560px) and (orientation: landscape) {
  .cover { min-height: 0; padding-block: 64px 76px; }
  .cover-avatar-wrap { margin-bottom: 16px; }
  .cover-avatar { width: clamp(72px, 16vh, 96px); }
  .cover-name { font-size: clamp(28px, 7vh, 38px); }
  .cover-line { margin-top: 9px; font-size: 13.5px; }
  .cover-down { display: none; }
}

/* Very old engines without svh/vh in flex contexts still get a usable cover. */
@supports not (height: 100svh) {
  .cover { min-height: 640px; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
  .cover { padding: 80px 18px 92px; }
  .contact { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .contact-v { font-size: 18px; }
  /* On a phone the three cards became three full-width boxes holding one short
     value each (~450px total). Label/value rows are the same information in
     roughly a third of the height. */
  .now-strip { display: grid; gap: 0; border-top: 1px solid var(--line); }
  .now-cell {
    display: grid; grid-template-columns: 64px minmax(0, 1fr);
    align-items: baseline; gap: 14px;
    min-width: 0; padding: 12px 0;
    border: 0; border-bottom: 1px solid var(--line-soft);
    border-radius: 0; background: none;
  }
  .about { grid-template-columns: 1fr; gap: 22px; }
  /* Four short facts stacked vertically ate ~300px of a phone screen. Two
     columns halve that without cramping the values. */
  .about-facts {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px; border-top: 1px solid var(--line);
  }
  .about-facts > div { padding: 11px 0; }
  .about-facts > div:nth-child(-n+2) { border-top: 0; }
  .proj { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; }
  .proj-mark { padding: 12px; }
  .proj-body { grid-template-columns: 1fr; gap: 10px; }
  .proj-id { gap: 10px; }
  .proj-id h3 { font-size: 24px; }
  .trip-date { grid-auto-flow: column; justify-content: start; gap: 8px; align-items: baseline; }
  .trip-badge { justify-self: start; }
  .friend-item { grid-template-columns: 24px minmax(0, 1fr); }
  .friend-note { display: none; }
  .modal-act { flex-direction: column-reverse; }
  .modal-act .btn { width: 100%; }
  .term-out { min-height: 175px; }
  .chip { height: 42px; padding: 0 15px; font-size: 13.5px; }
  .foot-inner { flex-direction: column; align-items: flex-start; }
}

/* ── reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mob-nav::before, .mob-nav-in { transition: none; }
  .cover-avatar-wrap, .cover-name, .cover-line, .cover-down {
    animation: none !important; opacity: 1 !important;
  }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .rail-track { animation: none !important; }
}

@media print {
  .bar, .palette, .toast, .term, .progress, .rail { display: none; }
  body { background: #fff; color: #000; }
}
