/* ============================================================
   Method DS · v4 · Base
============================================================ */
@import url('./tokens.css?v=45');
@import url('./animations.css?v=45');

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* 主题切换时平滑过渡色彩 */
  transition: background-color var(--t-theme) var(--ease), color var(--t-theme) var(--ease);
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink-80);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.75;              /* 中文正文：1.65 → 1.75 更透气 */
  letter-spacing: 0;              /* 中文 body 不加字距 */
  font-feature-settings: 'ss01', 'cv01', 'cv02';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-synthesis: none;           /* 禁止浏览器合成伪粗体/伪斜体 */
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;      /* v4.6: 大字号光学修饰，衬线更锐 */
  accent-color: var(--accent);    /* v4.6: 原生勾选/单选/滑块跟品牌橙 */
  transition: background-color var(--t-theme) var(--ease), color var(--t-theme) var(--ease);
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; transition: color var(--t-base) var(--ease); }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent-pale); color: var(--ink); }

/* v4.6 数字统一：等宽场景（代码/数据/统计）用表格数字 + 斜杠零，对齐更整齐 */
code, kbd, samp, .mono, [class*="stat"], [class*="__n"], td.n, .num, .tabnum {
  font-variant-numeric: tabular-nums slashed-zero;
}

/* v4.6 精致滚动条：细、随主题、hover 加深（padding-box 让轨道留白更利落）*/
* { scrollbar-width: thin; scrollbar-color: var(--ink-20) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-20); border-radius: 999px;
  border: 3px solid transparent; background-clip: padding-box;
  transition: background var(--t-base) var(--ease);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-40); background-clip: padding-box; }

/* ============================================================
   Grain · 全站纸张颗粒纹理（v4.3 "Editorial Atelier"）
   ----------------------------------------------------
   一层极淡的胶片颗粒覆盖整页，给数字界面以印刷品的手感。
   强度由 --grain-opacity 统一控制（tokens.css）；设 0 即彻底关闭。
============================================================ */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;            /* 在常规内容之上、modal(200)/toast(300) 之下 */
  pointer-events: none;
  opacity: var(--grain-opacity);
  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='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: multiply;
}
[data-theme="dark"] body::after { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::after { mix-blend-mode: screen; }
}

/* ============================================================
   Layout helpers
============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-8);
  position: relative;
}
.container--content { max-width: var(--container-content); }
.container--narrow  { max-width: var(--container-narrow); }
.container--text    { max-width: var(--container-text); }

section { position: relative; }

.section {
  padding: var(--sp-28) 0;
  position: relative;
}
.section--tight { padding: var(--sp-20) 0; }
.section--cream { background: var(--cream); }
.section--cream-warm { background: var(--cream-warm); }
.section--dark { background: var(--dark); color: var(--dark-on-ink); }

/* Dark section text overrides */
.section--dark .display, .section--dark .h1, .section--dark .h2,
.section--dark .h3, .section--dark .h4, .section--dark .h5 { color: var(--cream); }
.section--dark .lede { color: var(--dark-on-ink); }
.section--dark .body, .section--dark .body-sm { color: var(--dark-on-ink); }
.section--dark .eyebrow { color: var(--accent-soft); }
.section--dark .eyebrow::before { background: var(--accent); }

/* ============================================================
   Grid pattern overlay · 整页隐约方格纸纹理
============================================================ */
.grid-bg {
  position: relative;
}
.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--ink-08) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ink-08) 1px, transparent 1px);
  background-size: var(--grid-line) var(--grid-line);
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
}
.grid-bg > * { position: relative; z-index: 1; }

.section--dark.grid-bg::before {
  background-image:
    linear-gradient(to right, var(--dark-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--dark-grid) 1px, transparent 1px);
}

/* ============================================================
   Typography
============================================================ */
.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 700;               /* v4.7 无衬线：大字号需更足字重才立得住（Inter/PingFang 均有真 700）*/
  line-height: 1.04;              /* 中文大字：给每行一点呼吸 */
  letter-spacing: var(--ls-display);
  color: var(--ink);
  margin: 0;
  font-feature-settings: 'ss01';
  word-break: keep-all;           /* 中文不在词中间断行 */
  text-wrap: balance;             /* v4.3: 平衡折行，消灭孤字 widow */
}
.display em {
  font-style: normal;
  color: var(--accent);
  font-weight: 500;
  /* 细微的底部高亮线，增加强调感 */
  position: relative;
  display: inline;
}

.h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  color: var(--ink);
  margin: 0;
}
.h1 em { font-style: normal; color: var(--accent); font-weight: 500; }

/* 强调词与标题同字重（靠 accent 色区分，避免"强调反而更细"）*/
.display em, .h1 em, .h2 em, .h3 em { font-weight: 700; }
.h1, .h2, .h3 { text-wrap: balance; }

.h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  margin: 0;
  max-width: var(--container-text);
}
.h2 em { font-style: normal; color: var(--accent); font-weight: 700; }

.h3 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  color: var(--ink);
  margin: 0;
}

.h4 {
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 0;
}

.h5 {
  font-family: var(--font-body);
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 0;
}

.lede {
  font-family: var(--font-body);
  font-size: var(--fs-lede);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--ink-70);
  max-width: 620px;
  margin: 0;
  text-wrap: pretty;              /* v4.3: 段落末行不留孤字 */
}

.body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-80); text-wrap: pretty; }
.body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-base); color: var(--ink-70); }
.body-xs { font-size: var(--fs-sm); line-height: var(--lh-base); color: var(--ink-60); }

.mono { font-family: var(--font-mono); font-size: var(--fs-mono); letter-spacing: var(--ls-wide); }

/* —— .en · UI 中的拉丁缩写（AI 等）统一用黑体（无衬线），不跟随衬线标题 —— */
.en {
  font-family: var(--font-body);   /* v4.7 起 display 本身已是 Inter，此处保持一致 */
  font-weight: var(--fw-bold);
  font-style: normal;
  font-size: 0.94em;               /* 拉丁大写光学上比中文方块字显大，略收以求等高 */
  letter-spacing: 0.01em;
  padding-right: 0.06em;           /* 与紧随中文之间留呼吸 */
}

/* —— Eyebrow —— */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--accent);
}

/* ============================================================
   Top nav
============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--sp-5) 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border-bottom: 1px solid var(--ink-08);
  transition: background-color var(--t-theme) var(--ease), border-color var(--t-theme) var(--ease);
}
.topnav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}
.topnav__brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 22px;
  letter-spacing: var(--ls-tight);
}
.topnav__brand span:last-child {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  font-weight: var(--fw-medium);
  color: var(--ink-60);
}
.topnav__brand b { color: var(--accent); font-weight: var(--fw-bold); }

.topnav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}
.topnav__links a {
  color: var(--ink-70);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.2px;
}
.topnav__links a:hover { color: var(--ink); }
/* v4.6 签名手势：导航链接 hover 时品牌橙下划线从左画入 */
.topnav__links a { position: relative; }
.topnav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 1.5px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-base) var(--ease-out);
}
.topnav__links a:hover::after { transform: scaleX(1); }

@media (max-width: 900px) {
  .topnav__links { display: none; }
}
/* 品牌全称「AI 产品创新方法论」较长：中窄屏先收副标，避免与导航挤压 */
@media (max-width: 1120px) {
  .topnav__brand span:last-child { display: none; }
}

/* ============================================================
   Footer · 深蓝底 + 隐约网格 + 大量分类链接 + 大字 logo
============================================================ */
.footer {
  margin-top: var(--sp-32);
  background: var(--dark);
  color: var(--dark-on-ink);
  padding: var(--sp-20) 0 var(--sp-10);
  position: relative;
  overflow: hidden;
}
.footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--dark-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--dark-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-8);
  position: relative;
  z-index: 1;
}
.footer__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-12) var(--sp-8);
  margin-bottom: var(--sp-20);
}
.footer__col h4 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  color: var(--cream);
  margin: 0 0 var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid rgba(245,242,236,0.18);
}
.footer__col h4 .arrow { font-size: 14px; color: var(--dark-on-ink-60); }
.footer__col h5 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: var(--fw-semibold);
  color: var(--cream);
  margin: var(--sp-6) 0 var(--sp-3);
  letter-spacing: 0.1px;
}
.footer__col ul { list-style: none; padding: 0; margin: 0; }
.footer__col li { margin-bottom: var(--sp-2); }
.footer__col a {
  color: var(--dark-on-ink-60);
  font-size: 14px;
  transition: color var(--t-base) var(--ease);
}
.footer__col a:hover { color: var(--accent-soft); }
.footer__col li.sub a { padding-left: var(--sp-4); position: relative; }
.footer__col li.sub a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 8px; height: 1px;
  background: rgba(245,242,236,0.20);
}

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--sp-6);
  padding-top: var(--sp-10);
  border-top: 1px solid rgba(245,242,236,0.10);
}
.footer__logo {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(56px, 8vw, 96px);
  line-height: 0.9;
  letter-spacing: var(--ls-display);
  color: var(--accent);
  font-weight: var(--fw-bold);
}
.footer__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--dark-on-ink-40);
  letter-spacing: var(--ls-wide);
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.footer__meta a:hover { color: var(--cream); }

@media (max-width: 900px) { .footer__row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .footer__row { grid-template-columns: 1fr; } .container { padding: 0 var(--sp-5); } }

/* ============================================================
   Section head
============================================================ */
.section-head {
  max-width: 880px;
  margin-bottom: var(--sp-16);
}
.section-head__eyebrow { margin-bottom: var(--sp-5); }
.section-head__title { margin-bottom: var(--sp-5); }
.section-head__desc {
  font-size: var(--fs-lede);
  line-height: var(--lh-base);
  color: var(--ink-70);
  max-width: 620px;
}
/* v4.2 · section 头部 eyebrow 去橙——让品牌橙保持稀缺，只点睛 hero / LIVE */
.section-head__eyebrow { color: var(--ink-50); }
.section-head__eyebrow::before { background: var(--ink-30); }

/* ============================================================
   Misc utilities
============================================================ */
.divider { height: 1px; background: var(--ink-10); border: none; margin: var(--sp-12) 0; }
.section--dark .divider { background: rgba(245,242,236,0.10); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r-chip); }

/* ============================================================
   Editorial utilities · v4.3
============================================================ */
/* 下沉首字 · 编辑刊物经典开篇 —— 用在段首：<p class="body"><span class="dropcap">认</span>…</p> */
.dropcap {
  float: left;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  color: var(--accent);
  font-size: 3.4em;
  line-height: 0.74;
  padding: 0.06em 0.12em 0 0;
}

/* 正文内联链接 · 细下划线 + hover 橙（不影响导航/按钮里的 a）—— 用 .prose 包裹或单独 .link */
.prose a:not(.btn):not(.chip),
.link {
  color: var(--ink);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: background-size var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.prose a:not(.btn):not(.chip):hover,
.link:hover { color: var(--accent-deep); background-size: 100% 2px; }

/* ============================================================
   Reduced motion · 尊重系统"减少动态"偏好（无障碍）
============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn::before { display: none; }   /* 关闭按钮光扫 */
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   Theme Toggle · 明暗切换按钮
============================================================ */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-20);
  background: transparent;
  color: var(--ink-60);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease);
}
.theme-toggle:hover {
  background: var(--ink-08);
  color: var(--ink);
  border-color: var(--ink-40);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transition: transform var(--t-med) var(--ease);
}
.theme-toggle:active svg { transform: rotate(30deg); }

/* 图标切换 */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* 深色模式下系统偏好同步 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ============================================================
   全局颜色过渡（主题切换平滑）
   —— 精准列出属性，避免干扰 transform / opacity 动画
============================================================ */
:root {
  --color-transition:
    background-color var(--t-theme) var(--ease),
    border-color     var(--t-theme) var(--ease),
    color            var(--t-theme) var(--ease),
    fill             var(--t-theme) var(--ease),
    stroke           var(--t-theme) var(--ease),
    box-shadow       var(--t-theme) var(--ease);
}

/* 只对「色彩承载」元素加过渡，不污染 transform */
body, nav, footer,
.bento-card, .btn, .chip, .stat,
.section--cream, .section--cream-warm, .section--dark,
.topnav, .topnav__brand, .topnav__links a,
.eyebrow, .footer__col a, .theme-toggle {
  transition: var(--color-transition);
}

/* bento card 单独保留 box-shadow 过渡（hover 效果） */
.bento-card {
  transition:
    background-color var(--t-theme) var(--ease),
    border-color     var(--t-theme) var(--ease),
    box-shadow       var(--t-med)   var(--ease);
}

/* cursor glow 只过渡 opacity */
.cursor-glow {
  transition: opacity 700ms var(--ease);
}

/* scroll progress 只过渡颜色 */
.scroll-progress {
  transition: background-color var(--t-theme) var(--ease);
}

/* —— 数字对齐 · 等宽数字（stats / 表格 / 价格 等需要对齐的数字）—— */
.tnum { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum' 1, 'lnum' 1; }

/* ============================================================
   View Transitions · 跨页淡入淡出（MPA · v4.4）
   —— 仅支持的浏览器生效，其余优雅降级；减少动态时关闭
============================================================ */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* ============================================================
   Print · 打印 / 导出 PDF 样式（v4.4）
   —— 方法论长文打印时也体面：去掉装饰、黑字白底、衬线标题
============================================================ */
@media print {
  :root { --grain-opacity: 0; }
  body { background: #fff; color: #111; }
  body::after,                                   /* 颗粒 */
  .topnav, .ds-toc, .footer, .cursor-glow,
  .scroll-progress, .theme-toggle, .toast,
  .grid-bg::before, .bento-card::before { display: none !important; }
  .section { padding: 18pt 0; }
  .display, .h1, .h2, .h3, .h4, .h5,
  .bento-card__title, .quote, .module-row__title { color: #111 !important; }
  .display em, .h1 em, .h2 em, .h3 em,
  .quote em, .eyebrow { color: #000 !important; }
  .body, .lede, .prose, .prose p, .bento-card__sub { color: #222 !important; }
  a { color: #111 !important; }
  /* 正文外链显示真实地址 */
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  .bento-card, .pillar, .callout, .process__step, .panel__card {
    box-shadow: none !important; border: 1px solid #ccc !important; background: #fff !important;
  }
  .section--dark, .codeblock { background: #fff !important; color: #111 !important; }
  h2, h3, h4, .h2, .h3, .bento-card__title { break-after: avoid; }
  .bento-card, .callout, .figure, blockquote, .module-row, .pullquote { break-inside: avoid; }
  .section--hero { padding-top: 0; }
}
