/* ============================================================
   NKB 全站共享样式
   Design Tokens / Reset&Base / 内容区 / 左导航 / 移动顶栏+抽屉 / 页脚 / 公共断点
   所有页面统一引入（<link rel="stylesheet" href="./assets/site.css">），
   页面特有样式保留在各自 <style> 中。
   ============================================================ */

/* ---------- Design Tokens（瑞士极简：黑白 + 青绿） ---------- */
:root {
  --bg:      #FFFFFF;
  --surface: #F5F5F3;
  --ink:     #111111;
  --ink-2:   #555555;
  --ink-3:   #9A9A97;
  --line:    #E3E3E0;

  --accent:      #46B7B9;
  --accent-deep: #2C9B9D;
  --accent-soft: #EAF7F7;

  --font: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  --r-sm: 2px; --r-md: 4px; --r-lg: 8px;
  --shadow-1: 0 1px 0 var(--line), 0 10px 30px rgba(17,17,17,.06);
  --shadow-2: 0 24px 60px rgba(17,17,17,.14);
  --space-section: clamp(72px, 10vw, 132px);

  --nav-w: 280px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --dur: 280ms;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
/* <picture> 仅承载 WebP 回退，不生成盒子，保证包裹前后布局一致（P1-B） */
picture { display: contents; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* 通用：小号大写标签 */
.tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink-2);
}
.tag::before { content: ""; width: 26px; height: 2px; background: var(--accent); }

/* ---------- 内容区 ---------- */
.main { margin-left: var(--nav-w); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 clamp(28px, 6vw, 80px); }

/* 滚动进度条 */
.scroll-progress {
  position: fixed; top: 0; left: var(--nav-w); right: 0; height: 3px; z-index: 60;
  background: var(--accent);
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- 左导航（桌面） ---------- */
.nav-rail {
  position: fixed; inset: 0 auto 0 0;
  width: var(--nav-w); z-index: 50;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 36px 30px 30px;
}

/* 品牌（Logo 上图 + 文字，上下排布） */
.brand-lockup {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 16px;
}
.brand-mark {
  width: 64px; height: 64px; flex: none;
  display: grid; place-items: center;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text .b1 { font-weight: 800; font-size: 17px; letter-spacing: -.01em; line-height: 1.2; }
.brand-text .b2 { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }

/* 菜单 */
.nav-menu { margin-top: 40px; display: flex; flex-direction: column; }
.nav-menu a {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: baseline; gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink);
  transition: color var(--dur) var(--ease), padding-left var(--dur) var(--ease);
}
.nav-menu a .idx { font-size: 11px; font-weight: 600; color: var(--ink-3); transition: color var(--dur) var(--ease); }
.nav-menu a .en { font-size: 10px; font-weight: 600; letter-spacing: .22em; color: var(--ink-3); text-transform: uppercase; transition: color var(--dur) var(--ease); }
.nav-menu a:hover { padding-left: 6px; }
.nav-menu a:hover .idx, .nav-menu a:hover .en { color: var(--accent-deep); }
.nav-menu a.active { color: var(--accent-deep); padding-left: 6px; }
.nav-menu a.active .idx { color: var(--accent); }
.nav-menu a.active::before {
  content: ""; grid-row: 1; grid-column: 1 / -1; width: 100%;
  height: 2px; background: var(--accent); align-self: center; margin-top: -26px;
}
/* active 标记：左侧小方块 */
.nav-menu a.active { position: relative; }
.nav-menu a.active::after {
  content: ""; position: absolute; left: -30px; top: 50%;
  width: 5px; height: 5px; transform: translateY(-50%);
  background: var(--accent);
}

/* ---------- 作品二级菜单 ---------- */
.nav-menu .has-sub { position: relative; }
.nav-menu .chev {
  align-self: center; justify-self: end;
  width: 9px; height: 9px; position: relative;
}
.nav-menu .chev::before, .nav-menu .chev::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 1.5px; background: var(--ink-3);
  transform: translate(-50%, -50%);
  transition: background var(--dur) var(--ease);
}
.nav-menu .chev::after { transform: translate(-50%, -50%) rotate(90deg); }
.nav-rail .chev { display: none; }                     /* 桌面用 hover 面板，不显示 + 号 */

/* 桌面：hover 弹出面板 */
.nav-rail .work-sub {
  position: fixed; left: var(--nav-w); width: 340px;
  margin: 0; padding: 10px 0;
  background: var(--bg);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-2);
  list-style: none;
  opacity: 0; visibility: hidden;
  transform: translateX(-10px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  z-index: 55;
}
.nav-rail .has-sub:hover .work-sub,
.nav-rail .has-sub:focus-within .work-sub {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear 0s;
}
.nav-rail .work-sub li a {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline; gap: 10px;
  padding: 11px 22px;
  border: 0; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 700; color: var(--ink);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-rail .work-sub li:last-child a { border-bottom: 0; }
.nav-rail .work-sub li a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.nav-rail .work-sub .no { font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.nav-rail .work-sub .y { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.nav-rail .work-sub li a:hover .no,
.nav-rail .work-sub li a:hover .y { color: var(--accent); }

/* 移动抽屉：仅一级菜单，二级列表与展开图标不显示 */
.drawer .work-sub { display: none; }
.drawer .chev { display: none; }

/* 底部 */
.nav-foot { margin-top: auto; }
.nav-social { display: flex; gap: 8px; }
.nav-social a {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-social a:hover { border-color: var(--ink); transform: translateY(-2px); }
.nav-social img { width: 18px; height: 18px; object-fit: contain; }
.nav-copy { margin-top: 18px; font-size: 10.5px; color: var(--ink-3); letter-spacing: .08em; }
.nav-copy strong { color: var(--accent-deep); font-weight: 700; }

/* ---------- 移动端：顶栏 + 抽屉 ---------- */
.mobile-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.mobile-bar .mb-brand { display: flex; align-items: center; gap: 12px; }
.mobile-bar .brand-mark { width: 42px; height: 42px; }
.mobile-bar .mb-name { font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.hamburger {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  background: var(--bg); border: 1.5px solid var(--ink);
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); position: relative; transition: all .3s var(--ease); }
.hamburger span::before, .hamburger span::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--ink);
  transition: all .3s var(--ease);
}
.hamburger span::before { top: -7px; }
.hamburger span::after { top: 7px; }
body.menu-open .hamburger span { background: transparent; }
body.menu-open .hamburger span::before { top: 0; transform: rotate(45deg); }
body.menu-open .hamburger span::after { top: 0; transform: rotate(-45deg); }

.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 65;
  width: min(300px, 84vw);
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 96px 26px 28px;
  display: flex; flex-direction: column;
  transform: translateX(-102%);
  transition: transform .38s var(--ease);
}
body.menu-open .drawer { transform: translateX(0); }
.drawer .nav-menu { margin-top: 8px; }
.drawer .nav-foot { margin-top: auto; }
.backdrop {
  position: fixed; inset: 0; z-index: 62;
  background: rgba(17,17,17,.5);
  opacity: 0; pointer-events: none;
  transition: opacity .38s var(--ease);
}
body.menu-open .backdrop { opacity: 1; pointer-events: auto; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 2px solid var(--ink);
  padding: 72px 0 56px;
  text-align: center;
}
.footer .big {
  font-size: clamp(40px, 8vw, 96px);
  font-weight: 900; letter-spacing: -.03em; line-height: 1;
  text-transform: uppercase;
}
.footer .big em { font-style: normal; color: var(--accent); }
.footer .foot-social { display: flex; justify-content: center; gap: 10px; margin-top: 34px; }
.footer .foot-social a {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1.5px solid var(--line);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.footer .foot-social a:hover { border-color: var(--ink); background: var(--ink); }
.footer .foot-social img { width: 19px; height: 19px; object-fit: contain; }
.footer p { font-size: 12px; color: var(--ink-3); margin-top: 22px; letter-spacing: .1em; }

/* ---------- 公共断点：全站统一三档（P2-F） ----------
   1024px  平板：隐藏左侧导航栏、启用移动顶栏与抽屉，双栏版面（如关于区）转单栏
    768px  窄平板 / 大手机：卡片网格由多列降为 2 列，详情页主视觉与信息区纵向堆叠
    480px  手机：卡片网格降为 1 列
   内联样式（各页面 <style>）只允许使用这三个值，新增断点前请先在此登记。
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-rail { display: none; }
  .main { margin-left: 0; }
  .scroll-progress { left: 0; }
  .mobile-bar { display: flex; }
}

/* 动效降级 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 键盘可达性（P2-A） ---------- */
/* 统一焦点环：仅键盘导航显示，鼠标点击不出现描边 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 深色底（首屏 / 移动顶栏 / 抽屉）上的焦点环改用白色，保证对比度 */
.hero :focus-visible,
.mobile-bar :focus-visible,
.nav-rail :focus-visible,
.drawer :focus-visible {
  outline-color: #fff;
}
/* 跳至主要内容：默认移出视口，获得焦点时滑入（构建期注入到外壳最前） */
.skip-link {
  position: absolute; left: 12px; top: 12px; z-index: 999;
  padding: 12px 20px;
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: .08em;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }
