:root {
  --bg: #faf6ec;          /* Vera Tours cream */
  --paper: #fffdf7;
  --ink: #1f2a33;
  --muted: #66707a;
  --line: #e6dcc6;
  --accent: #10395a;      /* Vera Tours navy */
  --accent-2: #b48a3c;    /* Vera Tours gold */
  --sea: #3f6f8a;
  --ok: #3c7a4a;
  --shadow: 0 2px 10px rgba(60, 40, 20, .15);
  --top-h: 52px;
  --tab-h: 58px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 10px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; flex: none; z-index: 1000;
}
.topbar h1 { font-size: 1.05rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: Georgia, "Times New Roman", serif; letter-spacing: .02em; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; padding: 0 8px 4px; }
.lang { display: flex; border: 1px solid rgba(255,255,255,.6); border-radius: 8px; overflow: hidden; }
.lang button { background: none; border: 0; color: #fff; padding: 6px 10px; font-size: .85rem; font-weight: 600; }
.lang button.on { background: #fff; color: var(--accent); }

main { flex: 1; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }

/* ---------- tab bar ---------- */
.tabbar {
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--paper); border-top: 1px solid var(--line); flex: none; z-index: 1000;
}
.tabbar button { flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); }
.tabbar button span { line-height: 0; }
.tabbar button b { font-size: .72rem; font-weight: 600; }
.tabbar button.on { color: var(--accent); }

/* ---------- map ---------- */
#map { position: absolute; inset: 0; background: #ece4d3; }
.leaflet-container { font: inherit; background: #ece4d3; }
.map-ctrls { position: absolute; right: 12px; top: 12px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--paper); box-shadow: var(--shadow); font-size: 1.4rem; color: var(--accent); }
.fab.on { background: var(--accent); color: #fff; }
.gps-status { position: absolute; left: 12px; top: 34px; z-index: 500; background: rgba(255,253,248,.92); border-radius: 8px; padding: 4px 9px; font-size: .75rem; color: var(--muted); box-shadow: var(--shadow); }
.gps-status:empty { display: none; }

.stop-pin { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.stop-pin.opt { background: var(--accent-2); }
.stop-pin.done { background: var(--ok); }
.stop-pin.sel { transform: scale(1.25); outline: 3px solid rgba(180,138,60,.55); }
.poi-pin { font-size: 15px; text-align: center; line-height: 22px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(26,115,232,.35), 0 1px 4px rgba(0,0,0,.4); position: relative; }
.me-dot .cone { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 26px solid rgba(26,115,232,.35); transform-origin: 50% 100%; margin-left: -9px; margin-top: -26px; display: none; }
.map-label { background: none; border: 0; box-shadow: none; color: #5a4a3c; font-size: 10.5px; font-style: italic; text-shadow: 0 0 3px #f3ecdd, 0 0 3px #f3ecdd; padding: 0; }
.map-label::before { display: none; }

.next-card {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 600;
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px;
  display: flex; gap: 12px; align-items: center;
}
.next-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.next-card .t { flex: 1; min-width: 0; }
.next-card .t small { color: var(--muted); display: block; font-size: .75rem; }
.next-card .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-card .t .d { font-size: .8rem; color: var(--accent); }
.next-card .open { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.next-card .nav { background: none; border: 0; font-size: 1.5rem; color: var(--muted); padding: 4px; }

/* ---------- list ---------- */
.list { padding: 8px 0 30px; overflow-y: auto; height: 100%; }
.list h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 16px 6px; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.row .num { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.row .num.opt { background: var(--accent-2); }
.row .num.done { background: var(--ok); }
.row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 600; }
.row .t small { color: var(--muted); font-size: .78rem; }
.row .dist { font-size: .78rem; color: var(--accent); white-space: nowrap; }
.summary { margin: 12px 16px 0; color: var(--muted); font-size: .85rem; }

/* ---------- stop / chapter detail ---------- */
.hero { position: relative; background: #000; }
.hero img { width: 100%; max-height: 46vh; object-fit: cover; display: block; }
.hero .badge { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 10px; border-radius: 20px; font-size: .78rem; }
.content { padding: 14px 16px; max-width: 760px; margin: 0 auto; }
.content h2 { font-family: Georgia, serif; font-size: 1.5rem; margin: 4px 0 2px; }
.content .sub { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.content h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 24px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.content p { line-height: 1.6; margin: 0 0 .8em; }
.content ul { padding-left: 1.2em; line-height: 1.55; }
.content li { margin-bottom: .4em; }
.readaloud { background: var(--paper); border-left: 4px solid var(--accent-2); border-radius: 0 10px 10px 0; padding: 12px 14px; box-shadow: var(--shadow); font-size: 1.05rem; }
.readaloud p:last-child { margin-bottom: 0; }
.optional-note { background: #fbeed9; border-radius: 8px; padding: 8px 10px; font-size: .85rem; margin: 6px 0; }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; scroll-snap-type: x mandatory; }
.gallery figure { margin: 0; flex: none; width: 74%; max-width: 360px; scroll-snap-align: start; }
.gallery img { width: 100%; height: 190px; object-fit: cover; border-radius: 10px; background: #ddd; }
.gallery figcaption { font-size: .78rem; color: var(--muted); line-height: 1.35; margin-top: 4px; }
.gallery .kind { display: inline-block; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; background: var(--line); color: var(--ink); border-radius: 4px; padding: 1px 5px; margin-right: 4px; }
.gallery .kind.reconstruction, .gallery .kind.plan, .gallery .kind.historic { background: var(--accent-2); color: #fff; }
.sources { font-size: .8rem; color: var(--muted); }
.sources a { color: var(--sea); word-break: break-all; }
.credit { font-size: .72rem; color: var(--muted); }
.credit a { color: var(--sea); }
.actions { display: flex; gap: 8px; margin: 10px 0 0; flex-wrap: wrap; }
.btn { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: .88rem; font-weight: 600; color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 24px; }
.pager .btn { flex: 1; text-align: center; }
dl.glossary dt { font-weight: 700; margin-top: 10px; }
dl.glossary dd { margin: 2px 0 0; line-height: 1.5; }
.timeline { border-left: 3px solid var(--accent-2); padding-left: 12px; margin-left: 4px; }
.timeline div { margin-bottom: 10px; line-height: 1.45; }
.timeline b { color: var(--accent); display: block; font-size: .85rem; }

/* ---------- toast / lightbox ---------- */
.toast { position: fixed; left: 12px; right: 12px; top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); z-index: 2000; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast span { flex: 1; }
.toast button { background: var(--accent-2); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.94); display: flex; flex-direction: column; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; margin: 0 auto; touch-action: pinch-zoom; }
.lightbox .lb-cap { color: #ddd; font-size: .82rem; padding: 10px 16px; text-align: center; }
.lightbox .lb-cap a { color: #9cc7e0; }
.lb-close { position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 12px; background: none; border: 0; color: #fff; font-size: 2.4rem; }
[hidden] { display: none !important; }

blockquote.quote { margin: 0 0 14px; padding: 12px 14px; background: #f1e7d3; border-radius: 10px; font-family: Georgia, "Times New Roman", serif; }
blockquote.quote p { font-style: italic; margin-bottom: .5em; }
blockquote.quote footer { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--ink); }
blockquote.quote .qctx { font-family: system-ui, sans-serif; font-style: normal; font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
sup.fn { font-size: .62em; line-height: 0; }
sup.fn a { color: var(--sea); text-decoration: none; padding: 0 1px; }
.sources li.hl { background: #fbeed9; border-radius: 4px; }

/* ---------- Vera Tours branding ---------- */
.topbar h1 .brand { font-style: italic; font-weight: 400; color: #e9d3a1; margin-right: 6px; }
.splash { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .5s ease; }
.splash img { width: min(78vw, 420px); height: auto; }
.splash .sub { font-family: Georgia, "Times New Roman", serif; color: var(--accent); letter-spacing: .32em; text-transform: uppercase; font-size: .9rem; }
.splash .bar { width: 120px; height: 2px; background: var(--line); overflow: hidden; border-radius: 2px; }
.splash .bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--accent-2); animation: splashbar 1.1s ease-in-out infinite; }
@keyframes splashbar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.splash.hide { opacity: 0; pointer-events: none; }
.brand-foot { text-align: center; padding: 18px 0 6px; }
.brand-foot img { width: 140px; height: auto; opacity: .95; }
/* keep the stop list compact: long dating notes are shown in full on the stop page */
.row .t small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* "Before we arrive" entry points */
.intro-banner { position: absolute; left: 10px; right: 66px; top: 62px; z-index: 600; background: var(--accent); color: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 8px 8px 8px 12px; display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.intro-banner span { flex: 1; }
.intro-banner .go { background: var(--accent-2); color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 600; }
.intro-banner .x { background: none; border: 0; color: #fff; font-size: 1.4rem; padding: 0 4px; }
.intro-card { display: flex; gap: 12px; align-items: center; width: calc(100% - 24px); margin: 4px 12px 8px; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--accent); color: #fff; text-align: left; box-shadow: var(--shadow); }
.intro-card img { width: 110px; height: 96px; object-fit: cover; flex: none; }
.intro-card b { display: block; font-family: Georgia, serif; font-size: 1.15rem; }
.intro-card small { display: block; color: #e9d3a1; margin-top: 2px; font-size: .8rem; }

/* regional annotations */
.ann-pin { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.ann-label { background: rgba(255,253,247,.85); border: 0; box-shadow: none; color: var(--accent); font-weight: 600; font-size: 11px; padding: 1px 5px; border-radius: 4px; }
.ann-label::before { display: none; }
.ann-pop b { display: block; font-family: Georgia, serif; font-size: 1rem; }
.ann-pop small { color: var(--muted); display: block; }
.ann-pop p { margin: 6px 0; line-height: 1.45; }
.ann-img { width: 100%; border-radius: 6px; margin-top: 6px; }
