/* ============================================================
   秋日北疆 · 行旅图志  —  Autumn-expedition atlas theme
   ============================================================ */

:root {
  /* paper & ink */
  --paper:      #f4ecda;
  --paper-2:    #efe6d0;
  --panel:      #fbf6ea;
  --panel-2:    #f6eeda;
  --ink:        #2c2117;
  --ink-soft:   #5b4c3a;
  --ink-faint:  #8a7860;
  --line:       #ddcba4;
  --line-soft:  #e7d9ba;

  /* autumn accents */
  --gold:       #c8791e;   /* larch / birch gold */
  --gold-deep:  #a85f12;
  --rust:       #a8431e;   /* yardang desert */
  --spruce:     #1f4b43;   /* forest */
  --teal:       #2c8a86;   /* glacial lake */
  --teal-deep:  #1c6663;
  --sky:        #d9b25a;

  --shadow:     0 1px 2px rgba(54,38,20,.08), 0 8px 24px rgba(54,38,20,.10);
  --shadow-lg:  0 18px 48px rgba(44,33,23,.22);

  --font-sans: "PingFang SC","Microsoft YaHei","Hiragino Sans GB","Heiti SC","Source Han Sans SC",system-ui,sans-serif;
  --font-kai:  "Kaiti SC","STKaiti",KaiTi,"楷体","Songti SC","STSong",serif;
  --font-num:  "Cormorant Garamond","Cormorant",Georgia,"Times New Roman",serif;

  --sidebar-w: 430px;
}

/* progressive-enhancement Latin display font (falls back to Georgia) */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/fontsource/fonts/cormorant-garamond:vf@latest/latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+2000-206F, U+2070-209F;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;            /* app shell scrolls internally */
}

/* paper grain + faint topographic wash */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(200,121,30,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(31,75,67,.10), transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/></svg>");
}

/* ---------- App shell ---------- */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "hero map" "list map";
  height: 100vh;
}

/* header / hero */
.hero {
  grid-area: hero;
  position: relative;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,250,238,.85), rgba(246,238,218,.7)),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
}

/* itinerary deck (scrolling left column) */
.deck {
  grid-area: list;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border-right: 1px solid var(--line);
  box-shadow: 6px 0 28px rgba(44,33,23,.06);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.deck::-webkit-scrollbar { width: 9px; }
.deck::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 2px solid var(--panel); }
.deck::-webkit-scrollbar-track { background: transparent; }
.hero__topo {
  position: absolute; inset: 0; z-index: 0; opacity: .5;
  color: var(--line);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero__kicker {
  font-size: 12px; letter-spacing: .42em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 600; margin: 0 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.hero__kicker::before { content: ""; width: 22px; height: 1.5px; background: var(--gold); }
.hero__title {
  font-family: var(--font-kai);
  font-size: clamp(30px, 4.6vw, 40px);
  line-height: 1.04; margin: 0; letter-spacing: .04em;
  color: var(--ink); font-weight: 700;
}
.hero__title em {
  font-style: normal; color: var(--rust);
}
.hero__sub {
  margin: 9px 0 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.6;
}
.hero__sub .en {
  font-family: var(--font-num); font-size: 16px; letter-spacing: .02em;
  color: var(--ink-faint); font-style: italic;
}

.stats { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.stat {
  flex: 1 1 0; min-width: 84px;
  background: rgba(255,253,247,.72);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 12px; text-align: center;
}
.stat b {
  display: block; font-family: var(--font-num);
  font-size: 24px; line-height: 1; color: var(--gold-deep); font-weight: 700;
}
.stat span { font-size: 11px; color: var(--ink-faint); letter-spacing: .12em; }

/* day list */
.daylist {
  padding: 14px 16px 10px;
}

.section-tip {
  font-size: 12px; color: var(--ink-faint); margin: 0 4px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-tip::after { content: ""; flex: 1; height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 11px); }

/* ---------- practical info accordion ---------- */
.infobox { margin-bottom: 14px; }
.info__toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-sans); font-size: 14px; font-weight: 700; color: var(--spruce);
  background: linear-gradient(180deg, rgba(31,75,67,.08), rgba(31,75,67,.04));
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .2s, background .2s;
}
.info__toggle:hover { border-color: var(--spruce); }
.info__caret { color: var(--ink-faint); }
.info__panel { display: none; }
.infobox.is-open .info__panel { display: block; margin-top: 8px; }
.info__item {
  border: 1px solid var(--line-soft); border-radius: 10px; margin-bottom: 7px;
  background: var(--panel); overflow: hidden;
}
.info__head {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink); user-select: none;
}
.info__ic { font-size: 15px; }
.info__chev { margin-left: auto; color: var(--ink-faint); font-size: 12px; transition: transform .25s; }
.info__item.is-open .info__chev { transform: rotate(90deg); color: var(--gold-deep); }
.info__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.info__item.is-open .info__body { grid-template-rows: 1fr; }
.info__inner { overflow: hidden; padding: 0 13px; }
.info__item.is-open .info__inner { padding: 0 13px 11px; }
.info__p { margin: 0 0 7px; font-size: 12.5px; line-height: 1.68; color: var(--ink-soft); }
.info__hi { color: var(--gold-deep); font-weight: 600; }
.info__ul { margin: 2px 0 6px; padding-left: 4px; list-style: none; }
.info__ul li { font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); padding-left: 16px; position: relative; margin-bottom: 4px; }
.info__ul li::before { content: "›"; position: absolute; left: 3px; color: var(--gold); font-weight: 700; }

.day {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  opacity: 0; transform: translateY(10px);
  animation: rise .55s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }
.day:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.day.is-active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200,121,30,.25), var(--shadow-lg); }

.day__head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; cursor: pointer; user-select: none;
}
.day__no {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-num); font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), var(--shadow);
}
.day__no small { display: block; font-family: var(--font-sans); font-size: 8.5px;
  letter-spacing: .22em; opacity: .82; margin-bottom: 2px; }
.day__no b { font-size: 21px; }
.day__meta { flex: 1 1 auto; min-width: 0; }
.day__route { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day__title { margin: 2px 0 0; font-size: 12.5px; color: var(--gold-deep);
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day__drive { margin-top: 5px; display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-faint); }
.day__drive span { display: inline-flex; align-items: center; gap: 4px; }
.day__chev { flex: none; color: var(--ink-faint); transition: transform .3s ease; }
.day.is-open .day__chev { transform: rotate(90deg); color: var(--gold-deep); }

.day__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .35s ease;
}
.day.is-open .day__body { grid-template-rows: 1fr; }
.day__bodyinner { overflow: hidden; }
.day__summary {
  margin: 0 15px 4px; padding: 0 0 11px; font-size: 13px; line-height: 1.66;
  color: var(--ink-soft); border-bottom: 1px dashed var(--line);
}

.spots { list-style: none; margin: 8px 0 6px; padding: 0 10px 8px; }
.spot {
  display: flex; gap: 11px; padding: 9px 8px; border-radius: 10px; cursor: pointer;
  transition: background .18s ease;
}
.spot:hover { background: var(--panel-2); }
.spot__pin {
  flex: none; margin-top: 2px; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700;
  font-family: var(--font-num); box-shadow: var(--shadow); white-space: nowrap; letter-spacing: .4px;
}
.spot__info { flex: 1 1 auto; min-width: 0; }
.spot__name { font-size: 14px; font-weight: 600; color: var(--ink); }
.spot__name .tag {
  font-size: 10px; font-weight: 600; color: var(--spruce);
  background: rgba(31,75,67,.10); border-radius: 6px; padding: 1px 6px; margin-left: 7px;
  vertical-align: middle;
}
.spot__desc { font-size: 12px; color: var(--ink-faint); line-height: 1.55; margin-top: 2px; }
.spot__chips { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 10.5px; color: var(--ink-soft);
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 1.5px 8px;
}
.chip.gold { color: var(--gold-deep); border-color: rgba(200,121,30,.35); background: rgba(200,121,30,.08); }

.day__foot {
  margin: 0 15px 14px; padding-top: 9px; font-size: 12px; color: var(--ink-soft);
  line-height: 1.6;
}
.day__foot .lbl { color: var(--gold-deep); font-weight: 700; margin-right: 5px; }

.credit {
  padding: 14px 22px 20px; font-size: 11px; color: var(--ink-faint);
  border-top: 1px solid var(--line); line-height: 1.7;
}
.credit a { color: var(--gold-deep); text-decoration: none; border-bottom: 1px dotted; }

/* ---------- Map ---------- */
.mapwrap { grid-area: map; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #e8e0cd; }
.leaflet-container { font-family: var(--font-sans); background: #e8e0cd; }

/* floating toolbar */
.toolbar {
  position: absolute; z-index: 500; top: 16px; left: 16px;
  display: flex; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 32px);
}
.btn {
  font-family: var(--font-sans);
  background: rgba(251,246,234,.94); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
  transition: background .15s, transform .12s, border-color .15s;
}
.btn:hover { background: #fff; border-color: var(--gold); transform: translateY(-1px); }
.btn.is-on { background: var(--gold); color: #fff; border-color: var(--gold-deep); }

.layerbox {
  position: absolute; z-index: 500; top: 16px; right: 16px;
  background: rgba(251,246,234,.94); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px); display: flex; gap: 4px;
}
.layerbox button {
  border: 0; background: transparent; color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s;
}
.layerbox button:hover { background: var(--panel-2); }
.layerbox button.is-on { background: var(--spruce); color: #fff; }

/* legend */
.legend {
  position: absolute; z-index: 500; bottom: 18px; right: 16px;
  background: rgba(251,246,234,.95); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px); max-width: 220px;
}
.legend h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em; color: var(--ink-faint); font-weight: 700; }
.legend__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; }
.legend__item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-soft); cursor: pointer; }
.legend__dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }

/* custom attraction marker (divIcon) — 2x larger, labelled day.spot e.g. 1.1 */
.pin {
  --c: var(--gold);
  width: 46px; height: 46px; position: relative;
  transform: translate(-50%, -100%);
}
.pin__body {
  position: absolute; left: 50%; top: 50%; width: 40px; height: 40px;
  transform: translate(-50%,-58%) rotate(45deg);
  background: var(--c); border-radius: 50% 50% 50% 3px;
  box-shadow: 0 5px 13px rgba(44,33,23,.45), inset 0 0 0 2px rgba(255,255,255,.62);
}
.pin__num {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%);
  color: #fff; font-family: var(--font-num); font-weight: 700; font-size: 15px;
  letter-spacing: .5px; white-space: nowrap;
  z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.pin.is-flash .pin__body { animation: pinpop .6s ease; }
@keyframes pinpop { 0%{transform:translate(-50%,-58%) rotate(45deg) scale(1);} 40%{transform:translate(-50%,-72%) rotate(45deg) scale(1.3);} 100%{transform:translate(-50%,-58%) rotate(45deg) scale(1);} }

/* day-level overview marker (shown when zoomed out) */
.daypin {
  --c: var(--gold);
  width: 46px; height: 54px; position: relative;
  transform: translate(-50%, -100%);
}
.daypin__body {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  transform: translate(-50%,-56%) rotate(45deg);
  background: var(--c); border-radius: 50% 50% 50% 4px;
  box-shadow: 0 7px 16px rgba(44,33,23,.5), inset 0 0 0 2.5px rgba(255,255,255,.85);
}
.daypin__lbl {
  position: absolute; left: 50%; top: 43%; transform: translate(-50%,-50%);
  color: #fff; font-family: var(--font-num); font-weight: 700; font-size: 20px; line-height: 1;
  z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,.4); text-align: center; white-space: nowrap;
}
.daypin__lbl small {
  display: block; font-family: var(--font-sans); font-size: 8px;
  letter-spacing: .18em; opacity: .9; margin-bottom: 1px;
}

/* popup */
.leaflet-popup-content-wrapper {
  background: var(--panel); color: var(--ink);
  border-radius: 14px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.leaflet-popup-tip { background: var(--panel); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.6; width: 252px !important; }
.pop__day { font-size: 11px; letter-spacing: .14em; color: var(--gold-deep); font-weight: 700; }
.pop__name { font-family: var(--font-kai); font-size: 19px; font-weight: 700; margin: 3px 0 2px; }
.pop__name .en { font-family: var(--font-num); font-size: 13px; color: var(--ink-faint); font-style: italic; font-weight: 400; margin-left: 6px; }
.pop__type { display: inline-block; font-size: 10.5px; color: var(--spruce);
  background: rgba(31,75,67,.10); border-radius: 6px; padding: 1px 7px; margin-bottom: 7px; }
.pop__desc { color: var(--ink-soft); }
.pop__hl { margin: 8px 0 0; padding: 0; list-style: none; }
.pop__hl li { font-size: 12px; color: var(--ink-soft); padding-left: 14px; position: relative; margin-top: 3px; }
.pop__hl li::before { content: "✦"; position: absolute; left: 0; color: var(--gold); font-size: 10px; }
.pop__meta { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* loading veil */
.veil {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: var(--paper); transition: opacity .6s ease;
}
.veil.hide { opacity: 0; pointer-events: none; }
.veil__inner { text-align: center; color: var(--ink-soft); }
.veil__mark { font-family: var(--font-kai); font-size: 40px; color: var(--gold-deep); letter-spacing: .1em; }
.veil__bar { width: 160px; height: 3px; margin: 14px auto 0; background: var(--line); border-radius: 3px; overflow: hidden; }
.veil__bar i { display: block; height: 100%; width: 40%; background: var(--gold);
  animation: load 1.1s ease-in-out infinite; border-radius: 3px; }
@keyframes load { 0%{transform:translateX(-120%);} 100%{transform:translateX(320%);} }

/* mobile menu button (hidden on desktop) */
.mobtoggle { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  html, body { height: auto; overflow: visible; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 48vh auto;
    grid-template-areas: "hero" "map" "list";
    height: auto; min-height: 100vh;
  }
  .hero { border-right: 0; }
  .deck { border-right: 0; box-shadow: none; overflow: visible; }
  .mapwrap {
    position: sticky; top: 0; height: 48vh; z-index: 10;
    box-shadow: 0 8px 20px rgba(44,33,23,.20);
  }
  #map { position: absolute; }
  .legend { display: none; }
  .layerbox { top: 12px; right: 12px; }
  .toolbar { top: 12px; left: 12px; }
  .hero__title { font-size: 28px; }
  :root { --sidebar-w: 100%; }
}
@media (max-width: 480px) {
  .stats { gap: 6px; }
  .stat { min-width: 70px; padding: 7px 8px; }
  .stat b { font-size: 20px; }
  .leaflet-popup-content { width: 210px !important; }
}
