/* 13photos — 常规摄影图库样式
   主题：浅色 / 深色 / 跟随系统（html[data-theme]），主题色由 --accent 驱动 */

:root,
[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-muted: #667085;
  --text-soft: #98a2b3;
  --header-bg: rgba(255, 255, 255, .88);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .14);
  --skeleton: linear-gradient(90deg, #eef0f3 25%, #e3e6ea 37%, #eef0f3 63%);
}

[data-theme="dark"] {
  --bg: #0d0f13;
  --surface: #15181e;
  --surface-2: #1b1f26;
  --surface-3: #232831;
  --border: #272c36;
  --border-strong: #363c48;
  --text: #e7e9ee;
  --text-muted: #9aa3b2;
  --text-soft: #6f7887;
  --header-bg: rgba(13, 15, 19, .88);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
  --skeleton: linear-gradient(90deg, #1b1f26 25%, #232831 37%, #1b1f26 63%);
}

:root {
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, .12);
  --accent-ring: rgba(37, 99, 235, .35);
  --accent-contrast: #ffffff;
  --accent-deep: rgba(37, 99, 235, .85);
  --header-h: 62px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  transition: background-color .18s ease, color .18s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; opacity: .85; }

img { max-width: 100%; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------------- 顶部导航 ---------------- */

header.site {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

header.site .header-inner {
  display: flex; align-items: center; gap: 20px;
  height: var(--header-h);
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); flex: 0 0 auto; }
.logo:hover { opacity: 1; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-contrast);
  font-weight: 800; font-size: 15px; letter-spacing: -.5px;
}
.logo-text { font-weight: 700; font-size: 17px; letter-spacing: -.3px; line-height: 1.1; }
.logo-text small {
  display: block; font-weight: 400; font-size: 11px;
  color: var(--text-muted); letter-spacing: .3px; margin-top: 1px;
}

.main-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.main-nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--text-muted);
  font-size: 14px; white-space: nowrap;
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.header-user { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }

/* ---------------- 按钮 ---------------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  padding: 8px 14px; font-size: 14px; font-family: inherit; line-height: 1.4;
  transition: background-color .15s, border-color .15s, transform .05s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600;
}
button.primary:hover, .btn-primary:hover { background: var(--accent-deep); }
button.danger, .btn-danger { color: #b42318; border-color: #f5c6c2; background: #fef3f2; }
button.danger:hover, .btn-danger:hover { background: #fee4e2; }
[data-theme="dark"] button.danger,
[data-theme="dark"] .btn-danger { color: #ffb4ab; border-color: #5a2626; background: #2b1a1a; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px; padding: 0; border-radius: 9px;
  border-color: transparent; background: transparent; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

/* 主题控件 */
.theme-widget { position: relative; display: flex; align-items: center; gap: 2px; }
.theme-icon { display: none; align-items: center; justify-content: center; }
[data-theme-mode="system"] .theme-icon[data-icon="system"],
[data-theme-mode="light"] .theme-icon[data-icon="light"],
[data-theme-mode="dark"] .theme-icon[data-icon="dark"],
html:not([data-theme-mode]) .theme-icon[data-icon="system"] { display: flex; }
#accent-toggle .theme-icon { display: flex; }

/* 行内主题色兜底：脚本正常时由 JS 覆盖 --accent-soft 等派生变量 */
@supports (color: color-mix(in srgb, red 10%, transparent)) {
  :root {
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-ring: color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

.accent-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  width: 232px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.accent-panel__title { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.accent-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.accent-swatch {
  height: 30px; padding: 0; border-radius: 8px; border: 2px solid transparent;
  background: var(--sw); cursor: pointer;
}
.accent-swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.accent-custom { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-muted); }
.accent-custom input[type="color"] {
  width: 44px; height: 30px; padding: 2px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer;
}
.accent-panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.accent-panel__hint { font-size: 11px; color: var(--text-soft); }

/* ---------------- 主区域 ---------------- */

main {
  flex: 1 1 auto; width: 100%;
  max-width: 1240px; margin: 0 auto;
  padding: 24px 20px 56px;
}
/* 页面已在 main 内自带 .container 时不再重复计算内边距 */
main > .container { max-width: none; padding-left: 0; padding-right: 0; }

.crumbs { color: var(--text-soft); font-size: 12.5px; margin-bottom: 16px; }
.crumbs a { color: var(--text-muted); }
.crumbs span.sep { margin: 0 6px; opacity: .6; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; letter-spacing: -.2px; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }

/* 首页头图 */
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 32px; margin-bottom: 8px; }
.hero p { color: var(--text-muted); margin: 0 0 20px; font-size: 15px; }

.search-bar { display: flex; gap: 10px; max-width: 620px; }
.search-bar input { flex: 1 1 auto; }

/* 过滤条 */
.filter-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 24px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button, .tabs .btn {
  border-color: transparent; background: transparent; color: var(--text-muted);
  padding: 7px 13px; border-radius: 999px; font-size: 14px;
}
.tabs button:hover, .tabs .btn:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active, .tabs .btn.active {
  background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600;
}
.filter-bar .spacer { flex: 1 1 auto; }

/* ---------------- 图库网格 ---------------- */

.gallery-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(266px, 1fr));
}

.photo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.photo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }

.photo-card .thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
  background: var(--surface-2) center/cover no-repeat; overflow: hidden;
}
.photo-card .thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.photo-card:hover .thumb img { transform: scale(1.035); }
.photo-card .thumb .chip {
  position: absolute; left: 10px; top: 10px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(4px);
}

.photo-card .meta { padding: 12px 14px 14px; }
.photo-card .meta .t { font-weight: 650; font-size: 15px; margin-bottom: 6px; line-height: 1.45; }
.photo-card .meta .t a { color: var(--text); }
.photo-card .meta .s { color: var(--text-muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  display: inline-grid; place-items: center; font-size: 10px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); text-transform: uppercase;
}

.like {
  border: none; background: transparent; color: var(--text-soft);
  padding: 2px 4px; font-size: 12.5px; gap: 4px;
}
.like:hover { background: transparent; color: var(--accent); }

/* 徽标 */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; line-height: 1.7;
  border: 1px solid var(--border-strong); color: var(--text-muted); background: var(--surface-2);
}
.badge.aviation { color: #0b6bcb; border-color: #b6dcff; background: #eff8ff; }
.badge.railway { color: #7a3fc4; border-color: #dcc7f5; background: #f7f1fe; }
[data-theme="dark"] .badge.aviation { color: #8ec9ff; border-color: #1d3a55; background: #12212e; }
[data-theme="dark"] .badge.railway { color: #c9a6f5; border-color: #3d2b55; background: #1e1729; }
.badge.ok { color: #067647; border-color: #abefc6; background: #ecfdf3; }
.badge.pending { color: #b54708; border-color: #fedf89; background: #fffaeb; }
.badge.bad { color: #b42318; border-color: #fecdca; background: #fef3f2; }
[data-theme="dark"] .badge.ok { color: #75e0a7; border-color: #1e4d33; background: #10231a; }
[data-theme="dark"] .badge.pending { color: #fec84b; border-color: #5a4416; background: #241c0c; }
[data-theme="dark"] .badge.bad { color: #ffb4ab; border-color: #5a2626; background: #2b1a1a; }

/* ---------------- 卡片 / 面板 ---------------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }

.panel-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.panel-title h2, .panel-title h3 { margin: 0; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.stack { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 880px) { .stack { grid-template-columns: 1fr; } }

.empty { text-align: center; color: var(--text-muted); padding: 44px 20px; }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; font-weight: 600; }

.load-more-wrap { text-align: center; margin-top: 26px; }
.load-more-wrap button { min-width: 160px; }

/* ---------------- 表单 ---------------- */

input, textarea, select {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
input[type="color"] { padding: 2px; }
textarea { min-height: 88px; resize: vertical; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 13px; font-weight: 500; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.row.tight { flex: 0 0 auto; align-items: center; gap: 8px; }
.row.tight > * { flex: 0 0 auto; }
.spacer { flex: 1 1 auto; }

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; white-space: nowrap; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
td.wrap { word-break: break-all; max-width: 320px; }

/* ---------------- 标签云 ---------------- */

.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tagcloud a {
  color: var(--text-muted); padding: 4px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tagcloud a:hover { color: var(--accent); border-color: var(--accent-ring); opacity: 1; }

/* ---------------- 详情 / 回答 ---------------- */

.answer-block { border-left: 3px solid var(--accent-soft); padding: 2px 0 2px 14px; margin-bottom: 16px; }
.answer-block .q { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.answer-block .a { white-space: pre-wrap; }

.meta-list { display: grid; gap: 10px; margin: 0; }
.meta-list div { display: flex; gap: 10px; font-size: 14px; }
.meta-list dt, .meta-list .k { color: var(--text-muted); flex: 0 0 84px; }
.meta-list dd, .meta-list .v { margin: 0; flex: 1 1 auto; word-break: break-word; }

/* ---------------- 上传页 ---------------- */

.grid9 { display: grid; grid-template-columns: repeat(3, 46px); gap: 6px; }
.grid9 button { padding: 0; height: 46px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); }
.grid9 button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

canvas.preview {
  width: 100%; max-width: 380px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); display: block;
}

/* 固定水印文字（不可修改） */
.wm-fixed {
  padding: 9px 12px; border-radius: 9px;
  border: 1px dashed var(--border-strong); background: var(--surface-2);
  color: var(--text-muted); font-size: 14px; letter-spacing: .3px;
  user-select: none; -webkit-user-select: none;
}

.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* FilePond 适配主题 */
.filepond--root { margin-bottom: 0; font-family: inherit; }
.filepond--panel-root { background: var(--surface-2); border: 1px dashed var(--border-strong); }
.filepond--drop-label { color: var(--text-muted); }
.filepond--label-action { color: var(--accent); }

/* ---------------- 通知 / 提示 ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 999px; z-index: 200;
  box-shadow: var(--shadow-lg); max-width: 90vw; font-size: 14px;
}

.notice { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.notice-info { border-color: var(--accent-ring); background: var(--accent-soft); }

/* ---------------- 页脚 ---------------- */

.footer {
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; margin-top: 48px;
}
.footer .container { padding-top: 28px; padding-bottom: 24px; }
.footer-grid { display: flex; gap: 28px; flex-wrap: wrap; justify-content: space-between; }
.footer-brand { max-width: 320px; }
.footer-brand .logo-text { font-size: 16px; }
.footer-brand p { margin: 10px 0 0; color: var(--text-soft); font-size: 12.5px; line-height: 1.7; }
.footer-links { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-links h4 { margin: 0 0 10px; font-size: 13px; color: var(--text); font-weight: 600; }
.footer-links a { display: block; color: var(--text-muted); font-size: 13px; margin-bottom: 7px; }
.footer-bottom {
  border-top: 1px solid var(--border); margin-top: 22px; padding-top: 16px;
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  color: var(--text-soft); font-size: 12.5px;
}

/* ---------------- 工具类 ---------------- */

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none !important; }
.poem { font-style: italic; color: var(--text-soft); }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: 0; }

.skeleton { background: var(--skeleton); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 展示层彩蛋动画（由后台开关统一控制，不影响功能） */
.fly { position: fixed; font-size: 22px; pointer-events: none; z-index: 300; animation: fly 1.1s ease-out forwards; }
@keyframes fly { to { transform: translate(90px, -160px) rotate(28deg); opacity: 0; } }

/* 角落偶发浮现的抽象短句 */
.whisper {
  position: fixed; right: 18px; bottom: 18px; z-index: 250;
  max-width: 60vw; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  color: var(--text-muted); font-size: 13px; font-style: italic;
  box-shadow: var(--shadow-md); pointer-events: none;
  animation: whisperIn .5s ease-out both;
}
@keyframes whisperIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.shake { animation: shake .18s linear 2; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* 响应式 */
@media (max-width: 900px) {
  .main-nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  header.site .header-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .hero h1 { font-size: 24px; }
  main { padding: 16px 0 40px; }
}
@media (max-width: 560px) {
  .container { padding: 0 14px; }
  .photo-card .meta { padding: 10px; }
  .photo-card .meta .t { font-size: 14px; }
  .header-user { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
