/* site.css — public site「星夜远行」design (home + post pages).
 *
 * Section 4.1 of docs/superpowers/specs/2026-10-13-aesthetic-redesign-design.md
 * is the source of truth for every token below. Components reference tokens
 * only; never hard-code colors outside :root (canvas reads them too).
 *
 * Layout of this file (each work package appends only inside its region):
 *   base     tokens · reset · typography · container · nav · search · footer ·
 *            reveal · G2 section heads · starfield / spotlight layers   (WP0)
 *   region:hero        hero · constellation · star rail                  (WP1)
 *   region:sections    about · journey · writing · works · thoughts ·
 *                      moments · lightbox · G1/G3 helpers                (WP2)
 *   region:footprint   globe stage / panel / F1 / F3                     (WP4)
 */

:root {
  /* 背景与文字 */
  --bg-0: #030305;
  --bg-1: #07080d;
  --bg-glow: #16203a;
  --text: #e9e7e2;
  --text-strong: #fbf5e6;
  --muted: #8b8fa0;
  --muted-2: #5d6070;

  /* 金 */
  --gold: #e8c58a;
  --gold-hi: #f3dcae;
  --gold-lo: #c99a52;
  --gold-rgb: 232, 197, 138;
  --hairline: rgba(232, 197, 138, .18);
  --glass: rgba(10, 12, 20, .72);

  /* 字体 */
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-num: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* 动效 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 180ms;
  --t-mid: 480ms;
  --t-slow: 900ms;

  /* 布局 */
  --nav-h: 64px;
  --container: 1080px;
  --read-w: 680px;

  /* 地球（globe.js readTheme() 读取，名称不得改动） */
  --accent: #e8c58a;
  --accent-2: #f3dcae;
  --accent-rgb: 232, 197, 138;
  --accent-2-rgb: 243, 220, 174;
  --overlay-rgb: 10, 12, 20;
  --globe-ocean1: #0d1426;
  --globe-ocean2: #05070d;
  --globe-land: #1a2236;
  --globe-land-line: #2a3450;
  --globe-border: #2f3a58;
  --globe-region: rgba(26, 34, 54, .7);
  --globe-region-line: #34405f;

  color-scheme: dark;
}

@view-transition { navigation: auto; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 16px/1.8 var(--font-sans);
  color: var(--text);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* Fixed night-sky gradient; does not scroll with the page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background: radial-gradient(120% 90% at 70% 0%, var(--bg-glow) 0%, var(--bg-1) 55%, var(--bg-0) 100%);
  pointer-events: none;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
::selection { background: rgba(var(--gold-rgb), .32); color: var(--text-strong); }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- starfield / spotlight / stardust layers ---------- */
#starfield, .stardust {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#starfield { z-index: -2; opacity: 0; transition: opacity 1.2s var(--ease); }
#starfield.is-in { opacity: 1; }
html:not(.js) #starfield { display: none; }
.stardust { z-index: 60; }
.spotlight {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  --mx: -999px;
  --my: -999px;
  background: radial-gradient(380px circle at var(--mx) var(--my), rgba(var(--gold-rgb), .11), transparent 65%);
}

/* ---------- glass nav ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background var(--t-mid) var(--ease), border-color var(--t-mid) var(--ease);
}
.site-nav.is-solid {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: var(--hairline);
}
html.no-blur .site-nav.is-solid { background: var(--bg-1); -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav-inner { height: 100%; display: flex; align-items: center; gap: 20px; max-width: none; }
.brand {
  font: 600 15px/1 var(--font-serif);
  letter-spacing: .2em;
  color: var(--gold-hi);
  white-space: nowrap;
  transition: color var(--t-fast);
}
.brand:hover { color: var(--text-strong); }
.nav-spacer { flex: 1; }
.nav-link {
  position: relative;
  font-size: 13px;
  color: var(--muted);
  transition: color var(--t-fast);
  white-space: nowrap;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}
.nav-link:hover { color: var(--text-strong); }
.nav-link:hover::after { transform: scaleX(1); }

/* ---------- search (search.js) ---------- */
.search-box { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}
.search-box #site-search {
  width: 200px;
  height: 36px;
  padding: 0 34px 0 34px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  transition: width var(--t-mid) var(--ease), border-color var(--t-fast), background var(--t-fast);
}
.search-box #site-search::placeholder { color: var(--muted-2); }
.search-box #site-search:focus {
  outline: none;
  width: 280px;
  background: rgba(var(--overlay-rgb), .9);
  border-color: rgba(var(--gold-rgb), .55);
}
.search-kbd {
  position: absolute;
  right: 10px;
  font: 500 10px/1 var(--font-mono);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 5px;
  padding: 3px 6px;
  pointer-events: none;
  transition: opacity var(--t-fast);
}
#site-search:focus ~ .search-kbd { opacity: 0; }
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 28px));
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  background: rgba(var(--overlay-rgb), .96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 24px 60px -20px #000;
  z-index: 70;
}
.search-results .sr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: 9px;
  transition: background var(--t-fast);
}
.search-results .sr-item:hover,
.search-results .sr-item.active { background: rgba(var(--gold-rgb), .1); }
.search-results .sr-badge {
  flex: none;
  font: 500 10px/1 var(--font-mono);
  letter-spacing: .08em;
  color: var(--gold);
  border: 1px solid rgba(var(--gold-rgb), .35);
  border-radius: 999px;
  padding: 3px 7px;
}
.search-results .sr-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .sr-title mark { background: transparent; color: var(--gold-hi); font-weight: 600; }
.search-results .sr-date { flex: none; font: 400 12px/1 var(--font-num); color: var(--muted); }
.search-results .sr-empty { padding: 12px; font-size: 12px; color: var(--muted); }
.nav-search-btn { display: none; width: 40px; height: 40px; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); }
.nav-search-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; }

@media (max-width: 767px) {
  .nav-search-btn { display: grid; }
  .site-nav .search-box {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--nav-h);
    padding: 10px clamp(20px, 5vw, 48px) 12px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hairline);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--t-fast), transform var(--t-fast) var(--ease), visibility 0s linear var(--t-fast);
  }
  .site-nav.search-open .search-box { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .site-nav .search-icon { left: calc(clamp(20px, 5vw, 48px) + 12px); }
  .search-box #site-search, .search-box #site-search:focus { width: 100%; }
  .search-kbd { display: none; }
  .search-results { left: clamp(20px, 5vw, 48px); right: clamp(20px, 5vw, 48px); width: auto; }
}

/* ---------- footer ---------- */
.site-footer { position: relative; padding: 56px 0 48px; text-align: center; }
.footer-rule {
  display: block;
  width: min(420px, 70%);
  height: 1px;
  margin: 0 auto 22px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .6;
}
.footer-copy { font: 400 11px/1.8 var(--font-mono); letter-spacing: .16em; color: var(--muted-2); }
.footer-copy a { text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; transition: color var(--t-fast), text-decoration-color var(--t-fast); }
.footer-copy a:hover, .footer-copy a:focus-visible { color: var(--gold); text-decoration-color: currentColor; }

/* ---------- reveal ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}
html.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- G2 section heads ---------- */
.sec { position: relative; padding: clamp(96px, 14vh, 160px) 0 clamp(40px, 6vh, 72px); }
.sec-head { margin-bottom: clamp(36px, 5vw, 56px); }
.sec-line { display: block; overflow: hidden; line-height: 1.25; }
.sec-line > span { display: inline-block; }
.sec-num { font: 500 clamp(20px, 2.4vw, 26px)/1.1 var(--font-num); letter-spacing: .08em; color: var(--gold); }
.sec-title {
  font: 600 clamp(28px, 4vw, 44px)/1.25 var(--font-serif);
  letter-spacing: .06em;
  color: var(--text-strong);
  padding: 4px 0 2px;
}
.sec-en { font: 500 10px/2 var(--font-mono); letter-spacing: .34em; color: rgba(var(--gold-rgb), .7); }
.sec-rule {
  display: block;
  width: min(280px, 50%);
  height: 1px;
  margin-top: 18px;
  background: linear-gradient(90deg, var(--gold), transparent);
  transform-origin: left;
}
html.js .sec-head .sec-line > span { transform: translateY(110%); transition: transform var(--t-slow) var(--ease); }
html.js .sec-head .sec-line:nth-child(2) > span { transition-delay: 120ms; }
html.js .sec-head .sec-line:nth-child(3) > span { transition-delay: 240ms; }
html.js .sec-head .sec-rule { transform: scaleX(0); transition: transform var(--t-slow) var(--ease) 300ms; }
html.js .sec-head.is-in .sec-line > span { transform: none; }
html.js .sec-head.is-in .sec-rule { transform: scaleX(1); }

/* ---------- shared bits ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  line-height: 1;
  color: #d7cfbf;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
}
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  font-size: 13px;
  letter-spacing: .12em;
  color: var(--text-strong);
  border: 1px solid rgba(var(--gold-rgb), .45);
  border-radius: 999px;
  background: rgba(var(--gold-rgb), .04);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  will-change: transform;
}
.btn-gold:hover { background: rgba(var(--gold-rgb), .14); border-color: var(--gold); }
.btn-gold.is-solid { color: #1b1712; background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); border-color: transparent; }
.btn-gold.is-solid:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  html.js .sec-head .sec-line > span, html.js .sec-head .sec-rule { transform: none; transition: none; }
  #starfield { transition: none; }
}

/* ==== region:hero ==== */
:root {
  --star-core: #fff3d6;
  --shine: linear-gradient(100deg, #a8854c 0%, #f3dcae 32%, #fff 46%, #f3dcae 60%, #a8854c 100%);
  --rail-h: 62px;
}

/* touch ripple for .spotlight (starfield.js adds .is-ripple) */
.spotlight.is-ripple { animation: spot-ripple .6s var(--ease); }
@keyframes spot-ripple {
  from { opacity: 0; }
  30% { opacity: 1; }
  to { opacity: 0; }
}

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 2; }
.hero-text { max-width: 54%; will-change: transform, opacity; }
.hero-eyebrow {
  font: 500 10px/1.6 var(--font-mono);
  letter-spacing: .34em;
  color: rgba(var(--gold-rgb), .7);
  text-transform: uppercase;
}
.hero-name {
  margin: 22px 0 20px;
  font: 600 clamp(44px, 9vw, 112px)/1.08 var(--font-serif);
  letter-spacing: .06em;
  color: var(--gold-hi);
  perspective: 600px;
  white-space: nowrap;
}
.hero-name .ch { display: inline-block; transform-origin: 50% 100%; }
.hero-name .ch i,
.post-title .ch i {
  font-style: normal;
  display: inline-block;
  background: var(--shine);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 7s linear infinite;
  animation-delay: calc(var(--i, 0) * -.4s);
}
@keyframes shine { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes charin {
  from { opacity: 0; transform: translateY(40%) rotateX(-60deg); filter: blur(10px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.hero-title { font: 400 13px/1.6 var(--font-sans); letter-spacing: .3em; color: var(--muted); }
.hero-tagline {
  max-width: 30em;
  font: 400 clamp(15px, 1.5vw, 18px)/2 var(--font-serif);
  color: #b9b6ae;
}
.hero-tagline span { display: inline; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

.scroll-cue {
  position: absolute;
  z-index: 2;
  left: calc(max(0px, (100% - var(--container)) / 2) + clamp(20px, 5vw, 48px));
  bottom: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 9px/1 var(--font-mono);
  letter-spacing: .3em;
  color: var(--muted);
}
.scroll-cue s {
  display: block;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  transform-origin: left;
  animation: cue 2.2s cubic-bezier(.7, 0, .3, 1) infinite;
}
@keyframes cue {
  0% { transform: scaleX(0); opacity: 1; }
  55% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* Entrance timeline (5.2): only with JS, skipped when the URL has a hash. */
html.js:not(.no-intro) .hero-name .ch { animation: charin 1.3s var(--ease) both; animation-delay: calc(.15s + var(--i, 0) * .12s); }
html.js:not(.no-intro) .hero-eyebrow { animation: fade-in .9s var(--ease) .1s both; }
html.js:not(.no-intro) .hero-tagline span { display: inline-block; animation: rise-in .9s var(--ease) both; animation-delay: calc(.7s + var(--i, 0) * .12s); }
html.js:not(.no-intro) .hero-actions { animation: rise-in .9s var(--ease) 1.25s both; }
html.js:not(.no-intro) .scroll-cue { animation: fade-in .9s var(--ease) 1.7s both; }

/* ---------- constellation (5.2) ---------- */
/* No JS: a plain row of anchors under the hero text. */
.constellation {
  position: absolute;
  z-index: 3;
  left: calc(max(0px, (100% - var(--container)) / 2) + clamp(20px, 5vw, 48px));
  right: clamp(20px, 5vw, 48px);
  bottom: 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.constellation .star { display: inline-flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text); }
.constellation .star i { display: none; }
.constellation .star em { font: 400 12px/1 var(--font-num); font-style: normal; color: var(--gold); }
.constellation .star[data-off] { opacity: .35; pointer-events: none; }
html.js .constellation:not(.is-live) { opacity: 0; }

/* Live: constellation.js positions every star with transform. ≥768 the layer
   is fixed to the viewport (stars travel from the hero into the side rail). */
.constellation.is-live {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  pointer-events: none;
}
.cst-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cst-lines line { fill: none; }
.cst-lines .base { stroke: var(--gold); stroke-opacity: .26; stroke-width: 1; }
.cst-lines .base.dim { stroke-opacity: .14; stroke-dasharray: 3 5; }
.cst-lines .prog { stroke: var(--gold-hi); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.constellation.is-live .star {
  --k: 1;
  --lab: 1;
  --p: 0;
  --s: calc(var(--w, 1) * var(--k));
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  pointer-events: auto;
  font-size: 0;
  color: inherit;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.constellation.is-live .star[data-off] { --s: calc(var(--w, 1) * var(--k) * .75); pointer-events: none; cursor: default; }
.constellation.is-live .star i {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: calc(6px * 1.6 * var(--s));
  height: calc(6px * 1.6 * var(--s));
  margin: calc(-4.8px * var(--s)) 0 0 calc(-4.8px * var(--s));
  border-radius: 50%;
  background: var(--star-core);
  box-shadow: 0 0 calc(10px * var(--s)) rgba(var(--accent-2-rgb), .85);
  transition: background var(--t-fast);
}
.constellation.is-live .star i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(36px * var(--s));
  height: calc(36px * var(--s));
  margin: calc(-18px * var(--s)) 0 0 calc(-18px * var(--s));
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-2-rgb), .55) 0%, rgba(var(--accent-2-rgb), .12) 40%, transparent 70%);
  animation: twinkle 3.2s ease-in-out infinite;
  animation-delay: calc(var(--n, 0) * -.7s);
  transition: transform var(--t-mid) var(--ease);
}
.constellation.is-live .star b,
.constellation.is-live .star em {
  position: absolute;
  left: calc(50% + 12px * var(--s) + 8px);
  white-space: nowrap;
  font-style: normal;
  pointer-events: none;
  transition: color var(--t-fast), opacity var(--t-mid) var(--ease);
}
.constellation.is-live .star b {
  top: 50%;
  margin-top: -.62em;
  font: 400 calc(13px - 1.5px * var(--p))/1.2 var(--font-sans);
  letter-spacing: .08em;
  color: #cfc8b8;
  opacity: var(--lab);
}
.constellation.is-live .star em {
  top: calc(50% + 10px);
  font: 400 11px/1.2 var(--font-num);
  letter-spacing: .04em;
  color: var(--gold);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.constellation.is-live .star.is-left b,
.constellation.is-live .star.is-left em { left: auto; right: calc(50% + 12px * var(--s) + 10px); text-align: right; }
.constellation.is-live .star:hover i::before,
.constellation.is-live .star:focus-visible i::before { transform: scale(2); }
.constellation.is-live .star:hover b,
.constellation.is-live .star.is-current b { color: var(--text-strong); }
.constellation.is-live .star:hover em,
.constellation.is-live .star:focus-visible em { opacity: 1; transform: none; }
.constellation.is-live .star:focus-visible { outline: none; }
.constellation.is-live .star.is-lit i { background: #fff; }
.constellation.is-live .star.is-current i::before { animation: breathe 2.4s ease-in-out infinite; }
.constellation.is-live .star[data-off] i { background: #4a4d5c; box-shadow: none; }
.constellation.is-live .star[data-off] i::before { opacity: .12; animation: none; }
.constellation.is-live .star[data-off] b { color: var(--muted-2); }
@keyframes twinkle { 50% { opacity: .55; } }
@keyframes breathe {
  0%, 100% { transform: scale(1.2); opacity: 1; }
  50% { transform: scale(2.1); opacity: .6; }
}

/* Three quiet taps draw attention to a real navigation star, then disappear. */
.star-guide { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.star-guide::before {
  content: "";
  position: absolute;
  width: 46px; height: 46px; left: -23px; top: -23px;
  border: 1px solid var(--gold-hi); border-radius: 50%;
  box-shadow: 0 0 12px rgba(var(--accent-2-rgb), .16);
  opacity: 0;
  animation: star-guide-ring 2.6s ease-out 3;
}
.star-guide svg {
  position: absolute; left: -9px; top: -4px; width: 28px; height: 32px; max-width: none;
  fill: var(--bg-1); stroke: var(--gold-hi); stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .65));
  opacity: 0; transform-origin: 9px 4px;
  animation: star-guide-tap 2.6s var(--ease) 3;
}
.constellation.is-wave .star-guide svg { rotate: -110deg; }
@keyframes star-guide-tap {
  0%, 100% { opacity: 0; transform: translate(16px, 20px); }
  18% { opacity: .85; transform: translate(8px, 10px); }
  35%, 54% { opacity: .95; transform: none; }
  43% { opacity: 1; transform: scale(.88); }
  74% { opacity: 0; transform: translate(5px, 7px); }
}
@keyframes star-guide-ring {
  0%, 40% { opacity: 0; transform: scale(.25); }
  46% { opacity: .65; transform: scale(.45); }
  78%, 100% { opacity: 0; transform: scale(1.25); }
}
@media (prefers-reduced-motion: reduce) { .star-guide { display: none; } }

/* Docked: counts only on hover; narrow desktops keep labels on hover too so
   they never sit on top of the content column. */
@media (max-width: 1279px) {
  .constellation.is-live.is-docked .star b { opacity: 0; }
  .constellation.is-live.is-docked .star:hover b,
  .constellation.is-live.is-docked .star:focus-visible b { opacity: 1; }
}

/* Constellation entrance: stars at .4s + i·.25s, lines from .5s. */
html.js:not(.no-intro) .constellation.is-live .star { animation: fade-in .7s var(--ease) both; animation-delay: calc(.4s + var(--n, 0) * .25s); }
html.js:not(.no-intro) .constellation.is-live .star i { animation: star-pop .7s var(--ease) both; animation-delay: calc(.4s + var(--n, 0) * .25s); }
html.js:not(.no-intro) .cst-lines .base:not(.dim) { stroke-dasharray: 1; animation: draw-line 1s ease both; animation-delay: calc(.5s + var(--n, 0) * .2s); }
html.js:not(.no-intro) .cst-lines .base.dim { animation: fade-in 1s ease both; animation-delay: calc(.5s + var(--n, 0) * .2s); }
@keyframes star-pop { from { transform: scale(0); } to { transform: none; } }
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ---------- mobile hero: wave constellation under the name (5.6) ---------- */
@media (max-width: 767px) {
  .hero { align-items: stretch; }
  .hero-inner { display: flex; flex-direction: column; justify-content: flex-end; padding-top: calc(var(--nav-h) + 12px); padding-bottom: calc(40vh + 40px); }
  .hero-text { max-width: none; }
  .hero-name { font-size: clamp(44px, 14vw, 64px); margin: 16px 0 14px; white-space: normal; }
  .hero-actions { margin-top: 24px; }
  .scroll-cue { bottom: 18px; }
  .constellation { bottom: 40px; }
  .constellation.is-live.is-wave {
    position: absolute;
    inset: auto 0 36px 0;
    height: 40vh;
    z-index: 3;
  }
  .constellation.is-wave .star b,
  .constellation.is-wave .star.is-left b {
    left: 50%;
    right: auto;
    top: calc(50% + 8px + 6px * var(--s));
    margin: 0;
    font-size: 12px;
    text-align: center;
    transform: translateX(-50%);
    opacity: 1;
  }
  .constellation.is-wave .star em,
  .constellation.is-wave .star.is-left em {
    left: 50%;
    right: auto;
    top: calc(50% + 26px + 6px * var(--s));
    font-size: 10.5px;
    text-align: center;
    opacity: .85;
    transform: translateX(-50%);
  }
  .constellation.is-wave .star[data-off] em { opacity: .5; }
}

/* ---------- mobile bottom star rail (5.6) ---------- */
.star-rail { display: none; }
@media (max-width: 767px) {
  html.js .star-rail {
    position: fixed;
    z-index: 45;
    left: 14px;
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    height: var(--rail-h);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    padding: 0 6px;
    border-radius: 22px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--hairline);
    box-shadow: 0 18px 40px -18px #000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px);
    transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease), visibility 0s linear var(--t-mid);
  }
  html.js .star-rail.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  body.lightbox-open .star-rail { opacity: 0 !important; visibility: hidden !important; }
  html.no-blur .star-rail { background: var(--bg-1); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .rail-star {
    flex: 1 1 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    -webkit-tap-highlight-color: transparent;
  }
  .rail-star i {
    display: block;
    width: calc(6px * 1.6 * var(--w, 1) * .7);
    height: calc(6px * 1.6 * var(--w, 1) * .7);
    border-radius: 50%;
    background: var(--star-core);
    box-shadow: 0 0 8px rgba(var(--accent-2-rgb), .7);
    transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid);
  }
  .rail-star b { font: 400 10.5px/1 var(--font-sans); letter-spacing: .04em; color: #a9a59b; transition: color var(--t-fast); }
  .rail-star.is-current i { transform: scale(1.5); box-shadow: 0 0 0 4px rgba(var(--gold-rgb), .16), 0 0 14px var(--gold-hi); }
  .rail-star.is-current b { color: var(--gold-hi); }
  .rail-star[data-off] { opacity: .35; pointer-events: none; }
  .rail-star[data-off] i { background: #4a4d5c; box-shadow: none; }
  body.has-rail { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-name .ch, .hero-name .ch i, .post-title .ch, .post-title .ch i,
  .hero-eyebrow, .hero-tagline span, .hero-actions, .scroll-cue, .scroll-cue s,
  .constellation.is-live .star, .constellation.is-live .star i, .constellation.is-live .star i::before,
  .cst-lines .base, .spotlight.is-ripple { animation: none !important; }
  .cst-lines .base:not(.dim) { stroke-dashoffset: 0; }
  .constellation.is-live .star.is-current i::before { transform: scale(1.7); }
  .hero-name .ch i, .post-title .ch i { background-position: 40% 0; }
}
/* ==== /region:hero ==== */

/* ==== region:sections ==== */
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

main { position: relative; z-index: 1; }
.sec .container { position: relative; }

/* shared prose (about body) */
.prose { font: 400 16px/2 var(--font-serif); color: #cfcabe; }
.prose p + p { margin-top: 1em; }
.prose a, .ink-link { color: var(--gold-hi); border-bottom: 1px solid rgba(var(--gold-rgb), .4); transition: border-color var(--t-fast), color var(--t-fast); }
.prose a:hover, .ink-link:hover { color: var(--text-strong); border-bottom-color: var(--gold); }
.prose strong { color: var(--text-strong); font-weight: 600; }
.prose code { font: 400 .88em var(--font-mono); color: var(--gold-hi); background: rgba(255, 255, 255, .05); border-radius: 4px; padding: .1em .35em; }
.prose ul { list-style: none; padding: 0; }
.prose li { position: relative; padding-left: 1.2em; }
.prose li::before { content: "✦"; position: absolute; left: 0; top: .1em; font-size: .7em; color: var(--gold); }

/* ---------- I · about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-grid > :only-child { grid-column: 1 / -1; max-width: 720px; }
.about-meta { margin: 0; border-top: 1px solid var(--hairline); }
.about-row { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.about-row dt { font: 500 10px/2.2 var(--font-mono); letter-spacing: .28em; color: rgba(var(--gold-rgb), .7); }
.about-row dd { margin: 0; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.about-row .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.about-row .tags span {
  font-size: 12px;
  line-height: 1;
  color: #d7cfbf;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 13px;
  transition: border-color .6s var(--ease), color .6s var(--ease), box-shadow .6s var(--ease), background .6s var(--ease);
}
/* A: tags light up one by one once the meta block is revealed. */
html.js .about-meta.is-in .tags span {
  border-color: var(--gold);
  color: var(--text-strong);
  background: rgba(var(--gold-rgb), .06);
  box-shadow: 0 0 14px -6px rgba(var(--accent-2-rgb), .8);
  transition-delay: calc(400ms + var(--i, 0) * 80ms);
}
html:not(.js) .about-row .tags span { border-color: var(--gold); }

/* ---------- II · journey (E1) ---------- */
.timeline { --tl: 0; position: relative; max-width: 820px; padding-left: 34px; }
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: rgba(255, 255, 255, .1);
}
.timeline::after {
  background: linear-gradient(var(--gold-hi), var(--gold) 70%, rgba(var(--gold-rgb), .4));
  box-shadow: 0 0 10px rgba(var(--accent-2-rgb), .5);
  transform: scaleY(var(--tl));
  transform-origin: top;
}
html:not(.js) .timeline { --tl: 1; }
.tl-item { position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 28px; padding: 22px 0 26px; }
.tl-item + .tl-item { border-top: 1px solid rgba(255, 255, 255, .06); }
.tl-node {
  position: absolute;
  left: -34px;
  top: 30px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2a2c38;
  border: 1px solid rgba(var(--gold-rgb), .3);
  transition: background var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.tl-item.is-lit .tl-node,
html:not(.js) .tl-node { background: var(--star-core); border-color: var(--gold-hi); box-shadow: 0 0 0 4px rgba(var(--gold-rgb), .13), 0 0 14px var(--gold-hi); transform: scale(1.1); }
.tl-period { font: 500 13px/1.6 var(--font-num); letter-spacing: .06em; color: var(--gold); padding-top: 4px; }
.tl-company { font: 600 20px/1.45 var(--font-serif); color: var(--text-strong); }
.tl-role { margin-left: 10px; font: 400 13px var(--font-sans); letter-spacing: .08em; color: var(--muted); }
.tl-desc { margin-top: 8px; font-size: 14px; line-height: 1.9; color: #a9a7a1; white-space: pre-line; }
html.js .tl-item[data-reveal] { transform: translateX(18px); }
html.js .tl-item[data-reveal].is-in { transform: none; }

/* ---------- IV · writing (N1) ---------- */
.post-list { position: relative; border-top: 1px solid rgba(255, 255, 255, .07); }
.post-row {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 26px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  color: var(--text);
}
.post-row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(var(--gold-rgb), .2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-slow) var(--ease);
}
.post-row:hover::after, .post-row:focus-visible::after { transform: scaleX(1); }
.post-date { font: 400 13px/1 var(--font-num); letter-spacing: .06em; color: var(--muted); transition: color var(--t-fast); }
.post-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.post-title { font: 600 clamp(18px, 2vw, 22px)/1.45 var(--font-serif); color: var(--text-strong); transition: color var(--t-fast), transform var(--t-mid) var(--ease); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tags .pill { font-size: 11px; padding: 4px 10px; color: var(--muted); }
.post-thumb { display: none; }
.post-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(var(--gold-rgb), .3);
  color: var(--gold);
  font-size: 16px;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.post-row:hover .post-date { color: var(--gold); }
.post-row:hover .post-title { color: var(--gold-hi); transform: translateX(6px); }
.post-row:hover .post-arrow { background: var(--gold); border-color: var(--gold); color: #1b1712; }

.post-card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  width: 240px;
  height: 150px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
  will-change: transform, opacity;
}
.post-card.is-on { opacity: 1; }
.post-card-art {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(var(--gold-rgb), .35);
  background: linear-gradient(135deg, hsl(var(--h, 30) 42% 32%), hsl(calc(var(--h, 30) + 50) 48% 12%) 72%);
  box-shadow: 0 24px 50px -16px #000;
  transform: scale(.86);
  transition: transform var(--t-mid) var(--ease);
}
.post-card.is-on .post-card-art { transform: none; }
.post-card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-card-glyph {
  position: absolute;
  right: 14px;
  bottom: -18px;
  font: 600 120px/1 var(--font-serif);
  color: rgba(255, 244, 222, .82);
  text-shadow: 0 6px 30px rgba(0, 0, 0, .35);
}
.post-card-art.has-img .post-card-glyph { display: none; }
.post-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), transparent 45%);
}

/* ---------- V · works (P1) ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; perspective: 1000px; }
.project-card {
  --rx: 0deg;
  --ry: 0deg;
  --cx: 50%;
  --cy: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 210px;
  padding: 26px 26px 22px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015));
  border: 1px solid rgba(255, 255, 255, .09);
  transform-style: preserve-3d;
  isolation: isolate;
}
html.js .project-card[data-reveal].is-in {
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: opacity var(--t-slow) var(--ease), transform .25s ease-out;
}
.project-card::before {
  /* rotating conic gold border, visible on hover / press */
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--a), transparent 0deg, var(--gold-hi) 60deg, transparent 140deg, transparent 200deg, var(--gold-lo) 260deg, transparent 330deg);
  -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 exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
  animation: spin-a 4s linear infinite;
  animation-play-state: paused;
}
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(260px circle at var(--cx) var(--cy), rgba(var(--accent-2-rgb), .14), transparent 60%);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
  pointer-events: none;
}
.project-card.is-hot::before, .project-card.is-press::before,
.project-card:focus-within::before { opacity: 1; animation-play-state: running; }
.project-card.is-hot::after { opacity: 1; }
.project-card.is-press { transform: scale(.98) !important; transition: transform .15s ease-out !important; }
@keyframes spin-a { to { --a: 360deg; } }
.pj-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; transform: translateZ(20px); }
.pj-lang { display: inline-flex; align-items: center; gap: 8px; font: 500 10px/1 var(--font-mono); letter-spacing: .2em; color: rgba(var(--gold-rgb), .75); text-transform: uppercase; }
.pj-lang i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.pj-open { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); color: var(--muted); transition: color var(--t-fast), border-color var(--t-fast); }
.pj-open:hover { color: var(--gold-hi); border-color: var(--gold); }
.pj-name { font: 600 21px/1.4 var(--font-serif); color: var(--text-strong); transform: translateZ(30px); }
.pj-name a:hover { color: var(--gold-hi); }
.pj-desc { flex: 1; font-size: 13.5px; line-height: 1.85; color: #a9a7a1; transform: translateZ(14px); }
.pj-meta { display: flex; align-items: center; gap: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 12px; color: var(--muted); }
.pj-stars { color: var(--gold); }
.pj-stars .num { font: 400 20px/1 var(--font-num); color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.pj-license { font: 500 10px/1 var(--font-mono); letter-spacing: .16em; }

/* ---------- VI · thoughts (T1 + thoughts.js) ---------- */
.thought-list { display: grid; gap: 22px; max-width: 820px; }
.thought {
  position: relative;
  padding: 30px 32px 22px 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
}
.thought::before {
  content: "「";
  position: absolute;
  left: 16px;
  top: 6px;
  font: 400 44px/1 var(--font-serif);
  color: rgba(var(--gold-rgb), .35);
}
.thought-body {
  font: 400 17px/1.95 var(--font-serif);
  color: var(--text-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.thought-body.collapsed {
  max-height: 168px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 108px, transparent 100%);
  mask-image: linear-gradient(180deg, #000 108px, transparent 100%);
}
.thought-body .ink { opacity: 0; filter: blur(4px); transition: opacity .7s ease, filter .7s ease; transition-delay: var(--d, 0ms); }
.thought-body .ink-rest { transition-duration: 1.2s; }
.thought-body.is-inked .ink { opacity: 1; filter: none; }
.thought-toggle {
  margin-top: 12px;
  font: 500 12px/1 var(--font-sans);
  letter-spacing: .12em;
  color: var(--gold);
  padding: 8px 0;
}
.thought-toggle:hover { color: var(--gold-hi); }
.thought .meta { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 12px; color: var(--muted); }
.thought .meta .pill { font-size: 11px; padding: 4px 10px; }
.thought-date { font: 400 13px/1 var(--font-num); letter-spacing: .06em; }
.thought-collapse-float {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 44;
  height: 40px;
  padding: 0 18px;
  font: 500 12px/1 var(--font-sans);
  letter-spacing: .12em;
  color: var(--gold-hi);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--gold-rgb), .45);
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px #000;
  -webkit-tap-highlight-color: transparent;
}
.thought-collapse-float:hover { background: rgba(var(--gold-rgb), .14); }
.thought-collapse-float:active { transform: scale(.96); }
body.has-rail .thought-collapse-float { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- VII · moments (M1 + moments.js) ---------- */
.moments { display: grid; gap: 22px; max-width: 760px; }
.moment {
  padding: 24px 26px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
}
.moment-meta { display: flex; gap: 14px; align-items: baseline; margin-bottom: 10px; font-size: 12px; }
.moment-place { color: var(--gold); letter-spacing: .08em; }
.moment-place::before { content: "✦ "; font-size: .8em; }
.moment-date { font: 400 13px/1 var(--font-num); color: var(--muted); }
.moment-caption { font: 400 15.5px/1.9 var(--font-serif); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.moment-media { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moment-media[data-count="1"] { grid-template-columns: 1fr; }
.moment-media[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.moment-media .darkroom { display: block; border-radius: 10px; }
.moment-item { width: 100%; display: block; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .08); background: var(--bg-0); }
.moment-media:not([data-count="1"]) .moment-item { aspect-ratio: 1 / 1; object-fit: cover; }
.moment-media[data-count="1"] .moment-item { max-height: 480px; object-fit: contain; }
img.moment-item { cursor: zoom-in; transition: border-color var(--t-fast), filter 1.2s var(--ease); }
img.moment-item:hover { border-color: rgba(var(--gold-rgb), .5); }
.moment-embed { grid-column: 1 / -1; padding: 0; border: 0; background: transparent; }
.moment-media:not([data-count="1"]) .moment-item.moment-embed { aspect-ratio: auto; object-fit: fill; }
.moment-embed-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; }
.moment-embed-frame iframe { width: 100%; height: 100%; display: block; border: 0; }
.moment-embed-open { display: inline-block; margin-top: 8px; font-size: 11px; line-height: 1; letter-spacing: .06em; color: var(--muted); -webkit-tap-highlight-color: transparent; }
.moment-embed-open:hover { color: var(--gold-hi); }
@keyframes moment-flash {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-2-rgb), 0); border-color: rgba(255, 255, 255, .07); }
  20% { box-shadow: 0 0 0 1px var(--gold), 0 0 32px 4px rgba(var(--accent-2-rgb), .45); border-color: var(--gold); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-2-rgb), 0); border-color: rgba(255, 255, 255, .07); }
}
.moment.moment-flash { animation: moment-flash 1.8s ease-out; }

/* M1 darkroom (Motion.develop wraps the img): over-exposed + grain → normal. */
.darkroom { position: relative; display: block; overflow: hidden; }
.darkroom > img { filter: brightness(1.8) saturate(.2) contrast(.8); transition: filter 1.2s var(--ease), border-color var(--t-fast); }
.darkroom::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: .25;
  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='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  transition: opacity 1.2s var(--ease);
}
.darkroom.is-dev > img { filter: none; }
.darkroom.is-dev::after { opacity: 0; }

/* lightbox (moments.js) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 5, .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in .3s var(--ease);
}
.lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }
.lightbox-viewport { width: 100vw; height: 100%; overflow: hidden; will-change: transform; }
.lightbox-track { display: flex; height: 100%; will-change: transform; }
.lightbox-slide { flex: 0 0 100vw; height: 100%; display: flex; align-items: center; justify-content: center; }
.lightbox-img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px #000, 0 0 0 1px rgba(var(--gold-rgb), .18);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.lightbox-hint {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--gold-hi);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 8px 16px;
  opacity: 0;
  transition: opacity .2s ease;
}
.lightbox-hint.lb-hint-show { opacity: 1; }
.lightbox-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 2;
  height: 40px;
  padding: 0 16px;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--text-strong);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close:hover { border-color: var(--gold); color: var(--gold-hi); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  font: 300 28px/1 var(--font-serif);
  color: var(--gold-hi);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-fast), opacity var(--t-fast);
}
.lightbox-nav:hover { border-color: var(--gold); }
.lightbox-nav.is-end { opacity: .3; }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
.lightbox-nav[hidden] { display: none; }
.lightbox.is-flip { animation-duration: .45s; }
.flip-ghost {
  position: fixed;
  z-index: 101;
  margin: 0;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: none;
  transform-origin: 0 0;
}
.flip-ghost.is-go { transition: transform .55s var(--ease); }

/* ---------- section layout below 768 ---------- */
@media (max-width: 767px) {
  .about-grid { grid-template-columns: 1fr; }
  .timeline { padding-left: 28px; }
  .tl-node { left: -28px; }
  .tl-item { grid-template-columns: 1fr; gap: 6px; padding: 18px 0 20px; }
  .tl-node { top: 24px; }
  .post-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 20px 2px; }
  .post-date { grid-column: 1 / -1; }
  .post-arrow { display: none; }
  .thought { padding: 24px 20px 18px 40px; }
  .thought::before { left: 8px; font-size: 34px; }
  .thought-body { font-size: 16px; }
  .moment { padding: 18px; }
}
/* N1 on touch: 64px cover thumbnail on the right (only when there is one). */
@media (hover: none), (pointer: coarse) {
  .post-row .post-thumb { display: block; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid rgba(255, 255, 255, .1); }
  .post-row:has(.post-thumb) .post-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline { --tl: 1 !important; }
  .about-row .tags span, html.js .about-meta.is-in .tags span { transition: none; }
  .thought-body .ink { opacity: 1; filter: none; transition: none; }
  .darkroom > img { filter: none; transition: none; }
  .darkroom::after { display: none; }
  .project-card::before { animation: none; }
  .lightbox { animation: none; }
}
/* ==== /region:sections ==== */

/* ==== region:footprint ==== */
:root {
  --globe-arc: rgba(232, 197, 138, .55);
  --globe-night-rgb: 4, 8, 22;
  --globe-sun-rgb: 243, 220, 174;
}

.footprint-grid { display: grid; grid-template-columns: 1fr; gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (min-width: 960px) {
  .footprint-grid { grid-template-columns: 1.2fr 1fr; }
}

/* Block-level so globe.js sizes the canvas to min(stage, 600, innerWidth-40).
   Pinned to the row top: the panel grows when a selection shows notes, and a
   centred stage would shift between the two clicks of a double-click drill. */
.globe-stage { position: relative; display: block; width: 100%; max-width: 600px; margin: 0 auto; align-self: start; }
.globe-stage::before {
  content: "";
  position: absolute;
  inset: -8%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--gold-rgb), .1) 62%, rgba(var(--gold-rgb), .04) 78%, transparent 100%);
  pointer-events: none;
}
@media (max-width: 767px) {
  /* Keep the decorative halo inside the mobile page gutter. */
  .globe-stage::before { inset: -16px; }
}
#globe-canvas { display: block; margin: 0 auto; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent; }
#globe-canvas:active { cursor: grabbing; }

.globe-panel { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.globe-breadcrumb { font: 500 12px/1.6 var(--font-mono); letter-spacing: .14em; color: var(--muted); }
.globe-breadcrumb a { color: var(--gold); cursor: pointer; transition: color var(--t-fast); }
.globe-breadcrumb a:hover { color: var(--gold-hi); }
.globe-breadcrumb > span:not(.sep) { color: var(--text-strong); }
.globe-breadcrumb .sep { color: var(--muted-2); margin: 0 8px; }

.globe-stats { min-height: 1.3em; font: 400 15px/1.3 var(--font-sans); color: var(--text); letter-spacing: .04em; }
.globe-stats .num {
  font: 500 clamp(34px, 4.6vw, 52px)/1 var(--font-num);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--gold-hi);
  text-shadow: 0 0 24px rgba(var(--gold-rgb), .25);
}
.globe-stats .unit { margin-right: 4px; color: var(--text); }
.globe-stats .sep { color: var(--muted-2); margin: 0 4px; }

.globe-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 36px; }
.globe-back-btn {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--text-strong);
  border: 1px solid rgba(var(--gold-rgb), .45);
  border-radius: 999px;
  background: rgba(var(--gold-rgb), .06);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.globe-back-btn:hover { background: rgba(var(--gold-rgb), .16); border-color: var(--gold); }
.globe-back-btn:active { transform: scale(.96); }
.globe-drill-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  pointer-events: none;
}
.globe-drill-hint::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(var(--gold-rgb), .5);
  animation: hint-pulse 2.4s var(--ease) infinite;
}
@keyframes hint-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--gold-rgb), .5); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(var(--gold-rgb), 0); }
}

.globe-load-status {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 4;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text);
  background: rgba(var(--overlay-rgb), .9);
  border: 1px solid var(--hairline);
  border-radius: 999px;
}
.globe-load-status.is-error { color: var(--gold-hi); border-color: rgba(var(--gold-rgb), .55); }

.globe-notes, .globe-moment-links {
  padding: 14px 18px;
  background: rgba(var(--overlay-rgb), .6);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  animation: gml-in var(--t-mid) var(--ease);
}
@keyframes gml-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.globe-notes .gn-head, .globe-moment-links .gml-head {
  padding-bottom: 10px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .2em;
  color: rgba(var(--gold-rgb), .8);
  border-bottom: 1px solid var(--hairline);
}
.globe-notes .gn-item {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 14px;
  padding: 11px 0;
  font-size: 14px;
  line-height: 1.8;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.globe-notes .gn-item:last-child { border-bottom: 0; padding-bottom: 0; }
.globe-notes .gn-city { font-family: var(--font-serif); font-weight: 600; color: var(--gold-hi); }
.globe-notes .gn-text { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

.globe-moment-links { display: flex; flex-direction: column; gap: 8px; }
.globe-moment-links .gml-head { margin-bottom: 2px; }
.globe-moment-links .gml-count { color: inherit; }
.globe-moment-links .gml-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.globe-moment-links .gml-arrow { flex: none; color: var(--gold); transition: transform var(--t-fast) var(--ease); }
.globe-moment-links .gml-cap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.globe-moment-links .gml-item:hover { color: var(--text-strong); border-color: rgba(var(--gold-rgb), .45); background: rgba(var(--gold-rgb), .08); }
.globe-moment-links .gml-item:hover .gml-arrow { transform: translate(2px, -2px); }
.globe-moment-links .gml-item:active { transform: scale(.99); }

@media (max-width: 959px) {
  .globe-panel { align-items: center; text-align: center; }
  .globe-controls { justify-content: center; }
  .globe-notes, .globe-moment-links { width: 100%; max-width: 600px; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .globe-drill-hint::before, .globe-notes, .globe-moment-links, .moment.moment-flash { animation: none; }
}
/* ==== /region:footprint ==== */

/* ==== s_blog instance ==== */
/* ICP filing line under the footer copy (s_blog only, not in blog_self). */
footer .beian { margin-top: 8px; font-size: 11px; opacity: .7; }
footer .beian a { color: inherit; text-decoration: none; }
footer .beian a:hover { text-decoration: underline; }
