/* ============================================================
   碧溪土布 · 暖相传 —— 基础样式
   ============================================================ */
:root {
  --ink: #1d3f5e;
  --ink-2: #2c5576;
  --mid: #4f7291;
  --pale: #dfe9ef;
  --paper: #f7efe0;
  --accent: #c9784e;
  --accent-2: #e3a364;
  --white: #fffaf0;

  --ui-bg: #f6ecda;
  --ui-card: #fffaf0;
  --ui-line: rgba(120, 85, 55, .16);
  --ui-line-soft: rgba(120, 85, 55, .09);
  --ui-text: #2a3a48;
  --ui-muted: #7a6652;
  --ui-muted-2: #a08c76;

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Menlo", "Consolas", monospace;

  --radius: 18px;
  --shadow-sm: 0 2px 8px -4px rgba(80, 55, 35, .22);
  --shadow-md: 0 18px 40px -26px rgba(80, 55, 35, .55);
  --shadow-lg: 0 40px 80px -40px rgba(60, 40, 25, .55);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ui-text);
  background: var(--ui-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: rgba(30, 58, 95, .16); }

/* 纸张颗粒 */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  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='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  opacity: .055; mix-blend-mode: multiply;
}

/* ---------- 通用文字 ---------- */
.kicker {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--mid); display: flex; align-items: center; gap: 10px; font-weight: 500;
}
.kicker-line { display: inline-block; width: 26px; height: 1px; background: var(--mid); opacity: .6; }
.hl { position: relative; white-space: nowrap; }
.hl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .08em; height: .34em;
  background: rgba(191, 127, 82, .26); z-index: -1; border-radius: 2px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 500; line-height: 1;
  background: transparent; transition: transform .16s ease, background .16s ease, box-shadow .16s ease, border-color .16s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--white); box-shadow: 0 10px 24px -16px rgba(29, 63, 94, .9); }
.btn-primary:hover { background: #16314f; }
.btn-ghost { border-color: var(--ui-line); color: var(--ink); background: rgba(255, 250, 240, .55); }
.btn-ghost:hover { background: #fffaf0; border-color: rgba(120, 85, 55, .3); }
.btn-cream { background: var(--paper); color: var(--ink); }
.btn-cream:hover { background: #fffdf6; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.link {
  background: none; border: 0; padding: 0; font-size: 13px; color: var(--mid);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(71, 107, 143, .35);
}
.link:hover { color: var(--ink); }

/* ---------- 顶部品牌 ---------- */
.site-head {
  position: relative; z-index: 2;
  max-width: 1240px; margin: 0 auto; padding: 26px 32px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background-color: var(--ink);
  background-image:
    repeating-linear-gradient(90deg, rgba(253, 250, 243, .55) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(180deg, rgba(253, 250, 243, .32) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-family: var(--serif); font-size: 17px; letter-spacing: .12em; color: var(--ink); font-weight: 700; }
.brand-text i { font-style: normal; font-size: 10px; letter-spacing: .2em; color: var(--ui-muted); text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  border: 1px solid transparent; background: transparent; padding: 8px 12px;
  border-radius: 999px; font-size: 13px; color: var(--mid); transition: .16s;
}
.nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, .5); }

/* ---------- 海报通用 ---------- */
.poster {
  position: relative; overflow: hidden; transform-origin: top left;
  box-shadow: 0 0 0 1px rgba(30, 58, 95, .06);
  color: var(--ink);
}
.poster-fit { transform-origin: top left; }
.p-el { position: absolute; }
.p-text {
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  font-kerning: normal;
}
.p-art-wrap svg { pointer-events: none; }
.p-image img { pointer-events: none; }
.p-shape { pointer-events: none; }

/* ---------- 弹层 ---------- */
.bx-modal {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(48, 34, 22, .42);
  opacity: 0; transition: opacity .18s ease; backdrop-filter: blur(3px);
}
.bx-modal.open { opacity: 1; }
.bx-modal-card {
  position: relative; width: 100%; max-width: 540px; max-height: 88vh; overflow: auto;
  background: #fffaf0; border-radius: 22px; padding: 28px;
  box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.99);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
  -webkit-overflow-scrolling: touch;
}
.bx-modal.open .bx-modal-card { transform: none; }
.bx-modal-card.wide { max-width: 760px; }
.bx-modal-x {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ui-muted); font-size: 22px; line-height: 1;
}
.bx-modal-x:hover { background: rgba(120, 85, 55, .08); color: var(--ink); }
.bx-modal-head { padding-right: 28px; margin-bottom: 16px; }
.bx-modal-head h3 { font-family: var(--serif); font-size: 25px; letter-spacing: .05em; color: var(--ink); margin-top: 6px; }
.bx-kicker { font-size: 11px; letter-spacing: .2em; color: var(--accent); text-transform: uppercase; }
.bx-modal-sub { margin-top: 8px; font-size: 13px; line-height: 1.75; color: var(--ui-muted); }
.bx-modal-body { font-size: 14px; line-height: 1.75; color: var(--ui-text); }
.bx-modal-body p { margin: 0 0 10px; }
.bx-modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.bx-modal-foot .btn { padding: 11px 20px; }

/* ---------- Toast ---------- */
.bx-toast {
  position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 14px);
  background: rgba(58, 45, 33, .94); color: #fff8ea; font-size: 13px; letter-spacing: .02em;
  padding: 11px 18px; border-radius: 999px; z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 82vw; text-align: center;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, .6);
}
.bx-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .site-head { padding: 18px 18px 8px; }
  .site-nav .nav-link { padding: 8px; font-size: 12px; }
  .bx-modal { padding: 0; align-items: flex-end; }
  .bx-modal-card { max-width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; padding: 24px 20px calc(24px + var(--safe-b)); }
  .bx-modal-card.wide { max-width: 100%; }
  .bx-modal-head h3 { font-size: 21px; }
}

/* ---------- 二维码弹层 ---------- */
.qr-wrap { display: flex; flex-direction: column; gap: 18px; }
.qr-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.qr-tab {
  flex: 0 0 auto; text-align: left; border: 1px solid var(--ui-line); background: transparent;
  border-radius: 10px; padding: 8px 11px; line-height: 1.35; color: var(--ui-muted); transition: .15s;
}
.qr-tab b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.qr-tab span { font-size: 10px; color: var(--ui-muted-2); }
.qr-tab:hover { background: rgba(30, 58, 95, .04); }
.qr-tab.active { background: var(--ink); border-color: var(--ink); }
.qr-tab.active b { color: #fff; }
.qr-tab.active span { color: rgba(246, 241, 230, .6); }
.qr-main { display: flex; gap: 22px; align-items: center; }
.qr-box {
  width: 216px; height: 216px; flex: none; padding: 12px; background: #fff;
  border: 1px solid var(--ui-line); border-radius: 12px;
}
.qr-info { min-width: 0; flex: 1; }
.qr-label { font-family: var(--serif); font-size: 15px; color: var(--ink); margin-bottom: 8px; }
.qr-url {
  background: rgba(30, 58, 95, .05); border-radius: 8px; padding: 9px 10px;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--ui-muted);
  word-break: break-all; max-height: 74px; overflow: auto;
}
.qr-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.qr-btns .btn { padding: 8px 14px; font-size: 12px; }
.qr-warn {
  font-size: 11px; line-height: 1.65; color: #9a5c39; background: rgba(191, 127, 82, .12);
  padding: 8px 10px; border-radius: 8px; margin-top: 10px;
}
.qr-tip { font-size: 11px; line-height: 1.65; color: var(--ui-muted); margin-top: 10px; }

/* ---------- 使用说明 ---------- */
.help-steps { list-style: none; counter-reset: help; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.help-steps li { counter-increment: help; position: relative; padding-left: 40px; }
.help-steps li::before {
  content: counter(help, decimal-leading-zero); position: absolute; left: 0; top: 0;
  width: 27px; height: 27px; border-radius: 50%; border: 1px solid rgba(201, 120, 78, .45);
  color: var(--accent); font-family: var(--serif); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.help-steps b { display: block; font-size: 13px; color: var(--ink); margin-bottom: 2px; letter-spacing: .03em; }
.help-steps span { font-size: 12.5px; line-height: 1.75; color: var(--ui-muted); }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.help-col { border-top: 1px solid var(--ui-line); padding-top: 10px; }
.help-col h4 { font-size: 12px; letter-spacing: .07em; color: var(--ink); margin-bottom: 5px; }
.help-col p { font-size: 12px; line-height: 1.75; color: var(--ui-muted); }
.help-tip {
  margin-top: 16px; padding: 10px 12px; border-radius: 8px;
  background: rgba(30, 58, 95, .045); color: var(--ui-muted);
  font-size: 11.5px; line-height: 1.7;
}

@media (max-width: 640px) {
  .qr-main { flex-direction: column; align-items: stretch; gap: 16px; }
  .qr-box { width: 190px; height: 190px; margin: 0 auto; }
  .help-cols { grid-template-columns: 1fr; gap: 12px; }
}

/* 手机端页头（入口页 / 作品墙共用）：不换行、不挤压 */
@media (max-width: 640px) {
  .site-head { padding: 14px 16px 8px; gap: 8px; align-items: center; }
  .brand { gap: 8px; flex: none; }
  .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .brand-text b { font-size: 15px; letter-spacing: .08em; white-space: nowrap; }
  .brand-text i { display: none; }
  .site-nav { gap: 0; flex: none; }
  .site-nav .nav-link { padding: 7px 6px; font-size: 11.5px; white-space: nowrap; }
}
@media (max-width: 370px) {
  .site-nav .nav-link { padding: 7px 4px; font-size: 10.5px; }
  .brand-text b { font-size: 14px; }
}
