/* 旅曰 — travel journal aesthetic: warm paper, ink text, time-of-day accents */

:root {
  --paper: #f7f2ea;
  --paper-deep: #efe7da;
  --card: #fffdf9;
  --ink: #2b2620;
  --ink-soft: #6f6659;
  --ink-faint: #a89d8c;
  --vermillion: #c1441e;
  --vermillion-soft: #e8d5c9;
  --amber: #b8811b;
  --amber-soft: #f3e5cf;
  --indigo: #4f5490;
  --indigo-soft: #dcdded;
  --teal: #3d6b63;
  --teal-soft: #d8e5e2;
  --line: #e2d8c8;
  --serif: "Noto Serif TC", "PingFang TC", serif;
  --sans: "PingFang TC", "Noto Sans TC", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper);
  background-image: radial-gradient(circle at 15% 10%, rgba(193, 68, 30, 0.05), transparent 42%),
    radial-gradient(circle at 90% 85%, rgba(79, 84, 144, 0.06), transparent 45%),
    radial-gradient(circle at 70% 30%, rgba(184, 129, 27, 0.04), transparent 40%);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 18px calc(48px + env(safe-area-inset-bottom));
}

/* ---------- hero header ---------- */

.site-header { padding-top: 16px; }

.trip-switcher {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  padding: 0;
  background: none;
}

.hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 214px;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 10px 30px rgba(60, 42, 20, 0.18);
  /* fallback when no photo: layered warm gradient */
  background: linear-gradient(160deg, #d97644 0%, #c1441e 38%, #7c3a5e 75%, #4f5490 100%);
}

.hero-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(24, 16, 10, 0.72) 0%, rgba(24, 16, 10, 0.28) 45%, rgba(24, 16, 10, 0.12) 100%);
}

.hero-content {
  position: relative;
  padding: 46px 20px 16px;
  width: 100%;
}

.switcher-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.32em;
  color: #f5c9a8;
}

.trip-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(30px, 7.5vw, 42px);
  line-height: 1.2;
  margin: 4px 0 2px;
  letter-spacing: 0.02em;
  color: #fffdf9;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.trip-dates {
  font-family: var(--mono);
  font-size: 12.5px;
  color: rgba(255, 250, 240, 0.85);
  letter-spacing: 0.08em;
}

.switcher-hint {
  display: inline-block;
  margin-left: 10px;
  font-size: 11.5px;
  color: #fffdf9;
  border: 1px solid rgba(255, 253, 249, 0.55);
  border-radius: 999px;
  padding: 1px 10px;
  background: rgba(255, 253, 249, 0.14);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.trip-overview {
  margin-top: 16px;
  font-size: 14.5px;
  color: var(--ink-soft);
  border-left: 3px solid var(--vermillion);
  padding: 2px 0 2px 14px;
  text-wrap: pretty;
}

/* ---------- day nav ---------- */

.day-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 18px 12px;
  margin: 14px -18px 4px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.day-nav::-webkit-scrollbar { display: none; }

.day-pill {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.3;
}
.day-pill .dow { opacity: 0.55; margin-left: 4px; font-size: 11px; }
.day-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.day-pill.today-pill:not(.active) { border-color: var(--vermillion); color: var(--vermillion); }

/* ---------- day view ---------- */

.day-view { animation: fade-up 0.35s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.day-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 4px;
}

.day-number {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 26px;
  color: var(--vermillion);
}

.day-date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.today-badge {
  font-size: 11px;
  background: var(--vermillion);
  color: #fff;
  border-radius: 999px;
  padding: 1px 9px;
}

.day-summary {
  font-size: 13.5px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 12px;
  padding: 9px 14px;
  margin-bottom: 16px;
  text-wrap: pretty;
}

/* ---------- day timeline: one continuous journey line ---------- */

.day-timeline {
  position: relative;
  margin-left: 6px;
  padding-left: 26px;
}
.day-timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.section {
  margin-top: 24px;
  --slot: var(--vermillion);
  --slot-soft: var(--vermillion-soft);
}
.section:first-child { margin-top: 6px; }
.section.slot-am { --slot: var(--amber); --slot-soft: var(--amber-soft); }
.section.slot-pm { --slot: var(--vermillion); --slot-soft: var(--vermillion-soft); }
.section.slot-eve { --slot: var(--indigo); --slot-soft: var(--indigo-soft); }
.section.hotel { --slot: var(--teal); --slot-soft: var(--teal-soft); }

.section-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--slot);
  margin-bottom: 4px;
}
.section-label::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* diamond marker for the time-slot on the journey line */
.section-label::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  background: var(--slot);
  border-radius: 2px;
  box-shadow: 0 0 0 3px var(--paper);
}

.section.now .section-label .now-badge {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0;
  color: #fff;
  background: var(--slot);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------- itinerary lines (each stop is a node on the journey line) ---------- */

.line { position: relative; padding: 7px 0; }

/* small node for minor items */
.line::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 3px var(--paper);
}
/* big slot-colored node for tappable places */
.line.poi-line::before {
  left: -30px;
  top: 16px;
  width: 10px;
  height: 10px;
  background: var(--slot);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 2px var(--slot);
}
/* transit: an arrow travelling down the line instead of a node */
.line.transit::before {
  content: "▾";
  background: var(--paper);
  box-shadow: none;
  border-radius: 0;
  width: auto;
  height: auto;
  left: -32px;
  top: 6px;
  color: var(--teal);
  font-size: 13px;
  line-height: 1;
  padding: 2px 0;
}

.line-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  color: var(--ink-soft);
}

a.place, span.place, button.place { color: inherit; text-decoration: none; flex: 1; text-align: left; }
a.place { -webkit-tap-highlight-color: transparent; }
a.place .place-text {
  border-bottom: 1px solid var(--vermillion-soft);
  transition: border-color 0.15s;
}
a.place:active .place-text, a.place:hover .place-text { border-color: var(--vermillion); }
a.place::after {
  content: "↗";
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: 5px;
}

/* POI rows: the tappable stars of the list */
button.place {
  background: none;
  border: none;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}
button.place .place-text { border-bottom: 2px solid color-mix(in srgb, var(--slot) 30%, transparent); }
button.place::after {
  content: "›";
  font-family: var(--serif);
  color: var(--slot);
  font-size: 20px;
  line-height: 1;
}
.line.poi-line { padding: 9px 0; }

/* minor tappable places (restaurants, shops): same behavior, quieter look */
button.place.minor {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  color: var(--ink-soft);
}
button.place.minor .place-text {
  border-bottom: 1px dotted color-mix(in srgb, var(--slot) 45%, transparent);
}
button.place.minor::after { font-size: 16px; opacity: 0.7; }

.tag {
  flex: 0 0 auto;
  font-size: 11px;
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 2.5px;
  letter-spacing: 0.05em;
}
.tag.meal { background: var(--amber-soft); color: #8a6420; }
.tag.meal.m-lunch { background: var(--vermillion-soft); color: #97401e; }
.tag.meal.m-dinner { background: var(--indigo-soft); color: #45497e; }

/* transit rows: quiet teal mono text beside the ▾ arrow on the line */
.line.transit { padding: 6px 0; }
.transit-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal);
}

/* hotel: quiet labeled row */
.hotel-card { font-size: 15px; }
.hotel-card .line { padding: 4px 0; }
.hotel-card .line-main { font-family: var(--serif); font-weight: 700; font-size: 16.5px; color: var(--ink); }

/* ---------- place card (bottom sheet) ---------- */

.place-card { position: fixed; inset: 0; z-index: 60; }
.place-card-backdrop { position: absolute; inset: 0; background: rgba(30, 24, 16, 0.5); }
.place-card-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  overflow-x: hidden;
}
.pc-photo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.pc-photo[hidden] { display: none; }
.pc-body { padding: 18px 22px calc(26px + env(safe-area-inset-bottom)); }
.pc-name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 24px;
  line-height: 1.35;
  margin-bottom: 8px;
}
.pc-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: -2px 0 10px;
  font-size: 13px;
}
.pc-rating { color: var(--amber); font-weight: 700; }
.pc-count { color: var(--ink-faint); font-size: 12px; }
.pc-address { color: var(--ink-faint); font-size: 12px; }

.pc-intro { font-size: 14.5px; color: var(--ink-soft); text-wrap: pretty; margin-bottom: 18px; }
.pc-maps {
  display: block;
  text-align: center;
  background: var(--vermillion);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px;
}
.pc-maps:active { filter: brightness(0.92); }

/* ---------- fallback (loose format) ---------- */

.fallback-note {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 8px 0 12px;
}

/* ---------- trip menu (bottom sheet) ---------- */

.trip-menu { position: fixed; inset: 0; z-index: 50; }
.trip-menu-backdrop { position: absolute; inset: 0; background: rgba(43, 38, 32, 0.45); }
.trip-menu-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.trip-menu-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 12px;
}

.trip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: inherit;
  text-align: left;
  padding: 11px 4px;
  cursor: pointer;
  color: inherit;
}
.trip-item:last-child { border-bottom: none; }

.trip-item .t-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(140deg, #d97644, #7c3a5e);
}
.trip-item .t-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
}
.trip-item .t-body { flex: 1; min-width: 0; }
.trip-item .t-name { font-size: 15.5px; font-weight: 600; display: block; }
.trip-item.current .t-name { color: var(--vermillion); }
.trip-item .t-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 40px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

@media (min-width: 700px) {
  .site-header { padding-top: 36px; }
  .hero { min-height: 260px; }
}
