:root {
  --bg: #f5efe4;
  --paper: #f1e9db;
  --surface: #fbf7f0;
  --text: #2a231d;
  --muted: #6f655a;
  --line: #e2d7c5;
  --accent: #b0532c;
  --accent-ink: #8f3f1f;
  --shadow: 0 1px 2px rgba(60,40,20,.05), 0 10px 30px rgba(60,40,20,.08);
  --serif: "Fraunces", "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --radius: 20px;
  --gap: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1814; --paper: #221e19; --surface: #26211b; --text: #efe7da; --muted: #a89c8c;
    --line: #3a332a; --accent: #e08a5e; --accent-ink: #f0a47c; --shadow: 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #1b1814; --paper: #221e19; --surface: #26211b; --text: #efe7da; --muted: #a89c8c;
  --line: #3a332a; --accent: #e08a5e; --accent-ink: #f0a47c; --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

.eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
.kicker-box { display: inline-block; border: 1.5px solid rgba(255,255,255,.85); color: #fff; border-radius: 6px; padding: 4px 12px; font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 26px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.brand span { font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .3em; color: var(--muted); }
.topbar nav a { font-size: 16px; font-weight: 500; }
.topbar nav a.on { color: var(--accent); }

/* ---------- 首页大图 ---------- */
.home-hero { position: relative; border-radius: var(--radius); overflow: hidden; min-height: clamp(380px, 62vh, 640px); display: flex; align-items: center; background: #3a3128; }
.home-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,14,8,.62) 0%, rgba(20,14,8,.35) 45%, rgba(20,14,8,.05) 80%), linear-gradient(0deg, rgba(20,14,8,.35), transparent 40%); }
.home-hero-inner { position: relative; padding: 48px clamp(24px, 6vw, 84px); max-width: 860px; color: #fbf6ee; }
.home-hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(44px, 8vw, 104px); line-height: 1.02; letter-spacing: -.02em; margin: 26px 0 18px; }
.home-hero .lede { font-size: clamp(17px, 2vw, 22px); line-height: 1.6; margin: 0; max-width: 620px; opacity: .95; }

/* ---------- 数据栏 ---------- */
.stats { margin-top: 40px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.stats > div { padding: 34px 16px 30px; text-align: center; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats .label { display: block; font-size: 13px; letter-spacing: .22em; color: var(--muted); }
.stats b { display: block; font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 5vw, 64px); line-height: 1.1; margin-top: 10px; color: var(--accent); }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats > div { padding: 22px 10px; }
}

/* ---------- 最新的旅行 ---------- */
.latest { margin-top: 72px; }
.feature { margin-top: 22px; display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.feature-img { border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 2; background: var(--line); }
.feature-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.feature:hover .feature-img img { transform: scale(1.03); }
.feature .meta { color: var(--muted); font-size: 16px; }
.feature h2 { font-family: var(--serif); color: var(--accent); font-weight: 600; font-size: clamp(32px, 4vw, 52px); line-height: 1.15; margin: 10px 0 16px; letter-spacing: -.01em; }
.feature p { font-size: 19px; color: var(--muted); margin: 0 0 22px; }
.more { color: var(--accent); font-weight: 500; font-size: 18px; }
.more i { font-style: normal; display: inline-block; transition: transform .2s; margin-left: 6px; }
.feature:hover .more i { transform: translateX(4px); }
@media (max-width: 820px) { .feature { grid-template-columns: 1fr; } }

/* ---------- 全部旅行 ---------- */
.journal { margin-top: 88px; }
.journal-head .big { font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 6vw, 68px); line-height: 1.05; margin: 0; letter-spacing: -.02em; }
.journal-head p { color: var(--muted); font-size: 18px; margin: 12px 0 0; }
.grid { margin-top: 36px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 44px 32px; }
.jimg { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 2; background: var(--line); }
.jimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.jcard:hover .jimg img { transform: scale(1.04); }
.tag { position: absolute; left: 16px; top: 16px; background: rgba(251,247,240,.94); color: var(--accent-ink); border: 1.5px solid var(--accent); border-radius: 6px; padding: 3px 10px; font-size: 13px; font-weight: 600; letter-spacing: .14em; }
.jmeta { margin-top: 18px; font-size: 14px; letter-spacing: .16em; color: var(--muted); }
.jmeta i, .dest-hero .meta i { font-style: normal; margin: 0 10px; }
.jcard h3 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.2; margin: 8px 0 8px; }
.jcard:hover h3 { color: var(--accent); }
.jcard p { color: var(--muted); font-size: 17px; margin: 0; }

.footprint { margin-top: 80px; }
.map { margin-top: 18px; height: 360px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--line); z-index: 0; }

/* ---------- 目的地页 ---------- */
.crumb { display: inline-block; color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.crumb:hover { color: var(--accent); }
.crumb.bottom { margin-top: 56px; }
.dest-hero { position: relative; border-radius: var(--radius); overflow: hidden; min-height: clamp(360px, 64vh, 660px); display: flex; align-items: flex-end; background: #3a3128; }
.dest-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dest-hero .shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(20,14,8,.72) 0%, rgba(20,14,8,.25) 50%, rgba(20,14,8,.05) 100%); }
.dest-hero .inner { position: relative; padding: 40px clamp(24px, 5vw, 64px); color: #fbf6ee; max-width: 900px; }
.dest-hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(42px, 7.5vw, 96px); line-height: 1.04; letter-spacing: -.02em; margin: 20px 0 12px; }
.dest-hero .meta { font-size: 16px; opacity: .92; }
.kicker-edit { display: flex; gap: 8px; flex-wrap: wrap; }

.intro-row { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 44px 0 4px; }
@media (min-width: 860px) { .intro-row.has-map { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.intro { font-family: var(--serif); font-size: clamp(20px, 2.4vw, 26px); line-height: 1.55; margin: 0; max-width: 820px; }
.daynav { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.daynav a { border: 1px solid var(--line); border-radius: 99px; padding: 7px 18px; font-size: 15px; background: var(--surface); }
.daynav a:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.intro-row .map { margin-top: 0; height: 280px; }

.day { padding-top: 64px; scroll-margin-top: 12px; }
.day-head { display: grid; grid-template-columns: 1fr auto; align-items: end; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.day-head .eyebrow { grid-column: 1 / -1; }
.day-head h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.15; margin: 6px 0 0; letter-spacing: -.01em; }
.day-head .count { color: var(--muted); font-size: 14px; letter-spacing: .12em; }
.day-caption { margin: 0 0 22px; font-size: 18px; color: var(--muted); max-width: 760px; }

.masonry { display: flex; gap: var(--gap); align-items: flex-start; }
.masonry .col { flex: 1; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.tile { position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--line); cursor: zoom-in; }
.tile img { width: 100%; height: auto; transition: transform .5s ease, opacity .4s ease; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile .time { position: absolute; right: 10px; bottom: 10px; color: #fff; font-size: 12px; background: rgba(0,0,0,.42); padding: 1px 9px; border-radius: 99px; opacity: 0; transition: opacity .2s; }
.tile:hover .time { opacity: 1; }

/* ---------- 灯箱 ---------- */
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(14,11,8,.96); display: flex; align-items: center; justify-content: center; }
.lb[hidden] { display: none; }
.lb-figure { margin: 0; max-width: 100vw; max-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 56px 16px 16px; }
.lb-img { max-width: calc(100vw - 32px); max-height: calc(100vh - 140px); object-fit: contain; user-select: none; -webkit-user-drag: none; border-radius: 4px; }
.lb-cap { color: #eee4d6; font-size: 15px; margin-top: 14px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.lb-text { font-family: var(--serif); font-size: 18px; }
.lb-meta { color: #9b8f80; font-size: 13px; letter-spacing: .06em; }
.lb-btn { position: absolute; background: rgba(255,255,255,.08); color: #fff; border: 0; border-radius: 99px; width: 46px; height: 46px; font-size: 26px; cursor: pointer; line-height: 1; display: grid; place-items: center; z-index: 2; }
.lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-close { top: 12px; right: 12px; font-size: 20px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) { .lb-prev, .lb-next { display: none; } }

.empty { padding: 120px 0; text-align: center; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 13px; letter-spacing: .08em; padding: 80px 16px 44px; }
.leaflet-popup-content img { border-radius: 6px; }

/* ---------- 文字排版 ---------- */
.intro, .day-caption, .lb-text, .home-hero .lede { white-space: pre-line; }

/* ---------- 编辑模式 ---------- */
body.editing { padding-bottom: 96px; }
.editable { outline: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 5px; border-radius: 4px; cursor: text; min-width: 120px; }
.editable:hover, .editable:focus { outline-style: solid; outline-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.home-hero .editable, .dest-hero .editable { outline-color: rgba(255,255,255,.65); }
.home-hero .editable:focus, .dest-hero .editable:focus { background: rgba(0,0,0,.25); outline-color: #fff; }
.editable:empty::before { content: attr(data-ph); color: var(--muted); opacity: .85; }
.home-hero .editable:empty::before, .dest-hero .editable:empty::before { color: rgba(255,255,255,.75); }
p.editable { display: block; }
.home-hero h1.editable:empty::before, .dest-hero h1.editable:empty::before { font-size: .45em; }
.day-caption.editable { min-height: 1.6em; }
.tile-badge { position: absolute; left: 8px; top: 8px; font-size: 12px; color: #fff; background: rgba(0,0,0,.45); padding: 1px 8px; border-radius: 99px; }
.tile-badge.has { background: var(--accent); }
.editbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 900; width: min(760px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.18); border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.eb-info { display: flex; flex-direction: column; line-height: 1.35; }
.eb-status { color: var(--muted); font-size: 12px; }
.eb-status.ok { color: #2f7d4b; }
.eb-status.err { color: #c0392b; }
.eb-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.eb-actions button, .lb-edit button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.lb-edit { display: flex; gap: 8px; align-items: stretch; width: min(640px, calc(100vw - 32px)); margin-bottom: 4px; }
.lb-edit textarea { flex: 1; font: inherit; font-size: 16px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.lb-edit textarea:focus { outline: none; border-color: #fff; }
.lb-edit-btns { display: flex; flex-direction: column; gap: 6px; }
.lb-edit button { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); white-space: nowrap; }
.lb-edit .lb-save { background: var(--accent); border-color: var(--accent); }
.lb-edit button:disabled { opacity: .6; cursor: default; }
body.editing .lb-img { max-height: calc(100vh - 200px); }
@media (max-width: 640px) {
  .editbar { bottom: 8px; padding: 8px; }
  .eb-actions button { padding: 6px 8px; }
  .lb-edit { flex-direction: column; }
  .lb-edit-btns { flex-direction: row; }
  .lb-edit-btns button { flex: 1; }
}
.pw-mask { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; }
.pw-box { background: var(--surface); color: var(--text); border-radius: 14px; padding: 22px; width: min(360px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pw-box h3 { margin: 0 0 6px; font-family: var(--serif); }
.pw-box p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.pw-box input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.pw-err { color: #c0392b; font-size: 13px; min-height: 20px; margin: 6px 0; }
.pw-btns { display: flex; gap: 8px; justify-content: flex-end; }
.pw-btns button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.pw-btns .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
