/* ===========================================================================
   Suqin Marketing Site — Design Tokens
   Source of truth: ../DESIGN.md
   Every page must @import this file before any other styles.
   =========================================================================== */

:root {
  /* — Color: paper-warm surfaces — */
  --bg-warm:        #FAF6F0;
  --bg-warm-elev:   #F4EDE2;
  --bg-warm-sink:   #EFE6D7;

  /* — Color: caramel accent system — */
  --accent:         #B8763E;
  --accent-deep:    #8C5628;
  --accent-glow:    #D4A656;

  /* — Color: ink — */
  --text-primary:   #1A1410;
  --text-secondary: #5C4F44;
  --text-tertiary:  #9C8D7E;

  /* — Color: hairlines — */
  --line:           #E5DAC9;
  --line-strong:    #C9B89C;

  /* — Color: status — */
  --success:        #5C7A4A;
  --warn:           #C8821A;
  --danger:         #A03A2A;

  /* — Type scale — */
  --font-display:  4.5rem;
  --font-h1:       3rem;
  --font-h2:       2.125rem;
  --font-h3:       1.5rem;
  --font-body-lg:  1.125rem;
  --font-body:     1rem;
  --font-small:    0.875rem;
  --font-caption:  0.75rem;

  --lh-tight:      1.15;
  --lh-snug:       1.35;
  --lh-body:       1.7;
  --ls-display:   -0.02em;
  --ls-body:       0.01em;
  --ls-caption:    0.1em;

  /* — Type families — */
  --font-display-family: 'Instrument Serif', 'Noto Serif SC', serif;
  --font-serif-zh:       'Noto Serif SC', -apple-system, 'PingFang SC', serif;
  --font-sans-en:        'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono:           ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* — Layout — */
  --content-max:   1180px;
  --hero-copy-max: 680px;
  --gutter:        24px;
  --section-py:    120px;
  --section-py-m:  72px;

  /* — Radii (paper, not pillows) — */
  --r-sharp:       0;
  --r-letter:      2px;
  --r-card:        4px;
  --r-modal:       6px;

  /* — Motion — */
  --ease:          cubic-bezier(.2, .7, .2, 1);
  --dur-fast:      220ms;
  --dur-base:      320ms;
  --dur-slow:      520ms;

  /* — Shadows: warm browns only, never grey — */
  --shadow-card:   0 1px 0 rgba(255,255,255,0.6) inset,
                   0 8px 24px -16px rgba(60, 40, 20, 0.18);
  --shadow-cta:    0 1px 0 var(--accent-deep),
                   0 12px 32px -16px rgba(140, 86, 40, 0.45);
  --shadow-cta-hv: 0 1px 0 var(--accent-deep),
                   0 18px 40px -14px rgba(140, 86, 40, 0.55);
  --shadow-modal:  0 30px 80px -30px rgba(60, 40, 20, 0.45);
}

/* — Reset (minimal — only what we'd otherwise override on every page) — */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust:    100%;
       text-size-adjust:    100%;
}

body {
  background: var(--bg-warm);
  color: var(--text-primary);
  font-family: var(--font-serif-zh);
  font-size: var(--font-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

/* English / numerals inside Chinese copy */
.en, .num, code, kbd, samp, pre {
  font-family: var(--font-sans-en);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/* — Typography defaults — */
h1, h2, h3, h4 {
  font-family: var(--font-serif-zh);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: 0;
  margin: 0 0 0.6em;
  color: var(--text-primary);
}

h1 { font-size: var(--font-h1); }
h2 { font-size: var(--font-h2); }
h3 { font-size: var(--font-h3); font-weight: 500; }

p  { margin: 0 0 1.2em; color: var(--text-primary); }

.display {
  font-family: var(--font-display-family);
  font-weight: 400;
  font-size: var(--font-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
  margin: 0 0 0.4em;
}

.display .accent {
  font-style: italic;
  color: var(--accent-deep);
}

.eyebrow {
  font-family: var(--font-sans-en);
  font-size: var(--font-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  display: inline-block;
}

a {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
}
a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4rem 0;
}

/* ── Layout primitives ───────────────────────────────────────────────────── */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--section-py) 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 2.25rem;
  background: var(--accent);
  color: var(--bg-warm);
  font-family: var(--font-serif-zh);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: 0.08em;
  border: none;
  border-radius: var(--r-letter);
  box-shadow: var(--shadow-cta);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease),
              background var(--dur-fast) ease-out;
}
.btn-primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-cta-hv);
}
.btn-primary:active       { transform: translateY(0); }
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  background: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-letter);
  font-family: var(--font-serif-zh);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-warm-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-card);
}

/* ── Form fields (paper underline, not boxed) ────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}
.field label {
  font-family: var(--font-serif-zh);
  font-size: var(--font-small);
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.field label .hint {
  margin-left: 0.5rem;
  color: var(--text-tertiary);
  font-size: var(--font-caption);
  letter-spacing: 0.04em;
}
.field input,
.field textarea {
  background: var(--bg-warm-sink);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0.875rem 0.75rem;
  font-family: var(--font-serif-zh);
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur-fast) ease-out,
              box-shadow var(--dur-fast) ease-out;
}
.field input.mono,
.field textarea.mono {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-tertiary);
}
.field .err {
  color: var(--danger);
  font-size: var(--font-caption);
  letter-spacing: var(--ls-caption);
  margin-top: 0.25rem;
}

/* ── Step indicator (numerals, no fills) ─────────────────────────────────── */
.steps {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-display-family);
  color: var(--text-tertiary);
  margin: 0 0 3rem;
  font-size: 1.5rem;
}
.steps .step {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}
.steps .step::after {
  content: '—';
  margin-left: 0.6rem;
  color: var(--line-strong);
}
.steps .step:last-child::after { content: ''; }
.steps .step.active { color: var(--accent-deep); }
.steps .step .label {
  font-family: var(--font-serif-zh);
  font-size: var(--font-small);
  letter-spacing: 0.08em;
  color: inherit;
}

/* ── Pill / status badge ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-sans-en);
  font-size: var(--font-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  border-radius: var(--r-letter);
  background: rgba(156, 141, 126, 0.15);
  color: var(--text-secondary);
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--pending { background: rgba(200, 130, 26, 0.12); color: var(--warn); }
.pill--active  { background: rgba(92, 122, 74, 0.12);  color: var(--success); }
.pill--error   { background: rgba(160, 58, 42, 0.12);  color: var(--danger); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26, 20, 16, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease-out;
}
.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--bg-warm);
  border-radius: var(--r-modal);
  padding: 3rem 3rem 2.5rem;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  position: relative;
  transform: translateY(12px);
  opacity: 0;
  transition: transform var(--dur-base) var(--ease),
              opacity   var(--dur-base) var(--ease);
}
.modal-backdrop.is-open .modal {
  transform: translateY(0);
  opacity: 1;
}
.modal-close {
  position: absolute;
  top: 0.5rem; right: 0.75rem;
  background: none; border: 0;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  font-family: var(--font-sans-en);
  cursor: pointer;
  line-height: 1;
  /* DESIGN §8 — touch target ≥ 44×44px even on mobile thumbs */
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) ease-out;
}
.modal-close:hover,
.modal-close:active { color: var(--accent-deep); }

/* ── QR frame (payment) ──────────────────────────────────────────────────── */
.qr-frame {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-warm-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}
.qr-frame .label {
  font-family: var(--font-serif-zh);
  font-size: var(--font-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.qr-frame img {
  display: block;
  width: 280px;
  height: auto;          /* respect natural aspect ratio of the poster */
  max-width: 100%;
  object-fit: contain;
  background: var(--bg-warm);
  border-radius: var(--r-letter);
}
.qr-frame .amount {
  font-family: var(--font-display-family);
  font-size: 2.5rem;
  color: var(--accent-deep);
  margin-top: 1rem;
  line-height: 1;
}

/* ── Header / nav ────────────────────────────────────────────────────────── */
.site-header {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-display-family);
  font-size: 1.75rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-decoration: none;
  border: none;
}
.brand .accent {
  color: var(--accent-deep);
  font-style: italic;
}
.site-header nav {
  display: flex;
  gap: 2rem;
  font-family: var(--font-serif-zh);
  font-size: var(--font-small);
  letter-spacing: 0.06em;
}
.site-header nav a {
  color: var(--text-secondary);
  border: none;
}
.site-header nav a:hover { color: var(--accent-deep); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--line);
  font-size: var(--font-small);
  color: var(--text-tertiary);
}
.site-footer .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

/* ── Atmospheric glow (use once per page max, see DESIGN §6) ─────────────── */
.atmos {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 20%, rgba(212, 166, 86, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  :root {
    --font-display: 3.5rem;
    --font-h1:      2.5rem;
  }
}

@media (max-width: 767px) {
  :root {
    --font-display: 2.75rem;
    --font-h1:      2rem;
    --font-h2:      1.625rem;
    --section-py:   var(--section-py-m);
    --gutter:       20px;
  }

  /* iOS Safari 在 input font-size < 16px 时会自动放大整页 — 用 16px 兜底 */
  .field input,
  .field textarea {
    font-size: 16px;            /* 不能用 rem，浏览器只认绝对值阈值 */
    padding: 0.95rem 0.75rem;   /* 触控目标 ≥ 44px */
  }
  .field input.mono,
  .field textarea.mono {
    font-size: 16px;            /* mono 字段同样需要 */
    letter-spacing: 0.02em;
  }

  /* 全屏 sheet — 适配刘海屏 / 底部 home 横条 */
  .modal {
    border-radius: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;             /* 现代浏览器：动态视口高度，键盘弹出不会乱跳 */
    max-height: 100vh;
    max-height: 100dvh;
    padding: calc(3.5rem + env(safe-area-inset-top)) 1.25rem
             calc(1.5rem + env(safe-area-inset-bottom));
    overscroll-behavior: contain;          /* 内部滚动不传出去拽页面 */
    -webkit-overflow-scrolling: touch;
  }
  /* 全屏 modal 的 × 也要为 notch 留位 */
  .modal-close {
    top: calc(0.25rem + env(safe-area-inset-top));
    right: 0.5rem;
  }
  .site-header .container { flex-wrap: wrap; gap: 1rem; }
  .qr-frame img { width: 240px; }
}
