/* ==========================================================================
   halo-v5ai-theme · 主样式
   方向 1「精密界面」：亮底、单列纵向叙事、真实产品界面当主角、
   字阶只到 32px、层级靠间距、等宽字只用于技术元信息。

   换肤：只改本文件顶部 :root 令牌。
   深色：<html data-theme="dark"> 由 head.html 按主题设置写入。
   内页样式在 pages.css，两文件共用这里的令牌与外壳类。
   ========================================================================== */

:root {
  --paper: #f6f7f8;
  --surface: #ffffff;
  --ink: #0d0e10;
  --ink-2: #4c5057;
  --ink-3: #666b73;
  --line: #e3e4e7;
  --line-strong: #d3d5da;
  --accent: #4f46e5;
  --shadow-1: 0 1px 2px rgba(13, 14, 16, 0.05), 0 22px 44px -30px rgba(13, 14, 16, 0.34);
  --shadow-2: 0 1px 2px rgba(13, 14, 16, 0.04), 0 18px 40px -32px rgba(13, 14, 16, 0.3);
  --radius: 10px;
  --sans: -apple-system, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", Arial, sans-serif;
  --mono: "SFMono-Regular", Menlo, "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --paper: #0c0d0f;
  --surface: #141518;
  --ink: #ecedef;
  --ink-2: #a8acb4;
  --ink-3: #83878f;
  --line: #232529;
  --line-strong: #32353a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 22px 44px -30px rgba(0, 0, 0, 0.8);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.45), 0 18px 40px -32px rgba(0, 0, 0, 0.7);
}
html[data-theme="dark"] .frame img { filter: brightness(0.9) contrast(1.02); }

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}
::selection { background: rgba(79, 70, 229, 0.16); }

/* 仅供屏幕阅读器 */
.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;
}

/* 内页标题区（pages.css 复用）：与首页 .sec-head 同一条规则线 */
.page-head { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 56px; }
.page-head h1 { margin: 0; font-size: 32px; line-height: 1.3; font-weight: 600; letter-spacing: -0.018em; }
.page-head .page-desc { margin: 12px 0 0; color: var(--ink-2); max-width: 700px; }
.page-head .page-meta { margin: 14px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }

.wrap { width: min(1168px, 100%); margin: 0 auto; padding: 0 24px; }

/* 键盘可达性：跳转链接 */
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); color: var(--ink); padding: 10px 16px;
  border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px;
}
.skip-link:focus { left: 16px; }

/* ============================ 页头 ============================ */
.site-head { border-bottom: 1px solid var(--line); position: relative; }
.site-head .wrap { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; padding: 8px 0; text-decoration: none; min-height: 44px; }
.brand img { height: 22px; width: auto; display: block; align-self: center; }
.brand b { font-size: 16px; font-weight: 600; letter-spacing: -0.012em; }
.brand span { font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.01em; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  display: inline-flex; align-items: center; height: 44px; padding: 0 12px; border-radius: 6px;
  font-size: 14px; color: var(--ink-2); text-decoration: none; transition: color 0.12s ease;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; background: none;
  border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink-2); cursor: pointer;
}

/* ============================ 首屏 ============================ */
.hero { padding-top: 56px; padding-bottom: 48px; }
.hero h1 { margin: 0; font-size: 32px; line-height: 1.42; font-weight: 600; letter-spacing: -0.014em; max-width: 840px; }
.hero .lede { margin: 20px 0 0; max-width: 620px; font-size: 16px; line-height: 1.8; color: var(--ink-2); }
.hero .meta { margin: 22px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.02em; }
.hero .meta i { font-style: normal; padding: 0 10px; }
.hero .meta a { text-decoration: none; }
.hero .meta a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* 真实产品窗口并置叠压。
   数量无关：模板只取「有封面图的前两张」，第 1 张在前、第 2 张偏后叠压；
   只有一张时用 .stack-single 通栏；一张都没有就整块不渲染。 */
.stack { position: relative; height: 390px; margin-top: 28px; }
.win { position: absolute; margin: 0; top: 0; }
.win-a { left: 0; width: 620px; z-index: 2; }
.win-b { right: 0; top: 96px; width: 560px; z-index: 1; }
.win .frame {
  overflow: hidden; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.win-a .frame { height: 321px; }
.win-b .frame { height: 294px; }
.win .frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 45%); }
.stack-single { height: auto; }
.stack-single .win { position: static; width: 100%; }
.stack-single .win .frame { height: auto; aspect-ratio: 16 / 9; }
.stack-note { margin: 16px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.01em; }

/* ============================ 区块通用 ============================ */
.sec { margin-top: 56px; }
.sec-head {
  border-top: 1px solid var(--line); padding-top: 16px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
}
.sec-head h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.012em; }
.sec-head .hint { font-family: var(--mono); font-size: 13px; color: var(--ink-3); text-align: right; margin: 0; }
.sec-head .hint a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.sec-head .hint a:hover { color: var(--ink); text-decoration-color: var(--ink-3); }

/* ============================ 我做的事 ============================ */
.about .lead { margin: 20px 0 0; font-size: 20px; line-height: 1.7; max-width: 820px; letter-spacing: -0.008em; }
.about p.body { margin: 14px 0 0; max-width: 700px; color: var(--ink-2); }
.rows { margin-top: 28px; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 190px 1fr; gap: 40px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.row h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.row p { margin: 0; max-width: 660px; color: var(--ink-2); }

/* ============================ 项目 ============================ */
.proj { display: grid; grid-template-columns: 440px 640px; gap: 40px; align-items: start; margin-top: 36px; }
.proj + .proj { margin-top: 48px; }
.proj--rev { grid-template-columns: 640px 440px; }
.proj--rev .media { order: 1; }
.proj--rev .doc { order: 2; }
.proj h3 {
  margin: 0; font-size: 32px; line-height: 1.2; font-weight: 600;
  letter-spacing: -0.018em; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.proj h3 img.mark { display: block; height: 26px; width: auto; flex: none; }
.proj .desc { margin: 14px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.8; max-width: 440px; }
.spec { margin: 20px 0 0; display: grid; gap: 8px; }
.spec div { display: grid; grid-template-columns: 62px 1fr; gap: 14px; align-items: baseline; }
.spec dt { font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.02em; }
.spec dd { margin: 0; font-size: 14px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }

.go {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; margin-top: 22px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  font-size: 14px; text-decoration: none; transition: border-color 0.12s ease;
}
.go:hover { border-color: var(--ink-3); }
.go svg { transition: transform 0.14s ease; }
.go:hover svg { transform: translate(2px, -2px); }
.nolink {
  margin: 16px 0 0; min-height: 44px; display: flex; align-items: center;
  font-family: var(--mono); font-size: 13px; color: var(--ink-3);
}

.media { position: relative; }
.media .frame {
  border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-2); position: relative;
}
.media .frame img { display: block; width: 100%; height: auto; }
.media .frame.crop { height: 340px; }
.media .frame.crop img { height: 100%; object-fit: cover; object-position: var(--focus, 50% 45%); }
/* 两张图并排：第一张（通常是竖版面板）裁切填满，第二张（横版窗口）按原始比例整体呈现，
   避免把 1960×1618 的窗口塞进竖框后只剩一条竖切片。 */
.media .duo { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.media .duo .frame:first-child { height: 396px; }
.media .duo .frame:first-child img { height: 100%; object-fit: cover; object-position: var(--focus, 50% 40%); }
.media .duo .frame:nth-child(2) { height: auto; }
.media .duo .frame:nth-child(2) img { width: 100%; height: auto; }
.media .cap { margin: 10px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); line-height: 1.6; }
.media .hover-note {
  position: absolute; left: 12px; bottom: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px;
  opacity: 0; transition: opacity 0.16s ease;
}
.media .frame:hover .hover-note { opacity: 1; }
/* 没有界面图的卡片：单列收敛，不留空列 */
.proj--nomedia { grid-template-columns: minmax(0, 1fr); }
.proj--nomedia .doc { max-width: 820px; }
/* 没有界面图的卡片：不给破图，用虚线空版 + 说明 */
.media .frame.empty {
  display: flex; align-items: center; justify-content: center;
  height: 260px; border-style: dashed; box-shadow: none; background: transparent;
  font-family: var(--mono); font-size: 13px; color: var(--ink-3); text-align: center; padding: 20px;
}

/* ============================ 文章 ============================ */
.posts { margin-top: 24px; border-top: 1px solid var(--line); }
.post {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 44px;
}
/* 封面缩略图：16:10，细描边、不做重阴影，与整页克制一致 */
.post__thumb {
  flex: none; width: 128px; height: 80px; object-fit: cover;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  transition: border-color 0.12s ease;
}
.post:hover .post__thumb { border-color: var(--line-strong); }
.post h3 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.012em; line-height: 1.5; }
.post .tag { flex: none; margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.post:hover h3 { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.more {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; margin-top: 6px;
  font-size: 14px; color: var(--ink-2); text-decoration: none;
}
.more:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.empty-note { margin: 24px 0 0; color: var(--ink-3); font-size: 14px; }

/* ============================ 页脚 ============================ */
.foot { margin-top: 56px; border-top: 1px solid var(--line); padding: 28px 0 44px; }
.foot-top { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: start; }
.foot .brand b { font-size: 16px; }
.foot .tagline { margin: 8px 0 0; max-width: 420px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 20px; justify-content: flex-end; }
.foot-links a { display: inline-flex; align-items: center; height: 44px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
/* 社交链接（页脚） */
.socials { display: flex; flex-wrap: wrap; gap: 0 16px; list-style: none; margin: 10px 0 0; padding: 0; }
.socials__item { margin: 0; }
.socials__link { display: inline-flex; align-items: center; height: 44px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.socials__link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.socials__link--plain { color: var(--ink-3); }

.foot-base {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.01em;
}
.foot-base a { text-decoration: none; }
.foot-base a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* ============================ 动效 ============================ */
/* 原则：一次编排好的载入，胜过每块各自 fade-up。
   初始隐藏只挂在 .js 上（由 head 里的内联脚本在绘制前加），
   禁用 JS 时内容始终可见；脚本异常时由 theme.js 主动摘掉 .js 兜底。
   全部动效裹在 prefers-reduced-motion: no-preference 里。 */

/* 区块测线改成伪元素，才有「画出来」的空间（不改变布局） */
.sec-head { position: relative; border-top: 0; }
.sec-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: var(--line); transform-origin: left center;
}

@media (prefers-reduced-motion: no-preference) {
  /* --- 首屏载入：标题 → 导语 → 项目名 → 两个窗口 → 说明，每级约 80ms --- */
  @keyframes v5-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes v5-fade { from { opacity: 0; } to { opacity: 1; } }

  .hero h1    { animation: v5-rise .62s cubic-bezier(.22,.72,.2,1) both; }
  .hero .lede { animation: v5-rise .62s cubic-bezier(.22,.72,.2,1) .08s both; }
  .hero .meta { animation: v5-rise .56s cubic-bezier(.22,.72,.2,1) .16s both; }
  /* 装图的容器只做淡入、不加 transform：变换会把容器提升为合成层，
     大图在部分软件光栅环境下会漏画（这个坑实测踩过）。 */
  .stack figure { animation: v5-fade .62s ease both; }
  .stack figure:nth-of-type(1) { animation-delay: .24s; }
  .stack figure:nth-of-type(2) { animation-delay: .36s; }
  .stack-note { animation: v5-fade .5s ease .52s both; }

  /* --- 滚动进入：轻微上浮，测线从左延展 --- */
  /* :where() 把选择器优先级归零，否则 .js .about .lead 会压过 .js .is-in，
     加上 .is-in 也回不到可见（这个坑实测踩过：整块文案会消失）。 */
  /* 只让文字块参与揭示：淡入 + 上浮 10px。
     装图的容器（.proj .media / .posts / .stack figure）不参与 —— 它们一旦被
     opacity 过渡接管，大图在软件光栅下会漏画（实测踩过），收益也远不如文字明显。 */
  .js :where(.about .lead, .about .body, .about .rows, .proj .doc) {
    opacity: 0; transform: translateY(10px);
    transition: opacity .5s ease, transform .55s cubic-bezier(.22,.72,.2,1);
  }
  .js .is-in { opacity: 1; transform: none; }

  .js .sec-head::before { transform: scaleX(0); transition: transform .8s cubic-bezier(.22,.72,.2,1); }
  .js .sec-head.is-in::before { transform: scaleX(1); }

  /* --- 悬停：窗口轻微抬起、描边加深（回应用户动作，而不是自播） --- */
  /* 悬停只改描边与阴影，不位移：图框保持静止，符合这版克制的调子 */
  .media .frame { transition: border-color .2s ease, box-shadow .3s ease; }
  .media .frame:hover {
    border-color: var(--line-strong);
    box-shadow: 0 1px 2px rgba(13, 14, 16, 0.05), 0 24px 50px -34px rgba(13, 14, 16, 0.4);
  }
  .win .frame { transition: border-color .2s ease; }
  .win .frame:hover { border-color: var(--line-strong); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

/* ============================ 响应式 ============================ */
@media (max-width: 1180px) {
  .stack { height: auto; margin-top: 36px; display: grid; gap: 20px; }
  .win { position: static; width: 100%; }
  .win-b { top: auto; }
  .win-a .frame, .win-b .frame { height: auto; aspect-ratio: 1.72; }
  .proj, .proj--rev { grid-template-columns: 1fr; gap: 26px; }
  .proj--rev .media { order: 0; }
  .proj--rev .doc { order: 0; }
  .media .frame.crop { height: 420px; }
  .media .duo { grid-template-columns: 1fr 1fr; }
  .stack-note { margin-top: 0; }
}
@media (max-width: 760px) {
  .site-head .wrap { height: 58px; }
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 6px 12px 12px; display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a { height: 48px; padding: 0 12px; font-size: 15px; }
  .hero { padding-top: 48px; }
  .hero h1 { font-size: 26px; line-height: 1.5; }
  .hero .lede { font-size: 16px; }
  .about .lead { font-size: 18px; }
  .row { grid-template-columns: 1fr; gap: 4px; padding: 16px 0; }
  .proj h3 { font-size: 26px; }
  .proj .desc, .row p, .about p.body { font-size: 16px; }
  .spec dd, .foot .tagline, .foot-links a, .nolink { font-size: 15px; }
  .media .duo { grid-template-columns: 1fr; }
  .media .duo .frame { height: 300px; }
  .media .frame.crop { height: 240px; }
  .post { gap: 12px; padding: 12px 0; }
  .post__thumb { width: 84px; height: 56px; border-radius: 4px; }
  .post h3 { font-size: 17px; }
  .foot-top { grid-template-columns: 1fr; }
  .foot-links { justify-content: flex-start; }
  .sec { margin-top: 48px; }
}
@media (max-width: 420px) {
  .wrap { padding: 0 18px; }
  .hero h1 { font-size: 23px; }
}
