:root {
  --bg: #f4eee4;
  --panel: rgba(250, 246, 238, 0.92);
  --panel-strong: rgba(255, 251, 245, 0.98);
  --ink: #1f2b33;
  --muted: #5e6b73;
  --accent: #e07a5f;
  --accent-deep: #cc5f41;
  --sand: #d7b88a;
  --line: rgba(31, 43, 51, 0.08);
  --shadow: 0 30px 80px rgba(67, 54, 37, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(224, 122, 95, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(215, 184, 138, 0.2), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(255, 248, 238, 0.86), rgba(250, 242, 230, 0.92));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.hero-card,
.detail-card,
.filters-card,
.stops-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 1rem 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

h2 {
  font-size: 1.35rem;
}

.hero-copy,
.route-intro,
.detail-copy,
.detail-notes,
.overlay-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-copy,
.route-intro {
  margin-top: 0.65rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat {
  padding: 0.85rem 0.8rem;
  background: var(--panel-strong);
  border-radius: 18px;
  border: 1px solid rgba(31, 43, 51, 0.06);
}

.stat strong {
  display: block;
  font-size: 1.2rem;
}

.stat span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.hero-actions,
.detail-actions,
.link-row,
.filters-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.hero-actions,
.link-row,
.detail-actions {
  margin-top: 0.95rem;
}

button,
.link-action {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.05rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  text-decoration: none;
  text-align: center;
}

button:hover,
.link-action:hover {
  transform: translateY(-1px);
}

.primary-action {
  background: linear-gradient(135deg, var(--accent), #eea66e);
  color: white;
  box-shadow: 0 18px 40px rgba(224, 122, 95, 0.32);
}

.secondary-action {
  background: rgba(31, 43, 51, 0.08);
  color: var(--ink);
}

.link-row a {
  color: var(--accent-deep);
  font-weight: 800;
  text-decoration: none;
}

.detail-header,
.filters-header {
  margin-bottom: 0.85rem;
}

.pill-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: end;
}

.pill,
.count-badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: rgba(31, 43, 51, 0.06);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  border: 1px solid transparent;
  cursor: pointer;
}

.chip.is-active {
  background: rgba(224, 122, 95, 0.14);
  border-color: rgba(224, 122, 95, 0.35);
  color: var(--accent-deep);
}

.detail-tagline {
  margin: 0.45rem 0 0.8rem;
  color: var(--accent-deep);
  font-weight: 700;
}

.detail-copy + .detail-copy,
.detail-copy + .detail-notes,
.detail-notes + .detail-copy {
  margin-top: 0.45rem;
}

.detail-notes {
  margin-top: 0.75rem;
}

.stops-card {
  min-height: 0;
}

.stop-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.day-card {
  padding: 0.9rem;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid rgba(31, 43, 51, 0.06);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.day-card:hover,
.day-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(224, 122, 95, 0.28);
  box-shadow: 0 18px 34px rgba(53, 42, 28, 0.12);
}

.day-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.day-card h3 {
  font-size: 1rem;
}

.day-meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.day-summary {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.day-pill {
  min-width: 2.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(224, 122, 95, 0.12);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.stop-card {
  padding: 0.95rem;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(31, 43, 51, 0.06);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stop-card:hover,
.stop-card.is-selected {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(53, 42, 28, 0.12);
  border-color: rgba(224, 122, 95, 0.28);
}

.stop-card-top,
.stop-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.stop-order {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  flex: 0 0 auto;
}

.stop-title-wrap {
  flex: 1;
}

.stop-title {
  margin: 0;
  font-size: 1.02rem;
}

.stop-region {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.stop-day-label {
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 800;
}

.stop-notes {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.map-stage {
  position: relative;
  min-height: 100vh;
}

.map-canvas {
  width: 100%;
  height: 100vh;
}

.map-overlay {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  top: 1.25rem;
  z-index: 2;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, rgba(17, 24, 31, 0.76), rgba(33, 47, 58, 0.5));
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  backdrop-filter: blur(18px);
}

.map-overlay h2 {
  font-size: 1.6rem;
}

.overlay-copy {
  max-width: 28rem;
  color: rgba(255, 255, 255, 0.8);
}

.maplibregl-popup-content {
  border-radius: 16px;
  padding: 0.8rem 0.9rem;
  font-family: "Manrope", "Segoe UI", sans-serif;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .map-stage,
  .map-canvas {
    min-height: 65vh;
    height: 65vh;
  }

  .map-overlay {
    align-items: start;
    flex-direction: column;
  }
}

/* ── View toggle ─────────────────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  gap: 0.4rem;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 0.3rem;
  box-shadow: var(--shadow);
}

.view-tab {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.view-tab.is-active {
  background: var(--accent);
  color: #fff;
}

/* ── Schedule card ───────────────────────────────────────────────────────── */

.schedule-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 1rem 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.sched-day {
  margin-bottom: 1.4rem;
}

.sched-day:last-child {
  margin-bottom: 0;
}

.sched-day-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.sched-day-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.sched-day-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.sched-solar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
  padding: 0.4rem 0.6rem;
  background: rgba(31, 43, 51, 0.04);
  border-radius: 10px;
}

.sched-solar-item {
  white-space: nowrap;
}

.sunrise-color  { color: #e05f3f; }
.golden-am-color { color: #c87020; }
.golden-pm-color { color: #c86020; }
.sunset-color   { color: #b84020; }

.sched-stop {
  background: var(--panel-strong);
  border: 1px solid rgba(31, 43, 51, 0.08);
  border-radius: 14px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sched-stop:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(224, 122, 95, 0.18);
}

.sched-stop-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.sched-light-badge {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}

.sched-arrive-time {
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-left: auto;
}

.sched-stop-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.sched-stop-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sched-travel,
.sched-window,
.sched-depart {
  font-size: 0.72rem;
  color: var(--muted);
}

.sched-depart {
  font-weight: 600;
}

.sched-warning {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b85a20;
  background: rgba(184, 90, 32, 0.08);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
}

/* ── Detail header with stop nav ─────────────────────────────────────────── */

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.detail-header-left {
  flex: 1;
  min-width: 0;
}

.stop-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.nav-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  background: rgba(31, 43, 51, 0.07);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
  transform: none;
}

.stop-counter {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 2.6rem;
  text-align: center;
}

/* ── Tab badge ───────────────────────────────────────────────────────────── */

.tab-badge {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.68rem;
  font-weight: 800;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.view-tab.is-active .tab-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Play active state ───────────────────────────────────────────────────── */

.primary-action.is-playing {
  background: linear-gradient(135deg, #3a9a7a, #5bc49a);
  box-shadow: 0 18px 40px rgba(58, 154, 122, 0.32);
}

/* ── Map now-playing bar ─────────────────────────────────────────────────── */

.map-now-playing {
  position: absolute;
  left: 1.25rem;
  bottom: 2rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 251, 245, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 28px rgba(53, 42, 28, 0.18);
  pointer-events: none;
  max-width: 22rem;
}

.mnp-order {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  font-size: 0.88rem;
  transition: background 0.3s ease;
}

.mnp-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.mnp-title {
  font-size: 0.87rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mnp-light {
  font-size: 0.71rem;
  color: var(--muted);
  font-weight: 600;
}

.mnp-counter {
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .map-now-playing {
    left: 1rem;
    bottom: auto;
    top: 1rem;
    max-width: calc(100vw - 2rem);
  }
}
