/* 自托管字体（OFL,Google Fonts latin 子集）——零第三方请求，FR-18/19 */
@font-face {
  font-family: "Fraunces";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/fraunces-500.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/fraunces-600.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/source-sans-3-400.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/source-sans-3-600.woff2") format("woff2");
}

/* SortaSeat — 设计锚定 specs/001-seating-poster-generator/design.md
   屏幕 + 打印双样式；打印规格锚定 doc/research.html 核实表 P 系 */

:root {
  --paper: #FBF9F5;
  --ink: #211D17;
  --ink-soft: #6B6357;
  --line: #E4DED2;
  --accent: #2E5045;
  --accent-wash: #E3EAE4;
  --danger: #9C3D2E;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --pg: #FDFCF9;
  --pi: #1E1B16;
  --pgold: #A8894F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 "Source Sans 3", system-ui, sans-serif;
}

/* ── header / footer ── */
header.site {
  display: flex; align-items: baseline; gap: 28px;
  padding: 20px 32px; border-bottom: 1px solid var(--line);
}
.wordmark { font: 600 24px/1 "Fraunces", serif; letter-spacing: 0.01em; color: var(--ink); text-decoration: none; }
.wordmark em { font-style: italic; color: var(--accent); }
nav.site { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
nav.site a { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
footer.site {
  border-top: 1px solid var(--line); padding: 20px 32px;
  display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft);
}
footer.site nav { margin-left: auto; display: flex; gap: 16px; }
footer.site a { color: inherit; }
a:hover { color: var(--ink); }

/* ── hero（紧凑，工具优先）── */
.hero { max-width: 1440px; margin: 0 auto; padding: 26px 32px 0; }
.hero h1 { font: 600 40px/1.15 "Fraunces", serif; letter-spacing: 0.005em; }
.hero p { color: var(--ink-soft); margin-top: 8px; max-width: 56ch; }

/* ── editor 布局 ── */
.editor { display: flex; gap: 28px; padding: 24px 32px; max-width: 1440px; margin: 0 auto; align-items: flex-start; }
.panel { width: 360px; flex: none; display: flex; flex-direction: column; gap: 20px; }
.stage { flex: 1; min-width: 0; }

.field label, .field > .field-label { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
textarea, input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff;
  padding: 10px 12px; font: 14px/1.5 "Source Sans 3", sans-serif; color: var(--ink);
}
textarea { min-height: 150px; resize: vertical; }
textarea:focus, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 宾客行（FR-3 单条增删改） */
.guest-rows { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.guest-row {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 14px;
}
.guest-row .g-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-row select {
  border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
  font: 600 12px "Source Sans 3", sans-serif; color: var(--ink-soft); padding: 4px 6px; max-width: 110px;
}
.guest-row .rm, .table-row .rm {
  border: 0; background: none; color: var(--danger); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px; min-width: 32px; min-height: 32px;
}
.guest-add { display: flex; gap: 8px; margin-top: 8px; }
.guest-add input { flex: 1; }

/* 桌次列表 */
.table-list { list-style: none; display: flex; flex-direction: column; gap: 6px; min-height: 132px; }
.table-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 14px;
}
.table-row .shape-toggle {
  border: 0; background: none; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; padding: 4px; border-radius: 4px; flex: none;
  transition: transform 160ms var(--ease-out), color 160ms var(--ease-out);
}
.table-row .shape-toggle:hover { color: var(--accent); }
.table-row .shape-toggle:active { transform: scale(0.94); }
.table-row .shape-toggle svg { width: 18px; height: 15px; }
.table-row input[type="text"] { border: 0; padding: 2px 0; font-size: 14px; flex: 1; min-width: 0; background: transparent; }
.table-row input[type="text"]:focus-visible { outline: 1px solid var(--accent); }
.table-row .count { margin-left: auto; color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.table-row .count.over { color: var(--danger); font-weight: 600; }
.table-row .cap-input {
  width: 52px; flex: none; border: 1px solid var(--line); border-radius: 4px; background: #fff;
  padding: 4px 6px; font: 600 12px "Source Sans 3", sans-serif; color: var(--ink-soft); text-align: center;
}
.table-add { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.table-add select { border: 1px solid var(--line); border-radius: 4px; padding: 8px; background: #fff; font: 14px "Source Sans 3", sans-serif; }

/* 分段控件（视图切换） */
.seg { display: grid; grid-template-columns: 1fr 1fr; position: relative; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); background: var(--accent-wash); border-radius: 3px; transition: transform 200ms var(--ease-out); }
.seg[data-view="by-table"] .thumb { transform: translateX(100%); }
.seg button {
  position: relative; z-index: 1; border: 0; background: none; padding: 9px 0;
  font: 600 14px "Source Sans 3", sans-serif; color: var(--ink-soft); cursor: pointer;
  transition: color 160ms var(--ease-out);
}
.seg button[aria-pressed="true"] { color: var(--ink); }

/* chips 与按钮 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 7px 14px;
  font: 600 13px "Source Sans 3", sans-serif; color: var(--ink-soft); cursor: pointer; min-height: 40px;
  transition: transform 160ms var(--ease-out), background 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--accent); color: var(--ink); }
  .chip[aria-pressed="true"]:hover { color: #fff; }
  .btn-primary:hover { background: #26443A; }
  .btn-ghost:hover { background: var(--accent-wash); }
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border-radius: 4px; padding: 11px 22px; font: 600 15px "Source Sans 3", sans-serif;
  cursor: pointer; min-height: 44px;
  transition: transform 160ms var(--ease-out), background 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-ghost { background: none; color: var(--accent); border: 1px solid var(--accent); }
.btn-quiet { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; font-size: 13px; cursor: pointer; min-height: 40px; }

/* ── 预览 stage ── */
.stage-note { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.poster-viewport {
  border: 1px dashed var(--line); border-radius: 4px; padding: 24px;
  display: flex; justify-content: center;
  background: repeating-conic-gradient(#F3EFE7 0% 25%, transparent 0% 50%) 0 0/20px 20px;
}
.poster-scale {
  transform-origin: top left; width: 100%; max-width: 540px;
  aspect-ratio: 3 / 4; margin: 0 auto; position: relative; overflow: hidden;
}
.poster-scale .poster { transform-origin: top left; }

/* ── 海报本体（屏幕预览；尺寸由 render.js 内联 px，打印时重置）── */
.poster {
  position: relative; background: var(--pg); color: var(--pi);
  font-family: "Fraunces", serif; padding: 0.5in; overflow: hidden;
  transition: filter 180ms var(--ease-out), opacity 180ms var(--ease-out);
}
.poster.poster--ink-friendly { --pg: #FFFFFF; --pi: #000000; --pgold: #000000; }
.poster.swap { filter: blur(2px); opacity: 0.6; }

.p-safe { position: absolute; inset: 0.25in; border: 1px dashed rgb(107 99 87 / 0.35); pointer-events: none; }
.p-bleed { position: absolute; inset: 0; pointer-events: none; }
.p-bleed i { position: absolute; width: 0.35in; height: 0.35in; border: 0 solid rgb(107 99 87 / 0.45); }
.p-bleed i:nth-child(1) { top: 0.06in; left: 0.06in; border-top-width: 1px; border-left-width: 1px; }
.p-bleed i:nth-child(2) { top: 0.06in; right: 0.06in; border-top-width: 1px; border-right-width: 1px; }
.p-bleed i:nth-child(3) { bottom: 0.06in; left: 0.06in; border-bottom-width: 1px; border-left-width: 1px; }
.p-bleed i:nth-child(4) { bottom: 0.06in; right: 0.06in; border-bottom-width: 1px; border-right-width: 1px; }

.p-inner { position: relative; height: 100%; display: flex; flex-direction: column; text-align: center; }
.p-title { font-weight: 600; font-size: 0.62in; line-height: 1.2; }
.p-sub { font-family: "Source Sans 3", sans-serif; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.75; font-size: 0.2in; margin-top: 0.08in; }
.p-rule { border: 0; border-top: 1px solid var(--pgold); margin: 0.22in auto 0.28in; width: 2.2in; }

/* A–Z 榜 */
.az-cols { flex: 1; column-fill: auto; text-align: left; font-size: 0.3in; }
.az-cols--compact { font-size: 0.22in; }
.az-group { break-inside: avoid; margin-bottom: 0.22in; }
.az-letter { font-weight: 600; letter-spacing: 0.14em; border-bottom: 1px solid var(--pgold); padding-bottom: 0.04in; margin-bottom: 0.09in; }
.az-row { display: flex; align-items: baseline; line-height: 1.75; }
.az-row .who { white-space: nowrap; }
.az-row .dots { flex: 1; margin: 0 0.12in; border-bottom: 2px dotted rgb(30 27 22 / 0.35); transform: translateY(-0.06in); }
.poster--ink-friendly .az-row .dots { border-bottom-color: rgb(0 0 0 / 0.4); }

/* 按桌榜 */
.by-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3in; align-content: start; }
.by-grid--single { grid-template-columns: 1fr; }
.t-block { break-inside: avoid; }
.t-head { display: flex; align-items: center; justify-content: center; gap: 0.1in; margin-bottom: 0.12in; }
.t-shape { width: 0.28in; height: 0.24in; color: var(--pgold); }
.t-name { font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.3in; }
.t-rule { border: 0; border-top: 1px solid var(--pgold); width: 0.9in; margin: 0 auto 0.1in; }
.t-seats {
  font-family: "Source Sans 3", sans-serif; font-size: 0.15in; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.65; margin-bottom: 0.1in;
}
.t-seats--over { opacity: 1; font-weight: 600; color: var(--danger); }
.poster--ink-friendly .t-seats--over { color: #000; text-decoration: underline; }
.t-guest { font-size: 0.32in; line-height: 1.65; }
.t-unassigned { margin-top: 0.3in; padding-top: 0.14in; border-top: 1px dashed var(--pgold); grid-column: 1 / -1; }
.t-unassigned .t-name { font-size: 0.22in; }

/* 版面溢出提示（T038）：名单超单张海报容量时打印可见的续页指引，防静默裁名 */
.p-overflow {
  margin-top: auto; padding-top: 0.12in;
  font-family: "Source Sans 3", sans-serif; font-size: 0.15in; letter-spacing: 0.12em;
  text-transform: uppercase; text-align: center; color: var(--danger);
}
.poster--ink-friendly .p-overflow { color: #000; text-decoration: underline; }
.p-overflow--full { grid-column: 1 / -1; }

/* toast */
.toast {
  position: fixed; right: 24px; bottom: 24px; background: var(--ink); color: var(--paper);
  padding: 13px 20px; border-radius: 4px; font-size: 14px; z-index: 50;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  box-shadow: 0 8px 24px rgb(33 29 23 / 0.12); max-width: min(90vw, 420px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(8px); transition-duration: 150ms; }

/* 场景卡片 */
.scenarios { max-width: 1440px; margin: 0 auto; padding: 20px 32px 48px; }
.scenarios h2 { font: 600 28px "Fraunces", serif; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { border-top: 1px solid var(--ink); padding-top: 14px; opacity: 0; transform: translateY(8px); animation: rise 300ms var(--ease-out) forwards; }
.card:nth-child(2) { animation-delay: 40ms; }
.card:nth-child(3) { animation-delay: 80ms; }
.card h3 { font: 600 19px "Fraunces", serif; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--ink-soft); }
.card a { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* 场景页正文 */
.prose { max-width: 720px; margin: 0 auto; padding: 24px 32px 48px; }
.prose h1 { font: 600 34px/1.2 "Fraunces", serif; margin-bottom: 10px; }
.prose h2 { font: 600 24px "Fraunces", serif; margin: 28px 0 10px; }
.prose p, .prose li { color: var(--ink); margin-bottom: 10px; }
.prose .lede { color: var(--ink-soft); font-size: 17px; }
.prose details { border-top: 1px solid var(--line); padding: 12px 0; }
.prose summary { font-weight: 600; cursor: pointer; }
.cta-band { text-align: center; margin: 32px 0; }
.baked-sample { max-width: 1440px; margin: 0 auto; padding: 12px 32px; }
.baked-sample .poster-scale { margin: 0 auto; }

@media (max-width: 1023px) {
  .editor { flex-direction: column; }
  .panel { width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; opacity: 1; transform: none; }
  .poster, .toast, .chip, .btn, .seg .thumb { transition: none; }
}

/* ── 打印（P 系；Ctrl+P 兜底：规则不依赖 JS 挂 .printing 类，printing 类只管墨水友好）── */
@page { size: 18in 24in; margin: 0; }

@media print {
  body { background: #fff; }
  header.site, footer.site, .panel, .hero, .scenarios, .stage-note,
  .toast, .banner { display: none !important; }
  .editor { display: block; padding: 0; max-width: none; }
  .poster-viewport { border: 0; padding: 0; background: none; display: block; }
  .poster-scale { transform: none !important; width: auto !important; height: auto !important; aspect-ratio: auto; }
  .poster {
    transform: none !important;
    width: 100% !important; height: 100vh !important; padding: 0.5in; page-break-inside: avoid;
  }
  .p-safe { display: none; }
  .p-bleed i { border-color: #000; }
}
