/* ===================================================================
   Heading South — Trail Guide app
   =================================================================== */
:root {
  --c-deep: #0e3a45;
  --c-deep-2: #0a2c34;
  --c-terra: #c8703f;
  --c-terra-d: #a85a2e;
  --c-gold: #d9a566;
  --c-sand: #f6efe6;
  --c-sand-2: #efe5d6;
  --c-ink: #1d2a2d;
  --c-muted: #5c6b6e;
  --c-line: rgba(14,58,69,.12);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --bar: 58px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--c-ink); background: var(--c-sand);
  line-height: 1.6; overflow: hidden;
}
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--c-terra); outline-offset: 2px; }

/* ---- App bar ---- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; height: calc(var(--bar) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 10px; padding-left: 12px; padding-right: 16px;
  background: var(--c-deep); color: #fff; z-index: 1000;
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.appbar__back {
  background: rgba(255,255,255,.12); border: 0; color: #fff; width: 38px; height: 38px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.appbar__brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-size: 1rem; }
.appbar__brand img { border-radius: 50%; }
.appbar__brand span { font-family: var(--serif); font-size: 1.15rem; }
.appbar__brand strong { color: var(--c-gold); font-weight: 600; }
.appbar__spacer { flex: 1; }

/* ---- Views ---- */
.view { position: absolute; inset: calc(var(--bar) + env(safe-area-inset-top)) 0 0 0; }
.view--list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 22px 16px calc(40px + env(safe-area-inset-bottom)); }

/* ---- List ---- */
.list-intro { max-width: 620px; margin: 4px auto 22px; text-align: center; }
.list-intro h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 6vw, 2.6rem); color: var(--c-deep); line-height: 1.1; margin-bottom: 10px; }
.list-intro p { color: var(--c-muted); font-size: .98rem; }

.trail-list { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.tcard {
  display: flex; gap: 0; background: #fff; border: 1px solid var(--c-line); border-radius: 18px;
  overflow: hidden; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
  box-shadow: 0 16px 36px -26px rgba(10,44,52,.5); transition: transform .25s var(--ease), box-shadow .25s;
}
.tcard:active { transform: scale(.985); }
.tcard__swatch { width: 8px; flex: none; }
.tcard__body { padding: 16px 18px; flex: 1; }
.tcard__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tcard__area { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--c-terra); font-weight: 700; }
.tcard h3 { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; color: var(--c-deep); margin: 2px 0 8px; }
.tcard__meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--c-muted); font-weight: 600; }
.tcard__meta span { display: inline-flex; align-items: center; gap: 5px; }
.diff-pill { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 4px 10px; border-radius: 100px; white-space: nowrap; }
.diff-easy { background: #e3f0e6; color: #2e7d4f; }
.diff-moderate { background: #fbeeda; color: #b3791f; }
.diff-hard { background: #f6e0d8; color: #b2462b; }
.list-foot { text-align: center; color: var(--c-muted); font-size: .85rem; margin-top: 26px; }

/* ---- Map view ---- */
.view--map { inset: 0; }
#map { position: absolute; inset: 0; background: #add0d8; z-index: 1; }
.leaflet-container { font-family: var(--sans); }

.locate-btn {
  position: absolute; right: 16px; z-index: 1200;
  bottom: calc(46vh + 18px);
  width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--c-deep); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,.4); transition: bottom .35s var(--ease), background .2s;
}
.locate-btn.active { background: var(--c-terra); color: #fff; }

/* ---- Bottom sheet ---- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1300;
  background: #fff; border-radius: 22px 22px 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px -16px rgba(0,0,0,.4);
  max-height: 82vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transition: transform .4s var(--ease);
}
.sheet.collapsed { transform: translateY(calc(100% - 132px)); }
.sheet__handle { width: 44px; height: 5px; border-radius: 3px; background: #d8cdbd; margin: 6px auto 14px; cursor: grab; }
.sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.sheet__tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--c-terra); font-weight: 700; }
.sheet__head h2 { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--c-deep); line-height: 1.1; margin-top: 2px; }
.sheet__diff { flex: none; }

.sheet__stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 16px 0; padding: 14px 0; border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.sheet__stats div { text-align: center; }
.sheet__stats strong { display: block; font-family: var(--serif); font-size: 1.4rem; color: var(--c-deep); }
.sheet__stats span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-muted); }

.sheet__desc { color: var(--c-muted); font-size: .95rem; margin-bottom: 14px; }
.sheet__poi { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.poi-row { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.poi-row b { color: var(--c-deep); }
.poi-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c-gold); margin-top: 3px; box-shadow: 0 0 0 4px rgba(217,165,102,.22); }

.guide-btn {
  width: 100%; border: 0; cursor: pointer; padding: 16px; border-radius: 100px;
  background: var(--c-terra); color: #fff; font-family: var(--sans); font-weight: 700; font-size: 1rem;
  box-shadow: 0 12px 26px -10px rgba(200,112,63,.7); transition: background .25s;
}
.guide-btn:active { background: var(--c-terra-d); }
.guide-btn.tracking { background: var(--c-deep); }
.sheet__note { text-align: center; font-size: .82rem; color: var(--c-muted); margin-top: 10px; min-height: 1.1em; }

/* ---- Leaflet marker tweaks ---- */
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7df6; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(47,125,246,.3); }
.pin {
  width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
}
.pin span { transform: rotate(45deg); color: #fff; font-size: 12px; font-weight: 700; }
.pin--start { background: #2e7d4f; }
.pin--end { background: #b2462b; }
.pin--poi { width: 20px; height: 20px; background: var(--c-gold); }

@media (min-width: 760px) {
  .sheet { left: auto; right: 16px; bottom: 16px; width: 380px; border-radius: 22px; max-height: calc(100% - 32px); }
  .sheet.collapsed { transform: translateY(calc(100% - 116px)); }
  .locate-btn { bottom: 26px; right: 412px; }
}
