/* =======================================================
   鸦舍 / Crowxjy — 多主题电子书风格主样式表
   设计语言：
     · 通过 [data-theme] 切换 5 套整站风格(mono / pixel / terminal / manuscript / blackgold)
     · 主题不仅切色,还切字体、圆角、阴影质感、纹理、装饰
   ======================================================= */

/* ============================================================
   1. 主题令牌(默认: mono · 素描黑白)
   ============================================================ */
@font-face {
  font-family: 'Fusion Pixel 10px Monospaced';
  src: url('./assets/fonts/fusion-pixel-10px-monospaced-zh_hans.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* —— 颜色 —— */
  --washi:        #FFFFFF;   /* 主底:雪白 */
  --washi-2:      #F2F2F2;
  --paper:        #FFFFFF;   /* 内卡纸面 */
  --ink:          #1A1A1A;   /* 墨黑 */
  --ink-soft:     #404040;
  --ink-mute:     #8A8A8A;
  --shu:          #2A2A2A;   /* 主强调:深炭 */
  --shu-light:    #4A4A4A;
  --shu-deep:     #000000;
  --matcha:       #6B6B6B;
  --kincha:       #9A9A9A;
  --rurikon:      #2C3E50;
  --line:         #E0E0E0;

  /* —— RGB 三元组 —— */
  --shu-rgb:      42, 42, 42;
  --shu-deep-rgb: 0, 0, 0;
  --ink-rgb:      26, 26, 26;
  --washi-rgb:    255, 255, 255;
  --matcha-rgb:   107, 107, 107;

  /* —— 字体(默认:简洁现代衬线 + 思源宋体) —— */
  --font-jp:    'Cormorant Garamond', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
  --font-serif: 'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', serif;
  --font-serif-zh: 'Shippori Mincho', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', serif;
  --font-sans:  'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-hand:  'Cormorant Garamond', 'Noto Serif SC', serif;

  /* —— 间距 —— */
  --s-1: 4px;  --s-2: 8px;  --s-3: 16px; --s-4: 24px;
  --s-5: 32px; --s-6: 48px; --s-7: 64px; --s-8: 96px; --s-9: 128px;

  /* —— 半径(mono: 极小圆角) —— */
  --r-sm: 0px; --r-md: 2px;  --r-lg: 4px;

  /* —— 阴影风格(mono: 几乎无阴影,靠细描边) —— */
  --shadow-1: 0 1px 2px rgba(var(--ink-rgb),0.04);
  --shadow-2: 0 2px 6px rgba(var(--ink-rgb),0.06);
  --shadow-3: 0 8px 20px rgba(var(--ink-rgb),0.08);

  /* —— 装饰:页角小印 / 印章 / 章纹 默认开关(mono: 关) —— */
  --deco-corner-opacity: .15;
  --deco-seal-display:   none;     /* 朱砂印章在 mono 下隐藏 */
  --deco-vline-display:  none;     /* 竖排"第一章·序"在 mono 下隐藏 */
  --deco-stamp-display:  none;     /* contact "緣" 印章 */
  --deco-eyebrow-bars:   1;        /* 0=无 1=有 */
  --deco-noise-opacity:  0.018;    /* book 噪点强度 */

  /* —— 容器 / 缓动 —— */
  --container: 1240px;
  --ease-out:  cubic-bezier(.22,1,.36,1);
  --ease-soft: cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   1.1 主题: vermilion 已移除(与 manuscript 风格相近,保留 manuscript)
   ============================================================ */

/* ============================================================
   1.2 主题: pixel · 8bit 像素
   ============================================================ */
[data-theme="pixel"] {
  --washi:        #151515;
  --washi-2:      #2B1B12;
  --paper:        #241610;
  --ink:          #FFF4D6;
  --ink-soft:     #FFD966;
  --ink-mute:     #C78E4A;
  --shu:          #FF6B4A;       /* 像素绿主调 */
  --shu-light:    #FF9A6B;
  --shu-deep:     #E52521;
  --matcha:       #00A800;       /* 黄色像素 */
  --kincha:       #FBD000;
  --rurikon:      #5C94FC;
  --line:         #8B4513;
  --shu-rgb:      255, 107, 74;
  --shu-deep-rgb: 229, 37, 33;
  --ink-rgb:      255, 244, 214;
  --washi-rgb:    21, 21, 21;
  --matcha-rgb:   0, 168, 0;

  --font-jp:    'Press Start 2P', 'VT323', 'Songti SC', monospace;
  --font-serif: 'VT323', 'Press Start 2P', 'Songti SC', monospace;
  --font-sans:  'VT323', 'Press Start 2P', monospace;
  --font-hand:  'Press Start 2P', 'VT323', monospace;

  --r-sm: 0px; --r-md: 0px; --r-lg: 0px;
  /* 4px 硬阴影偏移,无模糊 —— 8bit 标志 */
  --shadow-1: 4px 4px 0 0 rgba(var(--shu-rgb),.6);
  --shadow-2: 6px 6px 0 0 rgba(var(--shu-rgb),.7);
  --shadow-3: 8px 8px 0 0 rgba(var(--shu-rgb),.8);

  --deco-corner-opacity: .8;
  --deco-seal-display:   grid;
  --deco-vline-display:  inline-block;
  --deco-stamp-display:  block;
  --deco-eyebrow-bars:   1;
  --deco-noise-opacity:  0.04;
}

/* ============================================================
   1.3 主题: terminal · 终端绿幕
   ============================================================ */
[data-theme="terminal"] {
  --washi:        #0A0E0A;
  --washi-2:      #0F1A10;
  --paper:        #0A0E0A;
  --ink:          #00FF41;       /* CRT 经典磷光绿 */
  --ink-soft:     #00CC33;
  --ink-mute:     #008822;
  --shu:          #00FF41;
  --shu-light:    #66FF8A;
  --shu-deep:     #00AA2A;
  --matcha:       #FFD93D;
  --kincha:       #FFB300;
  --rurikon:      #00CCFF;
  --line:         #003D14;
  --shu-rgb:      0, 255, 65;
  --shu-deep-rgb: 0, 170, 42;
  --ink-rgb:      0, 255, 65;
  --washi-rgb:    10, 14, 10;
  --matcha-rgb:   255, 217, 61;

  --font-jp:    'JetBrains Mono', 'Sarasa Mono SC', 'Cascadia Code', 'Courier New', monospace;
  --font-serif: 'JetBrains Mono', 'Sarasa Mono SC', monospace;
  --font-sans:  'JetBrains Mono', 'Sarasa Mono SC', 'IBM Plex Mono', monospace;
  --font-hand:  'JetBrains Mono', 'Sarasa Mono SC', monospace;

  --r-sm: 0px; --r-md: 0px; --r-lg: 0px;
  /* 文字发光阴影 —— 通过 box-shadow + filter 模拟 */
  --shadow-1: 0 0 4px rgba(var(--shu-rgb),.4);
  --shadow-2: 0 0 12px rgba(var(--shu-rgb),.5);
  --shadow-3: 0 0 24px rgba(var(--shu-rgb),.6);

  --deco-corner-opacity: .6;
  --deco-seal-display:   none;
  --deco-vline-display:  inline-block;
  --deco-stamp-display:  none;
  --deco-noise-opacity:  0.06;
}

/* ============================================================
   1.4 主题: manuscript · 手稿钢笔
   ============================================================ */
[data-theme="manuscript"] {
  --washi:        #FAF6E8;       /* 米黄方格纸 */
  --washi-2:      #F0E9D0;
  --paper:        #FFFCF0;
  --ink:          #2C3E50;       /* 钢笔蓝黑 */
  --ink-soft:     #34495E;
  --ink-mute:     #7F8C8D;
  --shu:          #C0392B;       /* 红铅笔批注 */
  --shu-light:    #E74C3C;
  --shu-deep:     #922B21;
  --matcha:       #27AE60;
  --kincha:       #D68910;
  --rurikon:      #2980B9;
  --line:         #D5C9A0;
  --shu-rgb:      192, 57, 43;
  --shu-deep-rgb: 146, 43, 33;
  --ink-rgb:      44, 62, 80;
  --washi-rgb:    250, 246, 232;
  --matcha-rgb:   39, 174, 96;

  --font-jp:    'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'Noto Serif SC', serif;
  --font-serif: 'Playfair Display', 'LXGW WenKai', 'Kaiti SC', serif;
  --font-sans:  'Inter', 'LXGW WenKai', 'Kaiti SC', sans-serif;
  --font-hand:  'Caveat', 'LXGW WenKai', 'Kaiti SC', serif;

  --r-sm: 1px; --r-md: 2px; --r-lg: 3px;
  --shadow-1: 1px 2px 4px rgba(var(--ink-rgb),0.10);
  --shadow-2: 2px 4px 10px rgba(var(--ink-rgb),0.12);
  --shadow-3: 4px 8px 20px rgba(var(--ink-rgb),0.18);

  --deco-corner-opacity: .25;
  --deco-seal-display:   none;
  --deco-vline-display:  none;
  --deco-stamp-display:  block;
  --deco-noise-opacity:  0.03;
}

/* ============================================================
   1.5 主题: blackgold · 黑金现代奢华
   ============================================================ */
[data-theme="blackgold"] {
  --washi:        #080706;
  --washi-2:      #12100C;
  --paper:        #17130C;
  --ink:          #F5ECD8;
  --ink-soft:     #D8C799;
  --ink-mute:     #9D8C63;
  --shu:          #D8B667;
  --shu-light:    #F3D98E;
  --shu-deep:     #8F6828;
  --matcha:       #5FA48D;
  --kincha:       #B88732;
  --rurikon:      #77A8B8;
  --line:         #3A2D18;
  --shu-rgb:      216, 182, 103;
  --shu-deep-rgb: 143, 104, 40;
  --ink-rgb:      245, 236, 216;
  --washi-rgb:    8, 7, 6;
  --matcha-rgb:   95, 164, 141;

  --font-jp:    'Playfair Display', 'Noto Serif SC', 'Songti SC', serif;
  --font-serif: 'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', serif;
  --font-serif-zh: 'Playfair Display', 'Noto Serif SC', 'Songti SC', serif;
  --font-sans:  'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-hand:  'Cormorant Garamond', 'Noto Serif SC', serif;

  --r-sm: 2px; --r-md: 6px; --r-lg: 8px;
  --shadow-1: 0 10px 28px rgba(0,0,0,.34), 0 0 0 1px rgba(var(--shu-rgb),.10);
  --shadow-2: 0 18px 42px rgba(0,0,0,.42), 0 0 0 1px rgba(var(--shu-rgb),.14);
  --shadow-3: 0 28px 72px rgba(0,0,0,.52), 0 0 0 1px rgba(var(--shu-rgb),.18);

  --deco-corner-opacity: .48;
  --deco-seal-display:   grid;
  --deco-vline-display:  inline-block;
  --deco-stamp-display:  block;
  --deco-eyebrow-bars:   1;
  --deco-noise-opacity:  0.028;
}
[data-theme="blackgold"] body[data-lang="zh"] {
  --font-hand: 'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', serif;
}


/* ------- 2. 重置 ------- */
*,*::before,*::after { box-sizing: border-box; margin:0; padding:0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); color: var(--ink); background: var(--washi); line-height:1.65; -webkit-font-smoothing: antialiased; }
img  { max-width:100%; display:block; }
a    { color: inherit; text-decoration: none; }
ul,ol { list-style: none; }
button { font: inherit; cursor: pointer; border:none; background:none; }

/* ------- 3. 全站和纸纹理底 ------- */
.book {
  position: relative;
  background-color: var(--washi);
  /* 双层叠加：噪点 + 纤维条纹，模拟和纸纤维 */
  background-image:
    radial-gradient(rgba(var(--ink-rgb),var(--deco-noise-opacity)) 1px, transparent 1px),
    radial-gradient(rgba(var(--ink-rgb),calc(var(--deco-noise-opacity) * 0.6)) 1px, transparent 1px),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(var(--ink-rgb),0.012) 3px 4px);
  background-size: 5px 5px, 9px 9px, 100% 4px;
  background-position: 0 0, 2px 3px, 0 0;
}

/* —— 主题特定纹理覆盖 —— */
/* pixel: 扫描线 + 像素粗格 */
[data-theme="pixel"] .book {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(var(--shu-rgb),.04) 2px 3px),
    repeating-linear-gradient(90deg, transparent 0 2px, rgba(var(--shu-rgb),.03) 2px 3px);
  background-size: 100% 3px, 3px 100%;
}
/* terminal: CRT 扫描线 + 微闪 */
[data-theme="terminal"] .book {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(var(--shu-rgb),.06) 2px 3px),
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.3) 100%);
  background-size: 100% 3px, 100% 100%;
}
[data-theme="terminal"] body { text-shadow: 0 0 2px rgba(var(--shu-rgb),.5); }
/* manuscript: 米黄方格纸 */
[data-theme="manuscript"] .book {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(var(--ink-rgb),.08) 27px 28px),
    repeating-linear-gradient(90deg, transparent 0 27px, rgba(var(--ink-rgb),.04) 27px 28px),
    radial-gradient(rgba(var(--ink-rgb),0.025) 1px, transparent 1px);
  background-size: 100% 28px, 28px 100%, 5px 5px;
}
/* blackgold: 黑曜漆面 + 细金属丝纹 */
[data-theme="blackgold"] .book {
  background-image:
    linear-gradient(135deg, rgba(var(--shu-rgb), .14) 0%, transparent 34%, rgba(119, 168, 184, .06) 68%, transparent 100%),
    linear-gradient(180deg, rgba(255,255,255,.035) 0%, transparent 28%, rgba(0,0,0,.22) 100%),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(var(--shu-rgb),.035) 18px 19px),
    radial-gradient(rgba(var(--shu-rgb),0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 19px 100%, 7px 7px;
}


/* ============================================================
   2.1 主题特定:标题字体 / 字号微调
   ============================================================ */

/* —— vermilion 已移除 —— */

/* —— pixel: Press Start 2P 字符宽度极大,英文标题需缩字号 —— */
[data-theme="pixel"] .hero__title       { font-size: clamp(28px, 5vw, 64px); line-height: 1.25; letter-spacing: 0; }
[data-theme="pixel"] .hero__subtitle    { font-size: clamp(14px, 1.6vw, 22px); line-height: 1.6; }
[data-theme="pixel"] .resume-cover__title { font-size: clamp(32px, 5.5vw, 72px); line-height: 1.2; }
[data-theme="pixel"] .chap__company     { font-size: clamp(18px, 2.4vw, 32px); line-height: 1.3; letter-spacing: 0; }
[data-theme="pixel"] .section-title     { font-size: clamp(22px, 3vw, 36px); line-height: 1.3; }
[data-theme="pixel"] .exp-card__company { font-size: clamp(14px, 1.6vw, 20px); }

/* —— terminal: chap 左侧色带改为纯绿,去掉橙色渐变 —— */
[data-theme="terminal"] .chap .story::before {
  background: linear-gradient(180deg, var(--shu), var(--shu-deep)) !important;
}
/* terminal 下 cover 标题左竖栏渐变也对齐 */
[data-theme="terminal"] .resume-cover::before {
  background: linear-gradient(180deg, var(--shu), var(--shu-deep)) !important;
}

/* —— mono: ribbon__badge 全部黑白灰,去掉金/银/抹茶彩色渐变 —— */
[data-theme="mono"] .case-card__thumb {
  border-bottom: 1px solid var(--line);
}
[data-theme="mono"] .ribbon__badge--gold {
  background: linear-gradient(135deg, #2A2A2A, #000000) !important;
  color: #fff !important;
}
[data-theme="mono"] .ribbon__badge--silver {
  background: linear-gradient(135deg, #BFBFBF, #6B6B6B) !important;
  color: #fff !important;
}
[data-theme="mono"] .ribbon__badge--matcha {
  background: linear-gradient(135deg, #8A8A8A, #404040) !important;
  color: #fff !important;
}
/* —— pixel: ribbon 用纯像素绿/黄 —— */
[data-theme="pixel"] .ribbon__badge--gold   { background: linear-gradient(135deg, #FBD000, #E8871A) !important; }
[data-theme="pixel"] .ribbon__badge--silver { background: linear-gradient(135deg, #72D84A, #00A800) !important; }
[data-theme="pixel"] .ribbon__badge--matcha { background: linear-gradient(135deg, #7EC8FF, #5C94FC) !important; }
[data-theme="pixel"] .ribbon__badge--gold,
[data-theme="pixel"] .ribbon__badge--silver,
[data-theme="pixel"] .ribbon__badge--matcha { color: #151515 !important; }
/* —— terminal: ribbon 全部磷光绿 —— */
[data-theme="terminal"] .ribbon__badge--gold,
[data-theme="terminal"] .ribbon__badge--silver,
[data-theme="terminal"] .ribbon__badge--matcha {
  background: linear-gradient(135deg, var(--shu-light), var(--shu-deep)) !important;
  color: #001a00 !important;
}
/* —— manuscript: ribbon 用钢笔蓝 + 红铅笔 —— */
[data-theme="manuscript"] .ribbon__badge--gold   { background: linear-gradient(135deg, #D68910, #B7791F) !important; }
[data-theme="manuscript"] .ribbon__badge--silver { background: linear-gradient(135deg, #2980B9, #1F618D) !important; }
[data-theme="manuscript"] .ribbon__badge--matcha { background: linear-gradient(135deg, #27AE60, #1E8449) !important; }
/* —— blackgold: 金属高光 + 少量冷色平衡 —— */
[data-theme="blackgold"] .ribbon__badge--gold {
  background: linear-gradient(135deg, #FFF2B8 0%, #D8B667 48%, #8F6828 100%) !important;
  color: #080706 !important;
}
[data-theme="blackgold"] .ribbon__badge--silver {
  background: linear-gradient(135deg, #F1E8D4 0%, #9D9480 52%, #4B463A 100%) !important;
  color: #080706 !important;
}
[data-theme="blackgold"] .ribbon__badge--matcha {
  background: linear-gradient(135deg, #9BD9C5 0%, #5FA48D 55%, #2F5D52 100%) !important;
  color: #07100D !important;
}

/* —— blackgold: 高对比兜底,避免浅金底上出现白字 —— */
[data-theme="blackgold"] .brand__seal,
[data-theme="blackgold"] .contact__stamp,
[data-theme="blackgold"] .exp-card__corner::after,
[data-theme="blackgold"] .resume-end__seal,
[data-theme="blackgold"] .chap-toc a:hover::before,
[data-theme="blackgold"] .chap-toc a.is-active::before {
  color: #080706;
}
[data-theme="blackgold"] .chap__seq,
[data-theme="blackgold"] .ed__btn--primary,
[data-theme="blackgold"] .ed__center-tab.is-active,
[data-theme="blackgold"] .ed__pill.is-active {
  color: #080706;
  background: linear-gradient(135deg, var(--shu-light), var(--shu) 58%, var(--kincha));
  border-color: rgba(var(--shu-rgb), .7);
}
[data-theme="blackgold"] .ed__btn--primary:hover:not(:disabled) {
  color: #080706;
  background: linear-gradient(135deg, #FFF2B8, var(--shu) 55%, var(--shu-deep));
}
[data-theme="blackgold"] .story mark {
  color: var(--shu-light);
  background: linear-gradient(180deg, transparent 55%, rgba(var(--shu-rgb), .24) 55%);
}
[data-theme="blackgold"] .site-header {
  background: rgba(var(--washi-rgb), .78);
  box-shadow: 0 1px 0 rgba(var(--shu-rgb), .10);
}
[data-theme="blackgold"] .exp-card,
[data-theme="blackgold"] .case-card,
[data-theme="blackgold"] .story {
  box-shadow: 0 0 0 1px rgba(var(--shu-rgb), .05);
}
[data-theme="blackgold"] .exp-card__ribbon {
  background: linear-gradient(180deg, rgba(var(--shu-rgb), .14) 0%, var(--paper) 100%);
}
[data-theme="blackgold"] .hero__cta {
  color: #080706;
  background: linear-gradient(135deg, var(--shu-light) 0%, var(--shu) 48%, var(--kincha) 100%);
  border: 1px solid rgba(var(--shu-rgb), .55);
  box-shadow: 0 14px 34px rgba(0,0,0,.38), 0 0 0 1px rgba(var(--shu-rgb), .18);
}
[data-theme="blackgold"] .hero__cta::before {
  background: linear-gradient(120deg, #FFF2B8 0%, var(--shu) 46%, var(--shu-deep) 100%);
}
[data-theme="blackgold"] .case-card__thumb,
[data-theme="blackgold"] .sharing-item {
  filter: saturate(.95) contrast(1.04);
}


/* 页角装饰：右上 / 左下 朱砂线条小印 */
.book::before, .book::after {
  content: ""; position: fixed; width: 60px; height: 60px;
  border: 1.5px solid var(--shu); opacity: var(--deco-corner-opacity); pointer-events: none; z-index: 1;
}
.book::before { top: 18px; right: 18px; border-left: none; border-bottom: none; }
.book::after  { bottom: 18px; left: 18px;  border-right: none; border-top: none; }

/* ------- 4. 顶部导航 ------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 40px;
  background: rgba(var(--washi-rgb),0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color .35s var(--ease-out), box-shadow .35s var(--ease-out), background-color .8s var(--ease-out);
}
.site-header .nav { justify-self: center; }
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(var(--ink-rgb),0.04);
}

/* 语言切换器 — 默认 v17 优雅纸张感(mono/manuscript 适用)
   pixel/terminal 主题在下方各自专项覆盖,确保 WCAG AA */
.lang-switch {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.4);
  overflow: hidden;
  font-family: 'JetBrains Mono', var(--font-sans);
  font-size: 12px;
  letter-spacing: .08em;
}
.lang-switch button {
  padding: 6px 12px;
  color: var(--ink-mute);
  background: transparent;
  transition: color .3s var(--ease-out), background-color .3s var(--ease-out);
  font-weight: 500;
}
.lang-switch button:hover:not(.is-active) { color: var(--shu); }
.lang-switch button.is-active {
  background: var(--ink);
  color: #fff;
}
.lang-switch__divider {
  width: 1px; align-self: stretch; background: var(--line);
}

/* —— pixel 主题:像素硬边 + 高对比度 ——
   washi #1A1A2E + ink #EAEAEA = contrast 14.6:1 ✓ AAA
   shu #00C853 + washi #1A1A2E = contrast 9.4:1 ✓ AAA */
[data-theme="pixel"] .lang-switch {
  border-radius: 0;
  border-width: 2px;
  border-color: var(--shu);
  background: var(--washi);
  font-size: 12px;                                /* 与默认一致 */
}
[data-theme="pixel"] .lang-switch button {
  font-family: 'VT323', monospace;
  font-size: 13px;                                /* VT323 渲染比 Inter 视觉略小,微调 */
  letter-spacing: .08em;
  color: var(--ink);
  min-width: 32px;                                /* 中/EN 等宽 */
  text-align: center;
  padding: 6px 10px;
}
[data-theme="pixel"] .lang-switch button.is-active {
  background: var(--shu);
  color: var(--washi);
  text-shadow: none;
}
[data-theme="pixel"] .lang-switch__divider { background: var(--shu); }

/* —— terminal 主题:CRT 绿幕高对比 ——
   实底深绿底 + 亮绿字;active 用反色
   ink #00FF41 + washi #0A0E0A = contrast 13.2:1 ✓ AAA */
[data-theme="terminal"] .lang-switch {
  border-radius: 0;
  border: 1px solid var(--shu);
  background: var(--washi);
}
[data-theme="terminal"] .lang-switch button {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
  background: transparent;
}
[data-theme="terminal"] .lang-switch button:hover:not(.is-active) {
  background: rgba(var(--shu-rgb), .12);
}
[data-theme="terminal"] .lang-switch button.is-active {
  background: var(--shu);
  color: var(--washi);
}
[data-theme="terminal"] .lang-switch__divider { background: var(--shu); opacity: .5; }

/* —— blackgold 主题:半透明黑金胶囊,active 使用香槟金反色 —— */
[data-theme="blackgold"] .lang-switch {
  border-color: rgba(var(--shu-rgb), .38);
  background: rgba(255,255,255,.055);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
[data-theme="blackgold"] .lang-switch button {
  color: var(--ink-soft);
}
[data-theme="blackgold"] .lang-switch button:hover:not(.is-active) {
  color: var(--shu-light);
  background: rgba(var(--shu-rgb), .08);
}
[data-theme="blackgold"] .lang-switch button.is-active {
  background: linear-gradient(135deg, var(--shu-light), var(--shu));
  color: #080706;
}
[data-theme="blackgold"] .lang-switch__divider { background: rgba(var(--shu-rgb), .28); }

/* —— 导航主题切换按钮(静态莱洛三角) —— */
.nav-theme-toggle {
  /* 默认隐藏,首页未滚动时不可见;履历页或滚动后由 .is-visible 显示 */
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--shu);
  background: rgba(var(--washi-rgb), .4);
  /* 纯色,无阴影、无渐变、无光效 */
  box-shadow: none;
  filter: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: scale(.85);
  transition: opacity .35s var(--ease-out),
              transform .35s var(--ease-out),
              visibility 0s linear .35s,
              color .4s var(--ease-out),
              border-color .4s var(--ease-out);
}
.nav-theme-toggle.is-visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity .35s var(--ease-out),
              transform .35s var(--ease-out),
              visibility 0s linear 0s,
              color .4s var(--ease-out),
              border-color .4s var(--ease-out);
}
.nav-theme-toggle:hover {
  color: var(--shu-deep);
  border-color: var(--shu);
}
.nav-theme-toggle:active { transform: scale(.92); }
.nav-theme-toggle:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 2px;
}
.nav-theme-toggle svg {
  display: block;
  /* 仅纯色填充,无 drop-shadow / 无渐变 */
}

/* terminal 主题:莱洛三角改为描边风(CRT 矢量线稿) */
[data-theme="terminal"] .nav-theme-toggle {
  background: transparent;                      /* 透明底 */
  border: 1px solid var(--shu);
  box-shadow: 0 0 0 1px rgba(var(--shu-rgb), .25),
              inset 0 0 6px rgba(var(--shu-rgb), .12);
}
[data-theme="terminal"] .nav-theme-toggle:hover {
  background: rgba(var(--shu-rgb), .08);
  box-shadow: 0 0 0 1px rgba(var(--shu-rgb), .5),
              inset 0 0 10px rgba(var(--shu-rgb), .2);
}
[data-theme="terminal"] .nav-theme-toggle svg path {
  fill: none !important;
  stroke: currentColor;
  stroke-width: 18;                             /* viewBox -180/180 → 18 单位约 1px 视觉 */
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(var(--shu-rgb), .6));
}
[data-theme="terminal"] .nav-theme-toggle:focus-visible {
  outline-color: var(--shu);
  box-shadow: 0 0 0 2px rgba(var(--shu-rgb), .4),
              inset 0 0 10px rgba(var(--shu-rgb), .25);
}
[data-theme="blackgold"] .nav-theme-toggle,
[data-theme="blackgold"] .lang-toggle-mobile {
  color: var(--shu-light);
  border-color: rgba(var(--shu-rgb), .42);
  background: rgba(var(--shu-rgb), .08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06),
              0 8px 24px rgba(0,0,0,.24);
}
[data-theme="blackgold"] .nav-theme-toggle:hover,
[data-theme="blackgold"] .lang-toggle-mobile:hover {
  color: #FFF2B8;
  border-color: var(--shu);
  background: rgba(var(--shu-rgb), .14);
}
.nav-theme-toggle__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand { display:flex; align-items:center; gap: 10px; position: relative; }
.brand__avatar { width:34px; height:34px; border-radius:50%; object-fit: cover; border: 1px solid var(--line); }
.brand__seal {
  position:absolute; left: 18px; top: -6px;
  width: 22px; height: 22px;
  display: var(--deco-seal-display, grid); place-items: center;
  font-family: var(--font-jp); font-weight: 700; font-size: 13px;
  color: #fff; background: var(--shu);
  transform: rotate(-8deg);
  box-shadow: 0 2px 6px rgba(var(--shu-deep-rgb),.4);
  border-radius: var(--r-sm);
  animation: sealPulse 4s var(--ease-out) infinite;
}
@keyframes sealPulse {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50%      { transform: rotate(-6deg) scale(1.06); }
}
.brand__name { font-family: var(--font-jp); font-weight: 700; font-size: 22px; letter-spacing: .04em; padding-left: 14px; }

.nav { display: flex; gap: 28px; }
.nav__link {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  padding: 4px 2px;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  transition: color .25s var(--ease-out);
}
.nav__link em {
  font-family: var(--font-jp); font-style: normal; font-size: 10px;
  color: var(--ink-mute); letter-spacing: .12em; margin-top: 2px;
  transition: color .25s var(--ease-out);
}
.nav__link::after {
  content:""; position: absolute; left: 50%; bottom: -4px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--shu);
  transform: translateX(-50%) scale(0);
  transition: transform .35s var(--ease-out);
}
.nav__link:hover, .nav__link.is-active { color: var(--ink); }
.nav__link:hover em, .nav__link.is-active em { color: var(--shu); }
.nav__link:hover::after, .nav__link.is-active::after { transform: translateX(-50%) scale(1); }

/* ------- 5. Hero / 序章 ------- */
.hero {
  position: relative;
  min-height: calc(100vh - 70px);
  min-height: calc(100dvh - 70px);    /* iOS Safari 动态视口 */
  display: flex; align-items: center;
  padding: var(--s-8) var(--s-6);
  overflow: hidden;
}

/* Hero 主栅格:左 7 文字 / 右 5 斐波那契曲线 —— 修复 V2 居中偏移 */
.hero__grid {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s-6);
  align-items: center;
}

/* —— 莱洛三角形 Reuleaux Triangle(V2 朱砂日轮配色 · 可交互玩具) —— */
.hero__reul {
  position: relative;
  width: 100%;
  display: flex; justify-content: center; align-items: center;
  color: var(--shu);
  outline: none;
  /* 入场 + 漂浮 全部放在容器层,不污染 .hero__reul-spin 的 transform */
  animation: reulContainerIn 1.4s var(--ease-out) both,
             reulFloat 9s var(--ease-out) infinite 1.4s;
}
.hero__reul:focus-visible { box-shadow: 0 0 0 3px rgba(var(--shu-rgb),.35); border-radius: 24px; }

.hero__reul-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 18px 48px rgba(var(--shu-deep-rgb),.28));
  transition: filter .8s ease-out;
}
/* SVG 渐变 stop 颜色平滑过渡 */
.hero__reul-svg stop { transition: stop-color .8s ease-out; }
/* 莱洛三角形渐变 —— 通过 CSS 控制 stop-color,跟随主题切换
   (SVG stop-color 属性不支持 CSS var(),必须用 stop-color 样式属性) */
#reulStop0 { stop-color: var(--shu-light); }
#reulStop1 { stop-color: var(--shu); }
#reulStop2 { stop-color: var(--shu-deep); }

/* 莱洛主体 —— 可交互层
   旋转和入场全部交给 anime.js,绝对不写 CSS animation,避免 keyframe 终态覆盖 inline transform */
.hero__reul-spin {
  /* SVG <g> 在 user space (0,0) 即 viewBox 中心(因为 viewBox 是 -180 -180 360 360)
     不要写 transform-box: fill-box —— 那会把基准切换到包围盒左上角,导致绕角旋转 */
  transform-origin: 0 0;
  cursor: pointer;
  transition: filter .4s var(--ease-out);
}
.hero__reul-spin:hover  { filter: drop-shadow(0 6px 18px rgba(var(--shu-rgb),.35)); }
.hero__reul-spin:active { filter: drop-shadow(0 2px 6px rgba(var(--shu-rgb),.5)); }

/* 辅助层:外圆(虚线 V2) + 内三角,反向缓转 —— 永远恒速,不响应 hover/click */
.hero__reul-aux {
  color: var(--shu-deep);
  opacity: .42;
  transform-origin: 0 0;
  animation: reulSpinReverse 36s linear infinite;
  pointer-events: none;     /* 让点击穿过到下层主体,且自身不响应 */
}
.hero__reul-aux .hero__reul-tri path { stroke-dasharray: 2 4; }

/* 中心锚点 */
.hero__reul-dot { filter: drop-shadow(0 0 4px rgba(255,255,255,.7)); pointer-events: none; }

/* —— Keyframes —— */
@keyframes reulSpin        { from { transform: rotate(0deg); }   to { transform: rotate(360deg); } }
@keyframes reulSpinReverse { from { transform: rotate(0deg); }   to { transform: rotate(-360deg); } }
@keyframes reulContainerIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes reulFloat {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__reul-spin,
  .hero__reul-aux,
  .hero__reul        { animation: none !important; }
}

/* 竖排小字（章节号） */
.hero__vline {
  position: absolute; left: 32px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-jp); font-size: 13px; letter-spacing: .6em;
  writing-mode: vertical-rl; color: var(--ink-mute);
  display: var(--deco-vline-display, inline-block);
}
.hero__vline span {
  display: inline-block;
  border-left: 1px solid var(--line); padding-left: 14px;
  animation: fadeUp 1.2s var(--ease-out) both;
}

.hero__inner { max-width: 100%; position: relative; z-index: 2; }
.hero__eyebrow {
  font-family: var(--font-jp); font-size: 12px; letter-spacing: .35em;
  color: var(--shu); margin-bottom: 18px;
  display: inline-flex; align-items: center; gap: 10px;
}
.hero__eyebrow::before, .hero__eyebrow::after {
  content: ""; width: 24px; height: 1px; background: var(--shu);
}
.hero__title {
  font-family: var(--font-jp);
  font-weight: 800;
  font-size: clamp(56px, 10vw, 132px);
  line-height: 1.08;
  letter-spacing: -.01em;
  margin-bottom: var(--s-4);
}
/* 强制换行符 —— 让 "欢迎来到" 与 "乌鸦的小窝" 正常上下对齐(左对齐,无错位) */
.hero__title .ink-break { display: none; }
/* 中文版:在第一/第二 span 之间换行,且第三 span(英文 Crowxjy)隐藏(中文用两行) */
body[data-lang="zh"] .hero__title .ink-break { display: block; width: 100%; height: 0; }
body[data-lang="zh"] .hero__title .ink--n3 { display: none; }
/* "墨迹晕开"入场动画 —— 仅做透明 + 轻微模糊,不再 translateY 错位
   (打字机模式下由 JS 加 .is-typing 类禁用此动画) */
.hero__title .ink {
  display: inline-block;
  vertical-align: baseline;
  opacity: 0;
  filter: blur(8px);
  animation: inkBleed 1.1s var(--ease-out) forwards;
}
.hero__title .ink--n1 { animation-delay: .15s; }
.hero__title .ink--n2 { animation-delay: .40s; }
.hero__title .ink--n3 { animation-delay: .60s; }
.hero__title .ink--accent { color: var(--shu); }
@keyframes inkBleed {
  to { opacity: 1; filter: blur(0); }
}

/* —— 打字机模式:JS 接管后,禁用 inkBleed,字符已被拆为单独 span —— */
.hero__title.is-typing .ink {
  opacity: 1;
  filter: none;
  animation: none;
}
.hero__title.is-typing .ink .tw-char {
  display: inline-block;
  opacity: 0;
}
.hero__title.is-typing .ink .tw-char.shown { opacity: 1; }

/* —— 闪烁光标 ▏(粘在最后一个字符末尾) —— */
.tw-caret {
  display: inline-block;
  width: .08em;
  height: .85em;
  margin-left: .04em;
  vertical-align: baseline;
  background: currentColor;
  animation: twBlink 1s steps(2, end) infinite;
  transform: translateY(.05em);
}
@keyframes twBlink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.hero__subtitle {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(20px, 2.6vw, 34px);
  color: var(--ink-soft);
  margin-bottom: var(--s-5);
  line-height: 1.4;
}
.hero__subtitle em { font-style: italic; color: var(--shu); font-family: var(--font-hand); font-size: 1.2em; margin-right: 4px; }

/* —— 中文版本字号收敛(避免中文宽汉字撑爆首屏) ——
   data-lang="zh" 由 i18n.js 在切换时写入 <body> */
body[data-lang="zh"] .hero__title    {
  font-size: clamp(44px, 7.4vw, 96px);
  letter-spacing: .04em;
  line-height: 1.15;
  margin-bottom: var(--s-4);
}
body[data-lang="zh"] .hero__subtitle {
  font-size: clamp(17px, 2vw, 26px);
  line-height: 1.6;
  letter-spacing: .02em;
  margin-bottom: var(--s-5);
}
body[data-lang="zh"] .hero__subtitle em { font-size: 1.05em; }
body[data-lang="zh"] .hero__points   {
  font-size: 14.5px;
  letter-spacing: .02em;
  line-height: 1.7;
  gap: 8px;
}
body[data-lang="zh"] .hero__eyebrow  {
  font-size: 11px;
  letter-spacing: .42em;
}
body[data-lang="zh"] .hero__scroll-label { letter-spacing: .3em; }

/* —— 中文版字体重定义 ——
   Shippori Mincho / Noto Serif JP 不含完整中文字符,日文衬线在汉字处会回退
   到系统宋体导致基线、字宽、笔画不统一的"错位"感。中文版统一改用:
     · Noto Serif SC(思源宋体)—— 文学/古典书籍调性,与日式衬线观感非常接近
     · LXGW WenKai(霞鹜文楷)—— 替代手写体,字形规整、温润有书卷气
*/
body[data-lang="zh"] {
  --font-jp:   'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --font-hand: 'LXGW WenKai', 'Noto Serif SC', 'Kaiti SC', serif;
}
html[data-theme="pixel"] body[data-lang="zh"] {
  --font-jp:    'Fusion Pixel 10px Monospaced', 'Press Start 2P', 'VT323', 'Songti SC', monospace;
  --font-serif: 'Fusion Pixel 10px Monospaced', 'VT323', 'Press Start 2P', 'Songti SC', monospace;
  --font-sans:  'Fusion Pixel 10px Monospaced', 'VT323', 'Press Start 2P', monospace;
  --font-hand:  'Fusion Pixel 10px Monospaced', 'Press Start 2P', 'VT323', monospace;
}

/* —— 中文版全局错位修复 ——
   中英混排时,中文字 (Shippori/Noto Serif JP) 与拉丁字 (Caveat/Cormorant) 的
   x-height 差异较大,baseline 对齐会出现"上下错位"。统一基线 + 内联块对齐。 */
body[data-lang="zh"] em,
body[data-lang="zh"] strong,
body[data-lang="zh"] mark { vertical-align: baseline; }

/* 兜底:中文版下,正文/标签的 em 等内联混排回归基线对齐 */
body[data-lang="zh"] .nav__link em,
body[data-lang="zh"] .ribbon__label,
body[data-lang="zh"] .chap__company em {
  letter-spacing: .04em;
  vertical-align: baseline;
  line-height: 1.4;
}

/* nav 链接堆叠的英文/中文行高对齐 */
body[data-lang="zh"] .nav__link em { font-size: 11px; margin-top: 3px; }

/* exp-card 卡片头部:中文标题与日期/角色基线统一 */
body[data-lang="zh"] .exp-card__company { line-height: 1.25; }
body[data-lang="zh"] .exp-card__role,
body[data-lang="zh"] .exp-card__team    { line-height: 1.55; }
body[data-lang="zh"] .exp-card__date    { font-size: 14px; line-height: 1.4; }

/* hero__points dot 与中文文字垂直居中 */
body[data-lang="zh"] .hero__points li { align-items: center; }
body[data-lang="zh"] .hero__points .dot { align-self: center; flex-shrink: 0; }

.hero__points { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-6); font-size: 15px; color: var(--ink-soft); }
.hero__points li { display: flex; align-items: center; gap: 10px; }
.hero__points .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--matcha);
  box-shadow: 0 0 0 3px rgba(var(--matcha-rgb),.18);
}
.hero__points strong { color: var(--ink); }

/* CTA 按钮 —— 朱砂底，悬停翻页效果 */
.hero__cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  font-family: var(--font-jp); font-weight: 600; font-size: 15px;
  color: #fff; background: var(--ink);
  border-radius: 999px;
  position: relative; overflow: hidden;
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out);
  box-shadow: var(--shadow-1);
}
.hero__cta::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, var(--shu) 0%, var(--shu-deep) 100%);
  transform: translateX(-100%);
  transition: transform .55s var(--ease-out);
}
.hero__cta span, .hero__cta svg { position: relative; z-index: 1; }
.hero__cta:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.hero__cta:hover::before { transform: translateX(0); }
.hero__cta svg { transition: transform .4s var(--ease-out); }
.hero__cta:hover svg { transform: translateX(4px); }

/* 滚动提示(呼吸感引导,可点击平滑滚动到 #resume) */
.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 10px 12px;
  color: var(--ink-mute);
  text-decoration: none;
  border-radius: 999px;
  animation: scrollBreath 3.2s var(--ease-out) infinite;
  transition: color .3s var(--ease-out), transform .3s var(--ease-out);
}
.hero__scroll:hover { color: var(--shu); transform: translate(-50%, -2px); }
.hero__scroll-label {
  font-family: var(--font-jp); font-size: 11px; letter-spacing: .42em;
  text-transform: uppercase;
}
.hero__scroll-track {
  position: relative;
  width: 1px; height: 44px;
  background: var(--line);
  overflow: hidden;
}
.hero__scroll-dot {
  display: block; width: 100%; height: 35%;
  background: var(--shu);
  animation: scrollHint 2.4s cubic-bezier(.65,.01,.35,1) infinite;
}
.hero__scroll-chev {
  animation: scrollChev 2.4s cubic-bezier(.65,.01,.35,1) infinite;
  opacity: .7;
}
@keyframes scrollHint {
  0%   { transform: translateY(-100%); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(280%);  opacity: 0; }
}
@keyframes scrollChev {
  0%,100% { transform: translateY(0);   opacity: .55; }
  50%     { transform: translateY(4px); opacity: 1; }
}
@keyframes scrollBreath {
  0%,100% { opacity: .8; }
  50%     { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__scroll, .hero__scroll-dot, .hero__scroll-chev { animation: none !important; }
}

/* ------- 6. 通用 section header ------- */
.section-header {
  max-width: var(--container); margin: 0 auto var(--s-6);
  position: relative;
}
.section-eyebrow {
  font-family: var(--font-jp); font-size: 12px; letter-spacing: .4em;
  color: var(--shu); margin-bottom: 12px;
  display: inline-flex; align-items: center; gap: 12px;
}
.section-eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--shu);
}
.section-title {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 60px);
  letter-spacing: -.01em;
  line-height: 1.15;
  color: var(--ink);
}
.section-title::after {
  content: "."; color: var(--shu); margin-left: 4px;
}
.link-arrow {
  position: absolute; right: 0; bottom: 4px;
  font-size: 14px; font-weight: 500; color: var(--shu);
  font-family: var(--font-sans);
  display: inline-flex; align-items: center; gap: 4px;
  transition: transform .3s var(--ease-out), letter-spacing .3s var(--ease-out);
}
.link-arrow:hover { transform: translateX(4px); letter-spacing: .04em; }

/* ------- 7. Resume 横向三栏 ------- */
.experience { padding: var(--s-9) var(--s-6); position: relative; }

.exp-grid {
  max-width: var(--container); margin: 0 auto;
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(3, 1fr);
  /* 默认三列，下方 media 处理两列 / 单列 */
}

.exp-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 0;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out);
  /* 整卡入场翻页效果 */
  transform-origin: left center;
}
.exp-card::before {
  /* 卡片内书脊线 */
  content: ""; position: absolute; left: 18px; top: 0; bottom: 0;
  width: 1px; background: var(--line);
  opacity: .8;
}
.exp-card:hover {
  transform: translateY(-8px) rotate(-.4deg);
  box-shadow: var(--shadow-3);
}

/* 顶部 ribbon —— 徽章 + 奖项名 */
.exp-card__ribbon {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--washi-2) 0%, var(--paper) 100%);
  border-bottom: 1px dashed var(--line);
}
.ribbon__badge {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 20px;
  box-shadow: var(--shadow-1);
  flex-shrink: 0;
  position: relative;
  animation: badgeFloat 5s var(--ease-out) infinite;
}
.ribbon__badge::after {
  content:""; position: absolute; inset: -5px;
  border: 1px solid currentColor; border-radius: 50%;
  opacity: .25;
  animation: badgeRing 3s var(--ease-out) infinite;
}
.ribbon__badge--gold   { background: linear-gradient(135deg, #E5B349, var(--kincha)); color: #fff; }
.ribbon__badge--silver { background: linear-gradient(135deg, #B6B0A1, #6F6A5F); }
.ribbon__badge--matcha { background: linear-gradient(135deg, #9DAB6B, var(--matcha)); }
.exp-card:nth-child(1) .ribbon__badge { animation-delay: 0s; }
.exp-card:nth-child(2) .ribbon__badge { animation-delay: -1.5s; }
.exp-card:nth-child(3) .ribbon__badge { animation-delay: -3s; }
@keyframes badgeFloat {
  0%,100% { transform: translateY(0) rotate(0); }
  50%     { transform: translateY(-3px) rotate(8deg); }
}
@keyframes badgeRing {
  0%,100% { transform: scale(1); opacity: .25; }
  50%     { transform: scale(1.15); opacity: 0; }
}
.ribbon__label {
  font-family: var(--font-jp);
  font-size: 11px; font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* 卡片正文 */
.exp-card__body {
  position: relative;
  padding: 28px 28px 32px 36px;
  flex: 1;
}
.exp-card__seq {
  position: absolute; right: 22px; top: 18px;
  font-family: var(--font-jp); font-weight: 700;
  font-size: 56px; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--line);
  transition: -webkit-text-stroke-color .4s var(--ease-out);
}
.exp-card:hover .exp-card__seq { -webkit-text-stroke-color: var(--shu); }
.exp-card__company {
  font-family: var(--font-jp); font-weight: 700;
  font-size: 28px; letter-spacing: -.01em;
  margin-bottom: 6px;
}
.exp-card__role {
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  color: var(--shu); margin-bottom: 12px; letter-spacing: .02em;
}
.exp-card__team { color: var(--ink-soft); font-size: 14px; }
.exp-card__date {
  margin-top: 10px;
  font-family: var(--font-hand); font-size: 18px; color: var(--ink-mute);
}

/* 角落朱砂小印 */
.exp-card__corner {
  position: absolute; right: 18px; bottom: 16px;
  width: 24px; height: 24px;
  background: var(--shu);
  border-radius: 4px; opacity: 0;
  transform: scale(.6) rotate(-12deg);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.exp-card__corner::after {
  content: "印"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-jp); font-weight: 700; font-size: 13px;
  color: #fff;
}
.exp-card:hover .exp-card__corner {
  opacity: .92; transform: scale(1) rotate(-8deg);
}

/* ------- 8. Portfolio ------- */
.portfolio { padding: var(--s-9) var(--s-6); background: var(--washi-2); position: relative; }
.portfolio::before, .portfolio::after {
  content: ""; position: absolute; left: 0; right: 0; height: 24px;
  background: repeating-linear-gradient(90deg, transparent 0 12px, var(--line) 12px 13px);
  opacity: .5;
}
.portfolio::before { top: 0; }
.portfolio::after  { bottom: 0; }

.portfolio__grid {
  max-width: var(--container); margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4);
}
.case-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out);
}
.case-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-3);
}
.case-card__thumb {
  aspect-ratio: 16/9;
  background-size: cover; background-position: center;
  filter: saturate(.85) sepia(.08);
  transition: transform .8s var(--ease-out), filter .8s var(--ease-out);
}
.case-card:hover .case-card__thumb { transform: scale(1.06); filter: saturate(1) sepia(0); }
.case-card__meta {
  padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.case-card__meta h3 {
  font-family: var(--font-jp); font-weight: 700; font-size: 18px;
}
.case-card__cta { font-size: 12px; color: var(--shu); white-space: nowrap; transition: transform .3s var(--ease-out); }
.case-card:hover .case-card__cta { transform: translateX(4px); }

/* ------- 8.5 Portfolio 分组(v18.15) ------- */
.portfolio__groups {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
}

.portfolio-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.portfolio-group__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 var(--s-3);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.portfolio-group__header::after {
  /* 朱砂短线装饰 */
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 64px; height: 2px;
  background: var(--shu);
}

.portfolio-group__logo {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--washi);
  border: 1px solid var(--line);
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 16px;
  color: #1A1A1A;
  letter-spacing: 0;
  flex-shrink: 0;
  overflow: hidden;
}
.portfolio-group__logo--img {
  padding: 6px;
  background: var(--paper);
}
.portfolio-group__logo img {
  width: 100%; height: 100%; object-fit: contain;
  display: block;
  filter: var(--portfolio-logo-filter, none);
  transition: filter .35s var(--ease-out);
}
.portfolio-group__logo-mask {
  display: block;
  width: 100%; height: 100%;
  background: currentColor;
  -webkit-mask-image: var(--portfolio-logo-url);
  mask-image: var(--portfolio-logo-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

[data-theme="pixel"] .portfolio-group__logo {
  color: var(--shu-light) !important;
  background: var(--paper);
  border-color: var(--shu);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(var(--shu-rgb), .35);
}
[data-theme="pixel"] .portfolio-group__logo--img img {
  --portfolio-logo-filter: brightness(0) saturate(100%) invert(64%) sepia(64%) saturate(2201%) hue-rotate(324deg) brightness(102%) contrast(102%);
}

[data-theme="terminal"] .portfolio-group__logo {
  color: var(--shu) !important;
  background: var(--washi);
  border-color: var(--shu);
  border-radius: 0;
  box-shadow: inset 0 0 10px rgba(var(--shu-rgb), .12),
              0 0 0 1px rgba(var(--shu-rgb), .22);
}
[data-theme="terminal"] .portfolio-group__logo--img img {
  --portfolio-logo-filter: brightness(0) saturate(100%) invert(69%) sepia(94%) saturate(2222%) hue-rotate(84deg) brightness(109%) contrast(106%);
}

[data-theme="blackgold"] .portfolio-group__logo {
  color: #080706 !important;
  background: linear-gradient(135deg, #FFF2B8 0%, var(--shu) 56%, var(--kincha) 100%);
  border-color: rgba(var(--shu-rgb), .72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28),
              0 10px 24px rgba(0,0,0,.24);
}
[data-theme="blackgold"] .portfolio-group__logo--img {
  background: linear-gradient(135deg, #FFF2B8 0%, var(--shu) 56%, var(--kincha) 100%);
}
[data-theme="blackgold"] .portfolio-group__logo--img img {
  --portfolio-logo-filter: brightness(0) saturate(100%) invert(3%) sepia(10%) saturate(1012%) hue-rotate(346deg) brightness(94%) contrast(102%);
}

.portfolio-group__title {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .02em;
  color: var(--ink);
  margin: 0;
}

.portfolio-group__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}

/* 卡片 h4(分组卡片新结构) */
.case-card__meta h4 {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 17px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 角标:PDF / 外链 */
.case-card__badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  background: var(--washi);
}
.case-card__badge--pdf {
  color: #B23B2C;
  border-color: rgba(178, 59, 44, .3);
  background: rgba(178, 59, 44, .06);
}
.case-card__badge--link {
  color: var(--shu);
  border-color: rgba(var(--shu-rgb), .3);
  background: rgba(var(--shu-rgb), .06);
}
.case-card__badge--none {
  color: var(--ink-mute);
  border-color: var(--line);
  background: var(--washi-2);
}
.case-card[aria-disabled="true"] {
  cursor: default;
}
.case-card[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}
.case-card--flip {
  min-height: 100%;
  perspective: 1200px;
  overflow: visible;
  background: transparent;
  border: 0;
}
.case-card--flip:hover {
  transform: translateY(-6px);
}
.case-card__flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  transition: transform .58s cubic-bezier(.4,0,.2,1);
  transform-style: preserve-3d;
}
.case-card--flip.is-flipped .case-card__flip-inner {
  transform: rotateY(180deg);
}
.case-card__face {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.case-card__face--front {
  display: flex;
  flex-direction: column;
}
.case-card__face--back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 22px;
  transform: rotateY(180deg);
}
.case-card__flip-title {
  margin: 0;
  font-family: var(--font-jp);
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
}
.case-card__flip-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}
.case-card__flip-tags {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* ------- 9. Sharings ------- */
.sharings { padding: var(--s-9) 0; overflow: hidden; }
.sharings .section-header { padding: 0 var(--s-6); }
.sharings__row {
  display: flex; gap: 18px; width: max-content;
  padding: 14px 0;
  will-change: transform;
}
.sharings__row--ltr { animation: slideLeft 70s linear infinite; }
.sharings__row--rtl { animation: slideRight 90s linear infinite; margin-top: 16px; }
.sharing-item {
  width: 280px; height: 180px;
  border-radius: var(--r-md);
  background-size: cover; background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
  filter: saturate(.85) sepia(.05);
  transition: transform .45s var(--ease-out), filter .45s var(--ease-out);
}
.sharing-item:hover { transform: scale(1.05) rotate(-1deg); filter: saturate(1) sepia(0); }
.sharings__row:hover { animation-play-state: paused; }
@keyframes slideLeft  { from { transform: translateX(0);    } to { transform: translateX(-50%); } }
@keyframes slideRight { from { transform: translateX(-50%); } to { transform: translateX(0);    } }

/* ------- 10. Contact ------- */
.contact {
  text-align: center;
  padding: var(--s-9) var(--s-6);
  position: relative;
  background: var(--washi);
}
.contact__stamp {
  display: var(--deco-stamp-display, inline-grid); place-items: center;
  width: 72px; height: 72px;
  font-family: var(--font-jp); font-weight: 700; font-size: 36px;
  color: #fff; background: var(--shu);
  border-radius: var(--r-md);
  transform: rotate(-6deg);
  margin-bottom: var(--s-4);
  box-shadow: 0 8px 22px rgba(var(--shu-deep-rgb),.3);
  animation: stampDrop 1.2s var(--ease-out) both;
}
@keyframes stampDrop {
  0%   { opacity: 0; transform: rotate(-30deg) scale(2.2); }
  60%  { opacity: 1; transform: rotate(-3deg) scale(.92); }
  100% { transform: rotate(-6deg) scale(1); }
}
.contact__intro { color: var(--ink-soft); font-size: 16px; margin-bottom: 18px; }
.contact__email {
  display: inline-block;
  font-family: var(--font-jp); font-weight: 700;
  font-size: clamp(36px, 5vw, 72px);
  color: var(--ink);
  position: relative;
  transition: color .3s var(--ease-out);
}
.contact__email::after {
  content:""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--shu);
  transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease-out);
}
.contact__email:hover { color: var(--shu); }
.contact__email:hover::after { transform: scaleX(1); }

/* ------- 11. 底部 ------- */
.site-footer {
  padding: 24px 40px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
}
.footer__nav { display: flex; gap: 24px; }
.footer__nav a { font-size: 13px; color: var(--ink-mute); transition: color .25s var(--ease-out); }
.footer__nav a:hover { color: var(--shu); }
.footer__copyright { font-size: 12px; color: var(--ink-mute); font-family: var(--font-jp); }

/* ------- 12. 翻页进度条 ------- */
.page-progress {
  position: fixed; left: 0; bottom: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--shu) 0%, var(--kincha) 100%);
  z-index: 99;
  transition: width .15s linear;
}

/* ------- 12.5 全局 hidden 兜底(防止 display: flex/grid 等覆盖 HTML hidden 属性) ------- */
[hidden] { display: none !important; }

/* ------- 13. 响应式(横向布局自适应) ------- */
@media (max-width: 960px) {
  .site-header    { grid-template-columns: auto auto auto; gap: 10px; }
  .site-header .nav { grid-row: 2; grid-column: 1 / -1; justify-self: start; padding-top: 8px; border-top: 1px solid var(--line); width: 100%; }
  .lang-switch    { grid-row: 1; grid-column: 2; }
  .nav-theme-toggle { grid-row: 1; grid-column: 3; }
  .exp-grid       { grid-template-columns: repeat(2, 1fr); }
  .portfolio__grid{ grid-template-columns: repeat(2, 1fr); }
  .portfolio-group__grid { grid-template-columns: repeat(2, 1fr); }
  .hero__grid     { grid-template-columns: 1fr; gap: var(--s-5); }
  .hero__reul     { order: -1; max-width: 320px; margin: 0 auto; }
  .hero__reul-svg { max-width: 320px; }
}
@media (max-width: 640px) {
  .site-header   { padding: 12px 16px; }
  .nav           { gap: 18px; }
  .nav__link em  { display: none; }
  .hero          { padding: var(--s-7) var(--s-3); }
  .hero__vline   { display: none; }
  .hero__reul     { max-width: 240px; }
  .experience, .portfolio, .contact { padding-left: var(--s-3); padding-right: var(--s-3); }
  .exp-grid        { grid-template-columns: 1fr; }
  .portfolio__grid { grid-template-columns: 1fr; }
  .portfolio-group__grid { grid-template-columns: 1fr; }
  .portfolio-group__title { font-size: 18px; }
  .portfolio-group__logo  { width: 36px; height: 36px; font-size: 14px; }
  .section-header  { margin-bottom: var(--s-5); }
  .link-arrow      { position: static; display: inline-block; margin-top: 12px; }
  .site-footer     { flex-direction: column; text-align: center; }
}

/* ------- 13.5 移动端深度适配(v18.4) ------- */
@media (max-width: 720px) {
  /* Header 紧凑化 */
  .site-header { padding: 10px 14px; gap: 8px; }
  .brand__name { font-size: 14px; }
  .brand__avatar { width: 28px; height: 28px; }
  .brand__seal { font-size: 16px; }
  .nav { gap: 14px; }
  .nav__link span { font-size: 13px; }

  /* Hero */
  .hero__title { font-size: clamp(28px, 9vw, 44px); line-height: 1.15; }
  .hero__sub   { font-size: 14px; }
  .hero__cta   { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero__cta .btn { width: 100%; text-align: center; min-height: 44px; }

  /* Portfolio 卡片 */
  .case-card__title  { font-size: 18px; }
  .case-card__desc   { font-size: 13px; }
  .case-card__cta    { min-height: 44px; padding: 10px 14px; }

  /* Sharings / Experience */
  .exp-card { padding: 18px 16px; }
  .exp-card__title { font-size: 16px; }
  .exp-card__meta  { font-size: 12px; }

  /* Contact */
  .contact__list { grid-template-columns: 1fr !important; gap: 14px; }
  .contact__item { padding: 14px; }

  /* Footer */
  .footer__nav { flex-wrap: wrap; justify-content: center; gap: 14px 18px; }
  .footer__nav a { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (max-width: 480px) {
  /* 极小屏:进一步压缩 */
  .site-header { padding: 8px 12px; }
  .brand__name { display: none; }      /* 只保留头像 + 印章 */
  .nav { gap: 10px; }
  .nav__link { padding: 6px 4px; }
  .nav__link span { font-size: 12px; letter-spacing: .04em; }

  .hero          { padding: var(--s-5) var(--s-2); }
  .hero__title   { font-size: 26px; }
  .hero__sub     { font-size: 13px; }
  .hero__reul    { max-width: 200px; }

  .section-header__title    { font-size: 22px; }
  .section-header__subtitle { font-size: 12px; }

  .case-card__title { font-size: 16px; }
  .case-card__desc  { font-size: 12px; line-height: 1.5; }
}

/* 触屏设备:统一最小点击区域(WCAG 2.5.5) */
@media (pointer: coarse) {
  .nav__link,
  .lang-switch button,
  .nav-theme-toggle,
  .btn,
  .case-card__cta,
  .link-arrow,
  .footer__nav a {
    min-height: 44px;
  }
  /* 触屏不依赖 hover */
  .case-card:hover { transform: none; }
}

/* ------- 14. 入场动画工具类（IntersectionObserver 驱动） ------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }

/* 翻页效果：左右翻入（用于 exp-card） */
.flip-in       { opacity: 0; transform: perspective(1200px) rotateY(-22deg) translateY(28px); transform-origin: left center; transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.flip-in.is-visible { opacity: 1; transform: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

/* ------- 15. 选中文本样式（朱砂高亮）------- */
::selection { background: rgba(var(--shu-rgb),.25); color: var(--ink); }

/* ------- 16. Case Flip Card Overlay（翻转卡片）------- */
.flip-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--ease-out);
}
.flip-overlay[hidden] {
  display: none;
}
.flip-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.flip-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  min-height: 360px;
  perspective: 1200px;
}
.flip-card__inner {
  position: relative;
  width: 100%;
  min-height: 360px;
  transition: transform .58s cubic-bezier(.4,0,.2,1);
  transform-style: preserve-3d;
}
.flip-overlay.is-flipped .flip-card__inner {
  transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-3);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-card__front {
  display: flex;
  flex-direction: column;
}
.flip-card__back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 34px 36px;
  transform: rotateY(180deg);
}
.flip-card__cover {
  min-height: 220px;
  background-size: cover;
  background-position: center;
  filter: saturate(.9) sepia(.08);
}
.flip-card__header {
  padding: 20px 24px 24px;
}
.flip-card__title {
  margin: 0;
  font-family: var(--font-jp);
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
}
.flip-card__tags {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-mute);
}
.flip-card__summary {
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
}
.flip-card__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--washi);
  color: var(--ink);
  cursor: pointer;
  font: 700 16px/1 var(--font-sans);
}
.flip-card__close:hover {
  color: var(--shu);
  border-color: rgba(var(--shu-rgb), .42);
}

@media (max-width: 640px) {
  .flip-overlay {
    padding: 16px;
  }
  .flip-card,
  .flip-card__inner,
  .flip-card__front,
  .flip-card__back {
    min-height: 340px;
  }
  .flip-card__cover {
    min-height: 180px;
  }
  .flip-card__header,
  .flip-card__back {
    padding: 22px;
  }
  .flip-card__title {
    font-size: 19px;
  }
  .flip-card__summary {
    font-size: 15px;
  }
}
