/* ===========================================================
   地球 online 收集手册 · 公共样式
   导航 / 按钮 / 卡片 / 照片 / 区块 / 页脚
   =========================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 页内跳转时，别让标题藏在吸顶栏底下 */
  scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

/* 纸张颗粒 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* —— 版心 —— */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

/* —— 顶栏 —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  /* 老浏览器不认 color-mix 时用这一行，别删 */
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--line);
  /* 刘海屏：底色铺到最顶上，内容往下让出安全区 */
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.topbar__in {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: var(--topbar-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: var(--fs-20);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding-block: 6px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--seal);
  color: #fff3e8;
  font-family: var(--font-hand);
  font-size: var(--fs-20);
  line-height: 1;
  transform: rotate(-3deg);
  box-shadow: var(--sh-1);
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav__a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-14);
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.nav__a:hover {
  background: var(--brand-wash);
  color: var(--brand-deep);
}

.nav__a.is-on {
  background: var(--ink);
  color: var(--paper);
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff8f0;
  font-size: var(--fs-16);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--sh-1);
  transition: background 0.18s var(--ease), transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.btn:hover {
  background: var(--brand-deep);
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn--ghost:hover {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

.btn--sm {
  min-height: 44px;
  padding: 0 16px;
  font-size: var(--fs-14);
}

/* —— 点着改字 ——
 *
 * 顶栏最右边那个小笔，按一下整页能改字的地方描一圈细虚线，点进去就能改，
 * 点到别处存。哪一句想放大一点，点进去时脚底下会冒出字号那一排（60%–220%）。
 *
 * 收起来的、连着别的动作的地方不标：链接、按钮、表单里的字、还在转的感叹号，
 * 点了会触发它们自己的动作，改字就点不进去。所以标不标由页面自己定，
 * 这里只管标上以后长什么样。
 */

.copybtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: var(--fs-14);
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.copybtn:hover {
  background: var(--brand-wash);
  color: var(--brand-deep);
}

.copybtn.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.copybtn__t {
  /* 宽屏露出「改字」两个字，窄屏只留那个笔 */
  font-size: var(--fs-12);
  letter-spacing: 0.04em;
}

/* 开着的时候：能改的地方描一圈细虚线。只要虚线，别满页都是框 */
body.is-copy [data-copy] {
  outline: 1px dashed var(--line-strong);
  outline-offset: 4px;
  border-radius: 3px;
  cursor: text;
  transition: background 0.15s var(--ease), outline-color 0.15s var(--ease);
}

body.is-copy [data-copy]:hover {
  background: var(--brand-wash);
  outline-color: var(--brand);
}

/* 正在写的那一处：白底、实线、外圈一圈淡色 */
body.is-copy [data-copy]:focus {
  background: var(--surface);
  outline: 2px solid var(--brand);
  box-shadow: 0 0 0 4px var(--brand-wash);
}

body.is-copy [data-copy]:empty::before {
  content: "（空着，点一下就能写）";
  color: var(--muted);
  font-size: var(--fs-12);
}

/* 改字时脚底下这一条说明。
 * 不用 left:50% + translateX 居中 —— 那样可用的宽度只剩半屏，句子会被提前折行。
 * 改成左右都贴 0、宽度按内容走、外边距自动居中，句子就能整行排开。 */
.yw-copybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--sp-4) + var(--safe-bottom));
  z-index: 40;
  width: fit-content;
  margin: 0 auto;
  max-width: calc(100% - 32px);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-12);
  line-height: 1.8;
  text-align: center;
  box-shadow: var(--sh-2);
  /* 说明是常驻的，点到字上别让它抢走焦点 */
  pointer-events: none;
}

.yw-copybar__say--short {
  display: none;
}

/* 点到某一句时冒出来的字号排 */
.yw-szbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp-4) + var(--safe-bottom) + 60px);
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 24px);
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-2);
  transform: translateX(-50%);
  white-space: nowrap;
}

.yw-szbar__lbl {
  flex: 0 0 auto;
  margin-right: 4px;
  font-size: var(--fs-12);
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--muted);
}

.yw-szbar__b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: var(--fs-14);
  line-height: 1;
  cursor: pointer;
}

.yw-szbar__b:hover:not(:disabled) {
  background: var(--brand-wash);
  color: var(--brand-deep);
}

.yw-szbar__b:disabled {
  opacity: 0.3;
  cursor: default;
}

.yw-szbar__val {
  min-width: 4.5ch;
  text-align: center;
  font-family: var(--font-num);
  font-size: var(--fs-12);
  color: var(--ink-2);
}

.yw-szbar__reset {
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  color: var(--muted);
}

/* 存没存上的回话：在脚底下闪一下就走 */
.yw-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp-4) + var(--safe-bottom) + 128px);
  z-index: 42;
  transform: translate(-50%, 6px);
  max-width: min(100% - 32px, 40ch);
  padding: 6px var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--brand-deep);
  color: #fff8f0;
  font-size: var(--fs-12);
  line-height: 1.7;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.yw-toast.is-say {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 拍照时那片快门、改字时那条说明，都在最底下，别叠一起 */
@media (max-width: 620px) {
  /* 窄屏这条只说最短的一句（不然得摞成三四行，挡住小半屏）；下面两条照样往上让 */
  .yw-copybar__say--long {
    display: none;
  }

  .yw-copybar__say--short {
    display: inline;
  }

  .yw-szbar {
    bottom: calc(var(--sp-3) + var(--safe-bottom) + var(--yw-bar, 44px));
  }

  .yw-toast {
    bottom: calc(var(--sp-3) + var(--safe-bottom) + var(--yw-bar, 44px) + 60px);
  }
}

@media (max-width: 520px) {
  .copybtn {
    padding: 0 8px;
  }

  .copybtn__t {
    /* 太窄了，只留笔 */
    display: none;
  }
}

/* —— 文字与链接 —— */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-12);
  letter-spacing: 0.16em;
  color: var(--muted);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--brand-deep);
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease), gap 0.18s var(--ease);
}

.link:hover {
  gap: 10px;
  border-bottom-color: currentColor;
}

/* —— 区块 —— */
.block {
  padding-block: calc(var(--sp-8) * var(--density));
}

.block__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.block__title {
  font-size: var(--fs-25);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.block__kicker {
  display: block;
  font-family: var(--font-hand);
  font-size: var(--fs-14);
  letter-spacing: 0.06em;
  color: var(--brand-deep);
  margin-bottom: 4px;
}

/* —— 卡片 —— */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.card--pad {
  padding: calc(var(--sp-5) * var(--density));
}

.card--link {
  display: block;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.card--link:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-2);
  border-color: var(--line-strong);
}

/* —— 照片（纯 CSS 虚焦胶片感） —— */
.photo {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: var(--paper-deep);
  isolation: isolate;
}

.photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tone);
  background-size: cover;
  background-position: center;
}

.photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(
      130% 110% at 50% 42%,
      rgba(0, 0, 0, 0) 42%,
      rgba(58, 36, 18, 0.3) 100%
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23g)' opacity='.5'/%3E%3C/svg%3E");
  opacity: 0.55;
  mix-blend-mode: multiply;
}

.photo--45 {
  aspect-ratio: 4 / 5;
}
.photo--11 {
  aspect-ratio: 1 / 1;
}

/* 色调 */
.photo[data-tone="dusk"] {
  --tone: radial-gradient(80% 65% at 16% 10%, #f2c690 0%, rgba(242, 198, 144, 0) 62%),
    radial-gradient(62% 55% at 88% 26%, #cf7b36 0%, rgba(207, 123, 54, 0) 58%),
    linear-gradient(168deg, #8fa0a6 0%, #b28c6e 46%, #dca86c 100%);
}

.photo[data-tone="sea"] {
  --tone: radial-gradient(90% 60% at 80% 12%, #dfe6e2 0%, rgba(223, 230, 226, 0) 60%),
    radial-gradient(70% 70% at 20% 88%, #4f6b74 0%, rgba(79, 107, 116, 0) 62%),
    linear-gradient(180deg, #a9bcc0 0%, #7d99a1 55%, #576f79 100%);
}

.photo[data-tone="green"] {
  --tone: radial-gradient(75% 60% at 22% 18%, #d8dda6 0%, rgba(216, 221, 166, 0) 60%),
    radial-gradient(60% 60% at 82% 80%, #5f7047 0%, rgba(95, 112, 71, 0) 62%),
    linear-gradient(160deg, #9fae7d 0%, #7b8b5f 52%, #5a6a44 100%);
}

.photo[data-tone="warm"] {
  --tone: radial-gradient(65% 55% at 26% 22%, #f6d6a6 0%, rgba(246, 214, 166, 0) 58%),
    radial-gradient(70% 60% at 84% 76%, #a8562c 0%, rgba(168, 86, 44, 0) 60%),
    linear-gradient(155deg, #d5a474 0%, #b87a49 48%, #7d4a2c 100%);
}

.photo[data-tone="cat"] {
  --tone: radial-gradient(60% 55% at 30% 24%, #efe2cf 0%, rgba(239, 226, 207, 0) 58%),
    radial-gradient(70% 65% at 82% 82%, #8b8272 0%, rgba(139, 130, 114, 0) 60%),
    linear-gradient(150deg, #cbbfaa 0%, #a39784 50%, #6f6659 100%);
}

.photo[data-tone="night"] {
  --tone: radial-gradient(60% 50% at 72% 14%, #e8c98e 0%, rgba(232, 201, 142, 0) 55%),
    radial-gradient(70% 65% at 20% 82%, #38455c 0%, rgba(56, 69, 92, 0) 62%),
    linear-gradient(165deg, #4b5566 0%, #333c4c 55%, #232a36 100%);
}

.photo[data-tone="cake"] {
  --tone: radial-gradient(60% 50% at 34% 18%, #fbe6cb 0%, rgba(251, 230, 203, 0) 58%),
    radial-gradient(65% 55% at 78% 74%, #c98f6a 0%, rgba(201, 143, 106, 0) 58%),
    linear-gradient(150deg, #e4c9a8 0%, #cfa982 52%, #a87d5c 100%);
}

.photo[data-tone="road"] {
  --tone: radial-gradient(65% 50% at 18% 16%, #e7dcc0 0%, rgba(231, 220, 192, 0) 58%),
    radial-gradient(65% 60% at 82% 78%, #6f7a58 0%, rgba(111, 122, 88, 0) 60%),
    linear-gradient(160deg, #bcc09a 0%, #9aa07a 50%, #6f7757 100%);
}

/* —— 宝丽来相框 —— */
.polaroid {
  position: relative;
  padding: 14px 14px 52px;
  background: #fffdf8;
  border-radius: 6px;
  box-shadow: var(--sh-2);
  transform: rotate(-1.6deg);
}

.polaroid .photo {
  border-radius: 2px;
}

.polaroid__cap {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: var(--fs-14);
  color: var(--muted);
}

/* —— 数字 —— */
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
}

/* —— 标签 —— */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-size: var(--fs-12);
  letter-spacing: 0.04em;
}

.tag--olive {
  background: var(--olive-wash);
  color: var(--olive);
}

.tag--line {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

/* —— 页脚 —— */
.sitefoot {
  position: relative;
  z-index: 1;
  margin-top: calc(var(--sp-8) * var(--density));
  padding-block: calc(var(--sp-7) * var(--density))
    calc(var(--sp-6) + var(--safe-bottom));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
}

.sitefoot__in {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.sitefoot__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--fs-20);
  margin-bottom: 10px;
}

.sitefoot__note {
  max-width: 30em;
  font-size: var(--fs-14);
  color: var(--muted);
}

.sitefoot__links {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.sitefoot__col h3 {
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.sitefoot__col a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: var(--fs-14);
  color: var(--ink-2);
}

.sitefoot__col a:hover {
  color: var(--brand-deep);
}

.sitefoot__fine {
  margin-top: var(--sp-6);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-12);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.sitefoot__fine a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
}

.sitefoot__fine a:hover {
  color: var(--brand-deep);
}

/* 页面主体置顶于纸纹之上 */
main,
.topbar,
.sitefoot {
  position: relative;
  z-index: 1;
}

/* —— 响应式 —— */
@media (max-width: 860px) {
  .topbar__in {
    gap: var(--sp-3);
  }

  .nav {
    margin-inline: 0;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav__a {
    padding: 0 11px;
  }


  .brand {
    font-size: var(--fs-16);
  }
}

/* 窄屏顶栏放不下「站名 + 五个导航 + 改字笔」：
   站名收成那颗印，五个导航才不用横向滑、不会被切掉半颗 */
@media (max-width: 620px) {
  .topbar__in {
    gap: var(--sp-2);
  }

  .brand {
    justify-content: center;
    gap: 0;
    min-width: 44px;
    min-height: 44px;
    font-size: 0;
  }
}

@media (max-width: 520px) {
  .nav__a {
    font-size: var(--fs-12);
    padding: 0 9px;
  }

  .block__title {
    font-size: var(--fs-20);
  }
}

/* 320 那种 4 英寸屏：顶栏再收一格，五个导航才全都露出来，
   不至于横向滑走「足迹」；当前那一颗补到 44 宽，才不会压成竖着的椭圆 */
@media (max-width: 380px) {
  .topbar__in {
    gap: 2px;
  }

  .brand {
    min-width: 40px;
  }

  .brand__mark {
    width: 28px;
    height: 28px;
    font-size: var(--fs-16);
  }

  .nav__a {
    padding: 0 6px;
  }

  .nav__a.is-on {
    padding: 0 12px;
  }

  .copybtn {
    padding: 0 6px;
  }
}

/* 4 英寸那种极窄屏（320px）：两边各让 6px 出来，
   不然一行 15 个汉字的标题会掉字 */
@media (max-width: 340px) {
  .shell {
    padding-inline: 14px;
  }
}

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