/* 字級依野薑通用字級系統（typography-scale）：標題 Bold 字距 0.1em，內文 regular 字距 0.05em。 */
:root {
  --navy: #0b1b45;
  --navy-2: #13296b;
  --gold: #c9971f;
  --ink: #1c2333;
  --muted: #5d6679;
  --line: #d9dee8;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --error: #b3261e;
  --warn-bg: #fff6dd;
  --warn-ink: #6b4e00;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 1rem;
  line-height: 2;
  letter-spacing: 0.05em;
}

h1, h2 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: 0.1em; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; margin-bottom: 1rem; }
p { margin: 0; }
small, .hint, .count, .error, .warn, .status, .fb-meta { font-size: 0.875rem; line-height: 1.85; letter-spacing: 0.05em; }
a { color: var(--navy-2); }

.site-header {
  background: var(--navy);
  color: #fff;
  padding: 2rem 1rem;
  border-bottom: 4px solid var(--gold);
}
.site-header > * { max-width: 1200px; margin-inline: auto; }
.site-header p { color: #d5dcf0; margin-top: 0.5rem; }

.layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 0;
}

/* 預覽比畫面高，讓它在自己的區塊內捲動，調照片時圖卡才看得到。 */
.preview { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }

/* 表單 */
.field { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 700; padding: 0; }
input[type="text"], textarea, select {
  width: 100%;
  font: inherit;
  letter-spacing: inherit;
  line-height: 1.5;
  color: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid #aab2c2;
  border-radius: 6px;
  background: #fff;
}
textarea { resize: vertical; }
.field label.sub { display: block; font-weight: 400; margin-top: 0.25rem; }
input[type="file"] { font: inherit; max-width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid #4f7dff;
  outline-offset: 2px;
}
[aria-invalid="true"] { border-color: var(--error); }

.hint { color: var(--muted); }
.count { float: right; font-variant-numeric: tabular-nums; }
.count.over { color: var(--error); font-weight: 700; }
.error { color: var(--error); font-weight: 700; }
.error:empty { display: none; }
#mismatch { margin-bottom: 1rem; border: 1px solid #e0b100; }
#mismatch .actions { margin-top: 0.5rem; }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 0.5rem 0.75rem; border-radius: 6px; margin-top: 0.5rem; }

.photo-controls { margin-top: 0.75rem; padding: 0.75rem; background: var(--bg); border-radius: 6px; }
.photo-controls label { display: grid; grid-template-columns: 3em 1fr; align-items: center; gap: 0.5rem; }
.photo-controls input[type="range"] { width: 100%; }

.btn {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.5;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--navy);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.btn:hover { background: #eef2fb; }
.btn-primary { background: var(--navy); color: #fff; width: 100%; padding-block: 0.8rem; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { border-color: var(--line); font-weight: 400; padding: 0.3rem 0.75rem; margin-top: 0.5rem; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.status { margin-top: 0.75rem; min-height: 1.85em; }
.status.ok { color: #14663a; font-weight: 700; }
.status.fail { color: var(--error); font-weight: 700; }

/* 模擬 Facebook 貼文：這一塊刻意照 Facebook 的字級與行距，不套通用字級。 */
.fb-post {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  font-family: -apple-system, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0;
}
.fb-head { display: flex; gap: 0.6rem; align-items: center; padding: 0.75rem 1rem 0.25rem; }
.fb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #cf2030; color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.75rem; letter-spacing: 0;
}
.fb-name { font-weight: 600; font-size: 0.9375rem; line-height: 1.3; }
.fb-meta { color: #65676b; font-size: 0.8125rem; line-height: 1.3; letter-spacing: 0; }
.fb-text {
  padding: 0.25rem 1rem 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.34;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fb-text .line { margin: 0; min-height: 1.34em; }
.fb-text .tag { color: #0064d1; margin: 0; }
.fb-text .empty { color: #9aa1ad; }
.fb-card { display: block; width: 100%; height: auto; touch-action: pan-y; }
.fb-card.draggable { cursor: grab; }
.fb-card.dragging { cursor: grabbing; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.actions .status { margin: 0; }

@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; max-height: none; overflow: visible; }
  .panel { padding: 1rem; }
  .site-header { padding: 1.5rem 1rem; }
}
