/* MondChat official site — paper and charcoal, hairlines, room to breathe. */

:root {
  --sans: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --r1: 4px;
  --r2: 8px;
  --d1: 120ms;
  --d2: 200ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="light"] {
  --bg: #f3f1ec;
  --surface: #faf9f6;
  --surface-2: #eae7df;
  --ink: #1a1917;
  --ink-2: #56534c;
  --ink-3: #69645a;
  --line: #dcd7cc;
  --line-strong: #c8c2b3;
  --accent: #a9432c;
  --accent-ink: #faf7f1;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #12110f;
  --surface: #191816;
  --surface-2: #232120;
  --ink: #ede9e1;
  --ink-2: #a9a49a;
  --ink-3: #8f8a80;
  --line: #2b2926;
  --line-strong: #3d3a34;
  --accent: #d2684c;
  --accent-ink: #1b110d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--d2) var(--ease), color var(--d2) var(--ease);
}

h1, h2, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent); color: var(--accent-ink); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: fixed; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: var(--r2); font-size: 13px;
  transition: top var(--d1) var(--ease);
}
.skip:focus { top: 16px; }

.kicker {
  font: 11px/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* 正文滑上来时在导航下面化开一层背景，退场不是被硬切掉。滚起来才出现。 */
.nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 64px;
  background: linear-gradient(to bottom, var(--bg), transparent);
  pointer-events: none;
}
.nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 64px;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 9px; width: fit-content; }
.brand__mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--line);
}
.brand__name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.nav__actions { display: flex; align-items: center; gap: 10px; }

.cta {
  display: inline-flex; align-items: center;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px; letter-spacing: -.005em;
  color: var(--ink);
  transition: background-color var(--d1) var(--ease), border-color var(--d1) var(--ease), color var(--d1) var(--ease);
}
.cta:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.themeBtn {
  position: relative;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  color: var(--ink-2);
  transition: border-color var(--d1) var(--ease), color var(--d1) var(--ease);
}
.themeBtn:hover { border-color: var(--line-strong); color: var(--ink); }
.themeBtn .ico { grid-area: 1 / 1; width: 16px; height: 16px; }
[data-theme="light"] .ico--sun { opacity: 0; transform: scale(.7); }
[data-theme="dark"] .ico--moon { opacity: 0; transform: scale(.7); }
.themeBtn .ico { transition: opacity var(--d2) var(--ease), transform var(--d2) var(--ease); }

/* ---------- hero ---------- */
.hero-wrap {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.hero {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 92px 28px 72px;
  min-height: 88vh;
  display: flex; flex-direction: column; justify-content: center;
}
.sky {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
[data-theme="light"] .sky { display: none; }
.moon {
  position: absolute;
  top: 50%; right: -140px;
  width: 520px; height: 520px;
  margin-top: -200px;
  z-index: 0;
  pointer-events: none;
}
.moon svg { width: 100%; height: 100%; stroke: var(--line-strong); stroke-width: 1; }
.moon__disc {
  fill: var(--surface);
  stroke: var(--line-strong);
}
[data-theme="dark"] .moon__disc { fill: var(--surface-2); }
.moon__crater {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
  opacity: .6;
}
.hero__mark {
  display: flex; align-items: center; gap: 16px;
}
.hero__mark img {
  width: 56px; height: 56px;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px color-mix(in srgb, var(--ink) 7%, transparent);
}
.hero h1 {
  margin-top: 22px;
  font-size: clamp(42px, 7.6vw, 82px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -.035em;
}
.lede {
  margin-top: 32px;
  max-width: 540px;
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.7;
  color: var(--ink-2);
}
.hero__quote {
  margin-top: 56px;
  padding-top: 22px;
  max-width: 540px;
  border-top: 1px solid var(--line);
}
.hero__quote blockquote p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-2);
  transition: opacity 420ms var(--ease);
}
.hero__quote figcaption {
  margin-top: 12px;
  font: 11px/1.4 var(--mono);
  letter-spacing: .08em;
  color: var(--ink-3);
  transition: opacity 420ms var(--ease);
}
.hero__quote.is-swapping blockquote p,
.hero__quote.is-swapping figcaption { opacity: 0; }

.hero__hint {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 64px;
  font: 11px/1.4 var(--mono);
  letter-spacing: .12em;
  color: var(--ink-3);
  width: fit-content;
  transition: color var(--d1) var(--ease);
}
.hero__hint:hover { color: var(--ink-2); }
.hero__hint svg { width: 15px; height: 15px; transition: transform var(--d2) var(--ease); }
.hero__hint:hover svg { transform: translateY(2px); }

/* ---------- essay ---------- */
.essay {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 140px 28px;
  /* 分节线画在顶上，配合滚动自己从左边拉出来。 */
  background-image: linear-gradient(var(--line), var(--line));
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 100% 1px;
}
.essay h2 {
  margin-top: 18px;
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.24;
  font-weight: 600;
  letter-spacing: -.022em;
}
.prose { margin-top: 40px; max-width: 600px; }
.prose p {
  font-size: 17px;
  line-height: 1.92;
  color: var(--ink-2);
}
.prose p + p { margin-top: 26px; }
.prose p:first-child { color: var(--ink); }

.essay--end { padding-bottom: 180px; }
.endmark {
  margin-top: 64px;
  font: 12px/1.6 var(--mono);
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* ---------- quote band ---------- */
.band {
  background: var(--ink);
  color: var(--bg);
  padding: 180px 28px;
}
[data-theme="dark"] .band { background: var(--surface-2); color: var(--ink); }
.band figure { max-width: 860px; margin: 0 auto; }
.band blockquote p {
  font-size: clamp(26px, 3.6vw, 44px);
  line-height: 1.42;
  font-weight: 500;
  letter-spacing: -.015em;
}
.band figcaption {
  margin-top: 32px;
  font: 11px/1.4 var(--mono);
  letter-spacing: .1em;
  color: color-mix(in srgb, currentColor 58%, transparent);
}

/* ---------- download gate ---------- */
.gate {
  width: min(440px, calc(100vw - 40px));
  padding: 26px 28px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px color-mix(in srgb, #000 30%, transparent);
}
.gate::backdrop {
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(2px);
}
.gate[open] { animation: gate-in 240ms var(--ease-out); }
@keyframes gate-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
}
.gate__title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.gate__body { margin-top: 12px; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.gate__actions {
  margin-top: 24px;
  display: flex; justify-content: flex-end; gap: 10px;
}
.gate__btn {
  height: 34px; padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color var(--d1) var(--ease), color var(--d1) var(--ease), opacity var(--d1) var(--ease);
}
.gate__btn:hover { border-color: var(--ink-2); color: var(--ink); }
.gate__btn--go {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}
.gate__btn--go:hover { color: var(--bg); opacity: .86; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); margin-top: 120px; }
.foot__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 28px 56px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.foot__meta {
  font: 11px/1.8 var(--mono);
  letter-spacing: .06em;
  color: var(--ink-3);
  text-align: right;
}

/* ---------- motion ---------- */
/* 进场和退场都挂在滚动位置上（view timeline）：滑到哪就演到哪，往回滑会原路退回，
   所以每次滑回来都能再来一次，也不会留下「停在屏幕中间却是透明」的死区。
   标题按行从遮罩里推上来，小标签从左揭开，段落淡入上浮，分节线跟着一起画出来。
   不支持这些特性的浏览器不加动画，正文照常可见。 */
@keyframes rv {
  0%   { opacity: 0; transform: translateY(22px); filter: blur(5px); }
  14%  { opacity: 1; transform: none; filter: none; }
  84%  { opacity: 1; transform: none; filter: none; }
  100% { opacity: 0; transform: translateY(-30px); filter: blur(3px); }
}
@keyframes wipe {
  0%   { clip-path: inset(0 100% 0 0); opacity: .3; }
  100% { clip-path: inset(0); opacity: 1; }
}
@keyframes line-up {
  0%   { transform: translateY(118%); }
  100% { transform: none; }
}
@keyframes rule {
  0%   { background-size: 0% 1px; }
  100% { background-size: 100% 1px; }
}
@keyframes edge-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes fade-up {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: none; }
}

/* 行遮罩：overflow: clip 不建滚动容器，行里的 view() 时间线仍然对着页面算。 */
.ln { display: block; overflow: clip; overflow-clip-margin: .12em; }
.ln__i { display: block; }

/* 首屏标题入场：一行一行推上来，其余元素随后淡入，进来就是开场。 */
@media (prefers-reduced-motion: no-preference) {
  .hero .ln__i {
    animation: line-up 820ms var(--ease-out) both;
    animation-delay: calc(40ms + var(--i, 0) * 90ms);
  }
  .hero__mark,
  .lede,
  .hero__quote,
  .hero__hint {
    animation: fade-up 760ms var(--ease-out) both;
  }
  .hero__mark { animation-delay: 40ms; }
  .lede { animation-delay: 330ms; }
  .hero__quote { animation-delay: 450ms; }
  .hero__hint { animation-delay: 560ms; }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* 段落和落款：淡入上浮。已经拆成行的标题、引言交给行遮罩。 */
    .reveal :is(p, blockquote, figcaption):not(.kicker):not(:has(.ln)),
    .reveal h2:not(:has(.ln)) {
      animation: rv linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }
    /* 小节标签：从左往右揭开。 */
    .reveal .kicker {
      animation: wipe linear both;
      animation-timeline: view();
      animation-range: cover 6% cover 34%;
    }
    /* 标题行：一行一行从自己的遮罩里推上来。 */
    .reveal .ln__i {
      animation: line-up linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 24%;
    }
    /* 分节线：滚到这一节，从左往右拉开。 */
    .essay {
      animation: rule linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
  }
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    /* 导航底下的那层化开只跟着页面滚动出现，回到顶部就收掉。 */
    .nav::after {
      animation: edge-in linear both;
      animation-timeline: scroll();
      animation-range: 0 120px;
    }
  }
}

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

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero { padding: 72px 22px 56px; min-height: auto; }
  .hero__mark img { width: 44px; height: 44px; border-radius: 11px; }
  .moon { width: 340px; height: 340px; right: -220px; margin-top: -110px; }
  .hero__hint { margin-top: 48px; }
  .essay { padding: 88px 22px; }
  .essay h2 br { display: none; }
  .band { padding: 110px 22px; }
  .band blockquote p br { display: none; }
  .foot { margin-top: 88px; }
  .foot__inner { padding: 36px 22px 44px; }
}

@media (max-width: 420px) {
  .nav__inner { padding: 0 18px; }
}
