:root {
  --bg: #0b1220;
  --panel: #111827;
  --panel-2: #0f172a;
  --line: #1f2937;
  --ink: #e5e7eb;
  --ink-dim: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #f59e0b;
  --good: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* Top nav */
.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topnav .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topnav .links {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.topnav .links a {
  color: var(--ink-dim);
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}

.topnav .links a.active,
.topnav .links a:hover {
  color: var(--ink);
  background: var(--panel-2);
  text-decoration: none;
}

/* Homepage layout */
.home {
  display: grid;
  grid-template-columns: 1fr 420px;
  height: calc(100vh - 56px);
}

#map {
  width: 100%;
  height: 100%;
  background: #0b1220;
}

.sidebar {
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 5;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-header .sub {
  color: var(--ink-dim);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.stat {
  text-align: center;
}

.stat strong {
  display: block;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.1;
}

.stat span {
  color: var(--ink-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stops-list {
  padding: 0.5rem 0;
}

.stop-row {
  display: flex;
  gap: 0.85rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
}

.stop-row:hover {
  background: var(--panel-2);
}

.stop-row.active {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--accent);
  padding-left: calc(1.25rem - 3px);
}

.stop-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  border: 2px solid #0b1220;
  box-shadow: 0 0 0 2px currentColor;
}

.stop-content { flex: 1; min-width: 0; }

.stop-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.stop-title .name {
  font-weight: 600;
  font-size: 0.95rem;
}

.stop-title .nights {
  color: var(--ink-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.stop-note {
  color: var(--ink-dim);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.country-divider {
  padding: 0.85rem 1.25rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.country-divider .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.country-divider .name {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}

.country-divider .meta {
  color: var(--ink-dim);
  font-size: 0.78rem;
}

.country-divider a {
  color: var(--ink-dim);
  font-size: 0.78rem;
  margin-left: 0.5rem;
}

.note-row {
  margin: 0.35rem 1.25rem 0.7rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  background: rgba(56, 189, 248, 0.1);
  border-left: 3px solid var(--accent);
  color: var(--ink);
}

.note-row.warn {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--danger);
}

/* Generic page layout */
.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.page h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.page h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.page h3 {
  margin: 1rem 0 0.4rem;
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.page .lead {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

@media (min-width: 640px) {
  .page {
    padding: 2.5rem 1.5rem 4rem;
  }
  .page h1 { font-size: 2rem; }
  .page h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; }
  .page h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
  .page .lead { font-size: 1.05rem; margin: 0 0 1.5rem; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

/* Potential Plans section */
.potential-card {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), var(--panel));
}

.potential-item {
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--line);
}

.potential-item:last-child { border: none; padding-bottom: 0; }

.potential-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.potential-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-2);
}

.potential-meta {
  color: var(--ink-dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

.potential-reason {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.potential-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent);
}

.country-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--country-color), transparent 80%), var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.country-hero .flag { font-size: 2.5rem; }
.country-hero h1 { margin: 0; }
.country-hero .meta { color: var(--ink-dim); font-size: 0.95rem; }

.stops-table {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.stops-table li {
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.stops-table li:last-child { border: none; }

.stops-table .name { font-weight: 600; }
.stops-table .note { color: var(--ink-dim); font-size: 0.9rem; flex: 1; margin-left: 0.5rem; }
.stops-table .nights { color: var(--ink-dim); font-size: 0.85rem; white-space: nowrap; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th, td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  font-weight: 600;
}

td:nth-child(n+2), th:nth-child(n+2) { text-align: right; }

tr.subtotal td {
  background: rgba(56, 189, 248, 0.06);
  font-weight: 700;
}

tr.total td {
  border-top: 2px solid var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  padding-top: 0.85rem;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.country-link {
  display: block;
  padding: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  transition: transform 0.12s, border-color 0.12s;
}

.country-link:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.country-link .flag { font-size: 1.8rem; }
.country-link h3 {
  margin: 0.4rem 0 0.2rem;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.15rem;
}

.country-link .meta { color: var(--ink-dim); font-size: 0.85rem; }

footer {
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.85rem;
  padding: 1.5rem;
  border-top: 1px solid var(--line);
}

/* MapLibre popup styling */
.maplibregl-popup-content {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: 8px !important;
  font-family: inherit;
  padding: 0.6rem 0.85rem !important;
}

/* Part II banner */
.pt2-banner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 1.25rem 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #065f46 0%, #0f766e 60%, #0e7490 100%);
  border: 1px solid #10b981;
  color: var(--ink) !important;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pt2-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.25);
  text-decoration: none !important;
}
.pt2-banner .pt2-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a7f3d0;
  font-weight: 600;
}
.pt2-banner .pt2-title {
  font-weight: 700;
  font-size: 1rem;
}
.pt2-banner .pt2-sub {
  font-size: 0.82rem;
  color: #d1fae5;
}

/* Nav — Pt II link accent (last item) */
.topnav .links a[href="americas.html"] {
  color: #6ee7b7;
  font-weight: 600;
}

.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-content .pop-name { font-weight: 700; }
.maplibregl-popup-content .pop-meta { color: var(--ink-dim); font-size: 0.85rem; }

@media (max-width: 880px) {
  .home { grid-template-columns: 1fr; height: auto; }
  #map { height: 60vh; /* sticky removed — scrolls away on mobile */ }
  .sidebar { max-height: none; border-left: none; border-top: 1px solid var(--line); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topnav {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav .brand { font-size: 0.9rem; white-space: nowrap; }
  .topnav .links {
    gap: 0.15rem;
  }
  .topnav .links a {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
  }
}

/* Seasonal calendar */
.seasons-page { max-width: 1180px; }
.seasons-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.seasons-hero h1 { margin-bottom: 0.35rem; }
.seasons-hero .lead { max-width: 700px; margin-bottom: 0; }
.season-key { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; color: var(--ink-dim); font-size: 0.8rem; justify-content: flex-end; }
.season-key span { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.season-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.season-swatch.dry { background: #10b981; }
.season-swatch.transition { background: #f59e0b; }
.season-swatch.rain { background: #3b82f6; }
.season-swatch.mixed { background: #8b5cf6; }
.season-callout {
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 8px;
  color: var(--ink-dim);
  background: rgba(56, 189, 248, 0.06);
  font-size: 0.88rem;
}
.season-callout strong { color: var(--ink); }
.season-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.season-table { min-width: 840px; margin: 0; font-size: 0.78rem; border-collapse: separate; border-spacing: 0; }
.season-table th, .season-table td { border: 0; padding: 0; text-align: center; }
.season-table thead th { height: 38px; background: var(--panel-2); border-bottom: 1px solid var(--line); color: var(--ink-dim); position: sticky; top: 56px; z-index: 2; }
.season-table .season-country-heading { min-width: 185px; padding-left: 1rem; text-align: left; position: sticky; left: 0; z-index: 4; }
.season-country-heading span { color: var(--ink-dim); font-weight: 400; }
.season-country { min-width: 185px; padding: 0.55rem 0.8rem !important; text-align: left !important; background: var(--panel); border-bottom: 1px solid var(--line) !important; position: sticky; left: 0; z-index: 1; }
.season-country span { font-size: 1rem; margin-right: 0.4rem; }
.season-country strong { font-size: 0.84rem; }
.season-country small { display: block; margin: 0.1rem 0 0 1.4rem; color: var(--ink-dim); font-size: 0.68rem; font-weight: 400; }
.season-cell { width: 65px; height: 55px; border-left: 1px solid var(--panel) !important; border-bottom: 1px solid var(--panel) !important; position: relative; }
.season-cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.season-cell.dry { background: rgba(16, 185, 129, 0.72); }
.season-cell.transition { background: rgba(245, 158, 11, 0.74); }
.season-cell.rain { background: rgba(59, 130, 246, 0.72); }
.season-cell.mixed { background: rgba(139, 92, 246, 0.72); }
.season-cell.hot { background: rgba(249, 115, 22, 0.77); }
.season-cell.haze { background: rgba(120, 113, 108, 0.82); }
.season-cell.travelling::after { content: ""; position: absolute; inset: 4px; border: 2px solid #fff; border-radius: 4px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45); }
.season-section th { padding: 0.5rem 0.8rem; text-align: left; background: #172033; border-bottom: 1px solid var(--line); color: var(--accent); font-size: 0.73rem; letter-spacing: 0.08em; text-transform: uppercase; }
.season-route { margin-top: 2.25rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 0.75rem; }
.section-heading h2 { margin: 0; }
.season-badge { padding: 0.25rem 0.5rem; border-radius: 99px; background: rgba(255, 255, 255, 0.08); color: var(--ink-dim); font-size: 0.72rem; white-space: nowrap; }
.season-advice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.season-advice-card { padding: 0.85rem 0.95rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.season-advice-card > div { display: flex; align-items: baseline; gap: 0.65rem; }
.season-advice-card h3 { margin: 0; color: var(--ink); font-size: 0.9rem; letter-spacing: 0; text-transform: none; }
.season-advice-card p { margin: 0.45rem 0 0; color: var(--ink-dim); font-size: 0.82rem; line-height: 1.45; }
.season-months { padding: 0.12rem 0.35rem; border-radius: 4px; background: rgba(255, 255, 255, 0.09); color: var(--ink); font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.season-notes { margin-top: 1.5rem; }
.season-notes h2 { margin-top: 0; }
.season-notes ul { margin: 0; padding-left: 1.2rem; color: var(--ink-dim); font-size: 0.9rem; }
.season-notes li + li { margin-top: 0.45rem; }
.season-notes strong { color: var(--ink); }

@media (max-width: 700px) {
  .seasons-hero { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .season-key { justify-content: flex-start; }
  .season-table thead th { top: 47px; }
  .season-advice-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.5rem; }
}
