/* Mobile UX layer: bottom tab bar, day jump chips, notice flags, touch targets. */
:root { --bottom-nav-h: 0px; --topbar-h: calc(48px + var(--safe-top, 0px)); }

/* ---- Day jump chips (all viewports) ---- */
.day-jump {
  position: sticky; top: var(--topbar-h); z-index: 15;
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 14px; padding: 10px 18px;
  background: rgba(255, 248, 251, .94); border-bottom: 1px solid #f1dfe7;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  scrollbar-width: none; scroll-snap-type: x proximity;
}
.day-jump::-webkit-scrollbar { display: none; }
.day-jump button {
  flex: 0 0 auto; min-width: 56px; min-height: 44px; padding: 4px 12px; scroll-snap-align: center;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid #eedbe4; border-radius: 12px; background: #fffdfd; color: #875a70;
  font: inherit; font-size: 12px; line-height: 1.2; cursor: pointer;
}
.day-jump button b { font-size: 13px; }
.day-jump button[aria-current="true"] { background: #f7dfe9; border-color: #edc4d4; color: #754459; }
.day-jump button.is-today { box-shadow: inset 0 0 0 1.5px #c9708f; }
.day-jump button.has-notice::after { content: "⚠"; font-size: 10px; color: #b4572a; }
.itinerary-section { scroll-margin-top: var(--topbar-h); }
.day-card { scroll-margin-top: calc(var(--topbar-h) + 72px); }
.day-notice-flag {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: #fff0dc; color: #9a4a12; font-size: 11px; font-weight: 700;
}

/* ---- Bottom tab bar ---- */
.bottom-nav { display: none; }
@media (max-width: 700px) {
  :root { --bottom-nav-h: calc(58px + env(safe-area-inset-bottom, 0px)); }
  body { padding-bottom: var(--bottom-nav-h); }
  .primary-navigation, .hero .section-tabs { display: none !important; }
  .section { scroll-margin-top: var(--topbar-h); }
  .bottom-nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    display: flex; height: var(--bottom-nav-h); padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: rgba(255, 250, 252, .97); border-top: 1px solid #f0dce6;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 -6px 20px rgba(167, 105, 132, .08);
  }
  body[data-active-view="ledger"] .bottom-nav {
    background: var(--theme-bottom-nav-bg, rgba(255, 254, 252, .97));
    border-top-color: var(--line, #E6DDD8);
  }
  .bottom-nav[hidden] { display: none; }
  .bottom-nav a {
    flex: 1 1 0; min-width: 0; min-height: 44px; margin: 5px 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 12px; color: var(--muted, #695B61); text-decoration: none; font-size: 11px; font-weight: 700;
    transition: background .18s ease, color .18s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav a i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 19px; height: 19px; font-style: normal; line-height: 1;
  }
  .bottom-nav a i svg {
    width: 18px; height: 18px; transition: transform .18s ease, stroke-width .18s ease;
  }
  .bottom-nav a[aria-current="page"] {
    color: #7c435d; background: #f7dfe9;
    box-shadow: inset 0 0 0 1px rgba(230, 184, 203, .65);
  }
  .bottom-nav a[aria-current="page"] i svg {
    stroke-width: 2.15; transform: translateY(-0.5px);
  }
  .bottom-nav a:active { background: #fff0f5; transform: scale(0.97); }
  .back-to-top { bottom: calc(var(--bottom-nav-h) + 12px); }
  .footer { padding-bottom: 28px; }
  .day-jump { margin-inline: -18px; }

  /* touch targets & readability */
  .geo-toolbar button { min-height: 44px; font-size: 14px; }
  .todo-form button { min-height: 44px; }
  .soft-label, .day-meta { font-size: 12px; }
  #geographic-map { height: min(440px, 60vh); }

  /* Prohibit nested vertical scroll containers on mobile (except map and modal sheets) */
  .geo-places,
  .flight-carousel,
  .travel-notices-list,
  .timeline,
  .todo-list,
  .accordion-stack {
    overflow-y: visible !important;
    max-height: none !important;
  }

  /* Full-width 2-column stop cards below map on mobile */
  .geo-places {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 2px 0 4px !important;
    margin-top: 8px !important;
  }
  .geo-place-card,
  .geo-places button.geo-place-card {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 58px !important;
    box-sizing: border-box !important;
    padding: 8px 9px !important;
    gap: 8px !important;
    border-radius: 13px !important;
    text-align: left !important;
    align-items: center !important;
  }
  .geo-place-card:last-child:nth-child(odd),
  .geo-places button.geo-place-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .geo-place-thumb {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
  }
  .geo-place-number {
    top: 2px;
    left: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 3.5px;
    font-size: 9.5px;
  }
  .geo-place-body {
    align-items: flex-start !important;
    text-align: left !important;
    gap: 2px !important;
  }
  .geo-place-meta {
    font-size: 9.5px !important;
    line-height: 1.15 !important;
  }
  .geo-place-name {
    font-size: 12.5px !important;
    line-height: 1.25 !important;
    text-align: left !important;
  }
  .geo-place-actions {
    gap: 4px !important;
    margin-top: 2px !important;
    flex-wrap: nowrap !important;
  }
  .geo-place-chip {
    min-height: 20px !important;
    padding: 1px 6.5px !important;
    font-size: 10px !important;
  }
}

/* ---- Daily weather chip beside the day title & Golden Hour timeline marker ---- */
.day-weather {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; vertical-align: middle;
  background: #eaf4f8; color: #2f6074; font-size: 12px; font-weight: 700; letter-spacing: 0; white-space: nowrap;
}
.schedule-item.schedule-golden-hour { min-height: 0; padding-bottom: 16px; }
.schedule-item.schedule-golden-hour::after { border-color: #d9822b; background: #fff3e0; }
.schedule-item.schedule-golden-hour .schedule-time { color: #b86b1b; }
.schedule-item.schedule-golden-hour .schedule-text { color: #9c5712; font-size: 13px; font-weight: 650; }

/* ---- Trip-day mode (today / tomorrow / overview switcher) ---- */
.vm-hide { display: none !important; }
.view-switch[hidden] { display: none; }
.view-switch {
  position: sticky; top: var(--topbar-h); z-index: 22; display: flex; gap: 8px; justify-content: center;
  padding: 8px 14px; background: rgba(255, 248, 251, .96); border-bottom: 1px solid #f1dfe7;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.view-switch button {
  flex: 1 1 0; max-width: 200px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid #eedbe4; border-radius: 12px; background: #fffdfd; color: #875a70; font: inherit; cursor: pointer;
}
.view-switch button b { font-size: 15px; }
.view-switch button span { font-size: 11px; opacity: .85; }
.view-switch button[aria-pressed="true"] { background: #f7dfe9; border-color: #edc4d4; color: #754459; box-shadow: inset 0 0 0 1px #edc4d4; }
body[data-view-mode="day"] .prep-section,
body[data-view-mode="day"] .drive-section,
body[data-view-mode="day"] .hero .section-tabs,
body[data-view-mode="day"] #day-jump,
body[data-view-mode="day"] #flight-dots,
body[data-view-mode="day"] #flight-index,
body[data-view-mode="day"] #day-count,
body[data-view-mode="day"] .bottom-nav,
body[data-view-mode="day"] .schedule-ticket.is-needs-confirmation,
body[data-view-mode="day"] .day-ticket-summary { display: none !important; }
body[data-view-mode="day"] .view-target .day-toggle { pointer-events: none; cursor: default; }
body[data-view-mode="day"] .view-target .day-chevron { display: none; }
body[data-view-mode="day"] .hero { min-height: 0; padding-bottom: 8px; }
body[data-view-mode="day"] #flight-carousel,
body[data-view-mode="day"] #travel-notices-list { overflow: visible; display: block; }
body[data-view-mode="day"] #flight-carousel .flight-card,
body[data-view-mode="day"] #travel-notices-list .travel-notice { max-width: none; width: 100%; margin-bottom: 12px; }
@media (max-width: 700px) {
  body:not([data-view-mode="overview"]) { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .view-switch {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 31; border-bottom: 0; border-top: 1px solid #f0dce6;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 20px rgba(167, 105, 132, .08);
  }
  body[data-view-mode="overview"] .view-switch { z-index: 31; }
  body:not([data-view-mode="overview"]) .back-to-top, body[data-view-mode="overview"] .back-to-top { bottom: calc(var(--bottom-nav-h) + 12px); }
}
@media (max-width: 700px) {
  body[data-switch="on"] { padding-bottom: calc(66px + var(--bottom-nav-h)); }
  body[data-switch="on"][data-view-mode="day"] { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  body[data-switch="on"] .bottom-nav { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); height: 52px; padding-bottom: 0; }
  body[data-switch="on"] .back-to-top { bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }
  body[data-switch="on"][data-view-mode="day"] .back-to-top { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
}

/* Day mode: map is pinned to the day's route; hide city/day tabs, keep style switch + numbered stops. */
body[data-view-mode="day"] .route-region-tabs,
body[data-view-mode="day"] #geo-days,
body[data-view-mode="day"] #route-day-count { display: none !important; }

/* ---- Mobile Typography & Sizing Polish (iOS HIG & Fluid Scale) ---- */
@media (max-width: 700px) {
  /* Hero title: compact & elegant on phones */
  .hero {
    min-height: 0;
    padding: 16px 16px 10px;
  }
  .hero h1 {
    font-size: clamp(23px, 6.2vw, 29px) !important;
    line-height: 1.25 !important;
    letter-spacing: -0.025em !important;
    font-weight: 750 !important;
  }
  .hero__meta {
    margin-top: 6px;
    gap: 4px 10px;
  }
  .hero__date {
    font-size: 13px !important;
    margin-top: 4px;
    color: #79616e !important;
  }
  .hero__meta .hero__date {
    flex: 0 0 100%;
    margin: 0 !important;
  }
  .hero-party-pill {
    min-height: 44px;
    font-size: 12.5px;
    padding: 4px 11px;
  }

  /* Section Headings: mobile-first compact rhythm */
  .section {
    scroll-margin-top: var(--topbar-h);
  }
  .section:not(.travel-notices-section) {
    padding: 16px 16px 18px !important;
  }
  .travel-notices-section {
    padding: 10px 16px;
  }
  .section:not(.travel-notices-section) .section-heading {
    margin-bottom: 10px !important;
  }
  .section-heading h2 {
    font-size: 19px !important;
    line-height: 1.3 !important;
    letter-spacing: -0.02em !important;
    font-weight: 750 !important;
  }

  /* Day Card & Timeline on Mobile */
  .day-card {
    margin-bottom: 12px;
  }
  .day-toggle {
    padding-top: 13px !important;
    padding-bottom: 13px !important;
  }
  .day-meta {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #ba7893 !important;
    letter-spacing: 0.04em !important;
  }
  .day-title {
    font-size: 17px !important;
    line-height: 1.35 !important;
    font-weight: 720 !important;
    margin-top: 2px !important;
  }
  .day-locations {
    font-size: 12.5px !important;
    color: #7d6774 !important;
    margin-top: 2px !important;
    line-height: 1.4 !important;
  }

  /* Timeline items: compact and legible */
  .schedule-item {
    padding-left: 70px !important;
    margin-bottom: 12px !important;
  }
  .schedule-time {
    font-size: 13px !important;
    font-weight: 700 !important;
  }
  .schedule-text {
    font-size: 14.5px !important;
    line-height: 1.62 !important;
  }

  /* Flight card: compact mobile margin */
  .flight-card {
    padding: 16px 16px 14px !important;
  }
}

/* Day Mode specific mobile compact app-header */
@media (max-width: 700px) {
  body[data-view-mode="day"] .hero {
    padding: 10px 16px 6px !important;
  }
  body[data-view-mode="day"] .hero h1 {
    font-size: 20px !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    font-weight: 750 !important;
  }
  body[data-view-mode="day"] .hero__meta {
    margin-top: 2px;
    gap: 6px 8px;
  }
  body[data-view-mode="day"] .hero__date {
    display: inline-block;
    font-size: 12px !important;
    margin-top: 2px !important;
  }
  body[data-view-mode="day"] .hero__meta .hero__date {
    margin: 0 !important;
  }
  body[data-view-mode="day"] .view-target .day-toggle {
    padding: 10px 14px !important;
  }
  body[data-view-mode="day"] .view-target .day-title {
    font-size: 17px !important;
  }
  body[data-view-mode="day"] .section {
    padding-top: 12px !important;
    padding-bottom: 14px !important;
  }
  body[data-view-mode="day"] .section-heading {
    margin-bottom: 8px !important;
  }
  body[data-view-mode="day"] .section-heading h2 {
    font-size: 18px !important;
  }
}

/* ---- Post-Trip Review Mode (Overview / Day 1..N switcher, bottom pager, notice fold) ---- */
.view-switch[data-mode="review"] {
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  padding-inline: 14px;
}
.view-switch[data-mode="review"]::-webkit-scrollbar {
  display: none;
}
.view-switch[data-mode="review"] button {
  flex: 0 0 auto;
  min-width: 88px;
  max-width: none;
  padding: 6px 12px;
  scroll-snap-align: center;
  white-space: nowrap;
}
.day-review-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #edd8e2;
}
.day-review-pager button {
  min-height: 42px;
  padding: 6px 14px;
  border: 1px solid #e9d1dc;
  border-radius: 999px;
  background: #fff9fb;
  color: #7d4961;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.day-review-pager button.day-review-pager__overview {
  background: #f7dfe9;
  border-color: #e5bdd0;
}
.day-review-pager__spacer {
  min-width: 84px;
}
.travel-notices-archive-fold {
  border: 1px solid #eedbe4;
  border-radius: 14px;
  background: #fffafc;
  padding: 10px 14px;
}
.travel-notices-archive-fold > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #875a70;
  list-style: none;
}
.travel-notices-archive-fold[open] > summary {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f2e2ea;
}
