/* Swayli — public site
 *
 * 颜色和字号阶梯取自 lib/core/tokens.dart，深蓝 #05063E 取自 App 图标的底色，
 * 所以站点和 App 看着是同一个产品，而不是事后另找人做的落地页。
 *
 * 两条自我约束：
 *   1) 没有 JavaScript。所有动效都是 CSS——hover、载入位移、以及在支持的浏览器
 *      上用 scroll()/view() 时间线做的滚动驱动动画。不支持的浏览器直接看到
 *      静止的最终状态，不是空白。
 *   2) 正文链接不用品牌粉 #FF4F6D：它在白底上只有 3:1，达不到 AA。粉色只用于
 *      装饰、渐变和大字；正文链接用 --link (#D92D50, 4.7:1)，勾选标记用
 *      --teal-ink (#0E7F7B, 4.8:1)。
 */

:root {
  --primary: #FF4F6D;
  --secondary: #16A6A1;
  --navy: #05063E;

  --link: #D92D50;
  --teal-ink: #0E7F7B;

  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text: #182230;
  --muted: #667085;
  --border: #DDE2E8;

  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 760px;

  --shadow-card: 0 4px 12px rgba(24, 34, 48, .06);
  --shadow-lift: 0 14px 30px rgba(24, 34, 48, .13);
  --ease: cubic-bezier(.22, .61, .36, 1);

  --tint-primary: rgba(255, 79, 109, .10);
  --tint-secondary: rgba(22, 166, 161, .10);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 固定在视口上的两团品牌色光晕，内容滚动时从上面滑过。用 fixed 而不是跟着
   文档滚，是为了让长文档（隐私政策那种）滚到后面不至于变成一片死白。 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 46% at 10% -6%, var(--tint-primary), transparent 70%),
    radial-gradient(52% 42% at 94% 6%, var(--tint-secondary), transparent 70%);
}

a { color: var(--link); }

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: rgba(255, 79, 109, .20); }

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 16px 72px;
}

/* --------------------------------------------------------------- header */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px max(16px, calc(50vw - var(--maxw) / 2));
  border-bottom: 1px solid transparent;
  background: rgba(247, 248, 250, .72);
  backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
}

/* 滚动驱动：往下滚 80px 的过程中，导航条从透明玻璃渐变成带边框的实心条。
   纯 CSS，没有滚动监听。不支持 scroll() 的浏览器保持上面那个静态玻璃态。 */
@supports (animation-timeline: scroll()) {
  .bar {
    animation: barSolid linear both;
    animation-timeline: scroll(root);
    animation-range: 0 80px;
  }
}

@keyframes barSolid {
  to {
    background: rgba(247, 248, 250, .92);
    border-bottom-color: var(--border);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
}

.mark {
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(5, 6, 62, .22);
  transition: transform .35s var(--ease);
}

.brand:hover .mark { transform: rotate(-6deg) scale(1.06); }

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #FF7A54);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}

.bar nav a {
  margin-inline-start: 18px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color .2s var(--ease);
}

.bar nav a:hover { color: var(--text); }

/* ---------------------------------------------------------------- text */

h1 {
  font-size: clamp(28px, 5.2vw, 38px);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}

h2 { font-size: 20px; letter-spacing: -.01em; margin: 34px 0 8px; }
h3 { font-size: 16px; margin: 0 0 6px; }

p { margin: 0 0 12px; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--link);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.lede { font-size: 18px; color: var(--muted); text-wrap: pretty; }
.meta, .muted, .note { color: var(--muted); font-size: 14px; }
.notice {
  border-inline-start: 3px solid var(--secondary);
  padding: 6px 12px;
  background: rgba(255, 255, 255, .04);
  font-size: 14px;
}
.langs { font-size: 14px; color: var(--muted); }
[dir="rtl"] .doclist a::after { content: "←"; }
.hero { margin-bottom: 34px; }

/* 品牌头图：只有首页用。法务页保持素面——在隐私政策上盖一层发光渐变，
   观感就成了营销页，而不是可以拿去当依据的文件。 */
.hero-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 38px 30px 32px;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(88% 120% at 6% 0%, rgba(255, 79, 109, .42), transparent 58%),
    radial-gradient(78% 108% at 100% 100%, rgba(22, 166, 161, .38), transparent 60%),
    var(--navy);
  box-shadow: 0 20px 44px rgba(5, 6, 62, .30);
}

/* 极淡的一道旋转光，让深色块不至于是一张死图。透明度 7%，慢到几乎察觉不到。 */
.hero-brand::after {
  content: "";
  position: absolute;
  inset: -45% -15%;
  z-index: -1;
  background: conic-gradient(from 0deg, transparent 0%,
    rgba(255, 255, 255, .07) 18%, transparent 38%);
  animation: sheen 22s linear infinite;
}

.hero-brand .eyebrow { color: #FF9DAE; }
.hero-brand .lede { color: #C8CBE8; }

.hero-mark {
  display: block;
  margin: 0 0 18px;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .38);
  animation: float 7s ease-in-out infinite;
}

.grad {
  background: linear-gradient(100deg, #FF9DAE, #5BE7E1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.facts li {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .20);
  background: rgba(255, 255, 255, .10);
  color: #E6E8F5;
  font-size: 13px;
}

/* --------------------------------------------------------------- blocks */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.card, .panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* 顶边那道品牌色平时收起来，hover 时从左边展开。 */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .40s var(--ease);
}

.card {
  transition: transform .30s var(--ease), box-shadow .30s var(--ease),
    border-color .30s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 79, 109, .34);
  box-shadow: var(--shadow-lift);
}

.card:hover::before { transform: scaleX(1); }

.card p:last-child, .panel p:last-child { margin-bottom: 0; }

.panel { margin-top: 34px; }
.panel h2 { margin-top: 0; }

.checks { list-style: none; margin: 0 0 12px; padding: 0; }

.checks li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 10px;
}

/* 勾用两条边框拼出来再转 45 度，省掉一个图标文件。 */
.checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(22, 166, 161, .14);
}

.checks li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--teal-ink);
  border-bottom: 2px solid var(--teal-ink);
  transform: rotate(-45deg);
}

/* ----------------------------------------------------------------- demo */

/* 竖屏录屏（448×970）。主约束是高度而不是宽度：按宽度铺满 760px 的正文栏，
   这段手机录屏会有 1.6 米高，谁也不会滚到底。

   两个都用 max-*、宽高都留 auto，是为了让浏览器自己按固有比例缩放：先受
   max-height 限制，屏幕窄到那个宽度都放不下时再受 max-width 限制。写死
   `height` 再配 `max-width: 100%` 的话，窄屏上两条约束会同时生效，画面被压扁。 */
.demo {
  margin: 18px 0 14px;
  text-align: center;
}

.demo video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(78vh, 680px);
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
  box-shadow: var(--shadow-lift);
}

.demo figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

/* 章节表：时间码定宽等宽字体，右对齐 —— 一列数字左右不齐是最难扫的。 */
.chapters {
  list-style: none;
  margin: 16px 0 12px;
  padding: 0;
}

.chapters li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.chapters li:last-child { border-bottom: 0; }

.chapters .at {
  flex: none;
  width: 44px;
  text-align: right;
  color: var(--link);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.doclist { list-style: none; margin: 0; padding: 0; }

.doclist li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease),
    border-color .28s var(--ease);
}

.doclist li:hover {
  transform: translateX(4px);
  border-color: rgba(255, 79, 109, .34);
  box-shadow: var(--shadow-lift);
}

.doclist a {
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
}

.doclist a::after {
  content: "→";
  display: inline-block;
  margin-inline-start: 6px;
  transition: transform .28s var(--ease);
}

.doclist li:hover a::after { transform: translateX(4px); }

.doclist .meta { display: block; margin: 4px 0 8px; }
.doclist p { margin: 0; color: var(--muted); font-size: 14px; }

.contacts { border-collapse: collapse; width: 100%; }

.contacts td {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.contacts td:first-child { color: var(--muted); width: 45%; }

/* 邮箱做成可点的胶囊，比一串下划线蓝字清楚，手机上也更好按。 */
.contacts td:last-child a {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 79, 109, .22);
  background: rgba(255, 79, 109, .07);
  font-size: 14px;
  text-decoration: none;
  word-break: break-all;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.contacts td:last-child a:hover {
  background: rgba(255, 79, 109, .14);
  border-color: rgba(255, 79, 109, .42);
}

/* --------------------------------------------------------------- footer */

footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 16px 52px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

footer a:hover { color: var(--text); border-bottom-color: var(--border); }
footer .rule { color: var(--text); font-weight: 500; }

/* --------------------------------------------------------------- motion */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes float {
  50% { transform: translateY(-7px); }
}

@keyframes sheen {
  to { transform: rotate(1turn); }
}

.hero { animation: rise .6s var(--ease) both; }

.grid > *, .panel, .doclist li { animation: rise .55s var(--ease) both; }

.grid > *:nth-child(2) { animation-delay: .07s; }
.grid > *:nth-child(3) { animation-delay: .14s; }
.grid > *:nth-child(4) { animation-delay: .21s; }
.grid > *:nth-child(5) { animation-delay: .28s; }
.doclist li:nth-child(2) { animation-delay: .06s; }
.doclist li:nth-child(3) { animation-delay: .12s; }
.doclist li:nth-child(4) { animation-delay: .18s; }
.doclist li:nth-child(5) { animation-delay: .24s; }

/* 支持 view() 的浏览器上，同一个 rise 改成由滚动位置驱动：卡片进入视口时才
   浮上来，而不是在首屏一次性放完（长页面上后半截等于没有动效）。 */
@supports (animation-timeline: view()) {
  .grid > *, .panel, .doclist li {
    animation-timeline: view();
    animation-range: entry 4% cover 24%;
    animation-delay: 0s;
  }
}

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

/* ----------------------------------------------------------- dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070829;
    --surface: #101336;
    --text: #F2F4F7;
    --muted: #9AA3C4;
    --border: #252A4A;
    --link: #FF8FA3;
    --teal-ink: #5BE7E1;
    --shadow-card: 0 4px 14px rgba(0, 0, 0, .34);
    --shadow-lift: 0 16px 34px rgba(0, 0, 0, .46);
    --tint-primary: rgba(255, 79, 109, .14);
    --tint-secondary: rgba(22, 166, 161, .12);
  }

  .bar { background: rgba(7, 8, 41, .72); }
  .brand { color: var(--text); }
  .checks li::before { background: rgba(91, 231, 225, .14); }

  .contacts td:last-child a {
    border-color: rgba(255, 143, 163, .28);
    background: rgba(255, 143, 163, .10);
  }

  .contacts td:last-child a:hover { background: rgba(255, 143, 163, .18); }

  @keyframes barSolid {
    to {
      background: rgba(7, 8, 41, .92);
      border-bottom-color: var(--border);
    }
  }
}

/* -------------------------------------------------------------- print */

/* 法务文件是会被人打印或存 PDF 的，别把导航条和光晕一起印上去。 */
@media print {
  /* 播放器印出来只是一张封面帧加一条播放条，占掉整页；章节表反而是印下来
     有用的那一半，留着。 */
  .bar, footer a, .hero-mark, body::before, .demo video { display: none; }
  body { background: #fff; color: #000; }
  .hero-brand { background: #fff; color: #000; box-shadow: none; }
  .hero-brand .lede, .hero-brand .eyebrow { color: #000; }
  .grad { color: #000; -webkit-text-fill-color: #000; }
  .facts li { border-color: #ccc; color: #000; }
  .card, .panel, .doclist li { box-shadow: none; border-color: #ccc; }
  main { max-width: none; padding: 0; }
}
