/* ==========================================================================
   Hongyu Guo — Cursor 风格预览（单屏滚动叙事版）
   设计规范：design/candidates/cursor.md（warm cream canvas + Cursor Orange）
   结构：400vh 滚动轨道 + sticky 100vh 视窗，四幕内容按滚动进度显现
   ========================================================================== */

:root {
  --primary: #f54e00;
  --primary-active: #d04200;
  --ink: #26251e;
  --body: #5a5852;
  --muted: #807d72;
  --hairline: #e6e5e0;
  --hairline-soft: #efeee8;
  --hairline-strong: #cfcdc4;
  --canvas: #f7f7f4;
  --surface-card: #ffffff;

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --sp-section: 80px;
  --sp-xxl: 48px;
  --sp-xl: 32px;
  --sp-lg: 24px;
  --sp-md: 20px;
  --sp-base: 16px;

  --rounded-md: 8px;
  --rounded-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

.top-nav {
  position: fixed; /* immune to scroll: no sticky re-positioning jitter */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  height: 64px;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline-soft);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-lg);
}

.wordmark { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.wordmark .dot { color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--body); transition: color 0.2s ease; }
.nav-links a:hover { color: var(--ink); }

/* language switch — 中 / EN */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
}
.lang-switch a {
  color: var(--muted);
  font-weight: 500;
  padding: 4px 2px;
  transition: color 0.2s ease;
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active { color: var(--primary); font-weight: 600; }
.lang-switch .sep { color: var(--hairline-strong); }

/* ---- scroll story: track + fixed viewport ---------------------------------- */
.hero-pond { height: 400vh; position: relative; }

/* fixed (not sticky): scroll only drives opacity, text position never moves —
   eliminates sub-pixel jitter caused by sticky re-positioning during scrolling */
.hero-sticky {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--canvas);
}

/* backdrop images */
.pond-scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #dfe9d9; }
.pond-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 72%;
  will-change: opacity, transform;
  transition: opacity 0.6s ease; /* image swap fades softly after a page-turn */
}

/* 第三张荷花图：全屏 cover（最小裁剪填满视窗），主体居中 */
.pond-img[data-i="2"] { object-fit: cover; object-position: 50% 50%; }

/* 视频 scrub 层：初始透明(poster 垫底)，loadeddata 后立即显示。
   poster 与视频首帧同帧，瞬时切换无差异；禁用过渡(弱网下过渡会卡在 0 导致视频整层不可见) */
.pond-video { opacity: 0; pointer-events: none; transition: none; }

/* cream veil — long smooth falloff, top kept light for the intro copy */
.pond-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(247, 247, 244, 0.88) 0%,
    rgba(247, 247, 244, 0.80) 14%,
    rgba(247, 247, 244, 0.60) 30%,
    rgba(247, 247, 244, 0.38) 44%,
    rgba(247, 247, 244, 0.20) 56%,
    rgba(247, 247, 244, 0.10) 66%,
    rgba(247, 247, 244, 0.06) 74%,
    rgba(247, 247, 244, 0.20) 86%,
    rgba(247, 247, 244, 0.88) 100%
  );
  transition: opacity 0.25s linear;
}

/* final white-out */
.white-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--canvas);
  opacity: 0;
  pointer-events: none;
}

/* ---- screen content layers -------------------------------------------------- */
.screen-content {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
}

.screen-content.visible { pointer-events: auto; }

.hero-content { justify-content: center; overflow: hidden; }

/* 首屏文案默认可见：JS 加载前(弱网/慢设备)也能看到 hero 内容，JS 就绪后接管淡入淡出 */
#screen-hero { opacity: 1; }

/* hero 内容包裹层：等比缩放(zoom)时保持与直接子元素相同的列式布局 */
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* soft radial glow behind the intro copy for contrast over imagery */
.hero-content::before {
  content: '';
  position: absolute;
  inset: 4% 10%;
  background: radial-gradient(
    ellipse at center,
    rgba(247, 247, 244, 0.72) 0%,
    rgba(247, 247, 244, 0.46) 42%,
    rgba(247, 247, 244, 0) 72%
  );
  z-index: -1;
  pointer-events: none;
}

/* translucent white veil over imagery (About / Projects), no card */
.screen-panel {
  background: rgba(255, 255, 255, 0.66);
}

.panel-inner {
  max-width: 760px;
  width: 100%;
  text-align: center;
}

.panel-inner .about-copy,
.panel-inner .projects-grid {
  text-align: left;
}

/* typography */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--body);
  margin-bottom: var(--sp-base);
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.9);
}

.section-title {
  font-size: 36px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.72px;
  color: var(--ink);
  margin-bottom: var(--sp-xxl);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 2px 20px rgba(255, 255, 255, 0.5);
}

.hero-avatar-wrap { text-align: center; }

.avatar {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--hairline);
  margin-bottom: var(--sp-xxl);
}

.hero-name {
  font-size: 72px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -2.16px;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 2px 26px rgba(255, 255, 255, 0.55);
}
.hero-name .dot { color: var(--primary); }

.hero-role {
  margin-top: var(--sp-md);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-active);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.9);
}

.hero-tagline {
  margin-top: var(--sp-xl);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.325px;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 2px 22px rgba(255, 255, 255, 0.5);
}

.hero-tagline-zh,
.hero-poem {
  margin-top: var(--sp-base);
  font-size: 17px;
  color: var(--body);
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.85);
}

.hero-cta { margin-top: var(--sp-xxl); display: flex; justify-content: center; gap: var(--sp-base); flex-wrap: wrap; }

/* buttons */
.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  border-radius: var(--rounded-md);
  padding: 10px 18px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-primary:hover { background: var(--primary-active); color: #ffffff; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-block;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  border-radius: var(--rounded-md);
  border: 1px solid var(--hairline-strong);
  padding: 9px 17px;
  transition: border-color 0.2s ease;
}
.btn-secondary:hover { border-color: var(--muted); }

/* about copy */
.about-copy p {
  font-size: 16px;
  line-height: 1.62;
  margin-bottom: var(--sp-md);
  color: var(--ink);
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.75);
}
.about-copy p:last-child { margin-bottom: 0; }
.about-copy .zh { color: var(--body); font-size: 15px; }
.about-copy a { font-weight: 600; }

/* projects grid — plain text, no cards */
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-xl); }

.product-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--canvas);
  border-radius: 9999px;
  padding: 4px 10px;
  margin-bottom: var(--sp-base);
}

.product-name {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.11px;
  color: var(--ink);
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.8);
}
.product-tagline {
  margin-top: var(--sp-base);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.7);
  flex: 1;
}
.product-cta { margin-top: var(--sp-xl); }
.product-cta .btn-primary { padding: 8px 16px; font-size: 13px; }

/* 产品卡正文中的内联链接（如加密标准出处） */
.product-tagline a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.product-tagline a:hover { color: var(--primary); }

/* VS Code 扩展开发案例 — 底部一行小字（扩展占比不大，不占版面） */
.ext-note {
  margin-top: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  text-align: left;
  text-shadow: 0 1px 6px rgba(255, 255, 255, 0.75);
}

.ext-note img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ext-note a { color: var(--body); text-decoration: underline; text-underline-offset: 3px; }
.ext-note a:hover { color: var(--primary); }

/* Community zone — 结尾幕留言讨论入口（横向卡片） */
.community-zone { margin-top: 32px; }

.community-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  max-width: 640px;
  width: 100%;
  /* 磨砂玻璃透明卡片 */
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--rounded-lg);
  padding: 26px 30px;
  text-align: left;
  box-shadow: 0 8px 32px rgba(38, 37, 30, 0.08);
}

.community-card .eyebrow { margin-bottom: 8px; }
.community-card .section-title { margin-bottom: 8px; font-size: 30px; }
.community-card .now-copy { margin-bottom: 0; font-size: 14px; }

.community-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.qr-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  /* 与磨砂卡片呼应：半透明白玻璃 */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--rounded-lg);
  padding: 8px 14px 8px 8px;
}

.qr-chip img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
}

.qr-chip span { font-size: 13px; font-weight: 500; color: var(--ink); }

/* 结尾幕：三处标题收紧间距，保证内容完整可见 */
.end-inner .section-title { margin-bottom: 20px; }
.end-row + .end-row { margin-top: 16px; }
.end-footer { margin-top: 26px; }

/* 面板内容超出视口时可从顶部滚动（短内容保持垂直居中） */
.screen-panel, .screen-end { justify-content: flex-start; }
.panel-inner, .end-inner { margin-top: auto; margin-bottom: auto; }

/* 面板保留极窄屏滚动能力，但隐藏滚动条（避免出现第二条滚动条） */
.screen-panel { scrollbar-width: none; }
.screen-panel::-webkit-scrollbar { display: none; }

/* 矮视口适配：压缩第 4 幕间距，减少缩放幅度 */
@media (max-height: 800px) {
  .screen-end .end-row + .end-row { margin-top: 14px; }
  .screen-end .community-zone { margin-top: 14px; }
  .screen-end .end-footer { margin-top: 14px; }
  .screen-end .end-inner .section-title { margin-bottom: 10px; font-size: 26px; }
}


/* end screen (white)：内容超出时由 JS 整体缩放适配，禁掉面板内滚动条 */
.screen-end { z-index: 4; overflow: hidden; }
.end-inner { position: relative; max-width: 960px; width: 100%; text-align: center; }
.end-gap { margin-top: var(--sp-xxl); }

.end-row {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

.end-row + .end-row { margin-top: 28px; }

.end-block {
  position: relative;
  z-index: 1;
  max-width: 560px;
  text-align: center;
}

/* decorative layers behind text — sized by JS to fit available space */
.carp-img {
  position: absolute;
  left: 1%;
  top: calc(50% - 50px); /* nudge up 50px total */
  z-index: 0;
  pointer-events: none; /* 纯装饰，不可点击 */
  cursor: default;
  /* JS 布局前的默认尺寸与隐藏：防止弱网/卡顿时闪现天然大图 */
  width: 132px;
  height: auto;
  max-width: 28vw;
  opacity: 0; /* 第四幕由 JS 渐显 */
  transform-origin: 50% 60%;
  filter: drop-shadow(0 8px 24px rgba(32, 32, 32, 0.12));
  animation: carp-sway 7s ease-in-out infinite;
}

@keyframes carp-sway {
  0%, 100% { transform: rotate(-3deg) translateY(-50%); }
  25%      { transform: rotate(0deg)  translateY(calc(-50% - 6px)); }
  50%      { transform: rotate(3deg)  translateY(-50%); }
  75%      { transform: rotate(0deg)  translateY(calc(-50% - 3px)); }
}

/* positioned by JS: bottom-aligned with the copyright line, width fits available space */
.frog-frames {
  position: absolute;
  right: 1%;
  z-index: 0;
  pointer-events: none; /* 纯装饰，不可点击 */
  cursor: default;
  opacity: 0; /* shown once JS lays it out */
}

.frog-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(-1); /* mirrored */
}

/* 6s cross-fade loop: one fades in while the other fades out */
.frog-frame.f1 { animation: frog-f1 6s ease-in-out infinite; }
.frog-frame.f2 { animation: frog-f2 6s ease-in-out infinite; }

@keyframes frog-f1 { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes frog-f2 { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

.now-copy { font-size: 16px; line-height: 1.5; margin-bottom: var(--sp-md); color: var(--body); }
.now-copy:last-child { margin-bottom: 0; }
.now-copy.zh { color: var(--muted); font-size: 15px; }

.links-rows { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: var(--sp-md); }
.links-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; }
.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.0;
  padding: 4px 6px;
  transition: color 0.2s ease;
}
.link-pill img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
}
.link-pill:hover { color: var(--primary); }

.end-footer { margin-top: var(--sp-xxl); font-size: 13px; line-height: 1.7; color: var(--muted); }
.end-footer .zh { margin-top: 2px; }
.end-footer .credit { margin-top: 8px; font-size: 12px; color: var(--muted); }
.end-footer .credit a { color: inherit; text-decoration: underline; }
.end-footer .credit a:hover { color: var(--primary); }

/* ---- responsive ------------------------------------------------------------- */
@media (max-width: 734px) {
  .screen-content { padding: 80px 16px 24px; justify-content: flex-start; }
  .hero-content { justify-content: center; }
  .hero-name { font-size: 44px; letter-spacing: -1.32px; }
  .hero-tagline { font-size: 22px; }
  .avatar { width: 132px; height: 132px; margin-bottom: var(--sp-xl); }
  .section-title { font-size: 28px; margin-bottom: var(--sp-xl); }
  .glass, .panel-inner { padding: 0; }
  .screen-panel { padding: 80px 22px 40px; } /* 80px clears the 64px fixed nav */
  .projects-grid { grid-template-columns: 1fr; }
  .ext-note { justify-content: center; text-align: center; }
  .community-zone { margin-top: 26px; }
  .community-card { flex-direction: column; gap: 18px; padding: 22px 20px; text-align: center; }
  .community-copy { text-align: center; }
  .community-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }

  .nav-links { gap: 16px; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-inner { flex-wrap: nowrap; }
  .wordmark { font-size: 13px; flex-shrink: 0; }

  /* bigger touch targets */
  .link-pill { padding: 10px 14px; gap: 8px; }
  .nav-links a { padding: 8px 2px; }
  .lang-switch a { padding: 8px 2px; }

  /* mobile only: two-column icon grid, second row aligned to the first row */
  .links-rows {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    column-gap: 28px;
    row-gap: 12px;
    justify-content: center;
  }
  .links-row { display: contents; }
  .links-row .link-pill { justify-self: start; }

  /* safe vertical centering: auto margins center content when it fits,
     and collapse to top-aligned (no clipping) when it is taller than the
     viewport — keeps the eyebrow (01/02/03) always visible */
  .panel-inner, .end-inner { margin-top: auto; margin-bottom: auto; }
}
