/* ==========================================================================
   GALLERY PRO — 设计系统
   ELLE 杂志式编辑美学：暖黑、金线、衬线大标题、发丝分割线
   ========================================================================== */

:root {
  /* 深色（默认） */
  --bg: #0A0A0A;
  --bg-soft: #0D0D0D;
  --surface: #111111;
  --surface-2: #171717;
  --surface-3: #1E1E1E;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.065);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #F4F2ED;
  --text-2: #9C9A94;
  --text-3: #6B6963;
  --gold: #C9A96E;
  --gold-hi: #DDC08A;
  --gold-ink: #0A0A0A;
  --gold-soft: rgba(201, 169, 110, 0.13);
  --gold-line: rgba(201, 169, 110, 0.4);
  --danger: #C4685F;
  --success: #5B9E7B;
  --info: #7B9EB8;
  --warn: #C08A45;
  --overlay: rgba(0, 0, 0, 0.82);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --img-placeholder: #141414;

  --serif: Georgia, "Noto Serif SC", "Songti SC", "Times New Roman", serif;
  --sans: "Segoe UI", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", "Courier New", monospace;

  --bar-h: 62px;
  --radius: 2px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --maxw: 1560px;
}

[data-theme="light"] {
  --bg: #F5F5F3;
  --bg-soft: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F1EE;
  --surface-3: #E8E8E4;
  --line: #E3E3DE;
  --line-soft: #EDEDE8;
  --line-strong: #CBCBC4;
  --text: #171715;
  --text-2: #5E5E58;
  --text-3: #8C8C85;
  --gold: #B08A45;
  --gold-hi: #C29B54;
  --gold-ink: #241C0E;
  --gold-soft: #F7EFDF;
  --gold-line: #E2D1AE;
  --danger: #B4443B;
  --success: #3F7D5C;
  --info: #4E7891;
  --warn: #99681F;
  --overlay: rgba(20, 20, 16, 0.55);
  --shadow: 0 20px 50px rgba(40, 36, 28, 0.12);
  --img-placeholder: #ECECE8;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* 极轻的顶部环境光，避免大块纯黑 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(201, 169, 110, 0.055), transparent 62%),
    radial-gradient(800px 400px at 100% 0%, rgba(123, 158, 184, 0.045), transparent 60%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(176, 138, 69, 0.06), transparent 62%),
    radial-gradient(800px 400px at 100% 0%, rgba(120, 120, 110, 0.04), transparent 60%);
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 400; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
figure, figcaption { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 3px;
}
::selection { background: var(--gold); color: var(--gold-ink); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }

/* ---------- 排版工具 ---------- */
.serif { font-family: var(--serif); letter-spacing: 0.01em; }
.mono { font-family: var(--mono); }
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--sans);
  font-weight: 600;
}
.eyebrow--gold { color: var(--gold); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.gold { color: var(--gold); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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;
}

/* ---------- 图标 ---------- */
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }
.icon--xl { width: 28px; height: 28px; }

/* ---------- 按钮 ---------- */
.btn {
  --btn-h: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease),
    color 0.25s var(--ease), transform 0.25s var(--ease), opacity 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: 0.4; pointer-events: none; }

.btn--primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--gold-ink);
}
.btn--primary:hover { background: var(--gold-hi); border-color: var(--gold-hi); }

.btn--outline {
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--outline:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }

.btn--ghost { color: var(--text-2); }
.btn--ghost:hover { color: var(--text); background: var(--gold-soft); }

.btn--quiet {
  color: var(--text-2);
  border-color: var(--line);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 500;
  font-size: 12.5px;
}
.btn--quiet:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }

.btn--danger { color: var(--danger); border-color: rgba(196, 104, 95, 0.34); }
.btn--danger:hover { background: rgba(196, 104, 95, 0.1); border-color: var(--danger); }

.btn--sm { --btn-h: 30px; padding: 0 12px; font-size: 10.5px; gap: 7px; }
.btn--lg { --btn-h: 46px; padding: 0 26px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--icon {
  --btn-h: 36px;
  width: 36px;
  padding: 0;
  border-radius: 50%;
  color: var(--text-2);
}
.btn--icon:hover { color: var(--text); background: var(--surface-2); }

/* 文本按钮（带下划线动效） */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--gold);
  padding-bottom: 3px;
  border-bottom: 1px solid var(--gold-line);
  transition: border-color 0.25s, color 0.25s;
}
.link-btn:hover { color: var(--gold-hi); border-color: var(--gold); }

/* ---------- 标签 / 胶囊 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 1px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  text-transform: uppercase;
  white-space: nowrap;
  background: transparent;
}
.chip--gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.chip--solid { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.chip--success { color: var(--success); border-color: rgba(91, 158, 123, 0.4); }
.chip--plain { border-color: transparent; padding: 0; }

.dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: none;
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 22px; }
.field__label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 8px; font-weight: 600;
}
.field__wrap { position: relative; display: flex; align-items: center; }
.field__icon { position: absolute; left: 0; color: var(--text-3); pointer-events: none; transition: color 0.2s; }
.input {
  width: 100%;
  height: 42px;
  padding: 0 2px 0 28px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--text);
  font-size: 14.5px;
  letter-spacing: 0.02em;
  transition: border-color 0.25s var(--ease);
  outline: none;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-bottom-color: var(--gold); }
.field__wrap:focus-within .field__icon { color: var(--gold); }
.input--bare { padding-left: 0; }

.select {
  height: 32px;
  padding: 0 26px 0 10px;
  background-color: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 14px, calc(100% - 9px) 14px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.select:hover { color: var(--text); border-color: var(--line-strong); }
.select:focus { outline: none; border-color: var(--gold); }
.select option { background: var(--surface); color: var(--text); }

.switch {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 34px; height: 18px; border-radius: 20px;
  border: 1px solid var(--line-strong);
  position: relative; transition: background-color 0.25s, border-color 0.25s;
  flex: none;
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-2); transition: transform 0.25s var(--ease), background-color 0.25s;
}
.switch input:checked + .switch__track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--gold-ink); }
.switch input:focus-visible + .switch__track { outline: 1.5px solid var(--gold); outline-offset: 2px; }

/* ---------- 分段控件 ---------- */
.seg {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.seg__btn {
  height: 26px;
  padding: 0 11px;
  border-radius: 1px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.2s, background-color 0.2s;
  white-space: nowrap;
}
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--gold-soft); color: var(--gold); }
.seg__btn .icon { width: 14px; height: 14px; }

/* ---------- 进度条 ---------- */
.progress {
  height: 2px;
  background: var(--line);
  overflow: hidden;
  border-radius: 2px;
}
.progress__fill {
  display: block;
  height: 100%;
  background: var(--gold);
  transition: width 0.6s var(--ease-out);
}

/* ---------- 分割线 ---------- */
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
.rule--soft { background: var(--line-soft); }

/* ---------- 图片占位 ---------- */
.ph {
  background: var(--img-placeholder);
  position: relative;
  overflow: hidden;
}
.ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.045) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.22s var(--ease) both;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  box-shadow: var(--shadow);
  animation: modal-in 0.32s var(--ease-out) both;
}
.modal--wide { max-width: 760px; }
.modal--full { max-width: 1040px; }
.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 30px 18px;
}
.modal__title { font-family: var(--serif); font-size: 24px; line-height: 1.25; }
.modal__sub { font-size: 12px; color: var(--text-2); margin-top: 7px; }
.modal__body { padding: 4px 30px 26px; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 18px 30px 24px;
  border-top: 1px solid var(--line-soft);
}
.modal__close { margin: -6px -10px 0 0; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 250px;
  max-width: 380px;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  font-size: 12.5px;
  color: var(--text);
  pointer-events: auto;
  animation: toast-in 0.35s var(--ease-out) both;
}
.toast.is-out { animation: toast-out 0.3s var(--ease) both; }
.toast__icon { color: var(--gold); margin-top: 1px; }
.toast--success { border-left-color: var(--success); }
.toast--success .toast__icon { color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--error .toast__icon { color: var(--danger); }
.toast__text { flex: 1; line-height: 1.5; }
.toast__sub { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(12px); }
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 90px 24px;
  border: 1px dashed var(--line);
  color: var(--text-2);
}
.empty__mark {
  font-family: var(--serif);
  font-size: 40px;
  color: var(--gold);
  opacity: 0.75;
  margin-bottom: 16px;
}
.empty__title { font-family: var(--serif); font-size: 20px; color: var(--text); margin-bottom: 8px; }

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
