/* =========================================================
   "你的中文名书法"页面（name.html）
   只用 style.css :root 里的颜色 / 字体变量
   ========================================================= */

.nm-sec { padding-bottom: clamp(72px, 9vw, 128px); }
.nm-two { align-items: start; }

/* ---------- 01 输入 ---------- */
.nm-input { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 24px 32px; align-items: end; }
.nm-opt { text-transform: none; letter-spacing: 0; }
.nm-try { margin: 22px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 14px; color: var(--mute); }
.nm-try button.link { background: none; border: 0; border-bottom: 1px solid currentColor; padding: 6px 0 2px; font: 500 14px/1.4 var(--sans); color: var(--ink); cursor: pointer; }
#nm-error { margin-top: 12px; }

/* ---------- 02 建议 ---------- */
.nm-aside { display: grid; gap: 20px; align-content: start; }
.nm-for { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.35; }
.nm-notice {
  margin: 0; font-size: 13px; line-height: 1.65; color: var(--ink-2);
  border-left: 2px solid var(--seal); padding: 2px 0 2px 14px; max-width: 46ch;
}
.nm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.nm-list .nm-card:first-child { grid-column: 1 / -1; }
.nm-card {
  position: relative; display: grid; gap: 6px; align-content: start; text-align: left;
  padding: 24px 26px 22px; background: transparent; color: var(--ink); font: inherit;
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .25s, background .25s;
}
.nm-card:hover { border-color: var(--ink-2); }
.nm-card[aria-checked="true"] { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--ink); }
.nm-tag { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.nm-hanzi { font-size: clamp(36px, 4.4vw, 56px); line-height: 1.2; letter-spacing: .1em; font-weight: 400; margin-top: 6px; overflow-wrap: anywhere; }
.nm-pinyin { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ink-2); }
.nm-chars { list-style: none; margin: 10px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13px; }
.nm-chars li { display: grid; grid-template-columns: 1.6em 4.6em minmax(0, 1fr); gap: 8px; align-items: baseline; }
.nm-chars .cn { font-size: 16px; color: var(--ink); }
.nm-py { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--mute); }
.nm-mean { color: var(--ink-2); }
.nm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; }
.nm-pick { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); display: flex; align-items: center; gap: 8px; }
.nm-card[aria-checked="true"] .nm-pick { color: var(--seal); }
.nm-card[aria-checked="true"] .nm-pick::before { content: ""; width: 7px; height: 7px; background: var(--seal); }
.nm-next { margin: 24px 0 0; }

/* ---------- 03 预览 ---------- */
.nm-band { background: var(--paper-2); padding: clamp(72px, 9vw, 128px) 0; }
.nm-band .sec-head { border-top-color: var(--line); }
.nm-preview { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.nm-stage { display: grid; place-items: center; min-height: 420px; padding: clamp(8px, 2vw, 24px) 0; }
.nm-mount { position: relative; display: grid; place-items: center; width: 100%; transition: padding .3s; }
.nm-stage[data-layout="v"] .nm-mount { width: min(100%, 360px); }

/* 宣纸 */
.nm-paper {
  position: relative; margin: 0; width: 100%; overflow: hidden;
  container-type: size;
  background-color: var(--paper);
  /* 纸纹：几层很淡的墨色斑点，模拟宣纸纤维 */
  background-image:
    radial-gradient(ellipse at 18% 22%, rgba(27, 26, 23, .035), transparent 40%),
    radial-gradient(ellipse at 82% 68%, rgba(27, 26, 23, .03), transparent 45%),
    repeating-linear-gradient(97deg, rgba(27, 26, 23, .012) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(8deg, rgba(27, 26, 23, .01) 0 1px, transparent 1px 11px);
  box-shadow: 0 1px 2px rgba(27, 26, 23, .08), 0 14px 40px rgba(27, 26, 23, .1);
}
.nm-stage[data-layout="v"] .nm-paper { aspect-ratio: 1 / 2; }
.nm-stage[data-layout="h"] .nm-paper { aspect-ratio: 2 / 1; }

.nm-ink {
  position: absolute; display: flex; align-items: center; justify-content: center;
  color: var(--ink); line-height: 1; white-space: nowrap;
  transition: opacity .35s;
}
.nm-ink .dot { font-family: var(--serif-cn); font-size: .5em; opacity: .8; }
.nm-stage[data-layout="v"] .nm-ink {
  writing-mode: vertical-rl; inset: 9% 0 9% 18%;
  font-size: min(calc(78cqh / var(--n, 3)), 50cqw);
  letter-spacing: .04em;
}
.nm-stage[data-layout="h"] .nm-ink {
  inset: 0 18% 0 6%;
  font-size: min(calc(70cqw / var(--n, 3)), 52cqh);
  letter-spacing: .04em;
}
.nm-stage.loading .nm-ink, .nm-stage.loading .nm-insc { opacity: .3; }

/* 落款 + 印章 */
.nm-colophon { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2.4cqh; }
.nm-stage[data-layout="v"] .nm-colophon { left: 9%; bottom: 10%; }
.nm-stage[data-layout="h"] .nm-colophon { right: 7%; bottom: 12%; gap: 4cqh; }
.nm-insc { writing-mode: vertical-rl; color: var(--ink-2); line-height: 1; letter-spacing: .12em; transition: opacity .35s; }
.nm-stage[data-layout="v"] .nm-insc { font-size: max(12px, 7cqw); }
.nm-stage[data-layout="h"] .nm-insc { font-size: max(12px, 7cqh); }
.nm-seal {
  display: grid; place-items: center; aspect-ratio: 1;
  background: var(--seal); color: var(--paper);
  font-family: var(--serif-cn); font-weight: 600; line-height: 1;
  border-radius: 2px; transform: rotate(-1.5deg);
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3px var(--paper); /* 白文印的内边框 */
}
.nm-stage[data-layout="v"] .nm-seal { width: max(26px, 11cqw); font-size: max(15px, 7cqw); }
.nm-stage[data-layout="h"] .nm-seal { width: max(26px, 11cqh); font-size: max(15px, 7cqh); }

/* 装裱示意：立轴（上下天杆地杆）/ 装框（木框 + 卡纸） */
.nm-stage[data-mount="scroll"] .nm-mount {
  background: color-mix(in srgb, var(--ink) 12%, var(--paper-2));
  box-shadow: 0 14px 40px rgba(27, 26, 23, .14);
}
.nm-stage[data-mount="scroll"][data-layout="v"] .nm-mount { padding: 22% 9% 30%; }
.nm-stage[data-mount="scroll"][data-layout="h"] .nm-mount { padding: 7% 12%; }
.nm-stage[data-mount="scroll"] .nm-paper { box-shadow: 0 0 0 1px rgba(27, 26, 23, .1); }
.nm-stage[data-mount="scroll"] .nm-mount::before,
.nm-stage[data-mount="scroll"] .nm-mount::after {
  content: ""; position: absolute; background: var(--ink); border-radius: 3px;
}
.nm-stage[data-mount="scroll"][data-layout="v"] .nm-mount::before { top: -4px; left: -3%; right: -3%; height: 8px; }
.nm-stage[data-mount="scroll"][data-layout="v"] .nm-mount::after { bottom: -7px; left: -7%; right: -7%; height: 14px; border-radius: 7px; }
.nm-stage[data-mount="scroll"][data-layout="h"] .nm-mount::before { left: -7px; top: -5%; bottom: -5%; width: 14px; border-radius: 7px; }
.nm-stage[data-mount="scroll"][data-layout="h"] .nm-mount::after { right: -7px; top: -5%; bottom: -5%; width: 14px; border-radius: 7px; }
.nm-stage[data-mount="frame"] .nm-mount {
  padding: 9%; background: var(--paper);
  border: 12px solid var(--ink);
  box-shadow: inset 0 0 0 1px var(--line), 0 14px 40px rgba(27, 26, 23, .18);
}
.nm-stage[data-mount="frame"] .nm-paper { box-shadow: 0 0 0 1px var(--line); }

/* 控件 */
.nm-controls { display: grid; gap: 32px; align-content: start; }
.nm-ctl { display: grid; gap: 14px; }
.nm-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nm-style {
  display: grid; gap: 6px; text-align: left; padding: 14px 16px 12px; min-height: 44px;
  background: var(--paper); color: var(--ink); font: inherit; cursor: pointer;
  border: 1px solid var(--line); transition: border-color .2s;
}
.nm-style:hover { border-color: var(--ink-2); }
.nm-style[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.nm-style-sample { font-size: 32px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.nm-style-name { font-size: 13px; font-weight: 500; }
.nm-style-sub { font-weight: 400; color: var(--mute); margin-left: 4px; }
.nm-seg { display: inline-flex; justify-self: start; border: 1px solid var(--ink); }
.nm-seg button {
  min-height: 44px; padding: 0 22px; background: transparent; color: var(--ink);
  border: 0; font: 500 14px/1 var(--sans); cursor: pointer;
}
.nm-seg button + button { border-left: 1px solid var(--ink); }
.nm-seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- 04 尺寸与装裱 ---------- */
.nm-options { display: grid; gap: 36px; }
.nm-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.nm-group legend { padding: 0; margin-bottom: 14px; }
.nm-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.nm-choice {
  display: grid; gap: 4px; align-content: start; padding: 18px 18px 16px; cursor: pointer;
  border: 1px solid var(--line); transition: border-color .2s, background .2s;
}
.nm-choice:hover { border-color: var(--ink-2); }
.nm-choice:has(input:checked) { border-color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--ink); }
.nm-choice:has(input:focus-visible) { outline: 2px solid var(--seal); outline-offset: 3px; }
.nm-choice-title { font-family: var(--serif); font-size: 22px; line-height: 1.2; }
.nm-choice-cm { display: block; font-family: var(--sans); font-size: 13px; color: var(--mute); margin-top: 2px; }
.nm-choice-note { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.nm-choice-price { font-size: 14px; font-weight: 500; margin-top: 8px; }
.nm-total { margin: 0; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 21px; color: var(--ink-2); }
.nm-total strong { font-weight: 500; color: var(--ink); }

/* ---------- 05 订单摘要（深色区块） ---------- */
.nm-summary { display: grid; grid-template-columns: 96px minmax(0, 1fr); margin: 8px 0 0; font-size: 14px; border-top: 1px solid rgba(237, 233, 224, .16); }
.nm-summary dt, .nm-summary dd { margin: 0; padding: 12px 0; border-bottom: 1px solid rgba(237, 233, 224, .16); }
.nm-summary dt { color: var(--on-ink-mute); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding-top: 14px; }
.nm-summary dd { color: var(--on-ink); }
.nm-sum-hanzi { font-size: 20px; margin-right: 6px; letter-spacing: .06em; }
.nm-summary .nm-sum-edit { grid-column: 1 / -1; border-bottom: 0; }

/* ---------- 底部：更大幅作品 ---------- */
.nm-more {
  display: flex; align-items: center; justify-content: space-between; gap: 24px 48px;
  padding-block: clamp(64px, 8vw, 112px);
}
.nm-more .lead { max-width: 30em; }
.nm-more .btn { flex: none; }

/* 中文 */
html[lang="zh-CN"] .nm-for em { font-style: normal; color: var(--seal); }
html[lang="zh-CN"] .nm-tag, html[lang="zh-CN"] .nm-pick { letter-spacing: .1em; }

/* ---------- 手机 ---------- */
@media (max-width: 1024px) {
  .nm-preview { grid-template-columns: 1fr; }
  .nm-styles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nm-input { grid-template-columns: 1fr; gap: 22px; }
  .nm-input .btn { width: 100%; }
  .nm-try button.link { min-height: 44px; padding: 0; border-bottom: 0; text-decoration: underline; text-underline-offset: 4px; }
  .nm-list { grid-template-columns: 1fr; gap: 12px; }
  .nm-card { padding: 20px 20px 18px; }
  .nm-for { font-size: 20px; }
  .nm-stage { min-height: 0; }
  .nm-stage[data-layout="v"] .nm-mount { width: min(100%, 270px); }
  .nm-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nm-style-sample { font-size: 28px; }
  .nm-seg { justify-self: stretch; }
  .nm-seg button { flex: 1; }
  .nm-choices { grid-template-columns: 1fr; gap: 10px; }
  .nm-choice { grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding: 14px 16px; }
  .nm-choice-title, .nm-choice-note { grid-column: 1; }
  .nm-choice-price { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin-top: 0; }
  .nm-total { font-size: 18px; }
  .nm-more { flex-direction: column; align-items: stretch; }
  .nm-more .btn { width: 100%; }
}

/* 装裱默认推荐画芯 */
.nm-reco {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 6px; border-radius: 10px;
  background: var(--seal); color: #F8F1E8; font: 600 10px/1 var(--sans); letter-spacing: .08em; vertical-align: middle;
}
html[lang="zh-CN"] .nm-reco { letter-spacing: .2em; }
