/* =========================================================================
   Editorial Wall — contribution form (shared by front-end modal + standalone page)
   颜色 / 空间 token 由 gallery.css 提供（保证 modal 在深色模式下仍正确）；
   本文件只补 contribute 专属的两个变量与组件样式，避免重定义 token 导致
   深色模式被覆盖。
   ========================================================================= */
:root {
  --danger: #b3261e;
  --accent-ink: #a8471f;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

.hidden { display: none !important; }

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; fill: currentColor; stroke: currentColor; }

/* page chrome (standalone contribute.php) ------------------------------- */
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 26px 18px 48px; display: flex; flex-direction: column; gap: 18px; min-height: 100vh; min-height: 100dvh; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink); transition: color 0.2s var(--ease); }
.brand:hover { color: var(--accent); }
.brand .mark { width: 34px; height: 34px; border-radius: 999px; background: var(--accent-soft); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(194, 85, 46, 0.22); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.brand .mark img { width: 22px; height: 22px; }
.head small { color: var(--muted); font-size: 12px; }

.hero { position: relative; background: linear-gradient(180deg, var(--surface), var(--surface)); border: 1px solid var(--line); border-radius: 24px; padding: 30px 24px 26px; text-align: center; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 44px rgba(20, 18, 14, 0.06); overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 50%; top: -30px; transform: translateX(-50%); width: 120px; height: 60px; background: radial-gradient(closest-side, var(--accent-soft), transparent); pointer-events: none; }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1.12; }
.hero p { color: var(--muted); font-size: 13.5px; margin-top: 8px; max-width: 36ch; margin-inline: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 14px 38px rgba(20, 18, 14, 0.05); }
.add-zone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; text-align: center; padding: 30px 16px; border: 1.5px dashed rgba(194, 85, 46, 0.55); border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: 16px; background: linear-gradient(180deg, var(--accent-soft), rgba(255, 255, 255, 0)); cursor: pointer; transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.25s var(--ease); }
.add-zone .icon { font-size: 34px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--ease); }
.add-zone span { font-weight: 700; font-size: 15px; color: var(--accent); }
.add-zone small { color: var(--muted); font-size: 12px; }
.add-zone:hover { border-color: var(--accent); box-shadow: 0 10px 30px rgba(194, 85, 46, 0.12); }
.add-zone:hover .icon { transform: translateY(-2px) scale(1.06); }
.add-zone.is-drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); box-shadow: 0 14px 38px rgba(194, 85, 46, 0.18); }

/* 移动端上传双入口：拍照 / 从相册选择（替代裸 <input> 触发的 iOS 原生菜单），横排并列 */
.add-actions { display: none; flex-direction: row; gap: 12px; }
.add-actions .btn { flex: 1; width: auto; padding: 15px 16px; font-size: 16px; }
.add-actions .btn .icon { width: 20px; height: 20px; margin-right: 2px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); animation: thumb-in 0.32s var(--ease) both; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 6px; font-size: 10px; color: #fff; background: linear-gradient(0deg, rgba(22, 22, 26, 0.7), transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity 0.2s var(--ease); }
.thumb:hover .meta { opacity: 1; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; border-radius: 999px; background: rgba(22, 22, 26, 0.72); color: #fff; font-size: 16px; cursor: pointer; display: grid; place-items: center; transition: background 0.2s var(--ease), transform 0.15s var(--ease); }
.thumb .rm:hover { background: var(--danger); transform: scale(1.08); }
@keyframes thumb-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field input, .field textarea { padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 16px; font-family: inherit; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.field textarea { resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.cat-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-pick button { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.2s var(--ease); }
.cat-pick button:hover { border-color: var(--accent); color: var(--accent); }
.cat-pick button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; box-shadow: 0 4px 14px rgba(194, 85, 46, 0.25); }
.cat-pick button[data-cat=""].active { background: transparent; color: var(--accent); border-color: var(--accent); box-shadow: none; }

#formFields { display: flex; flex-direction: column; gap: 16px; }
#submitBtn { padding: 13px 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 13px 20px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: transform 0.15s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(194, 85, 46, 0.25); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); box-shadow: 0 6px 18px rgba(194, 85, 46, 0.28); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn:focus-visible, .cat-pick button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }

.progress { display: none; }
.progress.show { display: block; animation: thumb-in 0.3s var(--ease) both; }
.track { height: 9px; border-radius: 999px; background: var(--paper); overflow: hidden; border: 1px solid var(--line); }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #d9683c); border-radius: 999px; transition: width 0.25s var(--ease); }
.progress small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }

.success { display: none; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 32px 10px; }
.success.show { display: flex; animation: thumb-in 0.35s var(--ease) both; }
.success .ok { width: 66px; height: 66px; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 36px; box-shadow: 0 10px 30px rgba(194, 85, 46, 0.3); animation: pop 0.45s var(--ease) both; }
.success h2 { font-family: var(--font-display); font-size: 21px; }
.success p { color: var(--muted); font-size: 13px; max-width: 32ch; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

.closed { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 34px 22px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; box-shadow: 0 14px 38px rgba(20, 18, 14, 0.05); }
.closed .icon { font-size: 42px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.closed h2 { font-family: var(--font-display); font-size: 19px; }
.closed p { color: var(--muted); font-size: 13.5px; max-width: 34ch; }

.foot { margin-top: auto; text-align: center; color: var(--muted); font-size: 11.5px; line-height: 1.6; }

/* 返回画廊链接（仅独立投稿页 header 使用；模态浮于画廊上，无需此入口） */
.home-link { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; font-family: inherit; transition: border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.home-link:hover { border-color: var(--accent); color: var(--accent); }
.home-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.home-link .icon { width: 1em; height: 1em; }

/* 法规 / 合规提示：随提交按钮出现，模态与独立页共用 */
.legal-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.5; }
.legal-note .icon { flex: none; width: 1.15em; height: 1.15em; margin-top: 1px; color: var(--accent); }

/* modal 内复用：去掉 .card / .closed 自身的卡片外观，由 .cm-panel 提供外壳 */
.cm-panel .card { border: none; border-radius: 0; padding: 18px 20px 22px; background: transparent; box-shadow: none; }
.cm-panel .closed { border: none; background: transparent; box-shadow: none; padding: 18px 20px 22px; }

/* ---- 模态浮层（contribute-modal） ---- */
.contribute-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}
.contribute-modal[hidden] { display: flex !important; opacity: 0; visibility: hidden; }
.contribute-modal.is-open { opacity: 1; visibility: visible; }
.cm-scrim {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 18, 0.55);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cm-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(20, 18, 14, 0.18), 0 0 0 1px var(--line);
  padding: 0;
  margin: 16px;
}
/* 模态标题栏：标题与关闭按钮并排，关闭按钮改为相对定位，永不遮挡内容 */
.cm-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
}
.cm-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.cm-close {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.cm-close:hover { background: var(--line); color: var(--ink); }
.cm-close:active { transform: scale(0.92); }
.cm-close .icon { width: 18px; height: 18px; }

@media (max-width: 760px) {
  .add-zone { display: none; }
  .add-actions { display: flex; }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}
