/* ---------- 主题变量 ---------- */
:root {
  --bg: #fbfaf8;
  --bg-soft: #f2f0ec;
  --fg: #1c1b19;
  --fg-muted: #6b6862;
  --line: #e3dfd8;
  --accent: #b4532a;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 8px 24px -12px rgba(28, 27, 25, .12);
  --glow: 0 0 0 1px rgba(180, 83, 42, .10),
          0 0 28px -8px rgba(180, 83, 42, .55),
          0 0 64px -24px rgba(180, 83, 42, .45),
          0 0 140px -60px rgba(180, 83, 42, .35);
  --glow-soft: 0 0 24px -8px rgba(180, 83, 42, .42);
  --glow-off: 0 0 0 1px rgba(180, 83, 42, 0),
              0 0 28px -8px rgba(180, 83, 42, 0),
              0 0 64px -24px rgba(180, 83, 42, 0),
              0 0 140px -60px rgba(180, 83, 42, 0);

  --light-a:rgba(214,132,52,.17);
  --light-b:rgba(120,150,255,.10);
  --light-c:rgba(214,120,160,.08);
  --sheen:rgba(255,255,255,.55);
  --sheen-opacity:.55;
  --orb-a: rgba(214, 132, 52, .16);
  --orb-b: rgba(120, 150, 255, .09);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #14130f;
  --bg-soft: #1c1a16;
  --fg: #ece8e1;
  --fg-muted: #9a958c;
  --line: #2e2a24;
  --accent: #e08a5f;
  --card: #1a1815;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px -14px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(224, 138, 95, .12),
          0 0 32px -8px rgba(224, 138, 95, .85),
          0 0 80px -26px rgba(224, 138, 95, .70),
          0 0 180px -70px rgba(224, 138, 95, .55);
  --glow-off: 0 0 0 1px rgba(224, 138, 95, 0),
              0 0 32px -8px rgba(224, 138, 95, 0),
              0 0 80px -26px rgba(224, 138, 95, 0),
              0 0 180px -70px rgba(224, 138, 95, 0);
  --glow-soft: 0 0 26px -8px rgba(224, 138, 95, .50);

  /* 光感配色 */
  --light-a:rgba(232,160,76,.14);
  --light-b:rgba(120,150,255,.09);
  --light-c:rgba(232,120,160,.07);
  --sheen:rgba(255,255,255,.035);
  --sheen-opacity:.85;
  --orb-a: rgba(232, 160, 76, .14);
  --orb-b: rgba(120, 150, 255, .10);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: .01em;
  transition: background .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent); color: var(--bg); }

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 80;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  box-shadow: var(--shadow), 0 0 30px -6px rgba(224,138,95,0);
  transition: transform .3s ease, border-color .4s ease,
              box-shadow .62s cubic-bezier(.4,0,.2,1);
}
.theme-toggle:hover { transform: rotate(-15deg) scale(1.05); border-color: rgba(224,138,95,.24); box-shadow: var(--shadow), var(--glow-soft); }

.theme-icon::before { content: "☀"; font-size: 17px; line-height: 1; }
html[data-theme="dark"] .theme-icon::before { content: "☾"; }

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 84px 24px 56px;
  display: flex;
  gap: 28px;
  align-items: center;
}

.avatar {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 650;
}

.tagline {
  margin: 8px 0 16px;
  color: var(--fg-muted);
  font-size: 17px;
}

.links { display: flex; flex-wrap: wrap; gap: 18px; }
.links a {
  color: var(--fg-muted);
  font-size: 15px;
  position: relative;
}
.links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width .2s ease;
}
.links a:hover { color: var(--accent); text-decoration: none; }
.links a:hover::after { width: 100%; }

/* ---------- 区块 ---------- */
main { max-width: 760px; margin: 0 auto; padding: 0 24px; }

.section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: none; }

h2 {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.lead { margin: 0; font-size: 17.5px; max-width: 60ch; }

/* ---------- 事实列表 ---------- */
.facts {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  background: var(--card);
  font-size: 15px;
}
.facts span { color: var(--fg-muted); }

#status { color: #2f9e44; }
html[data-theme="dark"] #status { color: #51cf66; }

/* ---------- 作品卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow-off);
    transition: transform .3s ease, border-color .4s ease, box-shadow .62s cubic-bezier(.4,0,.2,1);
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(224, 138, 95, .18);
  box-shadow: var(--shadow), var(--glow);
}

.card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.card p { margin: 0 0 14px; color: var(--fg-muted); font-size: 14.5px; line-height: 1.6; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 12px;
  letter-spacing: .04em;
}

/* ---------- 笔记列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; }

.list li {
  display: flex;
  gap: 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: none; }

.date {
  flex: 0 0 68px;
  color: var(--fg-muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.list a { color: var(--fg); }
.list a:hover { color: var(--accent); }

/* ---------- 技能标签 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chips span {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 14px;
  color: var(--fg);
    box-shadow: var(--glow-off);
    transition: border-color .4s ease, color .4s ease, transform .3s ease, box-shadow .62s cubic-bezier(.4,0,.2,1);
}
.chips span:hover {
  border-color: transparent;
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

/* ---------- 经历时间线 ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  display: flex;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: none; }
.timeline li:first-child { padding-top: 4px; }

.when {
  flex: 0 0 118px;
  color: var(--fg-muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.timeline h3 { margin: 0 0 4px; font-size: 16.5px; font-weight: 600; }
.timeline p { margin: 0; color: var(--fg-muted); font-size: 14.5px; line-height: 1.65; }

/* ---------- 区块内的更多链接 ---------- */
.more-link { margin: 22px 0 0; }
.more-link a {
  font-size: 14.5px;
  color: var(--accent);
  letter-spacing: .01em;
}
.more-link a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- 按钮 ---------- */
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font-size: 15px;
  box-shadow: var(--shadow), var(--glow-off);
    transition: border-color .4s ease, color .4s ease, transform .3s ease, box-shadow .62s cubic-bezier(.4,0,.2,1);
}
.btn:hover {
  border-color: transparent;
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow), var(--glow);
}

/* ---------- 页脚 ---------- */
footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  color: var(--fg-muted);
  font-size: 13.5px;
}
footer p { margin: 0; }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .hero-inner { flex-direction: column; align-items: flex-start; padding-top: 64px; }
  .section { padding: 40px 0; }
  .list li { flex-direction: column; gap: 2px; }
  .date { flex: none; }
}

/* ---------- 移动端排版（全站共用） ---------- */
@media (max-width: 700px) {
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  img, video { max-width: 100%; height: auto; }

  /* 触控目标不小于 44px */
  .btn, .cat, .tool, .card .more, footer a { min-height: 44px; }
  .btn, .cat { padding: 11px 18px; }

  /* 筛选条横向滚动，不换行挤压 */
  .cats, .chips {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 4px;
  }
  .cats::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
  .cats > *, .chips > * { flex: 0 0 auto; }

  /* 网格降列 */
  .res-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .tools-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .grid { grid-template-columns: 1fr !important; }

  /* 卡片收紧 */
  .res { padding: 14px; }
  .res h3 { font-size: 15.5px; }
  .card { padding: 16px; border-radius: 12px; }

  /* 长文件名不能把卡片撑出屏幕 */
  .res, .card, .tool, .res-top > div { min-width: 0; }
  .res h3, .res .meta, .tool .t, .tool .m,
  .res .path-hint, .res .cat-tag {
    overflow-wrap: anywhere; word-break: break-word; white-space: normal;
  }

  /* 标题与正文比例 */
  h1 { font-size: 26px !important; line-height: 1.3; }
  h2 { font-size: 18px !important; }
  .muted, .sub, .meta { font-size: 12.5px; }

  /* 内容区留白，避免贴边 */
  .wrap, .res-wrap, .tools-wrap { padding-left: 16px !important; padding-right: 16px !important; }
}

@media (max-width: 400px) {
  .tools-grid { grid-template-columns: 1fr !important; }
}

/* ---------- 页面切换（Chrome/Edge 126+ 跨文档 View Transitions） ---------- */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: vt-out .16s ease both;
  }
  ::view-transition-new(root) {
    animation: vt-in .3s cubic-bezier(.2, .7, .2, 1) both;
  }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

/* 兜底：不支持 View Transitions 的浏览器，页面自身淡入 */
@media (prefers-reduced-motion: no-preference) {
  body { animation: page-in .34s cubic-bezier(.2, .7, .2, 1) both; }
}
/* 注意：body 上不能出现 transform —— 那会让 body 成为 position:fixed 的包含块，
   灯箱、悬浮按钮都会被按整篇文档定位而跑到屏幕外。这里只做透明度淡入。 */
@keyframes page-in { from { opacity: 0; } }

/* 尊重"减少动态效果"偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   大屏 / 高 DPI / 异形比例适配
   说明：各页面的栅格写在页面内的 <style> 里，优先级高于本文件，
        所以这里的覆盖用 !important 才能真正生效。
   ============================================================ */

/* 1600px 以上：版心加宽、字号微调，避免 4K 下显得又小又空 */
@media (min-width: 1600px) {
  body { font-size: 16px; }
  .wrap, .res-wrap, .tools-wrap { max-width: 1200px !important; }
  .res-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 16px !important;
  }
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 16px !important;
  }
  .card { padding: 24px; }
  .res { padding: 20px; }
}

/* 2200px 以上：真正的大屏 */
@media (min-width: 2200px) {
  body { font-size: 17px; }
  .wrap, .res-wrap, .tools-wrap { max-width: 1440px !important; }
  .res-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
    gap: 20px !important;
  }
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 20px !important;
  }
  h1 { font-size: 40px; }
  .btn, .cat { padding: 12px 26px; }
}

/* 超宽比例（21:9 / 32:9）：限制行宽，避免一行太长影响阅读 */
@media (min-aspect-ratio: 21/9) and (min-width: 1600px) {
  .wrap, .res-wrap, .tools-wrap { max-width: 1180px !important; }
  .res p, .card p, .tool .t { max-width: 70ch; }
}

/* 竖屏 / 窄高比例（旋转显示器、平板竖放） */
@media (max-aspect-ratio: 3/4) and (min-width: 700px) {
  .res-grid, .tools-grid { grid-template-columns: 1fr !important; }
}

/* 高 DPI：1px 边框在 2x 屏上偏细，稍微提亮 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  :root { --line: rgba(28, 27, 25, .16); }
  html[data-theme="dark"] { --line: rgba(236, 232, 225, .14); }
  img { image-rendering: -webkit-optimize-contrast; }
}



/* ============================================================
   动效层：入场、按键反馈、切换过渡
   ============================================================ */

/* 卡片入场（由 JS 写入 --i 做交错） */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.res, .tool, .ph {
  animation: cardIn .42s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 9ms);
}

/* 按键反馈 */
.btn, .cat, .theme-toggle, .act, .lnk {
  transition: transform .16s ease, box-shadow .5s ease,
              border-color .3s ease, background .3s ease, color .3s ease;
}
.btn:active, .cat:active, .theme-toggle:active, .act:active {
  transform: scale(.955);
}

/* 主题切换时的整体过渡（亮暗互切不突兀） */
html.theme-anim body {
  transition: background-color .5s ease, color .5s ease;
}
/* 从按钮位置扩散的光圈 */
.theme-ripple {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle,
    rgba(var(--accent-rgb, 232,160,76), .38), transparent 70%);
  animation: rippleOut .62s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes rippleOut {
  to { transform: translate(-50%, -50%) scale(90); opacity: 0; }
}

/* 列表切换：旧内容淡出 */
.fading { opacity: 0; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease; }

/* ---------- 手机端：光球收小、减模糊，避免糊成一团 ---------- */
@media (max-width: 700px) {
          .theme-toggle { top: 12px; right: 12px; width: 34px; height: 34px; }
  .res, .tool, .ph { animation-duration: .34s; }
}

@media (max-width: 700px) and (prefers-reduced-motion: no-preference) {
  }

/* 尊重减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .theme-ripple { display: none; }
  .res, .tool, .ph { animation: none; }
}
/* ---------- 明亮模式可读性 + 切换流畅度 ---------- */
html[data-theme="light"]{
  --fg-muted:#5d5a55;      /* 比原来更深，正文对比度 >= 5.5 */
  --accent:#96470f;        /* 亮底上的强调色加深 */
}
/* 卡片上的浅色文字始终反色，避免压在图片上看不清 */
.card-cap, .ph .cap{color:#f4f1ea}

html.theme-anim body::before{animation-play-state:paused}
html.theme-anim .res,
html.theme-anim .tool,
html.theme-anim .ph{animation-play-state:paused}
html.theme-anim body{transition:background-color .3s ease,color .3s ease}

.theme-ripple{will-change:transform,opacity;contain:strict;animation-duration:.5s}
@keyframes rippleOut{to{transform:translate(-50%,-50%) scale(46);opacity:0}}
@media (prefers-reduced-motion: reduce){ html.theme-anim body{transition:none} }

/* ============================================================
   沉浸光感 v2：一层光场 + 一道光泽
   用多层 radial-gradient 直接画光，不再用 blur 处理大元素
   （手机上 blur 大范围元素最耗 GPU，且容易糊成一团）
   ============================================================ */

/* 主光场：左上方主光、右侧补光、底部环境反光 */
body::before{
  content:"";position:fixed;inset:-3vmax;z-index:0;pointer-events:none;
  background:
    radial-gradient(56% 44% at 16% 4%,  var(--light-a), transparent 70%),
    radial-gradient(48% 40% at 86% 18%, var(--light-b), transparent 72%),
    radial-gradient(66% 50% at 52% 104%, var(--light-c), transparent 74%);
  animation:lightBreath 76s ease-in-out infinite alternate;
  will-change:transform;
}
/* 光泽：一道很淡的斜向高光，制造"玻璃/纸张"的反射感 */
body::after{
  content:"";position:fixed;inset:0;z-index:0;pointer-events:none;
  background:linear-gradient(118deg,
    transparent 36%, var(--sheen) 48%, transparent 62%);
  opacity:var(--sheen-opacity, .8);
}
@keyframes lightBreath{
  from{transform:translate3d(0,0,0) scale(1)}
  to  {transform:translate3d(1.8vw,-1.4vh,0) scale(1.045)}
}
@media (prefers-reduced-motion: reduce){
  body::before{animation:none}
}
/* 内容浮在光之上 */
body > nav, body > header, body > section, body > main,
body > footer, body > .wrap{position:relative;z-index:1}
/* ===== 手机可读性 ===== */
@media (max-width: 700px) {
  .cat{ font-size: 13.5px !important; padding: 7px 16px; }
  .res .meta, .res .m, .meta{ font-size: 13px !important; line-height: 1.55; }
  .ico{ font-size: 13px; }
  .cat-tag{ font-size: 13px !important; padding: 3px 10px; }
  .dl{ font-size: 13.5px !important; }
  .count, .hint{ font-size: 13px !important; }
  .back{ font-size: 13.5px; }
  .head p{ font-size: 15px; line-height: 1.7; }
  .tools .m, .tool .m{ font-size: 13px !important; }
  footer{ font-size: 13px; }
}

/* 亮色模式：次要色加深 */
html[data-theme="light"]{
  --fg-muted:#514d47;
  --accent:#96470f;
}
html[data-theme="light"] .cat{ color:#4f4a44 !important; }
html[data-theme="light"] .cat:hover,
html[data-theme="light"] .cat.on{ color:#9a4b16; }
html[data-theme="light"] .dl{ color:#fff !important; font-weight:600; }
html[data-theme="light"] .cat-tag{ color:#5a554e; }
html[data-theme="light"] .meta,
html[data-theme="light"] .res .m{ color:#565049; }

/* ============================================================
   HDR / 广色域适配
   · 普通 sRGB 屏：完全不变
   · P3 广色域屏：强调色换成 Display P3，更饱和不刺眼
   · HDR 屏（dynamic-range: high）：光晕更亮更通透，暗部压得更深
   ============================================================ */

@supports (color: color(display-p3 1 1 1)) {
  @media (color-gamut: p3) {
    :root{
      /* 暗色：P3 里同样色相能给出更高的饱和度 */
      --accent:      color(display-p3 0.906 0.639 0.318);
      --accent-soft: color(display-p3 0.906 0.639 0.318 / 0.14);
    }
    html[data-theme="light"]{
      --accent:      color(display-p3 0.596 0.286 0.063);
      --accent-soft: color(display-p3 0.596 0.286 0.063 / 0.12);
    }
  }
}

/* HDR 屏：光可以更亮，黑可以更深 */
@media (dynamic-range: high) {
  :root{
    --hdr-boost: 1;
  }
  html[data-theme="dark"]{
    --bg: #0a0d12;          /* 比 sRGB 版更深，拉开动态范围 */
    --bg-soft: #10141b;
    --light-a: rgba(232,160,76,.17);
    --light-b: rgba(120,150,255,.11);
    --light-c: rgba(232,120,160,.09);
  }
  /* 光场稍微提亮，HDR 上不会"闷" */
  body::before{ opacity: calc(1 + .08 * var(--hdr-boost, 1)); }
  /* 只增强"光"，照片本身保持原样（HDR 屏会把 SDR 照片按标准亮度映射，
     再叠滤镜反而偏色） */
  .res:hover, .tile:hover{ --glow-boost: 1.06; }
}

/* 系统级色彩方案：让滚动条、表单控件、原生 UI 跟着主题走 */
:root{ color-scheme: dark; }
html[data-theme="light"]{ color-scheme: light; }

/* 照片：交给浏览器按屏幕能力做色调映射，避免二次提亮 */
.tile img, .ph img, .hero-media img{
  color-scheme: normal;
}

