/* ============================================================
   足迹 / Traces  v3  —  时间线在左 · 地图在右(占大头) · 小圆点
   Hermes 2026-10-04
   ============================================================ */
@import url("/footprints-data/app/skins.css");
#traces-app {
  --tr-bg: #0c1117;
  --tr-surface: #161e28;
  --tr-surface-2: #1e2836;
  --tr-border: #2c3a4c;
  --tr-text: #eaf1f9;
  --tr-muted: #9aabc0;
  --tr-accent: #38bdf8;
  --tr-accent-2: #34d399;
  --tr-chip: #1c2733;
  --tr-radius: 14px;
  --tr-shadow: 0 10px 34px rgba(0, 0, 0, .42);
  color: var(--tr-text);
  font-size: 15px;
}
#traces-app.tr-light {
  --tr-bg: #f6f8fb;
  --tr-surface: #ffffff;
  --tr-surface-2: #f1f4f9;
  --tr-border: #dfe6ef;
  --tr-text: #16202e;
  --tr-muted: #5d6b7e;
  --tr-accent: #0284c7;
  --tr-accent-2: #059669;
  --tr-chip: #eef2f7;
  --tr-shadow: 0 10px 30px rgba(15, 23, 42, .10);
}
/* 类型色 */
#traces-app { --ty-race: #f59e0b; --ty-work: #a78bfa; --ty-daily: #22d3ee; --ty-travel: #34d399; --ty-food: #fb7185; --ty-other: #94a3b8; }
.tr-tag.ty-race { color: var(--ty-race); border-color: color-mix(in srgb, var(--ty-race) 50%, transparent); }
.tr-tag.ty-work { color: var(--ty-work); border-color: color-mix(in srgb, var(--ty-work) 50%, transparent); }
.tr-tag.ty-daily { color: var(--ty-daily); border-color: color-mix(in srgb, var(--ty-daily) 50%, transparent); }
.tr-tag.ty-travel { color: var(--ty-travel); border-color: color-mix(in srgb, var(--ty-travel) 50%, transparent); }
.tr-tag.ty-food { color: var(--ty-food); border-color: color-mix(in srgb, var(--ty-food) 50%, transparent); }

/* ---------- 头部 ---------- */
.tr-head { margin-bottom: 16px; }
.tr-title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.tr-sub { color: var(--tr-muted); margin: 0 0 16px; max-width: 62ch; line-height: 1.6; }
.tr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.tr-stat { background: var(--tr-surface); border: 1px solid var(--tr-border); border-radius: var(--tr-radius); padding: 12px 14px; }
.tr-stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; }
.tr-stat span { color: var(--tr-muted); font-size: 12.5px; }
.tr-recent {
  margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--tr-surface); border: 1px solid var(--tr-border);
  border-radius: var(--tr-radius); padding: 10px 14px; font-size: 13.5px;
}
.tr-recent .lbl { color: var(--tr-muted); }
.tr-recent b { font-size: 15px; }
.tr-recent .d { color: var(--tr-muted); }

/* ---------- 工具栏 ---------- */
.tr-tools {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 14px 0; padding: 10px; border-radius: var(--tr-radius);
  background: var(--tr-surface); border: 1px solid var(--tr-border);
  position: sticky; top: 8px; z-index: 30; backdrop-filter: blur(8px);
}
.tr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-chip {
  border: 1px solid var(--tr-border); background: var(--tr-chip); color: var(--tr-text);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.tr-chip:hover { border-color: var(--tr-accent); }
.tr-chip.on { background: var(--tr-accent); border-color: var(--tr-accent); color: #04121b; font-weight: 600; }
.tr-chip em { font-style: normal; opacity: .72; font-size: 12px; }
.tr-spacer { flex: 1 }
.tr-search { background: var(--tr-surface-2); border: 1px solid var(--tr-border); color: var(--tr-text); border-radius: 10px; padding: 7px 12px; min-width: 168px; font-size: 13.5px; }
.tr-search::placeholder { color: var(--tr-muted); }
.tr-seg { display: flex; border: 1px solid var(--tr-border); border-radius: 10px; overflow: hidden; }
.tr-seg button { background: transparent; border: 0; color: var(--tr-muted); padding: 7px 12px; cursor: pointer; font-size: 13.5px; }
.tr-seg button.on { background: var(--tr-accent); color: #04121b; font-weight: 600; }
.tr-icon-btn { background: transparent; border: 1px solid var(--tr-border); color: var(--tr-text); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }

/* ---------- 主体：时间线左 / 地图右 ---------- */
.tr-body { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
#traces-app[data-view="map"] .tr-body { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); align-items: start; }
#traces-app[data-view="map"] .tr-timeline { order: 1; }
#traces-app[data-view="map"] .tr-map-wrap { order: 2; }

.tr-map-wrap {
  background: var(--tr-surface); border: 1px solid var(--tr-border);
  border-radius: var(--tr-radius); overflow: hidden; position: relative;
  height: clamp(440px, 74vh, 900px);
}
#traces-app[data-view="map"] .tr-map-wrap { position: sticky; top: 74px; }
.tr-map { width: 100%; height: 100%; }
.tr-map-hint {
  position: absolute; left: 12px; bottom: 30px; z-index: 5;
  background: rgba(8, 14, 20, .78); color: #dbe7f3; font-size: 12px;
  padding: 5px 10px; border-radius: 8px; backdrop-filter: blur(4px); pointer-events: none;
}
.tr-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--tr-accent);
  border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(56, 189, 248, .32), 0 2px 8px rgba(0, 0, 0, .45);
  cursor: pointer;
}
.tr-dot.multi { box-shadow: 0 0 0 3px rgba(56, 189, 248, .32), 0 0 0 7px rgba(52, 211, 153, .30); }
.tr-dot.sel { background: var(--tr-accent-2); transform: scale(1.25); }
/* 重叠归并后的小圆点（不带文字，仅用叠影暗示"这里有多处"） */
.tr-dot.group { box-shadow: 0 0 0 3px rgba(56, 189, 248, .34), 4px 5px 0 -1px rgba(56, 189, 248, .52), 8px 10px 0 -3px rgba(56, 189, 248, .28); }

/* ---------- 地图控制面板 ---------- */
.tr-mapbar {
  position: absolute; top: 10px; right: 10px; z-index: 8;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.tr-mapbar .grp {
  display: flex; gap: 4px; background: rgba(10, 16, 24, .82); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px; padding: 4px; backdrop-filter: blur(6px);
}
.tr-mapbar button {
  background: transparent; border: 0; color: #d7e3f0; font-size: 12.5px;
  padding: 5px 9px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.tr-mapbar button.on { background: var(--tr-accent); color: #04121b; font-weight: 600; }
.tr-mapbar button:hover:not(.on) { background: rgba(255, 255, 255, .12); }
.tr-mapbar .loading { opacity: .55 }

/* ---------- 时间线 ---------- */
.tr-timeline { display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.tr-year { position: sticky; top: 66px; z-index: 6; margin: 12px 0 2px; font-size: 12.5px; font-weight: 700;
  letter-spacing: .12em; color: var(--tr-muted); background: linear-gradient(to right, var(--tr-bg), transparent); }
.tr-year:first-child { margin-top: 0; }
.tr-card {
  background: var(--tr-surface); border: 1px solid var(--tr-border);
  border-radius: var(--tr-radius); padding: 9px; cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  content-visibility: auto; contain-intrinsic-size: 240px;
}
.tr-card:hover { transform: translateY(-2px); border-color: var(--tr-accent); box-shadow: var(--tr-shadow); }
.tr-card.sel { border-color: var(--tr-accent-2); }
.tr-card-thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--tr-surface-2); margin-bottom: 8px; }
.tr-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tr-noimg {
  width: 100%; height: 100%; display: grid; place-items: center; gap: 4px;
  background: radial-gradient(circle at 30% 25%, var(--tr-surface-2), var(--tr-chip) 70%);
  color: var(--tr-muted);
}
.tr-noimg span { font-size: 26px; font-weight: 800; opacity: .5; letter-spacing: .05em; }
.tr-noimg i { font-style: normal; font-size: 10.5px; opacity: .55; }
.tr-card-name { font-weight: 650; font-size: 15px; line-height: 1.35; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-card-desc { color: var(--tr-muted); font-size: 12.5px; line-height: 1.5; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tr-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--tr-chip);
  color: var(--tr-muted); border: 1px solid var(--tr-border); }
.tr-tag.acc { color: var(--tr-accent); border-color: color-mix(in srgb, var(--tr-accent) 45%, transparent); }
.tr-tag.visit { color: var(--tr-accent-2); border-color: color-mix(in srgb, var(--tr-accent-2) 45%, transparent); }
.tr-date { font-size: 11.5px; color: var(--tr-muted); }

/* 时间线视图: 宽栏横向卡片 */
#traces-app[data-view="timeline"] .tr-timeline { max-width: 940px; margin: 0 auto; }
#traces-app[data-view="timeline"] .tr-card { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 12px; }
#traces-app[data-view="timeline"] .tr-card-thumb { margin-bottom: 0; height: 100%; aspect-ratio: auto; }
#traces-app[data-view="timeline"] .tr-card-main { display: flex; flex-direction: column; }
#traces-app[data-view="timeline"] .tr-card-meta { margin-top: auto; }

/* ---------- 图墙 ---------- */
.tr-wall { columns: 4 200px; column-gap: 12px; }
.tr-wall figure { margin: 0 0 12px; break-inside: avoid; border-radius: 12px; overflow: hidden; position: relative; background: var(--tr-surface-2); cursor: zoom-in; }
.tr-wall img { width: 100%; display: block; }
.tr-wall figcaption { position: absolute; inset: auto 0 0 0; padding: 20px 10px 8px; font-size: 12px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75)); opacity: 0; transition: .2s; }
.tr-wall figure:hover figcaption { opacity: 1; }

/* ---------- 抽屉 ---------- */
.tr-drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100%); background: var(--tr-surface);
  border-left: 1px solid var(--tr-border); z-index: 60; transform: translateX(105%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1); display: flex; flex-direction: column; box-shadow: var(--tr-shadow); }
.tr-drawer.open { transform: none; }
.tr-drawer-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--tr-border); }
.tr-drawer-head h3 { margin: 0 0 6px; font-size: 20px; font-weight: 700; padding-right: 34px; }
.tr-drawer-body { overflow: auto; padding: 16px 18px 40px; flex: 1; }
.tr-close { position: absolute; top: 12px; right: 12px; background: var(--tr-surface-2); border: 1px solid var(--tr-border);
  color: var(--tr-text); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 16px; line-height: 1; }
.tr-visit { border: 1px solid var(--tr-border); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: var(--tr-surface-2); }
.tr-visit-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tr-visit-head b { font-size: 14.5px; }
.tr-visit p { margin: 0 0 10px; color: var(--tr-muted); font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
.tr-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.tr-gal img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--tr-surface); }
.tr-merge-note { margin-top: 10px; font-size: 12px; color: var(--tr-muted); border-top: 1px dashed var(--tr-border); padding-top: 8px; }

/* ---------- 灯箱 ---------- */
.tr-lightbox { position: fixed; inset: 0; background: rgba(3, 7, 12, .94); z-index: 90; display: none; align-items: center; justify-content: center; flex-direction: column; }
.tr-lightbox.open { display: flex; }
.tr-lightbox img { max-width: 94vw; max-height: 82vh; object-fit: contain; border-radius: 8px; }
.tr-lb-bar { display: flex; gap: 14px; align-items: center; margin-top: 14px; color: #cbd5e1; font-size: 13px; }
.tr-lb-bar button { background: rgba(255, 255, 255, .12); border: 0; color: #fff; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.tr-lb-prev, .tr-lb-next { position: fixed; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .12);
  border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 20px; }
.tr-lb-prev { left: 14px; } .tr-lb-next { right: 14px; }

/* ---------- 状态 ---------- */
.tr-empty, .tr-loading { padding: 36px 0; text-align: center; color: var(--tr-muted); }
.tr-skel { border-radius: var(--tr-radius); background: linear-gradient(90deg, var(--tr-surface), var(--tr-surface-2), var(--tr-surface));
  background-size: 200% 100%; animation: tr-sk 1.2s infinite; height: 172px; margin-bottom: 10px; }
@keyframes tr-sk { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.tr-sentinel { height: 1px }

/* ---------- 窄屏: 地图在上 ---------- */
@media (max-width: 900px) {
  #traces-app[data-view="map"] .tr-body { grid-template-columns: minmax(0, 1fr); }
  #traces-app[data-view="map"] .tr-map-wrap { order: 1; position: static; height: clamp(320px, 46vh, 520px); }
  #traces-app[data-view="map"] .tr-timeline { order: 2; }
  #traces-app[data-view="timeline"] .tr-card { grid-template-columns: 128px minmax(0, 1fr); }
  .tr-wall { columns: 2 140px; }
  .tr-tools { position: static; }
  .tr-year { position: static; }
  .tr-mapbar { flex-direction: row; }
}
@media (prefers-reduced-motion: reduce) { #traces-app * { transition: none !important; animation: none !important; } }
