/* ============================================================
   投递 POST —— 随机把你送到一个陌生人的站
   ------------------------------------------------------------
   这一页的隐喻是「一封信」：平台本来就是编号 + 署名，
   域名是地址，编号是邮戳。所以不画星空隧道，画一张纸。

   样式只做这一页的排版，颜色 / 字体 / 纸纹全部来自 app.css 的令牌：
   切主题、切字体预设（宋体 / 楷体 / 圆体）时，这一页跟着一起变。
   ============================================================ */

body.post {
  min-height: 100svh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

/* ---------- 上下边栏 ---------- */

.post-top,
.post-foot {
  position: relative;
  z-index: 2;
}

.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--faint);
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 2px;
  color: var(--muted);
  transition: color .22s;
}
.post-back:hover { color: var(--text); }
.post-back span { transition: transform .22s var(--ease); }
.post-back:hover span { transform: translateX(-3px); }

.post-brand {
  font-family: var(--brand-domain);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- 信纸 ---------- */

.post-sheet {
  position: relative;
  z-index: 2;
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 600px;
  /* 底部留出邮戳那一块：它在信尾偏右，长站名换行时不会顶上去。
     留 156px 而不是邮戳的 132px —— 邮戳旋转 -12°，角点会往上探出
     约 12px，132 正好会被它压到署名行。 */
  padding: 28px 0 156px;
}

/* 信头：一句「随手投一封」+ 一个日期，两端对齐。
   真信的开头都写日期，这一行是整页最便宜也最有效的「像一封信」。 */
.post-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.post-kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 11.5px;
  letter-spacing: .2em;
  color: var(--muted);
}

.post-date {
  font-family: var(--brand-domain);
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.post-kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
  opacity: .6;
}

/* 「致」：信的开头。用编号那套字体（品牌预设下是宋体），
   它比站名小得多，但正因为小，读起来才像手写的起笔。 */
.post-to {
  margin: 38px 0 0;
  font-family: var(--brand);
  font-size: 15px;
  letter-spacing: .3em;
  color: var(--faint);
}

.post-name {
  margin: 10px 0 0;
  font-family: var(--brand-cn);
  font-weight: 700;
  font-size: clamp(36px, 7.8vw, 68px);
  line-height: 1.2;
  letter-spacing: .03em;
  color: var(--text);
  word-break: break-word;
}
/* 逐字浮上来。延迟由 PHP 按字数等比算好，写进行内 --d：
   无论两个字还是十几个字，整段入场都在 0.65 秒里走完。 */
.post-name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  animation: post-rise .62s cubic-bezier(.2, .7, .3, 1) forwards;
  animation-delay: var(--d, .2s);
}
@keyframes post-rise {
  to { opacity: 1; transform: translateY(0); }
}

/* 站名底下一条短线：代替下划线，只在名字下面，不铺满整行 */
.post-name::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  margin-top: 24px;
  background: var(--accent);
  opacity: .6;
}

.post-host {
  margin: 20px 0 0;
  font-family: var(--brand-domain);
  font-size: 16px;
  letter-spacing: .05em;
  color: var(--accent-2);
}

.post-say {
  margin: 16px 0 0;
  max-width: 460px;
  font-size: 14px;
  line-height: 1.95;
  color: var(--text-2);
}

.post-sign {
  margin: 26px 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--faint);
}
.post-code {
  font-family: var(--brand);
  letter-spacing: .05em;
  color: var(--muted);
}
.post-dot { color: var(--line-2); }

/* ---------- 信封背面的小字（1.20.0） ----------
   上一版这一页从「一句话」直接跳到页脚，中间是空的：
   一张信纸摊开了，可信里只写了一个名字。
   现在补三组数字 + 标签 + 一行「这封是怎么挑的」，
   填满中间那段，而且填的都是这一页真知道、读者真会看的事。

   三格之间用竖细线分隔而不是小卡片：信纸上不应该出现三张卡片。 */
.post-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 30px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line-faint);
}

.post-facts > div {
  padding: 0 14px;
  border-left: 1px solid var(--line-faint);
  min-width: 0;
}
.post-facts > div:first-child { border-left: 0; padding-left: 0; }

.post-facts dt {
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--faint);
}

.post-facts dd {
  margin: 5px 0 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-2);
}

.post-facts dd b {
  font-family: var(--brand);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: .02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.post-facts dd span {
  font-size: 11px;
  color: var(--faint);
}

.post-tags {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--muted);
}

.post-tag--ok {
  border-color: var(--accent-line);
  color: var(--accent-2);
  background: var(--accent-bg);
}

/* 署名行现在只放编号，标签上移到 .post-tags —— 同一件事不印两遍 */
.post-sign { margin-top: 18px; }

/* 「这封是怎么挑的」：一行小字，比信封上任何一句都低调，
   但它决定了用户信不信「随机」这两个字。 */
.post-why {
  margin: 12px 0 0;
  max-width: 480px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--faint);
}

/* ---------- 邮戳 ---------- */

/* 放在信尾右侧，略微出血到纸外 —— 真的盖章不会盖得端端正正。
   旋转 -12° 是「手按下去的角度」，正着盖反而假。

   mix-blend-mode 是让它「长在纸上」的关键：
   日间用 multiply，珊瑚色压进纸纹里，像油墨渗进去；
   夜间用 screen，否则 multiply 在深底上会整块消失。 */
.post-seal {
  --so: .58;
  position: absolute;
  right: 4px;
  bottom: -18px;
  width: 132px;
  height: 132px;
  color: var(--accent);
  opacity: 0;
  transform: rotate(-12deg);
  transform-origin: 50% 50%;
  pointer-events: none;
  mix-blend-mode: multiply;
  animation: post-stamp .52s cubic-bezier(.3, .9, .4, 1) .8s both;
}
html[data-theme="dark"] .post-seal,
html[data-theme="contrast"] .post-seal {
  --so: .46;
  mix-blend-mode: screen;
}
.post-seal svg { display: block; width: 100%; height: 100%; }

/* 盖下来：从略大、略歪的一瞬间压平。60% 处稍微压过一点点（.97），
   就有「按实了」的弹性，而不是匀速缩放。 */
@keyframes post-stamp {
  0%   { opacity: 0; transform: rotate(-26deg) scale(1.5); }
  60%  { opacity: calc(var(--so) * 1.1); transform: rotate(-11deg) scale(.97); }
  100% { opacity: var(--so); transform: rotate(-12deg) scale(1); }
}

.seal-arc {
  font-family: var(--brand-domain);
  font-size: 10.5px;
  letter-spacing: .14em;
  fill: currentColor;
}
.seal-big {
  font-family: var(--brand);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: .03em;
  fill: currentColor;
}
.seal-small {
  font-family: var(--brand-domain);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: .26em;
  fill: currentColor;
}

/* ---------- 页脚 ---------- */

.post-foot {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 一条细线从 0 长到满：这就是「投递进度」。
   不用圆角进度条 —— 它在深色底上像加载动画，这里要像一条墨线。 */
.post-track {
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--line-2);
  overflow: hidden;
}
.post-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  animation: post-fill var(--ms, 2200ms) cubic-bezier(.45, .05, .55, .95) .4s forwards;
}
@keyframes post-fill { to { transform: scaleX(1); } }

.post-go {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.post-go a {
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 2px;
  transition: color .22s, border-color .22s;
}
.post-go a:hover { color: var(--accent-2); border-color: var(--accent-line); }

.post-note {
  width: 100%;
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  color: var(--faint);
}
.post-acts { display: flex; gap: 16px; }
.post-acts a { transition: color .22s; white-space: nowrap; }
.post-acts a:hover { color: var(--text); }

/* 探活失败：贴在底部，不打断主流程，也不假装一切正常 */
.post-warn {
  position: fixed;
  left: 50%;
  bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  padding: 6px 13px;
  font-size: 11.5px;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  border-color: color-mix(in srgb, var(--amber) 24%, transparent);
  border-radius: 999px;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 560px) {
  body.post { padding-left: max(20px, env(safe-area-inset-left));
              padding-right: max(20px, env(safe-area-inset-right));
              /* 信封里多了三组数字之后，小屏上偶尔会超出 844 的高度。
                 只在这一个断点放开纵向滚动：真的放不下时能滚到页脚，
                 而不是把「换一封 / 不投了」裁在屏幕外面。 */
              overflow-y: auto; }
  .post-brand { display: none; }
  /* 邮戳的 156px 留白在窄屏要按它自己的尺寸算：100px 的戳 + 18px 出血，
     留 46px 会让戳直接压到「这封是怎么挑的」那一行上（1.20.0 真压过）。 */
  .post-sheet { padding-bottom: 124px; }
  .post-to { margin-top: 32px; }
  .post-name { font-size: clamp(32px, 9.6vw, 46px); }
  .post-name::after { margin-top: 16px; width: 30px; }
  /* 窄屏上正文几乎占满整行，邮戳再摆中间就会压到「一句话」上。
     往下顺到署名之后，横向也和正文分开。 */
  .post-seal { width: 100px; height: 100px; right: 2px; bottom: 6px; }
  .post-say { font-size: 13.5px; }
  .post-facts { margin-top: 22px; padding-top: 13px; }
  .post-facts dd b { font-size: 19px; }
  .post-note { font-size: 11px; gap: 10px; }
  .post-acts { gap: 12px; }
}

/* 矮窗口：笔记本上常见 640~700 的内容高度，
   按 600 的间距排会贴着页脚，这里整体收一档。 */
@media (max-height: 700px) and (min-width: 561px) {
  .post-sheet { padding: 16px 0 44px; }
  .post-to { margin-top: 26px; }
  .post-name { font-size: clamp(34px, 6.4vw, 58px); }
  .post-name::after { margin-top: 16px; }
  .post-host { margin-top: 16px; }
  .post-say { margin-top: 12px; }
  .post-sign { margin-top: 20px; }
  .post-seal { width: 118px; height: 118px; }
  .post-note { margin-top: 18px; }
}

/* 横屏手机：高度不够，把信纸的上下留白收掉 */
@media (max-height: 560px) {
  .post-to { margin-top: 18px; }
  .post-name { font-size: clamp(26px, 5.2vw, 38px); }
  .post-name::after { margin-top: 12px; }
  .post-say { display: none; }
  .post-seal { width: 86px; height: 86px; }
  .post-note { margin-top: 14px; }
}

/* ---------- 关掉动效 ----------
   不是变慢，是整块不做：文字直接显形、邮戳已经在纸上、进度条直接满。
   JS 那边同时把等待缩到 1 秒 —— 会晕的人不该被罚站两秒半。 */
@media (prefers-reduced-motion: reduce) {
  .post-name span { opacity: 1; transform: none; animation: none; }
  .post-seal {
    opacity: var(--so);
    transform: rotate(-12deg);
    animation: none;
  }
  .post-fill { animation: none; transform: scaleX(1); }
  .post-back span { transition: none; }
}

/* ---------- 筛选态 ----------
   让人知道这一封是在什么范围里抽的。
   不说的话，点了「只看没看过的」却拿到看过的站，会以为是随机坏了。 */
.post-filter {
  /* 在信纸里，跟着信头走 —— 不做成页面顶部的一行浮标，
     那样它和信脱节，看起来像另一个组件。 */
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 0;
}
.post-filter-tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--accent-2);
  background: var(--accent-bg);
  border: 1px solid var(--accent-line);
}
.post-filter-note {
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- 换一种逛法 ----------
   同一页里给三个出口，省得「不投了」之后还要回展示馆再找入口。 */
.post-alt {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11.5px;
  color: var(--faint);
}
.post-alt a { transition: color .22s; }
.post-alt a:hover { color: var(--text); }
.post-alt span { color: var(--line-2); }

/* ---------- 矮窗口：装不下就整体收一档 ----------
   1.20.0 信封里多了三组数字、标签和一行来路说明，按原来的间距排，
   在 640 / 700 高的窗口上会把「不等了」顶到屏幕外面去——
   而那是这一页唯一的动作。
   这里只压间距和字号，不删内容：删掉一行小字，比缩小它更糟。 */
@media (max-height: 740px) {
  .post-sheet { padding: 8px 0 92px; }
  .post-to { margin-top: 18px; font-size: 13px; }
  .post-name { font-size: clamp(26px, 6vw, 40px); }
  .post-name::after { margin-top: 12px; width: 26px; }
  .post-host { margin-top: 12px; font-size: 14px; }
  .post-say { margin-top: 8px; font-size: 12.5px; line-height: 1.7; }
  .post-facts { margin-top: 14px; padding-top: 10px; }
  .post-facts dd b { font-size: 17px; }
  .post-facts dd span { font-size: 10px; }
  .post-tags { margin-top: 10px; }
  .post-sign { margin-top: 10px; font-size: 11.5px; }
  .post-why { margin-top: 7px; font-size: 10.5px; line-height: 1.65; }
  .post-seal { width: 76px; height: 76px; bottom: 4px; }
  .seal-big { font-size: 26px; }
  .seal-small { font-size: 14px; }
  .post-foot { padding-top: 6px; }
  .post-note { margin-top: 12px; }
  .post-alt { margin-top: 6px; font-size: 11px; }
}
