/* ══ Tokens ═══════════════════════════════════════════════ */
:root {
  --bg: #0a141b;                 /* deep blue-teal ink, the room the work sits in */
  --text: #e8eef2;
  --soft: #c4d1d9;
  --muted: #92a6b2;
  --faint: #667c8b;
  --line: rgba(173, 199, 214, 0.12);
  --line-2: rgba(173, 199, 214, 0.22);
  --amber: #f5a524;              /* the one accent: a signal light */
  --amber-2: #ffbe4d;
  --ok: #4fd1a1;                 /* status only */
  --violet: #a99bff;             /* second collaborator in the co-edit illustration */

  --display: "Mona Sans", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 5vw, 64px);
  --max: 1200px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);

  color-scheme: dark;
}

/* ══ Base ═════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
html[lang="zh-CN"] body { line-height: 1.75; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--amber); color: #1a1205; }

/* Language switching: only the active language's spans render. */
html[data-lang="en"] [data-l="zh"],
html[data-lang="zh"] [data-l="en"] { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--amber); color: #1a1205; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }

/* Ambient light + grain behind everything */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55vw 45vh at 88% -5%, rgba(245, 165, 36, 0.11), transparent 70%),
    radial-gradient(45vw 55vh at -5% 35%, rgba(34, 184, 207, 0.07), transparent 70%),
    var(--bg);
}
.ambient::after {
  content: ""; position: absolute; inset: 0; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page { overflow-x: clip; }
main { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ══ Top bar ══════════════════════════════════════════════ */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(var(--gutter), calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.bar.scrolled {
  background: rgba(10, 20, 27, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--line);
}
.mark { font-family: var(--mono); font-weight: 500; font-size: 0.9rem; text-decoration: none; }
.mark span { color: var(--amber); }
.bar nav { display: flex; gap: 30px; margin: 0 auto; }
.bar nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; transition: color .2s; }
.bar nav a:hover { color: var(--text); }
.bar-end { display: flex; align-items: center; gap: 12px; }
.lang {
  display: inline-flex; padding: 3px; gap: 2px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 999px;
}
.lang .opt { font-family: var(--mono); font-size: 0.72rem; line-height: 1; padding: 6px 10px; border-radius: 999px; color: var(--muted); transition: background-color .2s, color .2s; }
html[data-lang="en"] .lang .opt[data-for="en"],
html[data-lang="zh"] .lang .opt[data-for="zh"] { background: var(--text); color: var(--bg); }

/* ══ Buttons ══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font-size: 0.95rem; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.32); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1a1205; font-weight: 650; }
.btn.primary:hover { background: var(--amber-2); border-color: var(--amber-2); }
.btn.ghost { background: transparent; }
.btn .ico { width: 18px; height: 18px; flex: none; fill: currentColor; margin-left: -2px; }

/* Quiet links with an icon: the hero keeps one real button (Email) and lists the rest as text. */
.tlink {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 0;
  color: var(--soft); font-size: 0.98rem; font-weight: 550; text-decoration: none;
  border-bottom: 1px solid transparent; transition: color .2s, border-color .2s;
}
.tlink:hover { color: var(--text); border-bottom-color: var(--line-2); }
.tlink .ico { width: 17px; height: 17px; flex: none; fill: currentColor; }

/* ══ Hero ═════════════════════════════════════════════════ */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(36px, 5vw, 84px);
  align-items: center;
  min-height: calc(100svh - 70px);
  padding: clamp(28px, 6vh, 64px) 0 clamp(48px, 8vh, 88px);
}
.name {
  margin: 0;
  font-stretch: 125%; font-weight: 800;
  font-size: clamp(3.1rem, 8vw, 6.4rem);
  line-height: 0.92; letter-spacing: -0.04em;
}
.name .line { display: block; overflow: hidden; padding: 0.02em 0 0.16em; margin-bottom: -0.12em; }
.name .line > span { display: inline-block; animation: rise 1.1s var(--ease) both; }
.name .line:nth-child(2) > span { animation-delay: .09s; }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }
.name .cn {
  font-style: normal; font-stretch: 100%; font-weight: 500;
  font-size: 0.25em; letter-spacing: 0.28em; color: var(--muted);
  vertical-align: 0.5em; margin-left: 0.5em;
}
.role { margin: 30px 0 0; font-size: clamp(1.25rem, 2vw, 1.55rem); font-weight: 650; font-stretch: 105%; letter-spacing: -0.01em; }
.lede { margin: 12px 0 0; max-width: 32em; color: var(--muted); font-size: 1.08rem; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; margin-top: 30px; }
.facts { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 6px 28px; color: var(--faint); font-size: 0.9rem; }
.intro > :not(.name) { animation: fadeUp .9s var(--ease) both; animation-delay: .32s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── Pipeline card ─────────────────────────────────────── */
.pipe-wrap {
  position: relative; margin: 0; padding: 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.015) 60%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 60px 120px -50px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: fadeUp 1.1s var(--ease) .45s both;
}
.pipe-cap { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--muted); margin-bottom: 18px; }
.pipe {
  position: relative;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(94px, auto); gap: 26px 16px;
}
.wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wires path { fill: none; stroke: rgba(255, 255, 255, 0.13); stroke-width: 1.5; }
.wires path.trail { stroke: var(--amber); stroke-width: 2; stroke-dasharray: 4 5; animation: dash .6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -9; } }
.node {
  grid-row: var(--r); grid-column: var(--c);
  position: relative; z-index: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(8, 17, 23, 0.72); border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.node b { font-size: 0.84rem; font-weight: 650; font-stretch: 90%; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node i { font-style: normal; font-family: var(--mono); font-size: 0.64rem; color: var(--faint); }
.node small { font-size: 0.72rem; line-height: 1.35; color: var(--muted); margin-top: 4px; }
.node.gcp { border-style: dashed; }
.node.hot { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 165, 36, .14), 0 0 30px -6px rgba(245, 165, 36, .55); transform: translateY(-2px); }
.node.hot b { color: var(--amber); }
/* .pipe-ghost, not .ghost: a bare .ghost also matched .btn.ghost and hid those buttons. */
.packet, .pipe-ghost {
  position: absolute; z-index: 2; left: 0; top: 0; border-radius: 50%;
  background: var(--amber); opacity: 0; pointer-events: none;
}
.packet { width: 12px; height: 12px; margin: -6px 0 0 -6px; box-shadow: 0 0 16px 4px rgba(245, 165, 36, .6); }
.pipe-ghost { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; }
.send {
  grid-row: var(--r); grid-column: var(--c);
  align-self: center; justify-self: stretch; z-index: 1;
  font-size: 0.85rem; font-weight: 650;
  padding: 12px 10px; border-radius: 12px; cursor: pointer;
  background: rgba(245, 165, 36, 0.08); color: var(--amber);
  border: 1px solid rgba(245, 165, 36, 0.55);
  transition: background-color .2s, color .2s;
}
.send:hover { background: var(--amber); color: #1a1205; }
.send:disabled { opacity: .5; cursor: progress; }
.send:disabled:hover { background: rgba(245, 165, 36, 0.08); color: var(--amber); }
.log {
  margin: 18px 0 0; min-height: calc(6 * 1.65em + 22px);
  padding: 11px 13px; border-radius: 12px;
  background: rgba(4, 10, 14, 0.6); border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--mono); font-size: 0.68rem; line-height: 1.65; color: var(--muted);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.log .t { color: var(--faint); }
.log .ok { color: var(--ok); }
.log .hl { color: var(--amber); }

/* ══ About ════════════════════════════════════════════════ */
.about { padding: clamp(24px, 6vh, 64px) 0 0; }
.about p {
  margin: 0; max-width: 30em;
  font-size: clamp(1.3rem, 2.4vw, 1.95rem); line-height: 1.45; font-weight: 450;
  letter-spacing: -0.012em; color: var(--soft);
}

/* ══ Sections ═════════════════════════════════════════════ */
.block { padding-top: clamp(80px, 14vh, 150px); scroll-margin-top: 40px; }
.section-title {
  margin: 0;
  font-stretch: 118%; font-weight: 760;
  font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1; letter-spacing: -0.04em;
}
.section-title .path { font-family: var(--mono); font-weight: 500; font-stretch: 100%; font-size: 0.6em; letter-spacing: 0; color: var(--amber); vertical-align: 0.14em; margin-right: 0.25em; }

/* ══ Featured work ════════════════════════════════════════ */
.feature { position: relative; padding: clamp(64px, 11vh, 130px) 0 0; scroll-margin-top: 40px; }
.feature-glow {
  position: absolute; z-index: -1; pointer-events: none;
  inset: 0 -30vw -10% -30vw;
  background:
    radial-gradient(34% 46% at 66% 46%, color-mix(in srgb, var(--g1) 26%, transparent), transparent 72%),
    radial-gradient(22% 30% at 76% 72%, color-mix(in srgb, var(--g2) 16%, transparent), transparent 72%);
  opacity: 0; transition: opacity 1.6s var(--ease);
}
.feature.flip .feature-glow {
  background:
    radial-gradient(34% 46% at 34% 46%, color-mix(in srgb, var(--g1) 26%, transparent), transparent 72%),
    radial-gradient(22% 30% at 24% 72%, color-mix(in srgb, var(--g2) 16%, transparent), transparent 72%);
}
.feature.in .feature-glow { opacity: 1; }

.feature-grid {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(36px, 6vw, 96px);
}
.feature.flip .feature-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feature.flip .feature-copy { order: 2; }
.feature-media { position: relative; min-width: 0; }

.title-row { display: flex; align-items: center; gap: 18px; }
.app-icon { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .55)); }
.feature h3 {
  margin: 0;
  font-stretch: 125%; font-weight: 800;
  font-size: clamp(2.2rem, 4.4vw, 3.7rem); line-height: 1; letter-spacing: -0.045em;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 18px 0 0; color: var(--muted); font-size: 0.95rem; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--ok); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pitch { margin: 22px 0 0; max-width: 28em; font-size: clamp(1.15rem, 1.6vw, 1.38rem); line-height: 1.45; font-weight: 550; letter-spacing: -0.01em; }
.desc { margin: 14px 0 0; max-width: 34em; color: var(--muted); }
.points { list-style: none; padding: 0; margin: 20px 0 0; max-width: 36em; }
.points li { position: relative; padding-left: 22px; margin: 11px 0; color: var(--soft); }
.points li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 10px; height: 2px; border-radius: 2px; background: var(--g1); }
.stack { margin: 20px 0 0; max-width: 46em; font-family: var(--mono); font-size: 0.72rem; line-height: 1.9; color: var(--faint); }
.note { margin: 12px 0 0; color: var(--muted); font-size: 0.88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* ── Phone carousel (steaL) ───────────────────────────── */
.phones { --pw: clamp(178px, 20vw, 272px); --spread: calc(0.5 + 0.5 * var(--p, 1)); perspective: 1700px; }
.phone-stage { position: relative; height: calc(var(--pw) * 2.095 + 30px); transform-style: preserve-3d; touch-action: pan-y; }
.phone {
  position: absolute; left: 50%; top: 50%; margin: 0;
  width: var(--pw); aspect-ratio: 100 / 209.5;
  padding: calc(var(--pw) * 0.035);
  border-radius: calc(var(--pw) * 0.16);
  background: linear-gradient(150deg, #59626b 0%, #1d2227 18%, #0b0e11 50%, #23292f 82%, #5a636c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 0 0 calc(var(--pw) * 0.013) #06080a,
    0 60px 90px -40px rgba(0, 0, 0, 0.95),
    0 40px 90px -50px color-mix(in srgb, var(--g1) 70%, transparent);
  transform: translate(-50%, -50%) translate3d(var(--x), 0, var(--z)) rotateY(var(--ry)) scale(var(--s));
  transition: transform 1s var(--ease), opacity .8s var(--ease), filter .8s var(--ease);
  will-change: transform;
  cursor: pointer;
}
.phone::before {
  content: ""; position: absolute; left: calc(var(--pw) * -0.011); top: 19%;
  width: calc(var(--pw) * 0.013); height: 4.5%; border-radius: 2px 0 0 2px; background: #30373d;
  box-shadow: 0 calc(var(--pw) * 0.15) 0 #30373d, 0 calc(var(--pw) * 0.27) 0 #30373d;
}
.phone::after {
  content: ""; position: absolute; right: calc(var(--pw) * -0.011); top: 28%;
  width: calc(var(--pw) * 0.013); height: 10%; border-radius: 0 2px 2px 0; background: #30373d;
}
.phone .screen { position: relative; height: 100%; overflow: hidden; border-radius: calc(var(--pw) * 0.125); background: #111315; }
.phone .screen img { width: 100%; height: 100%; object-fit: cover; }
.phone .screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.03) 26%, transparent 42%);
}
.phone[data-pos="center"] { --x: 0px; --z: 0px; --ry: 0deg; --s: 1; cursor: zoom-in; }
.phone[data-pos="right"] { --x: calc(var(--pw) * 0.68 * var(--spread)); --z: -220px; --ry: -26deg; --s: 0.84; filter: brightness(0.48) saturate(0.85); }
.phone[data-pos="left"] { --x: calc(var(--pw) * -0.68 * var(--spread)); --z: -220px; --ry: 26deg; --s: 0.84; filter: brightness(0.48) saturate(0.85); }
.phone[data-pos="back"] { --x: 0px; --z: -420px; --ry: 0deg; --s: 0.7; opacity: 0; pointer-events: none; }
.phone[data-pos="left"]:hover, .phone[data-pos="right"]:hover { filter: brightness(0.7) saturate(0.95); }

.car-ui { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.car-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
  transition: background-color .2s, border-color .2s;
}
.car-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.car-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.car-dots { min-width: 7.5rem; justify-content: center; }
.car-dots .g-dot::after { background: var(--g1); }
.car-caps { margin-top: 14px; min-height: 1.6em; text-align: center; }

/* Captions shared by carousels and galleries */
.cap { display: none; margin: 0; font-size: 0.92rem; color: var(--soft); }
.cap.is-active { display: block; animation: capIn .5s var(--ease); }
@keyframes capIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── steaL repo map: the monorepo's real folders, laid out as the architecture ──
   Apps on top, shared/ in the middle, backend/ and outside services at the bottom. Hatched = in progress.
   One folder is open at a time; `order` drops its panel under the row the folder sits in. */
.repo { margin-top: clamp(48px, 8vh, 80px); }
.repo-root { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 20px; margin: 0 0 14px; font-family: var(--mono); font-size: 0.95rem; color: var(--text); }
.repo-root a { font-family: var(--display); font-size: 0.88rem; color: var(--muted); text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: color .2s; }
.repo-root a:hover { color: var(--text); }

.repo-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
  background: rgba(173, 199, 214, 0.17); border: 1px solid rgba(173, 199, 214, 0.17); border-radius: 16px; overflow: hidden;
}
.repo-cell { grid-column: span 3; padding: 20px 24px 22px; background-color: #0d1921; transition: background-color .2s; }
.repo-cell.is-dir { cursor: pointer; }
.repo-cell.is-dir:not(.is-open):hover { background-color: #10202a; }
.rc-shared, .repo-panel { grid-column: 1 / -1; }
.rc-back { grid-column: span 4; }
.rc-out { grid-column: span 2; background-color: #0a151c; }
/* in progress = hatched, like a site that's still fenced off */
.repo-cell.wip { background-image: repeating-linear-gradient(-45deg, rgba(245, 165, 36, 0.085) 0 1.5px, transparent 1.5px 11px); }
.repo-cell.is-open, .repo-panel { background-color: #11202a; }
.repo-panel { margin-top: -1px; padding: 6px 24px 26px; }
.repo-panel[hidden] { display: none; }
.rc-ios { order: 1; }
.rc-and { order: 2; }
.rp-ios, .rp-and { order: 3; }
.rc-shared { order: 4; }
.rp-shared { order: 5; }
.rc-back { order: 6; }
.rc-out { order: 7; }
.rp-back { order: 8; }

.repo-dir {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 16px;
  margin: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.repo-name { font-family: var(--mono); font-size: 0.95rem; color: var(--text); white-space: nowrap; }
.repo-name::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 12px 0 1px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); vertical-align: 0.14em; transition: transform .25s var(--ease);
}
.repo-dir[aria-expanded="true"] .repo-name::before { transform: translateY(-2px) rotate(45deg); }
.repo-leaf { margin: 14px 0 0; }
.repo-leaf .repo-name::before { visibility: hidden; }
.repo-st { font-size: 0.86rem; white-space: nowrap; }
.repo-st.built { color: var(--ok); }
.repo-st.wip { color: var(--amber); }
.repo-d { margin: 6px 0 0; padding-left: 19px; color: var(--soft); font-size: 0.95rem; line-height: 1.55; }
.repo-d code { font-family: var(--mono); font-size: 0.84em; color: var(--text); }
.repo-out-t { margin: 0; color: var(--muted); font-size: 0.95rem; }
.rc-out .repo-d { padding-left: 0; color: var(--muted); }

/* Panel: subfolders on the side of the open folder, notes beside them. Equal columns with a 48px gap
   line up with the cells above, so androidApp/'s subfolders hang under it on the right. */
.repo-panel-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 48px; }
.repo-panel:not([hidden]) .repo-panel-in { animation: capIn .5s var(--ease); }
.rp-and .repo-sub { order: 2; }
.repo-sub { list-style: none; margin: 0 0 0 3px; padding: 0; }
.repo-sub li { position: relative; padding: 0 0 14px 26px; font-size: 0.92rem; line-height: 1.5; }
.repo-sub li::before, .repo-sub li::after { content: ""; position: absolute; left: 0; background: rgba(173, 199, 214, 0.24); }
.repo-sub li::before { top: 0; bottom: 0; width: 1px; }
.repo-sub li:last-child::before { bottom: auto; height: 0.8em; }
.repo-sub li::after { top: 0.8em; width: 14px; height: 1px; }
.repo-sub code { display: block; font-family: var(--mono); font-size: 0.8rem; color: var(--text); }
.repo-sub li > span { color: var(--muted); }
.repo-notes p { margin: 0 0 14px; max-width: 60ch; color: var(--soft); font-size: 0.97rem; }
.repo-notes .aside { color: var(--muted); font-size: 0.92rem; }
.repo-notes .stack { margin: 4px 0 0; font-size: 0.72rem; color: var(--faint); }
html[lang="zh-CN"] .repo-d, html[lang="zh-CN"] .repo-notes p:not(.stack) { line-height: 1.75; }

.repo-key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin: 12px 2px 0; color: var(--faint); font-size: 0.88rem; }
.repo-key i { display: inline-block; width: 22px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 2px; background: repeating-linear-gradient(-45deg, rgba(245, 165, 36, 0.55) 0 1.5px, transparent 1.5px 6px); }

/* ── Browser frame + gallery ──────────────────────────── */
.stage-web { position: relative; padding-bottom: 9%; }
/* SmartPark: the cache card hangs lower so it doesn't cover the chart's x-axis labels. */
.stage-web.low-card { padding-bottom: 24%; }
.browser {
  --dir: 1;
  position: relative; overflow: hidden; border-radius: 14px;
  background: #0f1a21; border: 1px solid var(--line-2);
  box-shadow: 0 70px 130px -60px rgba(0, 0, 0, 0.95), 0 40px 100px -60px color-mix(in srgb, var(--g1) 70%, transparent);
  transform: perspective(1800px)
    rotateY(calc(var(--dir) * -10deg * (1 - var(--p, 1))))
    rotateX(calc(6deg * (1 - var(--p, 1))))
    scale(calc(0.94 + 0.06 * var(--p, 1)));
  transition: transform .5s var(--ease);
}
.feature.flip .browser { --dir: -1; }
.browser-bar {
  display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 14px;
  background: linear-gradient(#18252e, #131f27); border-bottom: 1px solid var(--line);
}
.browser-bar .g-caps { flex: 1; min-width: 0; text-align: center; }
.browser-bar .cap { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { position: relative; aspect-ratio: 16 / 10; background: #fff; cursor: zoom-in; overflow: hidden; }
.paper .view { aspect-ratio: 1422 / 895; background: #f7f6f1; }
.slide {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.03);
  transition: opacity 1s var(--ease), transform 7s linear;
}
.slide.is-active { opacity: 1; transform: scale(1); }

/* Page dots: a 6px dot each. The current one is a pill whose fill grows from a dot
   (--fill 0) to the full pill (--fill 1); width, not scaleX, so both ends stay round. */
.g-dots { display: flex; gap: 2px; flex: none; }
.g-dot { position: relative; width: 20px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; transition: width .35s var(--ease); }
.g-dot::before, .g-dot::after { content: ""; position: absolute; left: 7px; top: 9px; height: 6px; border-radius: 3px; }
.g-dot::before { right: 7px; background: rgba(255, 255, 255, 0.24); transition: background-color .2s; }
.g-dot:hover::before { background: rgba(255, 255, 255, 0.5); }
.g-dot::after { width: calc(6px + (100% - 20px) * var(--fill, 0)); background: var(--text); opacity: 0; }
.g-dot.is-active { width: 40px; }
.g-dot.is-active::after { opacity: 1; }

.float-card {
  position: absolute; z-index: 2; bottom: 0; left: -7%; width: 42%;
  padding: 7px 7px 0; border: 0; border-radius: 12px; cursor: zoom-in;
  background: #f3f5f6; color: #1d2a33; text-align: left;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.2);
  transform: rotate(-3deg) translateY(calc(40px * (1 - var(--p, 1))));
  transition: transform .5s var(--ease);
}
.feature.flip .float-card { left: auto; right: -7%; transform: rotate(3deg) translateY(calc(40px * (1 - var(--p, 1)))); }
.float-card:hover, .feature.flip .float-card:hover { transform: rotate(0deg) translateY(-6px); }
.float-card img { width: 100%; height: auto; border-radius: 6px; }
.float-card > span { display: block; padding: 8px 5px 9px; font-size: 0.78rem; font-weight: 650; }

/* ── Co-edit illustration (Agencia) ───────────────────── */
.coedit { margin: 0; }
.ce-window {
  border-radius: 18px; padding-bottom: 10px;
  background: linear-gradient(180deg, #13212a, #0d171e);
  border: 1px solid var(--line-2);
  box-shadow: 0 70px 130px -60px rgba(0, 0, 0, 0.95), 0 40px 100px -60px color-mix(in srgb, var(--g1) 80%, transparent);
  transform: perspective(1800px) rotateY(calc(10deg * (1 - var(--p, 1)))) rotateX(calc(6deg * (1 - var(--p, 1))));
  transition: transform .5s var(--ease);
}
.ce-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ce-title { font-weight: 650; }
.ce-live { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: rgba(79, 209, 161, 0.1); color: var(--ok); font-size: 0.74rem; }
.ce-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.ce-people { display: flex; margin-left: auto; }
.ce-people b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 2px solid #12202a; margin-left: -7px; font-size: 0.74rem; color: #14100a; }
.who-y { background: var(--amber); }
.who-t { background: var(--violet); }
.ce-field {
  margin: 14px 18px 0; padding: 12px 14px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025);
  transition: border-color .3s, box-shadow .3s;
}
.ce-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.74rem; }
.ce-val { margin: 0; min-height: 1.6em; font-size: 1rem; line-height: 1.6; }
.ce-field.sync-y { border-color: rgba(245, 165, 36, 0.6); box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.1); }
.ce-field.sync-t { border-color: rgba(169, 155, 255, 0.65); box-shadow: 0 0 0 3px rgba(169, 155, 255, 0.12); }
.caret { position: relative; display: inline-block; width: 2px; height: 1.2em; margin-left: 1px; vertical-align: -0.22em; background: var(--c); animation: blink 1.1s steps(1) infinite; }
.caret.typing { animation: none; }
.caret::before {
  content: attr(data-name); position: absolute; left: -1px; bottom: 100%; margin-bottom: 2px;
  padding: 3px 6px; border-radius: 5px 5px 5px 0; white-space: nowrap;
  background: var(--c); color: #14100a; font-size: 0.62rem; font-weight: 650; line-height: 1;
  opacity: 0; transform: translateY(3px); transition: opacity .3s, transform .3s;
}
/* Like real editors: the name flag shows while someone types, then fades. */
.caret.typing::before, .caret.recent::before { opacity: 1; transform: none; }
.caret.y { --c: var(--amber); }
.caret.t { --c: var(--violet); }
@keyframes blink { 50% { opacity: 0.25; } }
.ce-foot { padding: 12px 18px 4px; color: var(--muted); font-size: 0.76rem; }
.coedit figcaption { margin-top: 16px; color: var(--muted); font-size: 0.85rem; }

/* ══ More work cards ══════════════════════════════════════ */
.more-title { margin: clamp(80px, 13vh, 140px) 0 28px; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 720; font-stretch: 112%; letter-spacing: -0.03em; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card {
  --mx: 50%; --my: 0%;
  position: relative; overflow: hidden; border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  transition: border-color .3s;
}
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--g1) 16%, transparent), transparent 65%);
}
.card:hover { border-color: var(--line-2); }
.card:hover::after { opacity: 1; }
.card-media {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  padding: 0; border: 0; border-bottom: 1px solid var(--line); background: #0f1a21; cursor: zoom-in;
}
.card-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.card:hover .card-media > img { transform: scale(1.035); }
.card-media.mini .view { position: absolute; inset: 0; aspect-ratio: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-body { position: relative; z-index: 1; padding: 24px 26px 28px; }
.card h4 { margin: 0; font-size: 1.45rem; font-weight: 760; font-stretch: 115%; letter-spacing: -0.03em; }
.card .meta { margin-top: 10px; font-size: 0.88rem; }
.card-body > p:not(.meta):not(.stack) { margin: 14px 0 0; color: var(--soft); }
.card details { margin-top: 14px; }
.card summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease); }
.card details[open] summary::before { transform: rotate(45deg); }
.card summary:hover { color: var(--text); }
.card details ul { margin: 10px 0 0; padding-left: 1.1em; }
.card details li { margin: 7px 0; color: var(--soft); font-size: 0.94rem; }
.card details[open] ul { animation: capIn .4s var(--ease); }
.card .stack { margin-top: 16px; }
.card-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; }
.card-links a { color: var(--amber); text-decoration: none; font-weight: 550; font-size: 0.95rem; border-bottom: 1px solid rgba(245, 165, 36, 0.35); transition: border-color .2s; }
.card-links a:hover { border-bottom-color: var(--amber); }

/* ══ Skills ═══════════════════════════════════════════════ */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; margin-top: 36px; }
.skill { padding: 22px 0 26px; border-top: 1px solid var(--line); }
.skill.wide { grid-column: 1 / -1; }
.skill h3 { margin: 0 0 10px; font-size: 0.95rem; font-weight: 550; color: var(--muted); }
.skill p { margin: 4px 0 0; font-size: 1.05rem; color: var(--text); }
.skill.wide p { font-size: clamp(1.1rem, 1.8vw, 1.35rem); font-weight: 500; letter-spacing: -0.01em; }
.skill b { font-family: var(--mono); font-weight: 500; font-size: 0.68em; color: var(--amber); margin-right: 10px; vertical-align: 0.12em; }

/* ══ Education ════════════════════════════════════════════ */
.edu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 56px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.edu header h3 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 740; font-stretch: 112%; letter-spacing: -0.03em; }
.edu header p { margin: 6px 0 0; color: var(--soft); }
.edu .when { color: var(--faint); font-size: 0.92rem; }
.score .big { margin: 0; font-stretch: 125%; font-weight: 800; font-size: clamp(2.6rem, 5.6vw, 4.4rem); line-height: 1; letter-spacing: -0.045em; color: var(--amber); }
.score .gpa { margin: 10px 0 0; font-size: 1.2rem; font-weight: 600; }
.score .score-note { margin: 8px 0 0; color: var(--muted); max-width: 30em; }
.units { grid-column: 1 / -1; width: 100%; border-collapse: collapse; font-size: 0.97rem; margin-top: 8px; }
.units th { text-align: left; font-weight: 500; color: var(--faint); font-size: 0.85rem; padding: 0 4px 10px; border-bottom: 1px solid var(--line); }
.units th:last-child, .units td:last-child { text-align: right; white-space: nowrap; }
.units td { padding: 11px 4px; border-bottom: 1px solid rgba(173, 199, 214, 0.07); color: var(--soft); }
.units code { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); margin-right: 12px; }
.units .g { display: inline-block; min-width: 2.8em; text-align: center; font-family: var(--mono); font-size: 0.72rem; font-weight: 500; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--soft); }
.units .g.hd { background: var(--amber); border-color: var(--amber); color: #1a1205; }
.units .pending td { color: var(--faint); }
.units .pending td:last-child { font-size: 0.85rem; }
.edu-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.95rem; }
.edu.prior { margin-top: 48px; }
.edu.prior > p { margin: 0; color: var(--muted); align-self: center; }

/* ══ Contact ══════════════════════════════════════════════ */
.contact-lede { margin: 20px 0 0; max-width: 30em; font-size: clamp(1.15rem, 2vw, 1.4rem); color: var(--soft); }
.mail {
  display: inline-block; margin-top: 26px;
  font-stretch: 125%; font-weight: 800; font-size: clamp(1.6rem, 6vw, 4.6rem); letter-spacing: -0.045em; line-height: 1.05;
  color: var(--amber); text-decoration: none; overflow-wrap: anywhere;
  background: linear-gradient(var(--amber), var(--amber)) left bottom / 0% 3px no-repeat;
  padding-bottom: 6px; transition: background-size .5s var(--ease);
}
.mail:hover { background-size: 100% 3px; }
.contact-facts { margin: 48px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.contact-facts dt { color: var(--faint); font-size: 0.86rem; margin-bottom: 6px; }
.contact-facts dd { margin: 0; color: var(--soft); }
.contact-facts a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.contact-facts a:hover { text-decoration-color: var(--amber); }
.contact-facts s, .foot s { color: var(--muted); text-decoration-color: var(--amber); text-decoration-thickness: 2px; }

/* ══ Footer ═══════════════════════════════════════════════ */
.foot { max-width: calc(var(--max) + 2 * var(--gutter)); margin: clamp(90px, 14vh, 150px) auto 0; padding: 0 var(--gutter) 48px; color: var(--muted); font-size: 0.88rem; }
.foot-inner { border-top: 1px solid var(--line); padding-top: 26px; }
.foot p { margin: 0; max-width: 48em; }
.foot .built { color: var(--soft); }
.foot .ai { margin-top: 10px; line-height: 1.7; }

/* ══ Lightbox ═════════════════════════════════════════════ */
.lightbox { padding: 0; border: 0; background: transparent; overflow: visible; max-width: 94vw; max-height: 92vh; }
.lightbox::backdrop { background: rgba(4, 9, 12, 0.84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.lightbox[open] { animation: lbIn .35s var(--ease); }
@keyframes lbIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.lightbox img { max-width: min(1500px, 94vw); max-height: 84vh; width: auto; height: auto; border-radius: 12px; box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.9); }
.lb-cap { margin: 14px 0 0; text-align: center; color: var(--soft); font-size: 0.92rem; }
.lb-close {
  position: absolute; top: -50px; right: 0; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06);
}
.lb-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ══ Responsive ═══════════════════════════════════════════ */
@media (max-width: 1080px) {
  .feature-grid, .feature.flip .feature-grid { grid-template-columns: minmax(0, 1fr); }
  .feature.flip .feature-copy { order: 0; }
  .feature-media { max-width: 720px; }
  .feature-glow, .feature.flip .feature-glow {
    background: radial-gradient(50% 30% at 50% 70%, color-mix(in srgb, var(--g1) 24%, transparent), transparent 72%);
  }
  .rc-back, .rc-out { grid-column: span 3; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .edu { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .bar nav { display: none; }
  .bar-end { margin-left: auto; }
  .stage-web, .stage-web.low-card { padding-bottom: 0; }
  .float-card, .feature.flip .float-card {
    position: relative; left: auto; right: auto; bottom: auto;
    display: block; width: 62%; margin: -28px 0 0 auto; transform: rotate(-2deg);
  }
  .skills { grid-template-columns: minmax(0, 1fr); }
  .contact-facts { grid-template-columns: minmax(0, 1fr); }
  .units code { display: block; margin: 0 0 2px; }
  .phones { --pw: clamp(150px, 44vw, 200px); }
  /* Repo map: one column, each panel straight under its folder (DOM order). */
  .repo-grid { grid-template-columns: minmax(0, 1fr); }
  .repo-cell, .rc-shared, .rc-back, .rc-out, .repo-panel { grid-column: 1 / -1; order: 0; }
  .repo-panel-in { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
  .rp-and .repo-sub { order: 0; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .node, .send { grid-row: var(--mr); grid-column: var(--mc); }
  .pipe-wrap { padding: 14px; border-radius: 18px; }
  .card-body { padding: 20px 20px 24px; }
  .repo-cell { padding: 18px 18px 20px; }
  .repo-panel { padding: 4px 18px 22px; }
}

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