/* ==========================================================================
   Feiyu Qu · homepage
   Frosted + liquid glass over a living aurora / agent-network background.
   Plain CSS, no build step. Colors, radii and fonts are tokens at the top.
   ========================================================================== */

:root {
  --font-display: "SF Pro Display", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
                  "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", "Fira Code",
               Menlo, Consolas, "Liberation Mono", monospace;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Kaiti TC", "Songti SC", serif;

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --page: 1120px;
  --gutter: 24px;

  /* ---- light theme ("frosted daylight") ---- */
  --bg: #eef2f7;
  --text: #0b1220;
  --text-2: #2b3648;
  --muted: #586577;
  --accent: #00855a;
  --accent-2: #5a45e0;
  --accent-3: #0369a1;
  --accent-soft: rgba(0, 133, 90, .09);
  --accent-line: rgba(0, 133, 90, .38);
  --accent-glow: rgba(0, 133, 90, .45);
  --line: rgba(15, 23, 42, .09);
  --btn-bg: rgba(255, 255, 255, .55);

  --glass-bg: rgba(255, 255, 255, .5);
  --glass-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .85),
                  0 40px 80px -44px rgba(30, 41, 59, .35),
                  0 14px 34px -18px rgba(30, 41, 59, .2);
  --rim-hi: rgba(255, 255, 255, 1);
  --rim-lo: rgba(255, 255, 255, .3);
  --rim-mid: rgba(255, 255, 255, .75);
  --rim-spot: rgba(0, 133, 90, .6);
  --spot: rgba(255, 255, 255, .45);

  --liquid-bg: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .22));
  --liquid-shadow: 0 12px 32px -14px rgba(30, 41, 59, .35), 0 2px 8px -2px rgba(30, 41, 59, .14);
  --sheen: rgba(255, 255, 255, .55);
  --spec-hi: rgba(255, 255, 255, 1);
  --spec-lo: rgba(255, 255, 255, .7);
  --spec-edge: rgba(255, 255, 255, .55);
  --spec-glow: rgba(255, 255, 255, .25);
  --indicator-bg: rgba(255, 255, 255, .8);

  --code-bg: rgba(255, 255, 255, .55);
  --tag-conf-bg: rgba(0, 133, 90, .09);
  --tag-conf-fg: #00744e;
  --tag-conf-line: rgba(0, 133, 90, .26);
  --tag-jour-bg: rgba(90, 69, 224, .08);
  --tag-jour-fg: #4b37c9;
  --tag-jour-line: rgba(90, 69, 224, .26);
  --scrim: rgba(226, 232, 240, .45);
  --palette-bg: rgba(255, 255, 255, .62);
  --solid: #ffffff;
  --scroll-thumb: rgba(15, 23, 42, .22);

  --a1: #3ee0b4;
  --a2: #a58cff;
  --a3: #6cc4ff;
  --a4: #ffb38a;
  --aurora-opacity: .6;
  --grid: rgba(15, 23, 42, .055);
  --grain: .05;
  --net-rgb: 0, 118, 88;
  --net-rgb-2: 90, 69, 224;
  --accent-rgb: 0, 133, 90;
  --accent-2-rgb: 90, 69, 224;
  --globe-fill-hi: rgba(255, 255, 255, .62);
  --globe-fill-lo: rgba(255, 255, 255, .18);
  --globe-rim: rgba(255, 255, 255, .95);
  --globe-glow: rgba(0, 133, 90, .16);
  --globe-back: .1;
  --figure-filter: none;
  --num: #c2410c;
  --danger: #d92d20;
  --danger-glow: rgba(217, 45, 32, .45);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05070c;
    --text: #eaf0f7;
    --text-2: #c2ccd8;
    --muted: #8a97a8;
    --accent: #4ae3a7;
    --accent-2: #a08fff;
    --accent-3: #6cc8ff;
    --accent-soft: rgba(74, 227, 167, .12);
    --accent-line: rgba(74, 227, 167, .45);
    --accent-glow: rgba(74, 227, 167, .55);
    --line: rgba(255, 255, 255, .08);
    --btn-bg: rgba(255, 255, 255, .04);

    --glass-bg: rgba(14, 18, 28, .48);
    --glass-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .07),
                    0 44px 90px -44px rgba(0, 0, 0, .85),
                    0 14px 34px -18px rgba(0, 0, 0, .6);
    --rim-hi: rgba(255, 255, 255, .3);
    --rim-lo: rgba(255, 255, 255, .04);
    --rim-mid: rgba(255, 255, 255, .13);
    --rim-spot: rgba(74, 227, 167, .75);
    --spot: rgba(255, 255, 255, .055);

    --liquid-bg: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .025));
    --liquid-shadow: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .45);
    --sheen: rgba(255, 255, 255, .1);
    --spec-hi: rgba(255, 255, 255, .6);
    --spec-lo: rgba(255, 255, 255, .22);
    --spec-edge: rgba(255, 255, 255, .1);
    --spec-glow: rgba(255, 255, 255, .05);
    --indicator-bg: rgba(255, 255, 255, .1);

    --code-bg: rgba(3, 6, 11, .45);
    --tag-conf-bg: rgba(74, 227, 167, .1);
    --tag-conf-fg: #62f0bb;
    --tag-conf-line: rgba(74, 227, 167, .28);
    --tag-jour-bg: rgba(160, 143, 255, .12);
    --tag-jour-fg: #b9adff;
    --tag-jour-line: rgba(160, 143, 255, .3);
    --scrim: rgba(2, 4, 8, .5);
    --palette-bg: rgba(13, 17, 26, .66);
    --solid: #0f141d;
    --scroll-thumb: rgba(255, 255, 255, .18);

    --a1: #00b37a;
    --a2: #6a4cff;
    --a3: #0b8bd9;
    --a4: #d9468f;
    --aurora-opacity: .5;
    --grid: rgba(255, 255, 255, .045);
    --grain: .08;
    --net-rgb: 150, 236, 205;
    --net-rgb-2: 170, 158, 255;
    --accent-rgb: 74, 227, 167;
    --accent-2-rgb: 160, 143, 255;
    --globe-fill-hi: rgba(255, 255, 255, .09);
    --globe-fill-lo: rgba(255, 255, 255, .012);
    --globe-rim: rgba(255, 255, 255, .26);
    --globe-glow: rgba(74, 227, 167, .15);
    --globe-back: .07;
    --figure-filter: brightness(.9);
    --num: #f5a97f;
    --danger: #ff6b6b;
    --danger-glow: rgba(255, 107, 107, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #05070c;
  --text: #eaf0f7;
  --text-2: #c2ccd8;
  --muted: #8a97a8;
  --accent: #4ae3a7;
  --accent-2: #a08fff;
  --accent-3: #6cc8ff;
  --accent-soft: rgba(74, 227, 167, .12);
  --accent-line: rgba(74, 227, 167, .45);
  --accent-glow: rgba(74, 227, 167, .55);
  --line: rgba(255, 255, 255, .08);
  --btn-bg: rgba(255, 255, 255, .04);

  --glass-bg: rgba(14, 18, 28, .48);
  --glass-shadow: inset 0 1px 0 0 rgba(255, 255, 255, .07),
                  0 44px 90px -44px rgba(0, 0, 0, .85),
                  0 14px 34px -18px rgba(0, 0, 0, .6);
  --rim-hi: rgba(255, 255, 255, .3);
  --rim-lo: rgba(255, 255, 255, .04);
  --rim-mid: rgba(255, 255, 255, .13);
  --rim-spot: rgba(74, 227, 167, .75);
  --spot: rgba(255, 255, 255, .055);

  --liquid-bg: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .025));
  --liquid-shadow: 0 12px 32px -12px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .45);
  --sheen: rgba(255, 255, 255, .1);
  --spec-hi: rgba(255, 255, 255, .6);
  --spec-lo: rgba(255, 255, 255, .22);
  --spec-edge: rgba(255, 255, 255, .1);
  --spec-glow: rgba(255, 255, 255, .05);
  --indicator-bg: rgba(255, 255, 255, .1);

  --code-bg: rgba(3, 6, 11, .45);
  --tag-conf-bg: rgba(74, 227, 167, .1);
  --tag-conf-fg: #62f0bb;
  --tag-conf-line: rgba(74, 227, 167, .28);
  --tag-jour-bg: rgba(160, 143, 255, .12);
  --tag-jour-fg: #b9adff;
  --tag-jour-line: rgba(160, 143, 255, .3);
  --scrim: rgba(2, 4, 8, .5);
  --palette-bg: rgba(13, 17, 26, .66);
  --solid: #0f141d;
  --scroll-thumb: rgba(255, 255, 255, .18);

  --a1: #00b37a;
  --a2: #6a4cff;
  --a3: #0b8bd9;
  --a4: #d9468f;
  --aurora-opacity: .5;
  --grid: rgba(255, 255, 255, .045);
  --grain: .08;
  --net-rgb: 150, 236, 205;
  --net-rgb-2: 170, 158, 255;
  --accent-rgb: 74, 227, 167;
  --accent-2-rgb: 160, 143, 255;
  --globe-fill-hi: rgba(255, 255, 255, .09);
  --globe-fill-lo: rgba(255, 255, 255, .012);
  --globe-rim: rgba(255, 255, 255, .26);
  --globe-glow: rgba(74, 227, 167, .15);
  --globe-back: .07;
  --figure-filter: brightness(.9);
  --num: #f5a97f;
  --danger: #ff6b6b;
  --danger-glow: rgba(255, 107, 107, .5);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  scrollbar-color: var(--scroll-thumb) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
strong { color: var(--text); font-weight: 600; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
button { font: inherit; color: inherit; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: var(--btn-bg);
  color: var(--muted);
  font: 500 .7rem/1 var(--font-mono);
  text-align: center;
}

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg);
}
.skip-link:focus { top: 16px; }

.fx { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Icons */
.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; }

/* ==========================================================================
   Background: aurora + network canvas + grid + grain
   ========================================================================== */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.aurora span {
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
  opacity: var(--aurora-opacity);
  will-change: transform;
}
.aurora span:nth-child(1) {
  top: -34vmax; left: -22vmax;
  background: radial-gradient(closest-side, var(--a1), transparent);
  animation: drift-1 34s ease-in-out infinite alternate;
}
.aurora span:nth-child(2) {
  top: -30vmax; right: -26vmax;
  background: radial-gradient(closest-side, var(--a2), transparent);
  animation: drift-2 41s ease-in-out infinite alternate;
}
.aurora span:nth-child(3) {
  bottom: -40vmax; left: -10vmax;
  background: radial-gradient(closest-side, var(--a3), transparent);
  animation: drift-3 47s ease-in-out infinite alternate;
}
.aurora span:nth-child(4) {
  bottom: -42vmax; right: -30vmax;
  width: 60vmax; height: 60vmax;
  background: radial-gradient(closest-side, var(--a4), transparent);
  opacity: calc(var(--aurora-opacity) * .7);
  animation: drift-4 38s ease-in-out infinite alternate;
}
@keyframes drift-1 { to { transform: translate3d(22vmax, 16vmax, 0) scale(1.12); } }
@keyframes drift-2 { to { transform: translate3d(-18vmax, 22vmax, 0) scale(.9); } }
@keyframes drift-3 { to { transform: translate3d(26vmax, -18vmax, 0) scale(1.15); } }
@keyframes drift-4 { to { transform: translate3d(-20vmax, -14vmax, 0) scale(1.1); } }

#net { position: absolute; inset: 0; width: 100%; height: 100%; }

.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 100%);
}

.grain {
  position: absolute; inset: 0;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ==========================================================================
   Materials
   ========================================================================== */

/* Frosted glass: content cards. */
.glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--r-xl);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
  backdrop-filter: blur(26px) saturate(165%);
  box-shadow: var(--glass-shadow);
}
/* Hairline rim that catches light, plus a glow that follows the cursor along the edge. */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background:
    radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), var(--rim-spot), transparent 70%),
    linear-gradient(155deg, var(--rim-hi), var(--rim-lo) 32%, var(--rim-lo) 68%, var(--rim-mid));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* Soft specular sheen under the content, following the cursor. */
.glass.spot::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -30%), var(--spot), transparent 55%);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.glass.spot:hover::after { opacity: 1; }

/* Liquid glass: clear, thick-rimmed controls. main.js adds edge refraction in Chromium. */
.liquid {
  position: relative;
  isolation: isolate;
  background: var(--liquid-bg);
  -webkit-backdrop-filter: blur(12px) saturate(185%);
  backdrop-filter: blur(12px) saturate(185%);
  box-shadow: var(--liquid-shadow);
}
.liquid::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, var(--sheen), transparent 48%);
  box-shadow:
    inset 1.5px 1.5px 1px -1px var(--spec-hi),
    inset -1.5px -1.5px 1px -1px var(--spec-lo),
    inset 0 0 0 1px var(--spec-edge),
    inset 0 0 22px 0 var(--spec-glow);
}

/* ==========================================================================
   Dock (top navigation)
   ========================================================================== */
.dock-wrap {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}
.dock {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-pill);
  pointer-events: auto;
}
.logo {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  color: var(--text);
  font: 800 .98rem/1 var(--font-mono);
  letter-spacing: -.03em;
}
.logo:hover { text-decoration: none; }
.caret { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.dock-links { position: relative; display: flex; }
.dock-links a {
  position: relative; z-index: 1;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font: 500 .84rem/1 var(--font-mono);
  transition: color .25s var(--ease);
}
.dock-links a:hover, .dock-links a.active { color: var(--text); text-decoration: none; }
.dock-indicator {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--indicator-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px -6px rgba(0, 0, 0, .35);
  opacity: 0;
  transition: transform .55s var(--spring), width .55s var(--spring), opacity .3s var(--ease);
}
.dock-sep { width: 1px; height: 22px; margin: 0 6px; background: var(--line); }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--btn-bg); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  align-items: center;
  gap: 56px;
  max-width: var(--page);
  min-height: min(100vh, 920px);
  margin: 0 auto;
  padding: 150px var(--gutter) 90px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font: 500 .8rem/1 var(--font-mono);
  letter-spacing: .02em;
}
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}
.pulse-red { background: var(--danger); --pulse-glow: var(--danger-glow); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--pulse-glow, var(--accent-glow)); }
  70%, 100% { box-shadow: 0 0 0 12px transparent; }
}

.name {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 22px;
  font: 800 clamp(2.9rem, 7.4vw, 6.2rem)/.95 var(--font-display);
  letter-spacing: -.05em;
  white-space: nowrap;
  background: linear-gradient(100deg, var(--text) 0%, var(--text) 42%, var(--accent) 72%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.name .nick {
  margin: 0 .04em;
  font-size: .38em;
  font-weight: 700;
  letter-spacing: -.02em;
  vertical-align: .62em;
}

.role {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: clamp(1.08rem, 1.9vw, 1.3rem);
  line-height: 1.5;
}
.role .at { color: var(--accent); font-family: var(--font-mono); }
.role a { color: var(--text); font-weight: 600; }

.tagline {
  max-width: 32em;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 1.04rem;
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 17px;
  border-radius: var(--r-pill);
  color: var(--text);
  font: 500 .86rem/1 var(--font-mono);
  transition: translate .3s var(--spring), color .2s var(--ease);
}
.chip:hover { translate: 0 -2px; color: var(--accent); text-decoration: none; }
.chip svg { width: 16px; height: 16px; flex: none; }

/* Terminal */
.terminal { margin: 0; border-radius: var(--r-lg); overflow: hidden; }
.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.dots { display: inline-flex; gap: 7px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.term-title {
  flex: 1;
  margin-right: 52px;
  color: var(--muted);
  font: 500 .74rem/1 var(--font-mono);
  text-align: center;
}
.term-body {
  min-height: 268px;
  padding: 20px 22px 24px;
  color: var(--muted);
  font: .86rem/1.8 var(--font-mono);
}
.term-body .ln { display: block; white-space: pre-wrap; }
.term-body .cmd { color: var(--text); }
.term-body .ps { color: var(--accent-3); }
.term-body .arw, .term-body .hl { color: var(--accent); }
.cursor {
  display: inline-block;
  width: .6em; height: 1.1em;
  margin-left: 1px;
  vertical-align: -.18em;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Lens: sits on the terminal's top-right corner so its refraction shows the window edge. */
.term-stack { position: relative; }
.lens-wrap {
  position: absolute;
  top: -74px;
  right: -52px;
  z-index: 5;
}
.lens.liquid {
  width: 168px; height: 168px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(120% 120% at 30% 22%, rgba(255, 255, 255, .14), transparent 42%),
    radial-gradient(90% 90% at 75% 85%, rgba(140, 200, 255, .1), transparent 60%);
  -webkit-backdrop-filter: blur(2px) saturate(140%) brightness(1.04);
  backdrop-filter: blur(2px) saturate(140%) brightness(1.04);
  box-shadow: 0 34px 60px -24px rgba(0, 0, 0, .55), 0 10px 24px -12px rgba(0, 0, 0, .35);
  animation: bob 9s ease-in-out infinite;
}
.lens.liquid::after {
  content: "";
  position: absolute;
  top: 13%; left: 21%;
  width: 34%; height: 17%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .7), transparent);
  transform: rotate(-30deg);
  pointer-events: none;
}
.lens.grabbing { cursor: grabbing; animation-play-state: paused; }
@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -14px, 0) rotate(6deg); }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  max-width: var(--page);
  margin: 0 auto;
  padding: 72px var(--gutter);
}
.section-head { margin-bottom: 28px; }
.section-head .eyebrow::after {
  content: "";
  width: 72px; height: 1px;
  margin-left: 4px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.idx { color: var(--accent); }
.section-head h2 {
  margin: 0;
  font: 750 clamp(2.1rem, 4.6vw, 3.1rem)/1.05 var(--font-display);
  letter-spacing: -.035em;
}
.section-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font: 500 .8rem/1.4 var(--font-mono);
}
.section-meta sup, .authors sup { margin-left: 1px; font-size: .75em; line-height: 0; color: var(--accent); }

.card { padding: 30px 32px; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.bio { display: flex; flex-direction: column; }
.bio p { margin: 0 0 16px; color: var(--text-2); font-size: 1.06rem; line-height: 1.75; }
.bio .tags { margin-top: auto; padding-top: 6px; }
.bio p:last-child { margin-bottom: 0; }

.code-card { margin: 0; padding: 0; overflow: hidden; }
.code-card figcaption {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 500 .76rem/1 var(--font-mono);
}
.file-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.code-card pre {
  margin: 0;
  padding: 20px 22px 24px;
  overflow-x: auto;
  color: var(--text-2);
  font: .84rem/1.8 var(--font-mono);
}
.tk-k { color: var(--accent-3); }
.tk-s { color: var(--accent); }
.tk-p { color: var(--muted); }

/* Publications */
.pubs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.pub {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  padding: 24px;
  transition: translate .45s var(--ease);
}
.pub:hover { translate: 0 -3px; }
.pub-body { min-width: 0; padding-top: 4px; }

/* Overview figure on the left of each paper; click opens the lightbox. */
.pub-figure {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 10px;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 16px 32px -20px rgba(0, 0, 0, .6);
  filter: var(--figure-filter);
  cursor: zoom-in;
}
.pub-figure img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform .6s var(--ease);
}
.pub-figure.fit-top img { object-fit: cover; object-position: top center; }
.pub-figure:hover img { transform: scale(1.045); }
.pub-figure::after {
  content: "";
  position: absolute; right: 10px; bottom: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(8, 12, 18, .62) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 14px no-repeat;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s var(--ease), transform .3s var(--spring);
}
.pub-figure:hover::after, .pub-figure:focus-visible::after { opacity: 1; transform: none; }

.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.venue-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--tag-conf-line);
  border-radius: var(--r-pill);
  background: var(--tag-conf-bg);
  color: var(--tag-conf-fg);
  font: 600 .74rem/1 var(--font-mono);
  letter-spacing: .02em;
}
.venue-tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.venue-tag.journal { border-color: var(--tag-jour-line); background: var(--tag-jour-bg); color: var(--tag-jour-fg); }
.flag {
  padding: 5px 11px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-pill);
  color: var(--accent);
  font: 500 .72rem/1 var(--font-mono);
}

.pub-title { margin: 0 0 10px; font: 650 1.14rem/1.4 var(--font-display); letter-spacing: -.012em; }
.pub-title a {
  color: var(--text);
  background: linear-gradient(90deg, var(--accent), var(--accent-2)) 0 100% / 0 1.5px no-repeat;
  transition: background-size .45s var(--ease);
}
.pub-title a:hover { background-size: 100% 1.5px; text-decoration: none; }
.authors { margin: 0 0 4px; color: var(--text-2); font-size: .95rem; }
.me {
  padding-bottom: 1px;
  color: var(--text);
  font-weight: 650;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)) 0 100% / 100% 2px no-repeat;
}
.venue { margin: 0; color: var(--muted); font-size: .9rem; font-style: italic; }

.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--text-2);
  font: 500 .76rem/1 var(--font-mono);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease), translate .3s var(--spring);
}
.btn:hover, .btn[aria-expanded="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  translate: 0 -1px;
}
.btn svg { width: 13px; height: 13px; flex: none; }

.bibtex {
  position: relative;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--code-bg);
  animation: unfold .4s var(--ease);
}
.bibtex pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--text-2);
  font: .78rem/1.7 var(--font-mono);
}
.bibtex .copy-btn { position: absolute; top: 10px; right: 10px; z-index: 1; }
.bib-type { color: var(--accent-2); }
.bib-key { color: var(--text); }
.bib-field { color: var(--accent-3); }
.bib-val { color: var(--accent); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }

.more { margin: 22px 0 0; color: var(--muted); font-size: .92rem; }

/* News (optional section) */
.news { display: grid; gap: 10px; margin: 0; list-style: none; }
.news li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 16px; }
.news time { color: var(--accent); font: 500 .84rem/1.9 var(--font-mono); }

/* Contact */
.contact-card { display: grid; gap: 14px; padding: 38px 40px; }
.prompt-line { margin: 0; color: var(--muted); font: 500 .86rem/1 var(--font-mono); }
.prompt-line .ps { color: var(--accent-3); }
.prompt-line .arw { color: var(--accent); }
.email-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin: 0;
}
.email-line a {
  color: var(--text);
  font: 700 clamp(1rem, 4.2vw, 2.1rem)/1.2 var(--font-mono);
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.email-line a:hover { color: var(--accent); text-decoration: none; }
.contact-note { margin: 4px 0 0; color: var(--muted); }

/* Status bar (footer) */
.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  width: min(var(--page) - 2 * var(--gutter), calc(100% - 2 * var(--gutter)));
  margin: 48px auto max(24px, env(safe-area-inset-bottom));
  padding: 11px 20px;
  border-radius: 18px;
  color: var(--muted);
  font: 500 .74rem/1.5 var(--font-mono);
}
.sb-item { display: inline-flex; align-items: center; gap: 7px; }
.sb-item svg { width: 13px; height: 13px; }
.sb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.sb-grow { flex: 1; }
.sb-btn { padding: 0; border: 0; background: none; cursor: pointer; }
.sb-btn:hover kbd { color: var(--accent); border-color: var(--accent-line); }

/* ==========================================================================
   Command palette + toast
   ========================================================================== */
.palette {
  position: fixed; inset: 0; z-index: 100;
  display: grid;
  place-items: start center;
  padding: 13vh 16px 16px;
}
.palette-scrim {
  position: absolute; inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade .2s var(--ease);
}
.palette-panel.liquid {
  width: min(600px, 100%);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--palette-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  animation: rise .32s var(--spring);
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.palette-input svg { width: 18px; height: 18px; flex: none; }
.palette-input input {
  flex: 1;
  min-width: 0;
  border: 0; outline: 0;
  background: none;
  color: var(--text);
  font: 500 1rem/1.4 var(--font-sans);
}
.palette-input input::placeholder { color: var(--muted); }
#palette-list { position: relative; max-height: min(50vh, 420px); margin: 0; padding: 8px; overflow-y: auto; list-style: none; }
.cmd-group {
  padding: 12px 12px 6px;
  color: var(--muted);
  font: 600 .66rem/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: .93rem;
  cursor: pointer;
}
.cmd-item[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.cmd-item[aria-selected="true"] .cmd-icon { color: var(--accent); }
.cmd-icon { width: 16px; color: var(--muted); font: 500 .9rem/1 var(--font-mono); text-align: center; }
.cmd-hint { margin-left: auto; color: var(--muted); font: 500 .72rem/1 var(--font-mono); }
.cmd-empty { padding: 18px 12px; color: var(--muted); font: 500 .85rem var(--font-mono); }
.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 .72rem/1.6 var(--font-mono);
}
.palette-foot kbd { margin-right: 2px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.toast {
  position: fixed;
  left: 50%; bottom: 30px;
  z-index: 150;
  padding: 11px 18px;
  border-radius: var(--r-pill);
  color: var(--text);
  font: 500 .8rem/1 var(--font-mono);
  pointer-events: none;
  opacity: 0;
  translate: -50% 24px;
  transition: opacity .3s var(--ease), translate .45s var(--spring);
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ==========================================================================
   Reveal on scroll (JS adds .in)
   ========================================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(22px) scale(.985);
  transition: opacity .9s var(--ease), transform .9s var(--ease), translate .45s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   Affiliations (hero lines + about cards with crests)
   ========================================================================== */
.hero-affil {
  display: grid;
  gap: 9px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: clamp(1rem, 1.7vw, 1.08rem);
  line-height: 1.45;
}
.hero-affil li { display: flex; align-items: center; gap: 12px; }
.hero-affil .at { color: var(--accent); font-family: var(--font-mono); }
.hero-affil a { color: var(--text); font-weight: 600; }
.crest-sm {
  flex: none;
  width: 28px; height: 28px;
  padding: 3px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 6px 14px -6px rgba(0, 0, 0, .45);
  object-fit: contain;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.tags li {
  padding: 6px 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 .76rem/1 var(--font-mono);
}

/* "Seeking PhD" badge (hero), inline pill, and the matching lines in About / Contact */
.seeking {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 10px 16px 10px 13px;
  border-radius: var(--r-pill);
  color: var(--text);
  font: 600 .84rem/1 var(--font-mono);
  transition: translate .3s var(--spring);
}
.seeking strong { color: var(--accent); font-weight: 700; }
.seeking svg { width: 15px; height: 15px; transition: translate .3s var(--spring); }
.seeking:hover { translate: 0 -2px; text-decoration: none; }
.seeking:hover svg { translate: 3px 0; }
.pill {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 9px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 .7rem/1.2 var(--font-mono);
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: 2px;
}
.hero-affil .nw { white-space: nowrap; }
.hero-affil .pill { font-size: .66rem; vertical-align: 2px; }
.bio .seeking-line { display: flex; align-items: center; gap: 11px; color: var(--danger); font-weight: 500; }
.bio .seeking-line strong { color: inherit; }
.bio .seeking-line .pulse { flex: none; }
.seeking-note strong { color: var(--accent); }
/* Education + experience: compact lists in About's right column */
.cv-col { display: grid; gap: 16px; align-content: start; }
.cv-card { padding: 18px 22px 6px; }
.cv-title {
  margin: 0 0 4px;
  color: var(--muted);
  font: 600 .68rem/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.cv-list { margin: 0; padding: 0; list-style: none; }
.cv-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}
.cv-item + .cv-item { border-top: 1px solid var(--line); }
.crest {
  flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 8px 18px -10px rgba(0, 0, 0, .5);
}
.crest img { width: 34px; height: 34px; object-fit: contain; }
.cv-body { min-width: 0; }
.cv-body p { margin: 0; }
.cv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 10px;
  font: 650 .95rem/1.35 var(--font-display);
  letter-spacing: -.01em;
}
.cv-head a, .cv-head > span:first-child { color: var(--text); }
.cv-when { color: var(--accent); font: 600 .7rem/1.6 var(--font-mono); white-space: nowrap; }
.cv-item.now .cv-when::before { content: "● "; }
.cv-role { margin-top: 2px !important; color: var(--text-2); font-size: .87rem; line-height: 1.45; }
.cv-meta { margin-top: 2px !important; color: var(--muted); font: 500 .7rem/1.55 var(--font-mono); }

/* ==========================================================================
   Blog cards (homepage teaser and /blog/)
   ========================================================================== */
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 176px;
  padding: 24px 26px;
  color: var(--text);
  transition: translate .45s var(--ease);
}
.post-card:hover { translate: 0 -3px; text-decoration: none; }
.post-date { color: var(--accent); font: 500 .74rem/1 var(--font-mono); }
.post-title { font: 650 1.14rem/1.35 var(--font-display); letter-spacing: -.012em; }
.post-excerpt { color: var(--muted); font-size: .93rem; line-height: 1.6; }
.post-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: auto;
  padding-top: 6px;
  color: var(--muted);
  font: 500 .72rem/1.4 var(--font-mono);
}
.post-tag { color: var(--accent-2); }

/* ==========================================================================
   Life: travel globe + hobby galleries
   ========================================================================== */
.travel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin-bottom: 16px;
  padding: 26px 30px;
}
.globe-wrap { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1; justify-self: center; }
#globe { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#globe.dragging { cursor: grabbing; }
#globe.hovering { cursor: pointer; }
.globe-tip {
  position: absolute; left: 0; top: 0; z-index: 2;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--text);
  font: 600 .8rem/1.35 var(--font-mono);
  white-space: nowrap;
  pointer-events: none;
  translate: -50% calc(-100% - 14px);
}
.globe-tip small { display: block; color: var(--muted); font-weight: 500; font-size: .68rem; }
.globe-hint {
  position: absolute; left: 50%; bottom: 0;
  margin: 0;
  color: var(--muted);
  font: 500 .7rem/1 var(--font-mono);
  white-space: nowrap;
  pointer-events: none;
  translate: -50% 0;
}

.hobby-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 6px;
  font: 700 1.28rem/1.2 var(--font-display);
  letter-spacing: -.02em;
}
.hobby-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
}
.hobby-icon svg { width: 18px; height: 18px; }
.travel-stats { margin: 0 0 18px; color: var(--muted); font: 500 .8rem/1.5 var(--font-mono); }
.place-groups { display: grid; gap: 14px; }
.place-group h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font: 600 .66rem/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.place-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.place-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--text-2);
  font: 500 .74rem/1 var(--font-mono);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.place-etc { align-self: center; padding: 0 4px; color: var(--muted); font: 500 .76rem/1 var(--font-mono); }
.place-chip.base { border-color: var(--accent-line); color: var(--accent); }
.place-chip:hover, .place-chip.active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

.hobbies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hobby { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.media > img, .media > video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--code-bg);
  cursor: zoom-in;
}
.media > :first-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
/* Empty frame ("留白") until photos or videos are added. */
.media.is-empty {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background:
    radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 70%),
    repeating-linear-gradient(135deg, transparent 0 11px, var(--line) 11px 12px);
}
.media.is-empty[data-glyph="brush"]::before {
  content: "";
  inset: 22% 34%;
  background: var(--text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 4c-6 1-10 6-12 12l-2 4 4-2c6-2 11-6 12-12Z'/%3E%3Cpath d='M14 10 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 4c-6 1-10 6-12 12l-2 4 4-2c6-2 11-6 12-12Z'/%3E%3Cpath d='M14 10 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.media.is-empty::before {
  content: attr(data-glyph);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text);
  font: 400 clamp(4rem, 8vw, 6.2rem)/1 var(--font-kai);
  opacity: .1;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 28px; }
.lightbox-scrim {
  position: absolute; inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fade .2s var(--ease);
}
.lightbox-panel {
  display: grid;
  gap: 10px;
  max-width: min(1240px, 100%);
  max-height: 100%;
  margin: 0;
  padding: 14px;
  border-radius: var(--r-lg);
  animation: rise .32s var(--spring);
}
.lightbox-stage img, .lightbox-stage video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  margin: 0 auto;
  border-radius: 12px;
  background: #fff;
}
.lightbox-stage video { background: #000; }
.lightbox-caption { padding: 0 6px 2px; color: var(--text-2); font: 500 .78rem/1.5 var(--font-mono); }
.lightbox-close, .lightbox-nav {
  position: absolute;
  background: var(--palette-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px var(--line), 0 10px 24px -10px rgba(0, 0, 0, .6);
  color: var(--text);
}
.lightbox-close { top: -14px; right: -14px; }
.lightbox-nav { top: 50%; translate: 0 -50%; }
.lightbox-nav.prev { left: -18px; }
.lightbox-nav.next { right: -18px; }

/* ==========================================================================
   Blog pages (Jekyll layouts)
   ========================================================================== */
.page-narrow { max-width: 860px; margin: 0 auto; padding: 120px var(--gutter) 24px; }
.page-wide { max-width: var(--page); margin: 0 auto; padding: 120px var(--gutter) 24px; }
.read-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 3px; pointer-events: none; }
.read-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}
.post-article { padding: 46px 54px 50px; }
.post-head h1 {
  margin: 10px 0 14px;
  font: 800 clamp(2.1rem, 5vw, 3.2rem)/1.08 var(--font-display);
  letter-spacing: -.04em;
}
.post-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  color: var(--muted);
  font: 500 .78rem/1.6 var(--font-mono);
}
.prose { margin-top: 32px; color: var(--text-2); font-size: 1.04rem; line-height: 1.8; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { color: var(--text); font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.25; }
.prose h2 { margin: 2em 0 .6em; font-size: 1.6rem; }
.prose h3 { margin: 1.7em 0 .5em; font-size: 1.25rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li + li { margin-top: .3em; }
.prose a { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.prose strong { color: var(--text); }
.prose blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--text);
  font: .86em var(--font-mono);
}
.prose pre {
  margin: 1.4em 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--code-bg);
  font: .84rem/1.7 var(--font-mono);
}
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.prose img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: var(--r-md); }
.prose table { width: 100%; margin: 1.4em 0; border-collapse: collapse; font-size: .92rem; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { color: var(--text); font-weight: 600; }
.prose hr { height: 1px; margin: 2.4em 0; border: 0; background: var(--line); }
.prose .abstract {
  margin: 0 0 2.2em;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--code-bg);
  font-size: .98rem;
}
.prose .abstract > :last-child { margin-bottom: 0; }
.prose .katex { font-size: 1.05em; }
.prose .katex-display { margin: 1.1em 0; padding: 4px 2px; overflow-x: auto; overflow-y: hidden; }
.prose figure { margin: 2em 0; }
.prose .fig-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.prose .fig-row img {
  width: 100%;
  height: auto;
  margin: 0;
  aspect-ratio: 3 / 2;
  padding: 8px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  filter: var(--figure-filter);
}
.prose figcaption { grid-column: 1 / -1; margin-top: 8px; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.prose .refs { padding-left: 1.6em; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.prose .refs li { margin: .55em 0; padding: 2px 6px; border-radius: 8px; scroll-margin-top: 100px; }
.prose .refs li:target { background: var(--accent-soft); color: var(--text); }
@media (max-width: 640px) {
  .prose .fig-row { grid-template-columns: minmax(0, 1fr); }
}
/* Rouge (kramdown) syntax colours */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cp, .highlight .cd { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kc, .highlight .nd { color: var(--accent-2); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se,
.highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl { color: var(--accent); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: var(--num); }
.highlight .nf, .highlight .fm, .highlight .nc, .highlight .nn, .highlight .nb, .highlight .bp, .highlight .nt { color: var(--accent-3); }
.highlight .na, .highlight .nv, .highlight .vi { color: var(--text); }
.highlight .gd { color: #ef6461; }
.highlight .gi { color: var(--accent); }

.post-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.post-nav a { display: grid; gap: 6px; padding: 18px 22px; color: var(--text); }
.post-nav a:hover { text-decoration: none; }
.post-nav .next { text-align: right; grid-column: 2; }
.post-nav small { color: var(--muted); font: 500 .72rem/1 var(--font-mono); }
.section-head .blog-title {
  margin: 0;
  font: 800 clamp(2.4rem, 6vw, 3.6rem)/1.02 var(--font-display);
  letter-spacing: -.045em;
}
.statusbar a { color: inherit; }
.statusbar a:hover { color: var(--accent); text-decoration: none; }
.prose kbd { font-size: .78em; }
.year-label { margin: 28px 0 12px; color: var(--accent); font: 600 .8rem/1 var(--font-mono); letter-spacing: .06em; }
.post-index { display: grid; gap: 14px; }
.post-index .post-card { min-height: 0; }

/* ==========================================================================
   404 page
   ========================================================================== */
.notfound {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px var(--gutter);
}
.notfound .card { width: min(560px, 100%); }
.notfound h1 { margin: 6px 0 12px; font: 750 clamp(2.4rem, 7vw, 3.4rem)/1 var(--font-display); letter-spacing: -.04em; }
.notfound .term-body { min-height: 0; padding: 0; margin: 18px 0 24px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
/* Keep the lens inside the viewport once the side margins get narrow. */
@media (max-width: 1199px) {
  .lens-wrap { right: -14px; }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    min-height: 0;
    padding-top: 132px;
    padding-bottom: 56px;
  }
  .lens-wrap { top: -56px; right: -10px; }
  .lens.liquid { width: 128px; height: 128px; }
}

@media (max-width: 980px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .cv-col { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 680px) {
  .cv-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .sb-hide-sm { display: none; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  body { font-size: 15.5px; }
  .dock-links a { padding: 9px 9px; font-size: .8rem; }
  .logo { padding: 9px 9px 9px 11px; }
  .dock-sep { margin: 0 2px; }
  .icon-btn { width: 34px; height: 34px; }
  .hero { padding-top: 118px; gap: 36px; }
  .lens-wrap { top: -46px; right: -4px; }
  .lens.liquid { width: 96px; height: 96px; }
  .section { padding-top: 52px; padding-bottom: 52px; }
  .card, .pub { padding: 22px 20px; }
  .contact-card { padding: 26px 22px; }
  .term-body { min-height: 0; padding: 16px 16px 20px; font-size: .8rem; }
  .term-title { margin-right: 0; text-align: right; }
  .code-card pre { padding: 16px 16px 20px; font-size: .8rem; }
  .news li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* New sections (papers with figures, life, blog pages) */
@media (max-width: 980px) {
  .travel { grid-template-columns: minmax(0, 1fr); }
  .hobbies { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .pub { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .pub-body { padding-top: 0; }
  .post-article { padding: 30px 24px 34px; }
  .page-narrow, .page-wide { padding-top: 100px; }
}
@media (max-width: 560px) {
  .dock-links a { padding: 9px 7px; }
  .seeking { font-size: .8rem; }
  .hobbies { grid-template-columns: minmax(0, 1fr); }
  .travel { padding: 18px; gap: 18px; }
  .cv-card { padding: 16px 16px 4px; }
  .lightbox { padding: 12px; }
  .lightbox-close { top: 8px; right: 8px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav .next { grid-column: auto; }
}

/* Very narrow phones (e.g. 320px): tighten the dock so it fits. */
@media (max-width: 360px) {
  .dock { padding: 5px; }
  .logo { padding: 9px 6px 9px 9px; }
  .dock-links a { padding: 9px 5px; font-size: .74rem; }
  .dock-sep { display: none; }
  .icon-btn { width: 30px; height: 30px; }
  .seeking { gap: 8px; padding: 9px 13px 9px 11px; font-size: .72rem; }
  .hero-affil .nw { white-space: normal; }
}

@media (hover: none) {
  .sb-btn { display: none; }
}

/* ==========================================================================
   Accessibility & fallbacks
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass, .liquid, .lens.liquid, .palette-panel.liquid, .lightbox-close, .lightbox-nav {
    background: var(--solid) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass, .liquid, .palette-panel.liquid { background: var(--solid); }
}

@media print {
  .bg, .dock-wrap, .lens-wrap, .statusbar, .palette, .toast, .pub-actions, .bibtex, .skip-link,
  .lightbox, .globe-wrap, .read-progress, .hobbies { display: none !important; }
  body { background: #fff; color: #000; }
  .glass { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass::before, .glass::after { display: none; }
  .name { color: #000; background: none; }
  .js .reveal { opacity: 1; transform: none; }
}
