/* ── Itinerary page — document-style presentation layer ── */

:root {
  --ink: #111827;
  --body: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --accent: #2563eb;
  --paper: #fdf9ef;
  --paper-edge: #d9b458;
  --col: 780px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--body);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}

.mi {
  font-family: 'Material Symbols Outlined';
  font-size: 1.1em;
  vertical-align: -0.18em;
  line-height: 1;
  font-weight: normal;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ── */

#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px 24px 0;
}
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  transition: all 0.2s ease;
}
.topbar-back:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.topbar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ── Sticky stop nav ── */

#stop-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 8px 0 10px;
  margin-top: 12px;
}
.nav-row {
  display: flex;
  gap: 6px;
  max-width: var(--col);
  margin: 0 auto;
  padding: 3px 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-row::-webkit-scrollbar { display: none; }

.stop-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 5px 12px 5px 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--body);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.stop-tab:hover { border-color: var(--faint); }
.stop-tab.active { border-color: var(--accent); background: #eff6ff; }
.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.tab-label { font-weight: 600; color: var(--ink); }
.tab-dates { color: var(--muted); font-size: 11.5px; }

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 11px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-chip:hover { border-color: var(--faint); color: var(--body); }
.filter-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-chip .count { opacity: 0.55; font-size: 11px; }

/* ── Layout column ── */

#itinerary-root { max-width: var(--col); margin: 0 auto; padding: 0 24px 120px; }

/* ── Cover ── */

.cover { padding: 44px 0 20px; border-bottom: 1px solid var(--line); }
.cover-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.cover-title {
  font-size: clamp(30px, 5.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.12;
  color: var(--ink);
}
.cover-sub { margin-top: 12px; font-size: 17px; color: var(--muted); max-width: 56ch; }
.cover-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.cover-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--body);
}
.cover-chip .mi { color: var(--muted); }

.overview-block { margin-top: 34px; }
#overview-map {
  height: 430px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 12px;
}
.overview-pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  font-family: inherit;
}
.overview-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 14px;
  margin-top: 14px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.legend-item:hover { background: var(--bg-soft); }
.legend-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.legend-main { min-width: 0; display: flex; flex-direction: column; }
.legend-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-dates { font-size: 11.5px; color: var(--muted); }

/* ── Chapters ── */

.chapter { padding: 52px 0 8px; border-bottom: 1px solid var(--line); }
.chapter:last-child { border-bottom: none; }

.chapter-thumb {
  height: 260px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(120deg, #eef2f7, #f7f9fb 60%, #eef2f7);
  margin-bottom: 22px;
  position: relative;
}
.chapter-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 34px;
}

.chapter-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.chapter-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
}
.chapter-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.chapter-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 2.5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--body);
}
.info-badge.booking-booked { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.info-badge.booking-dropin { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.info-badge.booking-unverified { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.info-badge.booking-fallback { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.info-badge.type-book { background: var(--paper); border-color: #ecd9a8; color: #8a6a1f; }
.info-badge.risk { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

.chapter-lead { margin-top: 18px; font-size: 16.5px; color: var(--ink); font-weight: 500; }
.chapter-summary { margin-top: 10px; color: var(--body); max-width: 62ch; }
.chapter-empty { margin-top: 20px; font-size: 13.5px; color: var(--faint); font-style: italic; }

.chapter-map-link, .tl-map-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
}
.tl-map-link { margin-top: 8px; font-size: 12.5px; }

/* ── Book quote ── */

.book-quote {
  margin: 22px 0 4px;
  background: var(--paper);
  border-left: 3px solid var(--paper-edge);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px 13px;
}
.book-quote blockquote {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 15px;
  color: #4b3f21;
  line-height: 1.6;
}
.book-quote figcaption {
  margin-top: 9px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a6a1f;
}

/* ── Timeline ── */

.timeline { margin-top: 26px; }
.tl-phase { display: flex; gap: 16px; }
.tl-rail {
  flex-shrink: 0;
  width: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.tl-rail::before {
  content: '';
  position: absolute;
  top: 30px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}
.tl-phase:last-child .tl-rail::before { display: none; }
.tl-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
  z-index: 1;
}
.tl-dot .mi { font-size: 16px; vertical-align: 0; }
.tl-content { flex: 1; min-width: 0; padding-bottom: 26px; }
.tl-phase-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 7px 0 8px;
}
.tl-item { padding: 8px 0; }
.tl-item + .tl-item { border-top: 1px dashed var(--line); }
.tl-item-title { font-size: 14.5px; font-weight: 650; color: var(--ink); }
.tl-item-title .mi { color: var(--muted); margin-right: 3px; }
.tl-item-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-item-meta.booked { color: #047857; font-weight: 600; }
.tl-item-desc { font-size: 13.5px; color: var(--body); margin-top: 4px; max-width: 60ch; }
.tl-item-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-soft);
}
.tl-item.journey.ferry .tl-item-title .mi { color: #0e7490; }

/* ── Fallbacks ── */

.chapter-fallbacks { margin-top: 18px; }
.chapter-fallbacks summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  user-select: none;
  padding: 4px 0;
  list-style: none;
}
.chapter-fallbacks summary::-webkit-details-marker { display: none; }
.chapter-fallbacks summary::after { content: ' ▸'; color: var(--faint); }
.chapter-fallbacks[open] summary::after { content: ' ▾'; }
.fallback-row {
  display: flex;
  gap: 11px;
  padding: 9px 0 9px 4px;
  border-top: 1px dashed var(--line);
}
.fallback-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 6px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 800;
}

/* ── POI rows ── */

.chapter-pois { margin-top: 26px; }
.chapter-section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.chapter-section-label .count { font-weight: 600; letter-spacing: 0; }
.poi-list { margin-top: 6px; }
.poi-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.poi-row:first-child { border-top: none; }
.poi-row.filtered-out { display: none; }
.chapter-pois.filtered-empty .poi-list::after {
  content: 'Nothing in this category here.';
  display: block;
  padding: 10px 0;
  font-size: 12.5px;
  color: var(--faint);
  font-style: italic;
}
.poi-icon { flex-shrink: 0; width: 26px; height: 26px; margin-top: 2px; }
.poi-icon img { width: 100%; height: 100%; }
.poi-main { flex: 1; min-width: 0; }
.poi-name { font-size: 14px; font-weight: 650; color: var(--ink); }
.poi-name:hover { color: var(--accent); }
.poi-name-plain { font-size: 14px; font-weight: 650; color: var(--ink); }
.poi-tagline { font-size: 13px; color: var(--body); margin-top: 2px; max-width: 62ch; }
.poi-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

.poi-quote { margin-top: 7px; }
.poi-quote summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  color: #8a6a1f;
  user-select: none;
  list-style: none;
}
.poi-quote summary::-webkit-details-marker { display: none; }
.poi-quote summary::after { content: ' ▸'; }
.poi-quote[open] summary::after { content: ' ▾'; }
.poi-quote-text {
  margin-top: 6px;
  background: var(--paper);
  border-left: 3px solid var(--paper-edge);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 13.5px;
  color: #4b3f21;
}

/* ── Epilogue / empty state ── */

.chapter.epilogue .chapter-kicker { color: var(--muted); }

.empty-state { text-align: center; padding: 110px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 40px; color: var(--faint); margin-bottom: 14px; }
.empty-state h1 { font-size: 22px; color: var(--ink); margin-bottom: 8px; }

/* ── Responsive ── */

@media (max-width: 640px) {
  #itinerary-root, #topbar, .nav-row { padding-left: 16px; padding-right: 16px; }
  .cover { padding-top: 28px; }
  #overview-map { height: 320px; }
  .chapter-thumb { height: 190px; }
  .tab-dates { display: none; }
}

/* ── Print ── */

@media print {
  #topbar, #stop-nav, .chapter-map-link, .tl-map-link { display: none; }
  .chapter { break-inside: avoid-page; border-bottom: 1px solid #ccc; padding-top: 28px; }
  #overview-map { display: none; }
  details { display: block; }
  details > *:not(summary) { display: block; }
}
