/* =============================================================================
   Trip Companion — styles.  Phone-first, large type, high contrast, calm.
   No trip content lives here (that's all in js/trip-data.js).
   ========================================================================== */

:root {
  --navy: #1f3a5f;
  --navy-2: #26506e;
  --teal: #2d6a6a;
  --gold: #b9822b;
  --gold-soft: #e8b954;
  --cream: #f6f2ea;
  --card: #ffffff;
  --ink: #21262c;
  --ink-soft: #55606b;
  --line: #e5ded2;
  --danger: #b23b3b;
  --good: #2d7d4f;

  --shadow: 0 2px 10px rgba(31, 58, 95, .08), 0 1px 3px rgba(31, 58, 95, .06);
  --shadow-lg: 0 6px 24px rgba(31, 58, 95, .14);
  --radius: 16px;
  --radius-sm: 11px;

  --tap: 52px;                 /* minimum tap target */
  --pad: 16px;
  --maxw: 720px;               /* keep comfortable on desktop */

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
a { color: var(--navy-2); }
img { display: block; max-width: 100%; }

/* ---------- App shell / scroll area ---------------------------------------- */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
}

.view { padding: var(--pad); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head { padding: calc(var(--safe-top) + 8px) var(--pad) 4px; }
.view-title { font-size: 30px; color: var(--navy); }
.view-sub { color: var(--ink-soft); font-size: 16px; margin-top: 2px; }

.section-label {
  text-transform: uppercase; letter-spacing: .08em; font-size: 13px; font-weight: 700;
  color: var(--gold); margin: 22px 4px 10px;
}

/* ---------- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border-radius: 999px; border: 0; cursor: pointer;
  font-family: var(--font); font-size: 17px; font-weight: 600;
  background: var(--navy); color: #fff; text-decoration: none;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.gold { background: var(--gold); }
.btn.call { background: var(--good); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; font-size: 15px; padding: 0 14px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------- Cards ---------------------------------------------------------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 14px;
}
.card-pad { padding: var(--pad); }
.card-photo { width: 100%; height: 190px; object-fit: cover; background: #e9e3d7; }

/* ---------- Countdown / hero (Today view) --------------------------------- */
.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  color: #fff; box-shadow: var(--shadow-lg); margin-bottom: 16px;
  background: linear-gradient(135deg, var(--navy), var(--teal));
}
.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.hero-inner { position: relative; padding: 26px var(--pad) 24px; text-align: center; }
.hero-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; opacity: .9; }
.hero-title { font-size: 30px; margin: 6px 0 2px; }
.hero-dates { opacity: .92; font-size: 16px; }

.countdown { display: flex; justify-content: center; gap: 10px; margin: 20px 0 6px; }
.count-cell { background: rgba(255,255,255,.14); border-radius: 14px; padding: 12px 8px; min-width: 76px; backdrop-filter: blur(2px); }
.count-num { font-size: 34px; font-weight: 700; font-family: var(--serif); line-height: 1; }
.count-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; opacity: .9; margin-top: 4px; }
.hero-note { font-size: 15px; opacity: .95; margin-top: 8px; }

/* "Happening now" strip during the trip */
.now-badge { display: inline-block; background: var(--gold); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }

/* ---------- Timeline items ------------------------------------------------- */
.item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.item-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 15px var(--pad); background: none; border: 0; cursor: pointer; text-align: left;
  font-family: var(--font); color: var(--ink); min-height: var(--tap);
}
.item-emoji { font-size: 24px; width: 30px; text-align: center; flex: 0 0 auto; }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-name { font-size: 17px; font-weight: 600; }
.item-meta { font-size: 14px; color: var(--ink-soft); margin-top: 1px; }
.item-chev { flex: 0 0 auto; color: var(--ink-soft); transition: transform .2s ease; font-size: 20px; }
.item.open .item-chev { transform: rotate(90deg); }

.item-body { padding: 0 var(--pad) var(--pad); display: none; }
.item.open .item-body { display: block; }
.item-photo { width: calc(100% + var(--pad) * 2); margin: 4px 0 14px calc(var(--pad) * -1); height: 200px; object-fit: cover; }

.detail-row { display: flex; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 16px; }
.detail-row:first-of-type { border-top: 0; }
.detail-ico { flex: 0 0 auto; width: 22px; text-align: center; opacity: .8; }
.detail-txt { flex: 1 1 auto; min-width: 0; }
.detail-label { font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.detail-value { -webkit-user-select: text; user-select: text; word-break: break-word; }
.conf-num { font-weight: 700; letter-spacing: .04em; font-size: 18px; color: var(--navy); }
.notes { color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; margin-top: 4px; }

/* ---------- Driver-transfer card (first-class citizen) --------------------- */
.item.transfer { border: 2px solid var(--gold); background: linear-gradient(180deg, #fffaf0, #fff); }
.item.transfer .item-emoji { color: var(--gold); }
.item.transfer .now-badge { background: var(--navy); }
.transfer-tag { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gold); }

/* ---------- Day list (itinerary) ------------------------------------------- */
.day-card { display: flex; align-items: stretch; gap: 0; width: 100%; text-align: left;
  background: var(--card); border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; cursor: pointer; overflow: hidden; font-family: var(--font); color: var(--ink); }
.day-date { flex: 0 0 66px; background: var(--navy); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 12px 4px; }
.day-dow { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.day-dnum { font-size: 26px; font-weight: 700; font-family: var(--serif); line-height: 1.05; }
.day-mon { font-size: 12px; opacity: .85; }
.day-info { flex: 1 1 auto; padding: 12px 14px; min-width: 0; }
.day-n { font-size: 13px; color: var(--gold); font-weight: 700; letter-spacing: .04em; }
.day-title { font-size: 18px; font-weight: 600; margin: 1px 0 3px; }
.day-city { font-size: 14px; color: var(--ink-soft); }
.day-chev { align-self: center; padding-right: 14px; color: var(--ink-soft); font-size: 22px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  color: var(--navy-2); font-size: 17px; font-weight: 600; padding: 6px 0; margin-bottom: 6px; cursor: pointer; font-family: var(--font); min-height: 44px; }

/* City banner atop a day */
.day-banner { position: relative; border-radius: var(--radius); overflow: hidden; color: #fff;
  margin-bottom: 16px; box-shadow: var(--shadow); }
.day-banner img { width: 100%; height: 150px; object-fit: cover; }
.day-banner .overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(31,58,95,.15), rgba(31,58,95,.72)); }
.day-banner .cap { position: absolute; left: 16px; right: 16px; bottom: 12px; }
.day-banner .cap h2 { font-size: 24px; }
.day-banner .cap .sub { font-size: 14px; opacity: .95; }

/* ---------- Weather -------------------------------------------------------- */
.weather { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff;
  border-radius: var(--radius-sm); box-shadow: var(--shadow); margin-bottom: 14px; }
.weather .wx-emoji { font-size: 30px; }
.weather .wx-main { flex: 1 1 auto; }
.weather .wx-temp { font-size: 20px; font-weight: 700; }
.weather .wx-desc { font-size: 14px; color: var(--ink-soft); }
.weather.muted { color: var(--ink-soft); font-size: 15px; }

/* ---------- Reservations / Contacts / Packing ------------------------------ */
.res { padding: 14px var(--pad); }
.res .res-name { font-size: 18px; font-weight: 600; }
.res .res-sub { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.res .res-conf { margin-top: 8px; }
.pill { display: inline-block; background: #eef4f2; color: var(--teal); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; font-weight: 600; }
.pill.pending { background: #fbf1e0; color: var(--gold); }

.contact { display: flex; align-items: center; gap: 12px; padding: 12px var(--pad); }
.contact .c-emoji { font-size: 24px; width: 30px; text-align: center; }
.contact .c-main { flex: 1 1 auto; min-width: 0; }
.contact .c-label { font-size: 13px; color: var(--ink-soft); }
.contact .c-name { font-size: 17px; font-weight: 600; }
.contact .c-call { flex: 0 0 auto; }

/* Packing */
.pack-group { margin-bottom: 8px; }
.check {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px var(--pad); background: #fff; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; font-family: var(--font); font-size: 17px; color: var(--ink); min-height: var(--tap);
}
.check:last-child { border-bottom: 0; }
.check .box { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.check.done .box { background: var(--good); border-color: var(--good); }
.check.done .lbl { text-decoration: line-through; color: var(--ink-soft); }
.check .del { flex: 0 0 auto; color: var(--ink-soft); font-size: 20px; padding: 4px 6px; opacity: .55; }

.add-row { display: flex; gap: 10px; padding: 12px var(--pad) 4px; }
.add-row input { flex: 1 1 auto; min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0 14px; font-size: 17px; font-family: var(--font); background: #fff; }
.add-row input:focus { outline: 2px solid var(--navy-2); border-color: var(--navy-2); }

/* ---------- Empty states --------------------------------------------------- */
.empty { text-align: center; color: var(--ink-soft); padding: 26px 18px; }
.empty .e-emoji { font-size: 34px; }
.empty .e-title { font-size: 18px; font-weight: 600; color: var(--ink); margin-top: 6px; }
.empty .e-text { font-size: 15px; margin-top: 4px; }

/* ---------- Flights placeholder ------------------------------------------- */
.flight-leg { display: flex; align-items: center; gap: 10px; padding: 12px var(--pad); border-top: 1px solid var(--line); }
.flight-leg:first-child { border-top: 0; }
.flight-leg .fl-route { flex: 1 1 auto; font-weight: 600; }
.flight-leg .fl-date { color: var(--ink-soft); font-size: 14px; }

/* ---------- Segmented toggle (list / calendar) ----------------------------- */
.segmented { display: flex; background: #ece5d8; border-radius: 999px; padding: 4px; margin: 6px 0 14px; }
.segmented button { flex: 1 1 0; border: 0; background: none; min-height: 44px; border-radius: 999px;
  font-family: var(--font); font-size: 16px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.segmented button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

/* ---------- Calendar ------------------------------------------------------- */
.cal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.cal-title { text-align: center; font-family: var(--serif); font-size: 20px; color: var(--navy); margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--ink-soft); font-weight: 700; padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1 / 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: 15px; color: var(--ink-soft); background: #faf7f1; border: 0; cursor: default; padding: 2px; }
.cal-cell.blank { background: transparent; }
.cal-cell.trip { background: var(--navy); color: #fff; cursor: pointer; font-weight: 600; }
.cal-cell.trip .cal-dot { width: 5px; height: 5px; border-radius: 999px; background: var(--gold-soft); margin-top: 3px; }
.cal-cell.today { outline: 3px solid var(--gold); }
.cal-legend { display: flex; gap: 14px; justify-content: center; margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .sw { width: 14px; height: 14px; border-radius: 4px; background: var(--navy); }

/* ---------- Bottom tab bar ------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center; gap: 2px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: var(--maxw); }
.tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--tabbar-h); background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font-family: var(--font); font-size: 11px; font-weight: 600; }
.tab .tab-ico { font-size: 22px; line-height: 1; }
.tab.active { color: var(--navy); }
.tab.active .tab-ico { transform: translateY(-1px); }

/* ---------- Toast ---------------------------------------------------------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15px; z-index: 100;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-2px); }

/* ---------- Offline banner ------------------------------------------------- */
.offline { background: var(--gold); color: #fff; text-align: center; font-size: 14px; font-weight: 600;
  padding: 8px 12px; }

/* ---------- Desktop niceties ----------------------------------------------- */
@media (min-width: 760px) {
  body { font-size: 18px; }
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; background: var(--cream); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
