/* =============================================================
   style.css — 活動前台樣式（產品 B，CR-030 卡 B）
   =============================================================
   視覺基準取自 外來資源/20260728-活動/給當下的你_V2_手機版.html
   （**僅取色系、文案、版面比例，不照抄結構**，見 CR-030 §Background）。

   ★ D55②：**本卡不宣告 @font-face**。UI 一律走系統字型堆疊，
     2,648.7 KB 的 NotoSerifTC subset 字型留給卡 C 的結果圖渲染。
     ⇒ 已知代價：頁面 UI 字型會依裝置而異，與結果圖不完全一致。
   ★ CSP：無 inline style，噪點底紋以 data: URI 寫在本檔（_headers 的 img-src 含 data:）。
   ============================================================= */

:root {
  --bg: #f5f1eb;
  --paper: #fbf8f3;
  --ink: #5b534d;
  --muted: #968b82;
  --gold: #b99565;
  --line: rgba(91, 83, 77, .13);
  --shadow: 0 20px 55px rgba(75, 60, 48, .11);
  --danger: #9c5b4a;

  /* D55②：系統字型堆疊，不自帶字型檔 */
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", serif;
  --sans: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, #faf7f2 0%, #f4efe8 54%, #eee7de 100%);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  width: min(100%, 430px);
  margin: 0 auto;
  min-height: 100vh;
}

.screen { padding: 22px 22px 63px; position: relative; }

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

/* ---- hero ---- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%,
      rgba(255, 246, 220, .70) 0%,
      rgba(255, 241, 205, .32) 24%,
      rgba(246, 244, 239, .10) 46%,
      transparent 68%),
    #f6f4f1;
}

.hero > * { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--serif);
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: .12em;
  margin: 0 0 24px;
}

.hero-title {
  font-family: var(--serif);
  text-align: center;
  font-weight: 400;
  font-size: 1.5rem;
  color: #544533;
  line-height: 1.75;
  letter-spacing: .08em;
  margin: 0 0 34px;
}

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

.intro {
  font-family: var(--serif);
  text-align: center;
  font-size: 1rem;
  line-height: 1.95;
  letter-spacing: .05em;
  margin: 0 0 26px;
}

/* ---- 卡片（hero 範例 ＋ 完成頁共用） ---- */
.moment-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, .86), rgba(250, 246, 239, .75));
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  padding: 34px 24px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.moment-card::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(91, 83, 77, .06);
  pointer-events: none;
}

.moment-id {
  font-family: Georgia, serif;
  font-size: 1rem;
  letter-spacing: .12em;
  color: #776b63;
  margin: 0 0 28px;
  position: relative;
}

.moment-copy {
  font-family: var(--serif);
  font-size: 1.625rem;
  line-height: 1.75;
  letter-spacing: .04em;
  margin: 0;
  position: relative;
  word-break: break-word;
}

.moment-date {
  font-size: .6875rem;
  letter-spacing: .15em;
  color: var(--muted);
  margin: 26px 0 0;
  position: relative;
}

.revisit {
  font-family: var(--serif);
  text-align: center;
  font-size: 1.0625rem;
  line-height: 1.95;
  letter-spacing: .05em;
  margin: 30px 0 26px;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: #776b63;
  color: #fffaf5;
  letter-spacing: .14em;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(91, 83, 77, .14);
}

/* ---- write ---- */
.write { padding-top: 54px; border-top: 1px solid var(--line); }

.write h2 {
  font-family: var(--serif);
  text-align: center;
  font-size: 1.6875rem;
  line-height: 1.8;
  letter-spacing: .08em;
  font-weight: 400;
  margin: 0 0 30px;
}

/* D57：非 open 狀態的說明列 */
.state-note {
  font-family: var(--serif);
  text-align: center;
  font-size: .9375rem;
  line-height: 1.9;
  color: var(--muted);
  background: rgba(255, 255, 255, .5);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin: 0 0 24px;
}

/* 非 open 時整組表單降低視覺權重（disabled 本身由 D57 狀態機控制） */
.write:not([data-state="open"]) .paper,
.write:not([data-state="open"]) .turnstile-slot,
.write:not([data-state="open"]) .submit { opacity: .5; }

.paper {
  background: linear-gradient(160deg, rgba(255, 255, 255, .93), rgba(249, 245, 238, .82));
  border: 1px solid rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  padding: 28px 22px 24px;
  position: relative;
}

.paper::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(91, 83, 77, .06);
  pointer-events: none;
}

.paper > * { position: relative; z-index: 1; }

textarea {
  width: 100%;
  min-height: 190px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  text-align: center;
  font-size: 1.5rem;
  line-height: 1.85;
  padding: 12px 4px;
}

textarea::placeholder { color: rgba(91, 83, 77, .22); }
textarea:disabled { cursor: not-allowed; }

.count { font-size: .625rem; color: var(--muted); text-align: right; margin: 0; }
.count[data-over="true"] { color: var(--danger); }

.field-error, .form-error {
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--danger);
  margin: 8px 0 0;
}

.form-error { text-align: center; margin: 16px 0 0; }

.mail { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

input {
  width: 100%;
  height: 48px;
  border: 0;
  border-bottom: 1px solid rgba(91, 83, 77, .26);
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 2px;
  font-size: .9375rem;
}

input:focus { border-bottom-color: var(--gold); }
input:disabled { cursor: not-allowed; }

.mail-copy {
  font-family: var(--serif);
  font-size: .875rem;
  line-height: 1.9;
  color: #736961;
  margin: 20px 0 0;
}

.mail-copy strong { font-weight: 400; color: #8f6f4c; }

.privacy { font-size: .625rem; line-height: 1.65; color: var(--muted); margin-top: 12px; }

.turnstile-slot { margin-top: 20px; display: flex; justify-content: center; min-height: 65px; }

.submit {
  margin-top: 24px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: #776b63;
  color: #fffaf5;
  letter-spacing: .14em;
}

.submit:disabled { cursor: not-allowed; opacity: .55; }

.submit.ghost {
  background: transparent;
  color: #776b63;
  border: 1px solid rgba(91, 83, 77, .28);
}

/* D59：IDEMPOTENCY_CONFLICT 的確認區 */
.confirm-box {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
}

.confirm-text {
  font-family: var(--serif);
  font-size: .9375rem;
  line-height: 1.85;
  margin: 0;
}

.confirm-actions { display: flex; gap: 12px; }
.confirm-actions .submit { flex: 1; }

/* ---- project / footer ---- */
.project { padding-top: 76px; text-align: center; }

.project h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.8;
  letter-spacing: .07em;
  margin: 0;
}

.project strong {
  display: block;
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.2;
  margin: 12px 0;
}

.soft {
  font-family: var(--serif);
  color: var(--muted);
  font-size: .875rem;
  line-height: 2;
  margin: 28px 0 0;
}

.brand-footer { padding: 76px 22px 90px; text-align: center; border-top: 1px solid var(--line); }

.brand-footer h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: .09em;
  margin: 0 0 24px;
}

.brand-footer p {
  font-family: var(--serif);
  font-size: .9375rem;
  line-height: 2.05;
  letter-spacing: .03em;
  margin: 0;
}

.brand-mark { margin-top: 36px; font-size: .6875rem; letter-spacing: .22em; color: var(--muted); }

/* ---- result（D55①：卡 B 為文字版；#resultImageMount 留給卡 C） ---- */
.result { padding: 40px 22px 90px; text-align: center; border-top: 1px solid var(--line); }

.result-copy {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 2;
  letter-spacing: .04em;
  margin: 28px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
