/*
 * 墨溟 · core — 全站共用的设计系统
 * 三色：纸（底）、墨（字与形）、朱（印，只在需要落款的地方出现）。
 * 夜里纸变成海，墨变成月白；朱不变。
 */

/* ------------------------------------------------------------------ 令牌 */

:root {
  --paper: #f2efe8;
  --paper-2: #e9e5dc;
  --paper-3: #dcd7cb;
  --ink: #121417;
  --ink-2: #4b4d51;
  --ink-3: #7c7e81;
  --ink-4: #a8a7a2;
  --hair: rgba(18, 20, 23, .13);
  --hair-2: rgba(18, 20, 23, .24);
  --seal: #c23a22;
  --seal-ink: #f2efe8;          /* 朱底上的字 */
  --veil: rgba(242, 239, 232, .82);
  --shadow: 0 1px 0 rgba(18, 20, 23, .04), 0 18px 48px -18px rgba(18, 20, 23, .22);
  color-scheme: light;

  --serif: 'Noto Serif SC', 'Source Han Serif SC', 'Source Han Serif', 'Songti SC', 'STSong', 'SimSun', serif;
  --latin: 'Instrument Serif', 'Noto Serif SC', 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, 'Noto Serif SC', monospace;
  --sans: system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;

  --margin: clamp(20px, 4.4vw, 72px);
  --gutter: clamp(16px, 1.8vw, 28px);
  --mast-h: 76px;
  --measure: 36em;

  --t-micro: 11px;
  --t-small: 14px;
  --t-body: 17px;
  --t-lead: clamp(19px, 1.5vw, 22px);
  --t-h3: clamp(21px, 1.7vw, 25px);
  --t-h2: clamp(28px, 2.6vw, 38px);
  --t-h1: clamp(40px, 5vw, 76px);
  --t-display: clamp(64px, 10vw, 168px);

  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-ink: cubic-bezier(.22, .61, .36, 1);
}

/* 夜：深海与月白 */
:root[data-theme="dark"] {
  --paper: #0e1013;
  --paper-2: #16191d;
  --paper-3: #23272c;
  --ink: #ece8df;
  --ink-2: #b4b0a7;
  --ink-3: #85827b;
  --ink-4: #5d5b56;
  --hair: rgba(236, 232, 223, .12);
  --hair-2: rgba(236, 232, 223, .24);
  --seal: #e0563b;
  --seal-ink: #0e1013;
  --veil: rgba(14, 16, 19, .82);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 24px 60px -20px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* 没有脚本时跟随系统 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #0e1013; --paper-2: #16191d; --paper-3: #23272c;
    --ink: #ece8df; --ink-2: #b4b0a7; --ink-3: #85827b; --ink-4: #5d5b56;
    --hair: rgba(236, 232, 223, .12); --hair-2: rgba(236, 232, 223, .24);
    --seal: #e0563b; --seal-ink: #0e1013; --veil: rgba(14, 16, 19, .82);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ 基础 */

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--mast-h) + 16px);
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.85;
  font-weight: 400;
  font-kerning: normal;
  text-autospace: normal;
  text-spacing-trim: normal;
  line-break: strict;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
@media (min-width: 1100px) { body { font-size: 18px; } }

h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--paper); }

:focus { outline: none; }
:focus-visible {
  outline: 1.5px solid var(--seal);
  outline-offset: 4px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  left: var(--margin);
  top: 10px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-small);
  transform: translateY(-160%);
  transition: transform .3s var(--ease);
}
.skip:focus-visible { transform: none; }

/* 小标签：等宽、疏排 */
.label {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label b { font-weight: 500; color: var(--ink); }
.latin { font-family: var(--latin); font-weight: 400; letter-spacing: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* 链接：一根细线，悬停时由左向右着墨 */
.link {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat,
              linear-gradient(var(--hair-2), var(--hair-2)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size .5s var(--ease);
}
.link:hover { background-size: 100% 1px, 100% 1px; }

/* ------------------------------------------------------------------ 印 */

.seal {
  display: inline-block;
  flex: none;
  width: 18px;
  aspect-ratio: 100 / 186;
  background: var(--seal);
  -webkit-mask: url(/assets/img/seal.svg?v=08347ab1) center / contain no-repeat;
  mask: url(/assets/img/seal.svg?v=08347ab1) center / contain no-repeat;
}
.seal--square {
  aspect-ratio: 1;
  -webkit-mask-image: url(/assets/img/seal-square.svg?v=43a6d3e0);
  mask-image: url(/assets/img/seal-square.svg?v=43a6d3e0);
}

/* ------------------------------------------------------------------ 刊头 */

.mast {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--mast-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: env(safe-area-inset-top, 0px) var(--margin) 0;
  transition: transform .6s var(--ease), background-color .4s, box-shadow .4s;
  view-transition-name: mast;
}
.mast::before {               /* 滚动后才出现的纸面 */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--veil);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 1px 0 var(--hair);
  opacity: 0;
  transition: opacity .4s;
}
.mast.is-solid::before { opacity: 1; }
.mast.is-away { transform: translateY(-100%); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  line-height: 1;
}
.brand .seal { width: 17px; transition: transform .6s var(--ease); }
.brand:hover .seal { transform: rotate(-4deg) scale(1.06); }
.brand__name {
  font-family: var(--latin);
  font-size: 25px;
  letter-spacing: .01em;
  transform: translateY(1px);
}
.brand__sub {
  font-size: 13px;
  letter-spacing: .32em;
  color: var(--ink-3);
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--hair-2);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.6vw, 44px);
}
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 0;
  font-size: 15px;
  letter-spacing: .18em;
  line-height: 1.2;
  color: var(--ink);
}
.nav__i {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  transform: translateY(-3px);
  transition: color .3s;
}
.nav__link::after {
  content: '';
  position: absolute;
  left: 0; right: .18em; bottom: 4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s var(--ease);
}
.nav__link:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__link:hover .nav__i { color: var(--seal); }
.nav__link[aria-current="page"] .nav__i { color: var(--seal); }
.nav__link[aria-current="page"]::after { transform: scaleX(1); background: var(--seal); }

/* 昼夜：一枚会变成月牙的圆 */
.daynight {
  position: relative;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  border-radius: 50%;
}
.daynight svg { width: 18px; height: 18px; overflow: visible; }
.daynight .dn-disc { fill: currentColor; }
.daynight .dn-ring { fill: none; stroke: currentColor; stroke-width: 1.2; }
.daynight .dn-cut { transition: transform .7s var(--ease); }
:root[data-theme="dark"] .daynight .dn-cut { transform: translate(-5px, -3px); }
.daynight .dn-rays { stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; transition: opacity .4s, transform .7s var(--ease); transform-origin: center; }
:root[data-theme="dark"] .daynight .dn-rays { opacity: 0; transform: rotate(-60deg) scale(.6); }
.daynight:hover { color: var(--seal); }

/* ------------------------------------------------------------------ 按钮 */

.btn {
  --b: var(--hair-2);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--b);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: .12em;
  line-height: 1;
  white-space: nowrap;
  isolation: isolate;
  overflow: hidden;
  transition: color .45s var(--ease), border-color .45s;
}
.btn::before {                  /* 墨从下方涨上来 */
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--ink);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform .55s var(--ease);
}
.btn:hover { color: var(--paper); border-color: var(--ink); }
.btn:hover::before { transform: none; }
.btn small { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; opacity: .62; }
.btn--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--ink::before { background: var(--seal); }
.btn--ink:hover { border-color: var(--seal); }
.arrow {
  display: inline-block;
  width: 1.1em;
  transition: transform .5s var(--ease);
}
a:hover > .arrow, button:hover > .arrow, .btn:hover .arrow { transform: translateX(4px); }

/* ------------------------------------------------------------------ 版记 */

.foot {
  position: relative;
  padding: clamp(80px, 12vw, 160px) var(--margin) calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hair);
  overflow: hidden;
}
.foot__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: 48px;
}
.foot__lede {
  grid-column: 1 / span 5;
  font-size: var(--t-h3);
  line-height: 1.6;
  letter-spacing: .02em;
}
.foot__lede .seal { width: 22px; margin-bottom: 26px; }
.foot__col { grid-column: span 2; display: grid; align-content: start; gap: 6px; }
.foot__col:first-of-type { grid-column: 7 / span 2; }
.foot__col .label { margin-bottom: 12px; }
.foot__col a { width: fit-content; font-size: 15px; letter-spacing: .06em; }
.foot__col p { font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.foot__word {
  margin: clamp(56px, 9vw, 120px) 0 0;
  font-family: var(--latin);
  font-size: clamp(120px, 27vw, 460px);
  line-height: .74;
  letter-spacing: -.02em;
  white-space: nowrap;
  user-select: none;
  color: var(--ink);
}
.foot__word i { font-style: italic; }
.foot__base {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 32px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
  color: var(--ink-3);
}
.foot__base a:hover { color: var(--ink); }
.beian { display: flex; flex-wrap: wrap; gap: 4px 20px; }

/* ------------------------------------------------------------------ 入场 */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--d, 0) * 1ms);
}
.js [data-reveal].is-in, .no-reveal [data-reveal] { opacity: 1; transform: none; }

/* 逐行抬起的大字 */
.rise { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.js .rise > span {
  display: block;
  transform: translateY(105%);
  transition: transform 1.3s var(--ease);
  transition-delay: calc(var(--d, 0) * 1ms);
}
.rise > span { display: block; }
.is-in .rise > span, .rise.is-in > span, .no-reveal .rise > span { transform: none; }

/* ------------------------------------------------------------------ 跨页过渡 */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .45s var(--ease-io) both; }
::view-transition-new(root) { animation: vt-in .7s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-14px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }
::view-transition-group(mast) { animation-duration: .5s; }

/* 昼夜切换时由按钮处向外晕开，不用默认的淡入淡出 */
:root.is-theming::view-transition-old(root),
:root.is-theming::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.is-theming::view-transition-group(mast) { animation: none; }
@property --vt-r { syntax: '<length>'; inherits: false; initial-value: 0px; }
:root.is-theming::view-transition-new(root) {
  -webkit-mask-image: radial-gradient(circle at var(--vt-x, 50%) var(--vt-y, 0px), #000 calc(var(--vt-r) - 180px), transparent var(--vt-r));
  mask-image: radial-gradient(circle at var(--vt-x, 50%) var(--vt-y, 0px), #000 calc(var(--vt-r) - 180px), transparent var(--vt-r));
}

/* ------------------------------------------------------------------ 响应 */

@media (max-width: 900px) {
  .foot__lede { grid-column: 1 / -1; }
  .foot__col, .foot__col:first-of-type { grid-column: span 4; }
}
@media (max-width: 640px) {
  :root { --mast-h: 64px; --t-body: 16.5px; }
  .brand__sub { display: none; }
  .brand__name { font-size: 23px; }
  .nav { gap: 16px; }
  .nav__link { font-size: 14px; letter-spacing: .1em; }
  .nav__i { display: none; }
  .foot__col, .foot__col:first-of-type { grid-column: span 6; }
  .foot__col:last-of-type { grid-column: 1 / -1; }
  .foot__base { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  [data-reveal], .rise > span { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}
@media (forced-colors: active) {
  .seal { background: CanvasText; }
  .btn::before { display: none; }
}
@media print {
  .mast, .foot__word, .daynight { display: none; }
  html { background: #fff; color: #000; }
}
