/* ============================================================
   Hanzi Studio — Design System
   现代简洁中国风 · 面向北美用户
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* 纸张与墨色 */
  --paper:        #FBFAF7;
  --paper-2:      #F5F2EB;
  --paper-3:      #EDE8DD;
  --surface:      #FFFFFF;
  --surface-2:    #FAF8F4;

  --ink:          #1B1A18;
  --ink-2:        #55514A;
  --ink-3:        #8C877E;
  --ink-inverse:  #FBFAF7;

  --line:         #E6E1D7;
  --line-2:       #D5CEC0;
  --line-3:       #C0B8A6;

  /* 朱砂 —— 主强调色 */
  --seal:         #B23A2C;
  --seal-600:     #98301F;
  --seal-700:     #7E2718;
  --seal-soft:    #F8EAE6;
  --seal-line:    #E7C6BE;

  /* 青绿 —— 次强调色 */
  --jade:         #3C6A5C;
  --jade-soft:    #E8F0EC;

  /* 金 —— 点缀 */
  --gold:         #A9873A;
  --gold-soft:    #F6EFDD;
  --plum:         #7A5470;
  --plum-soft:    #F3ECF1;

  /* 字格专用色 */
  --grid-line:    #D9B3A8;
  --grid-line-bw: #C9C3B6;
  --grid-ink:     #16150F;
  --trace-1:      #DCD6CA;  /* 描红·浅 */
  --trace-2:      #B9B2A4;  /* 描红·中 */
  --trace-3:      #8E8879;  /* 描红·深 */
  --outline:      #CFC9BB;

  /* 尺度 */
  --w-page: 1200px;
  --w-read: 720px;
  --radius: 4px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  /* 阴影 —— 克制 */
  --shadow-xs: 0 1px 2px rgba(27,26,24,.05);
  --shadow-sm: 0 1px 2px rgba(27,26,24,.05), 0 2px 6px rgba(27,26,24,.05);
  --shadow-md: 0 2px 6px rgba(27,26,24,.05), 0 10px 28px rgba(27,26,24,.08);
  --shadow-lg: 0 4px 10px rgba(27,26,24,.06), 0 24px 60px rgba(27,26,24,.12);

  /* 字体 */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino,
           "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --han-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong,
               "SimSun", "AR PL UMing CN", serif;
  --han-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
              "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;

  --header-h: 64px;
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

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

::selection { background: var(--seal-soft); color: var(--seal-700); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Layout ---------- */
.wrap { width: 100%; max-width: var(--w-page); margin: 0 auto; padding: 0 24px; }
.wrap--read { max-width: var(--w-read); }
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.stack > * + * { margin-top: var(--gap, 16px); }

.hairline { height: 1px; background: var(--line); border: 0; margin: 0; }

/* 装饰：印章方点 */
.seal-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--seal); border-radius: 1px;
  transform: translateY(-1px);
}

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251,250,247,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand__seal {
  width: 32px; height: 32px; border-radius: 3px;
  background: var(--seal); color: #fff;
  display: grid; place-items: center;
  font-family: var(--han-serif); font-size: 19px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  flex: 0 0 auto;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name {
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  letter-spacing: -0.015em;
}
.brand__tag {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 12px; border-radius: var(--radius);
  font-size: 14.5px; font-weight: 500; color: var(--ink-2);
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none; width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--line-2); align-items: center; justify-content: center;
}
.nav-toggle span { display: block; width: 16px; height: 1.5px; background: var(--ink); position: relative; }
.nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 1.5px; background: var(--ink);
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 8px; margin: 0; box-shadow: var(--shadow-md);
    display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a { padding: 12px 14px; font-size: 16px; }
  .header-actions .btn--store { display: none; }
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--ink-inverse); }
.btn--primary:hover { background: #33302B; }
.btn--seal { background: var(--seal); color: #fff; }
.btn--seal:hover { background: var(--seal-600); }
.btn--ghost { border-color: var(--line-2); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--line-3); background: var(--surface-2); }
.btn--quiet { color: var(--ink-2); }
.btn--quiet:hover { color: var(--ink); background: var(--paper-2); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn__icon { width: 16px; height: 16px; flex: 0 0 auto; }

.link-seal { color: var(--seal); font-weight: 600; border-bottom: 1px solid var(--seal-line); }
.link-seal:hover { border-bottom-color: var(--seal); }

/* ---------- 6. Typography helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--seal);
}
.h-display {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(34px, 5.2vw, 60px); line-height: 1.06; letter-spacing: -0.025em;
}
.h1 { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -0.02em; }
.h2 { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 30px); }
.h3 { font-size: 18px; }
.lede { font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.han { font-family: var(--han-serif); }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }

.section-head { max-width: 640px; }
.section-head .h2 { margin-top: 12px; }
.section-head p { margin-top: 12px; color: var(--ink-2); }

/* 章节小标题：左侧朱砂竖线 */
.rule-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-left: 14px; position: relative;
}
.rule-head::before {
  content: ""; position: absolute; left: 0; top: .18em; bottom: .18em;
  width: 2px; background: var(--seal); border-radius: 1px;
}

/* ---------- 7. Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card--pad { padding: 24px; }
.card--hover { transition: box-shadow .2s, border-color .2s, transform .2s; }
.card--hover:hover { box-shadow: var(--shadow-md); border-color: var(--line-2); }

.tool-card { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.tool-card__mark {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--han-serif); font-size: 22px; color: var(--ink);
}
.tool-card__title { font-family: var(--serif); font-size: 20px; }
.tool-card__desc { color: var(--ink-2); font-size: 14.5px; }
.tool-card__go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; color: var(--seal); }
.tool-card:hover .tool-card__go svg { transform: translateX(3px); }
.tool-card__go svg { transition: transform .18s; }

.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, 1fr); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- 8. Forms ---------- */
.field { display: block; }
.field__label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px;
}
.field__hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }

.input, .textarea, .select {
  width: 100%; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 9px 11px; font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--seal);
  box-shadow: 0 0 0 3px var(--seal-soft);
}
.textarea {
  min-height: 132px; resize: vertical; line-height: 1.7;
  font-family: var(--han-sans), var(--sans);
  font-size: 17px; letter-spacing: .04em;
}
.select { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C877E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select--sm { padding: 6px 28px 6px 9px; font-size: 13.5px; }

/* 分段控件 */
.seg { display: flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 3px; }
.seg__btn {
  flex: 1; height: 30px; border-radius: 3px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn[aria-pressed="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs); border: 1px solid var(--line-2);
  height: 30px;
}
.seg--wide .seg__btn { height: 34px; }

/* 开关 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row__text { display: flex; flex-direction: column; }
.switch-row__title { font-size: 14px; font-weight: 600; }
.switch-row__desc { font-size: 12px; color: var(--ink-3); }
.switch {
  position: relative; width: 40px; height: 23px; border-radius: var(--radius-pill);
  background: var(--line-2); flex: 0 0 auto; transition: background .18s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.18); transition: transform .18s;
}
.switch[aria-checked="true"] { background: var(--seal); }
.switch[aria-checked="true"]::after { transform: translateX(17px); }

/* 滑杆 */
.range { width: 100%; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output {
  min-width: 34px; text-align: center; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px; padding: 2px 0;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--line-2); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--seal); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--seal);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer;
}

/* 折叠面板 */
details.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.panel > summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary svg { width: 14px; height: 14px; transition: transform .2s; color: var(--ink-3); }
details.panel[open] > summary svg { transform: rotate(90deg); }
details.panel .panel__body { padding: 4px 14px 16px; border-top: 1px solid var(--line); }

/* ---------- 9. Badge / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge--seal { background: var(--seal-soft); color: var(--seal-700); border-color: var(--seal-line); }
.badge--jade { background: var(--jade-soft); color: var(--jade); border-color: #CFE0D9; }
.badge--live { background: var(--jade-soft); color: var(--jade); }
.badge--soon { background: var(--paper-2); color: var(--ink-3); }

/* ---------- 10. Ad slots ---------- */
.ad-slot { display: flex; flex-direction: column; gap: 6px; }
.ad-slot__label {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); text-align: center;
}
.ad-slot__box {
  display: grid; place-items: center;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(0,0,0,.012) 9px, rgba(0,0,0,.012) 18px);
  color: var(--ink-3); font-size: 12px; text-align: center; padding: 12px; gap: 4px;
}
.ad-slot__box strong { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.ad-slot[data-h="90"]  .ad-slot__box { min-height: 90px; }
.ad-slot[data-h="250"] .ad-slot__box { min-height: 250px; }
.ad-slot[data-h="280"] .ad-slot__box { min-height: 280px; }
.ad-slot[data-h="600"] .ad-slot__box { min-height: 600px; }
body[data-ads="off"] .ad-slot { display: none !important; }

/* ---------- 11. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--paper-2);
  margin-top: 80px; padding: 56px 0 32px;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 {
  font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 14px; font-weight: 700;
}
.footer-col a { display: block; font-size: 14px; color: var(--ink-2); padding: 4px 0; }
.footer-col a:hover { color: var(--seal); }
.footer-business {
  margin-top: 40px; padding: 20px 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper);
}
.footer-business h4 {
  font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px; font-weight: 700;
}
.footer-business p {
  font-size: 13px; line-height: 1.75; color: var(--ink-2); margin: 0;
}
.footer-business a { color: var(--seal); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 页脚分享按钮 ---------- */
.footer-share {
  margin-top: 40px; padding: 20px 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper);
}
.footer-business + .footer-share { margin-top: 16px; }
.footer-share h4 {
  font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px; font-weight: 700;
}
.share-row { display: flex; flex-wrap: wrap; gap: 10px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.share-btn svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.share-btn:hover {
  border-color: var(--seal-line); color: var(--seal); background: var(--seal-soft);
}
.share-btn:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.footer-bottom {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-3);
}

/* ---------- 12. Toast ---------- */
.toast-host {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--ink-inverse);
  padding: 10px 16px; border-radius: var(--radius); font-size: 14px;
  box-shadow: var(--shadow-lg); animation: toast-in .22s ease-out;
}
.toast--err { background: var(--seal-700); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 13. Misc ---------- */
.sr-divider { display: flex; align-items: center; gap: 14px; color: var(--ink-3); }
.sr-divider::before, .sr-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }
