/* ============================================================
   travel-ui.css — 韓國旅行手帳/相簿風格 override
   在 styles.css 之後載入。草莓粉 × 薰衣草紫 × 天空藍，深色可讀文字。
   ============================================================ */

/* ---------- 1. 色票與基礎 ---------- */
:root {
  --blue: #6c46c4;            /* 主色改為可讀的薰衣草紫（連結、eyebrow、pin 皆沿用） */
  --navy: #3a2d5c;            /* 深梅紫，取代深藍 */
  --ink: #2b2440;             /* 主文字 */
  --muted: #6b627f;           /* 次要文字，對白底 >= 4.5:1 */
  --line: #efdbe4;            /* 粉色細線 */
  --paper: #ffffff;
  --surface: #fff7f9;         /* 淡草莓奶油底 */
  --strawberry: #c9416f;      /* 草莓粉（深，可當文字/按鈕） */
  --strawberry-soft: #ffe3ec; /* 草莓粉（淺底） */
  --lavender: #6c46c4;
  --lavender-soft: #ece4fb;
  --sky: #2d6e9c;             /* 天空藍（深，可當文字） */
  --sky-soft: #dcefff;
  --cream: #fffaf4;
  --shadow: 0 6px 22px rgba(107, 70, 196, 0.08);
  --radius: 20px;
  font-family: ui-rounded, "Hiragino Maru Gothic ProN", "PingFang TC", "Microsoft JhengHei",
    "Noto Sans TC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

body {
  background:
    radial-gradient(circle at 12% 0%, #fde8f0 0, transparent 38%),
    radial-gradient(circle at 100% 10%, #ece4fb 0, transparent 34%),
    var(--surface);
  background-attachment: scroll;
}

.page-shell, #main, .view, .timeline, .event, .event-card,
.meal-card, .meal-choice, .shop-card, .map-layout, .map-panel, .map-place-panel {
  min-width: 0;
  max-width: 100%;
}

button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--lavender);
  outline-offset: 3px;
}

h1, h2, h3 {
  color: var(--ink);
}

.eyebrow {
  color: var(--strawberry);
}

a {
  color: var(--lavender);
}

/* ---------- 2. Header ---------- */
.topbar {
  height: 76px;
}

.brand {
  color: var(--navy);
}

.brand-mark {
  background: linear-gradient(135deg, #f7a8c2, #c9416f);
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(201, 65, 111, 0.25);
}

.brand-sub {
  color: var(--muted);
}

.connection {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
  max-width: none;
}

.icon-button {
  border-radius: 999px;
  border-color: var(--line);
  color: var(--navy);
  min-height: 44px;
  min-width: 44px;
}

.icon-button:hover {
  background: var(--lavender-soft);
}

/* ---------- 3. Intro：旅行票券 ---------- */
.trip-intro {
  background: linear-gradient(135deg, #fff1f6 0%, #f4edff 55%, #e8f4ff 100%);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 26px 30px;
  gap: 24px;
  position: relative;
}

/* 票券撕線：左側文案與右側照片之間 */
.trip-intro::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  right: calc(42% + 12px);
  border-left: 2px dashed #e4c7d8;
}

/* 票券上下缺口 */
.trip-intro::after {
  content: "";
  position: absolute;
  right: calc(42% + 3px);
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 calc(100% + 0px) 0 0 var(--surface);
}

.trip-intro .eyebrow {
  color: var(--strawberry);
  background: var(--strawberry-soft);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
}

.trip-intro h1 {
  color: var(--navy);
}

.trip-dates {
  color: var(--ink);
}

.trip-dates > span:first-child {
  color: var(--muted);
}

.date-tag {
  color: var(--sky);
  background: var(--sky-soft);
  border-radius: 999px;
  padding: 1px 9px;
  font-weight: 650;
}

.intro-note {
  color: var(--muted);
}

.seoul-time {
  color: var(--lavender);
  font-weight: 650;
}

/* 右側照片：拍立得框 */
.intro-image {
  background: var(--paper);
  padding: 8px 8px 22px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(58, 45, 92, 0.14);
  min-height: 180px;
  aspect-ratio: 4 / 3;
}

.intro-image img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.intro-image .photo-block {
  margin: 0;
  height: 100%;
}

.intro-image .photo-strip {
  height: 100%;
}

.intro-image .photo-open {
  width: 100%;
  height: 100%;
}

/* ---------- 4. 班機住宿：票根 ---------- */
.quick-facts {
  border-radius: var(--radius);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.quick-facts > div + div,
.quick-facts > button {
  border-left: 2px dashed var(--line);
}

.quick-facts > button {
  border-radius: 12px;
}

.quick-facts > button:hover {
  background: var(--lavender-soft);
}

.fact-label {
  color: var(--strawberry);
  font-weight: 650;
  letter-spacing: .04em;
}

.quick-facts strong {
  color: var(--navy);
}

/* ---------- 5. 主分頁 ---------- */
.main-tabs {
  gap: 6px;
}

.tab {
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
}

.tab:hover {
  background: var(--lavender-soft);
}

.tab.active {
  background: var(--navy);
  color: #fff;
}

/* ---------- 6. 顯示設定列 ---------- */
.preferences-toolbar {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
}

/* ---------- 7. Day picker：手帳索引標籤 ---------- */
.day-picker {
  gap: 10px;
  margin-bottom: 14px;
}

.day {
  border-radius: 16px;
  border-color: var(--line);
  position: relative;
  transition: background-color .15s, border-color .15s;
}

.day:hover {
  background: var(--cream);
}

.day .date {
  color: var(--navy);
}

.day .theme {
  color: var(--muted);
}

.day.active {
  background: linear-gradient(180deg, #ffeef4, #ffffff);
  border-color: var(--strawberry);
  color: var(--strawberry);
}

.day.active .date {
  color: var(--strawberry);
}

.day.active::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 46px;
  height: 14px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(201, 184, 245, 0.8);
  border-radius: 3px;
}

/* ---------- 8. 每日照片摘要（TravelUI 新增） ---------- */
.day-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.day-overview-photos {
  min-width: 0;
}

.day-overview-photos .photo-block {
  margin: 0;
}

.day-overview-copy {
  min-width: 0;
}

.day-overview-copy .eyebrow {
  display: inline-block;
  background: var(--strawberry-soft);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
}

.day-overview-copy h3 {
  font-size: 1.3rem;
  color: var(--navy);
}

.day-overview-theme {
  color: var(--muted);
  font-size: .95rem;
  margin-top: 6px;
}

.day-overview-stats {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-overview-stats li {
  font-size: .8rem;
  font-weight: 650;
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--lavender-soft);
  color: var(--lavender);
}

.day-overview-stats li.stat-confirmed {
  background: var(--sky-soft);
  color: var(--sky);
}

.day-overview-stats li.stat-photos {
  background: var(--strawberry-soft);
  color: var(--strawberry);
}

.day-overview-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 2px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: .85rem;
  background: var(--cream);
}

/* 快速入口 */
.day-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.shortcut {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  font-size: .88rem;
}

.shortcut:hover {
  background: var(--strawberry-soft);
  border-color: #f3c0d3;
}

.shortcut-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.shortcut-shops {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  margin-left: auto;
}

.shortcut-shops:hover {
  background: #4a3a73;
  border-color: #4a3a73;
}

/* ---------- 9. 區段標題 ---------- */
.section-heading h2 {
  color: var(--navy);
}

.timezone-note {
  background: var(--sky-soft);
  color: var(--sky);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 650;
}

/* ---------- 10. Timeline ---------- */
.timeline::before {
  background: #e3d6f7;
}

.event::before {
  background: var(--strawberry);
  border-color: var(--surface);
  box-shadow: 0 0 0 2px #f6c7d8;
}

.event-time strong {
  color: var(--navy);
}

.event-card {
  border-radius: 18px;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.event-card p {
  color: var(--muted);
}

.event-card .photo-block {
  margin: 12px 0 0;
}

/* ---------- 11. 狀態標籤 ---------- */
.badge {
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--lavender-soft);
  color: #54419a;
}

.badge.confirmed {
  background: var(--sky-soft);
  color: #1c5a84;
}

.badge.suggested {
  background: var(--strawberry-soft);
  color: #a63660;
}

.badge.optional {
  background: var(--lavender-soft);
  color: #54419a;
}

/* ---------- 12. 按鈕 ---------- */
.button {
  border-radius: 999px;
  min-height: 44px;
}

.button.primary {
  background: var(--strawberry);
  color: #fff;
}

.button.primary:hover {
  background: #b23661;
}

.button.secondary {
  border-color: #ead3dd;
  color: var(--navy);
}

.button.secondary:hover {
  background: var(--lavender-soft);
}

.text-link, button.text-link, .copy-link {
  color: var(--lavender);
}

/* ---------- 13. Aside 卡 ---------- */
.aside-card {
  background: var(--lavender-soft);
  border-color: #dccff7;
  border-radius: 18px;
}

.aside-card h3 {
  color: #4b3691;
}

.aside-card.warning {
  background: #fff3e9;
  border-color: #f4d6c2;
}

.aside-card.warning h3 {
  color: #8f4219;
}

.aside-card .photo-block {
  margin: 12px 0 0;
}

/* ---------- 14. 飯店卡 ---------- */
.hotel-card {
  border-radius: 22px;
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, #fff, #f8f3ff);
}

.hotel-times strong {
  color: var(--navy);
}

/* ---------- 15. Meals ---------- */
.meal-card {
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.meal-head h3 {
  color: var(--strawberry);
}

.meal-area {
  color: var(--lavender);
  font-weight: 650;
}

.meal-choice {
  border-top: 1px dashed var(--line);
}

.meal-choice h4 {
  color: var(--navy);
}

.meal-choice .photo-block {
  margin: 10px 0 0;
}

.meal-details summary {
  color: var(--lavender);
}

.meal-jump {
  color: var(--strawberry);
}

/* ---------- 16. 店家清單：搜尋、日期篩選、卡片 ---------- */
.filter {
  border-radius: 999px;
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}

.filter:hover {
  background: var(--lavender-soft);
}

.filter.active,
.filter[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

#shop-search {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 11px 16px 11px 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper) no-repeat 15px center /
    18px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c46c4' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  color: var(--ink);
  font-size: .95rem;
}

#shop-search::placeholder {
  color: var(--muted);
}

#shop-day-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

#shop-day-filters button {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #f0c9d8;
  background: var(--strawberry-soft);
  color: #a63660;
  font-weight: 650;
  font-size: .86rem;
}

#shop-day-filters button[aria-pressed="true"],
#shop-day-filters button.active {
  background: var(--strawberry);
  border-color: var(--strawberry);
  color: #fff;
}

.shop-card {
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.shop-card > .photo-block:first-child {
  margin: -22px -22px 16px;
}

.shop-card > .photo-block:first-child .photo-open {
  border-radius: 0;
}

.shop-card h3 {
  color: var(--navy);
}

.shop-card .neighborhood {
  color: var(--lavender);
  font-weight: 650;
}

.shop-note {
  background: var(--cream);
  border-left: 3px solid #f7c6d8;
  border-radius: 10px;
}

/* ---------- 17. 地圖與地點詳情 ---------- */
.map-panel, .map-place-panel {
  border-radius: 22px;
  box-shadow: var(--shadow);
}

#trip-map {
  background: #eef2fb;
}

.place-map-pin {
  background: var(--lavender);
  box-shadow: 0 2px 7px rgba(58, 45, 92, 0.3);
}

.place-map-pin.approximate {
  background: #fff;
  color: var(--lavender);
  border-color: var(--lavender);
}

.place-map-pin.hotel-pin {
  background: var(--strawberry);
}

.map-place-panel select {
  border-radius: 14px;
  border-color: var(--line);
}

#map-detail h3 {
  color: var(--navy);
}

#map-detail .photo-block {
  margin: 12px 0 0;
}

.map-precision {
  background: var(--lavender-soft);
  color: #54419a;
  border-radius: 999px;
}

.map-location-note {
  background: var(--cream);
  border-radius: 12px;
}

.return-buffer {
  background: #fff3e9;
  border-color: #f4d6c2;
  border-radius: 18px;
}

.route-card {
  border-radius: 18px;
}

.route-card summary::after {
  color: var(--strawberry);
}

/* ---------- 18. Tips 與安裝卡 ---------- */
.tip-card {
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.tip-card .tip-number {
  color: var(--strawberry);
  background: var(--strawberry-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.install-card {
  background: linear-gradient(135deg, #3a2d5c, #5b3fa0);
  border-radius: 22px;
}

.install-card p {
  color: #e5dcf7;
}

.install-card > button {
  color: var(--lavender) !important;
}

/* ---------- 19. Footer / toast ---------- */
footer {
  color: var(--muted);
}

#photo-credit {
  margin-top: 8px;
}

.toast {
  background: var(--navy);
  border-radius: 999px;
}

/* ---------- 20. Dialog（設定、安裝） ---------- */
dialog {
  border-radius: 24px;
  border-color: var(--line);
  box-shadow: 0 24px 80px rgba(58, 45, 92, 0.25);
}

dialog::backdrop {
  background: rgba(43, 36, 64, 0.55);
}

dialog h2 {
  color: var(--navy);
}

.dialog-close {
  border-radius: 50%;
  color: var(--navy);
}

.dialog-close:hover {
  background: var(--lavender-soft);
}

.preference-group {
  border-radius: 14px;
}

.preference-items label:has(input:checked) {
  background: var(--lavender-soft);
}

.preference-category input[type="checkbox"],
.preference-items input[type="checkbox"] {
  accent-color: var(--strawberry);
}

/* ============================================================
   21. 照片元件（PhotoUI 產生結構）
   figure.photo-block.photo-VARIANT > div.photo-strip > button.photo-open > img + span.photo-caption
   figcaption.photo-note
   ============================================================ */
.photo-block {
  margin: 14px 0 0;
  min-width: 0;
  max-width: 100%;
}

.photo-strip {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  margin: -2px -2px 0;
  scrollbar-width: thin;
  scrollbar-color: #d9cdf3 transparent;
}

.photo-open {
  position: relative;
  flex: 0 0 auto;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--lavender-soft);
  scroll-snap-align: start;
  min-width: 44px;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(58, 45, 92, 0.1);
}

.photo-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--lavender-soft);
}

.photo-open:focus-visible {
  outline: 3px solid var(--lavender);
  outline-offset: 3px;
}

.photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(180deg, transparent, rgba(43, 36, 64, 0.7));
  color: #fff;
  font-size: .7rem;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.photo-note {
  margin-top: 6px;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--muted);
}

/* hero：拍立得單張 */
.photo-hero .photo-strip {
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-hero .photo-open {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  box-shadow: none;
}

/* overview：三張拼貼（1 大 2 小） */
.photo-overview .photo-strip {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-overview .photo-open {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
}

.photo-overview .photo-open:first-child {
  grid-column: 1;
  grid-row: span 2;
  aspect-ratio: auto;
}

.photo-overview .photo-open:first-child img {
  position: absolute;
  inset: 0;
}

.photo-overview .photo-open:only-child {
  grid-column: 1 / -1;
  grid-row: auto;
  aspect-ratio: 16 / 9;
}

.photo-overview .photo-strip:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-overview .photo-strip:has(> :nth-child(2):last-child) .photo-open {
  grid-row: auto;
  aspect-ratio: 4 / 3;
}

.photo-overview .photo-strip:has(> :nth-child(2):last-child) .photo-open img {
  position: static;
}

/* event：時間軸短橫圖 strip */
.photo-event .photo-open {
  width: 132px;
  aspect-ratio: 4 / 3;
}

/* card：店家卡頂部整張 */
.photo-card .photo-strip {
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-card .photo-open {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 200px;
  border-radius: 14px;
}

/* meal：餐點選項中等高度 */
.photo-meal .photo-open {
  width: 148px;
  aspect-ratio: 4 / 3;
}

/* map：地點詳情 */
.photo-map .photo-strip {
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-map .photo-open {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 180px;
}

/* aside：補充卡 */
.photo-aside .photo-open {
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 150px;
}

/* ---------- 22. 照片燈箱 dialog#photo-dialog ---------- */
.photo-dialog {
  width: min(960px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: #1f1931;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.photo-dialog::backdrop {
  background: rgba(31, 25, 49, 0.88);
}

.photo-dialog .dialog-close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.photo-dialog .dialog-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.photo-dialog .dialog-close:focus-visible,
#photo-prev:focus-visible,
#photo-next:focus-visible {
  outline: 3px solid #f7a8c2;
  outline-offset: 3px;
}

.photo-viewer {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
}

#photo-large {
  display: block;
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  background: #120f1d;
}

#photo-caption,
#photo-credit {
  padding: 0 72px;
  margin: 0;
  overflow-wrap: anywhere;
}

#photo-caption {
  padding-top: 14px;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.5;
}

#photo-credit {
  padding-top: 6px;
  font-size: .8rem;
  color: #cfc4e8;
}

#photo-source {
  display: inline-block;
  margin: 8px 72px 18px;
  min-height: 44px;
  line-height: 44px;
  color: #f7a8c2;
  font-size: .85rem;
  font-weight: 650;
}

#photo-prev,
#photo-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
}

#photo-prev {
  left: 12px;
}

#photo-next {
  right: 12px;
}

#photo-prev:hover,
#photo-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

#photo-prev:disabled,
#photo-next:disabled {
  opacity: .35;
}

/* ---------- 23. 版面斷點 ---------- */
@media (max-width: 820px) {
  .day-overview {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .day-aside .aside-card .photo-aside .photo-open {
    max-height: 130px;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: 68px;
  }

  .connection {
    padding: 3px 8px;
  }

  /* intro：手機改為上文下圖的票券，照片完整可見 */
  .trip-intro {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px 18px 18px;
    min-height: 0;
    border-radius: 22px;
  }

  .trip-intro::before {
    top: auto;
    left: 18px;
    right: 18px;
    bottom: calc(100% - 100% + 0px);
    display: none;
  }

  .trip-intro::after {
    display: none;
  }

  .intro-copy {
    width: 100%;
  }

  .intro-note {
    max-width: none;
  }

  .intro-image {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 0;
    opacity: 1;
    border-radius: 12px;
    padding: 6px 6px 16px;
    border-top: 2px dashed #e4c7d8;
    padding-top: 12px;
  }

  .intro-image::after {
    display: none;
  }

  .intro-image img {
    position: static;
    height: 100%;
  }

  h1 {
    font-size: 1.9rem;
  }

  .quick-facts {
    border-radius: 18px;
  }

  /* 底部導覽 */
  .main-tabs {
    position: fixed;
    top: auto;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(58, 45, 92, 0.08);
    border-radius: 18px 18px 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  .main-tabs .tab {
    flex-direction: column;
    gap: 2px;
    min-height: 52px;
    border-radius: 14px;
    font-size: .72rem;
    padding: 6px 4px;
    color: var(--muted);
  }

  .main-tabs .tab > span {
    font-size: 1.15rem;
  }

  .main-tabs .tab.active {
    background: var(--lavender-soft);
    color: var(--lavender);
  }

  .day-picker {
    gap: 8px;
    margin-bottom: 12px;
  }

  .day {
    border-radius: 14px;
  }

  .day.active::before {
    width: 34px;
    height: 10px;
    top: -5px;
  }

  .day-overview {
    padding: 12px;
    border-radius: 18px;
  }

  .day-overview-copy h3 {
    font-size: 1.15rem;
  }

  .day-shortcuts {
    gap: 6px;
  }

  .shortcut {
    flex: 1 1 calc(33.333% - 6px);
    justify-content: center;
    padding: 8px 10px;
    font-size: .84rem;
  }

  .shortcut-shops {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .timezone-note {
    max-width: 110px;
  }

  .event::before {
    box-shadow: 0 0 0 2px #f6c7d8;
  }

  .photo-event .photo-open {
    width: 112px;
  }

  .photo-meal .photo-open {
    width: 128px;
  }

  .photo-card .photo-open {
    max-height: 180px;
  }

  .shop-card > .photo-block:first-child {
    margin: -20px -20px 14px;
  }

  #shop-search {
    min-height: 48px;
    font-size: .92rem;
  }

  .photo-dialog {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 18px;
  }

  #photo-large {
    max-height: 58vh;
  }

  #photo-caption,
  #photo-credit {
    padding-left: 16px;
    padding-right: 16px;
  }

  #photo-source {
    margin: 6px 16px 72px;
  }

  /* 手機燈箱前後鍵移到底部，避開文字 */
  #photo-prev,
  #photo-next {
    top: auto;
    bottom: 14px;
    transform: none;
    width: 48px;
    height: 48px;
  }

  #photo-prev {
    left: 16px;
  }

  #photo-next {
    right: 16px;
  }

  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1280px) {
  .page-shell {
    max-width: 1160px;
  }

  .photo-event .photo-open {
    width: 148px;
  }
}

/* ---------- 24. 減少動態 ---------- */
@media (max-width: 360px) {
  .brand-sub {font-size: .55rem; letter-spacing: .02em;}
  .header-actions {gap: 6px;}
  .connection {font-size: .65rem; padding: 3px 6px;}
}

@media (prefers-reduced-motion: reduce) {
  .day,
  .shortcut,
  .tab,
  .photo-open,
  .button {
    transition: none !important;
  }

  .photo-strip {
    scroll-snap-type: none;
  }
}

/* ---------- 25. 實際 PhotoUI 結構整合：拼貼、完整圖說與燈箱 ---------- */
/* 圖說保留在文件流中，長 attribution 也能完整閱讀。 */
.photo-open {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.photo-open img {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-caption {
  position: static;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  padding: 7px 9px;
  background: var(--cream);
  color: var(--ink);
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.45;
  text-shadow: none;
}

.photo-event .photo-open,
.photo-meal .photo-open,
.photo-aside .photo-open {
  height: auto;
  aspect-ratio: auto;
  max-height: none;
}

.day-aside .aside-card .photo-aside .photo-open {
  max-height: none;
}

/* 首頁三張採 1 大 2 小；容器依圖說高度成長，不溢出頁面。 */
.intro-copy {
  min-width: 0;
  flex: 1 1 0;
}

.intro-image {
  flex: 0 1 44%;
  width: 44%;
  height: auto;
  min-height: 0;
  min-width: 0;
  aspect-ratio: auto;
  align-self: center;
  padding: 8px;
}

.intro-image .photo-block,
.intro-image .photo-strip {
  height: auto;
}

.photo-hero .photo-strip,
.photo-overview .photo-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-auto-rows: auto;
  gap: 8px;
  align-items: stretch;
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-hero .photo-open,
.photo-overview .photo-open {
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
}

.photo-hero .photo-open:first-child,
.photo-overview .photo-open:first-child {
  grid-column: 1;
  grid-row: span 2;
}

.photo-hero .photo-open:first-child img,
.photo-overview .photo-open:first-child img {
  position: static;
  flex: 1 1 0;
  height: 0;
  min-height: 180px;
  aspect-ratio: auto;
}

.photo-hero .photo-open:only-child,
.photo-overview .photo-open:only-child {
  grid-column: 1 / -1;
  grid-row: auto;
  aspect-ratio: auto;
}

.photo-hero .photo-open:only-child img,
.photo-overview .photo-open:only-child img {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.photo-hero .photo-strip:has(> :nth-child(2):last-child),
.photo-overview .photo-strip:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-hero .photo-strip:has(> :nth-child(2):last-child) .photo-open,
.photo-overview .photo-strip:has(> :nth-child(2):last-child) .photo-open {
  grid-row: auto;
  aspect-ratio: auto;
}

.photo-hero .photo-strip:has(> :nth-child(2):last-child) .photo-open img,
.photo-overview .photo-strip:has(> :nth-child(2):last-child) .photo-open img {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
}

/* 店家卡與地圖雙張以雙欄呈現，單張則自然跨滿。 */
.photo-card .photo-strip,
.photo-map .photo-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 0;
  margin: 0;
}

.photo-card .photo-open,
.photo-map .photo-open {
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
}

.photo-card .photo-open img,
.photo-map .photo-open img {
  aspect-ratio: 4 / 3;
}

.photo-card .photo-open:only-child,
.photo-map .photo-open:only-child {
  grid-column: 1 / -1;
}

.photo-card .photo-open:only-child img,
.photo-map .photo-open:only-child img {
  aspect-ratio: 16 / 9;
}

.shop-card > .photo-block:first-child {
  margin: 0 0 16px;
}

.shop-card > .photo-block:first-child .photo-open {
  border-radius: 14px;
}

/* Lightbox 的 controls 與 attribution 是 photo-viewer 的兄弟節點。 */
.photo-dialog {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #8670ad #1f1931;
}

.photo-dialog > h2 {
  padding: 20px 72px 18px 20px;
  color: #fff;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.photo-dialog .photo-viewer {
  display: block;
  max-height: none;
}

.photo-dialog #photo-large {
  width: 100%;
  height: auto;
  max-height: min(54vh, 560px);
  max-height: min(54dvh, 560px);
  object-fit: contain;
}

.photo-dialog .photo-controls {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 6px;
}

.photo-dialog #photo-counter {
  text-align: center;
  color: #e5dcf7;
  font-variant-numeric: tabular-nums;
}

.photo-dialog #photo-prev,
.photo-dialog #photo-next {
  position: static;
  inset: auto;
  transform: none;
  display: inline-flex;
  width: auto;
  height: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #8670ad;
  background: #3a2d5c;
  color: #fff;
  font-size: .85rem;
  line-height: 1.4;
}

.photo-dialog #photo-prev:hover,
.photo-dialog #photo-next:hover {
  background: #514071;
}

.photo-dialog #photo-caption,
.photo-dialog #photo-credit,
.photo-dialog #photo-modified {
  margin: 0;
  padding: 8px 20px 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.photo-dialog #photo-caption {
  color: #fff;
}

.photo-dialog #photo-credit,
.photo-dialog #photo-modified {
  color: #e5dcf7;
  font-size: .85rem;
}

.photo-dialog > .card-actions {
  gap: 8px 18px;
  margin: 0;
  padding: 10px 20px 20px;
}

.photo-dialog #photo-source,
.photo-dialog #photo-license {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 0;
  line-height: 1.5;
  color: #ffcada;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .intro-image {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    padding: 12px 6px 6px;
  }

  .photo-hero .photo-open:first-child img,
  .photo-overview .photo-open:first-child img {
    min-height: 150px;
  }

  .photo-hero .photo-open:only-child img,
  .photo-overview .photo-open:only-child img,
  .photo-hero .photo-strip:has(> :nth-child(2):last-child) .photo-open img,
  .photo-overview .photo-strip:has(> :nth-child(2):last-child) .photo-open img {
    min-height: 0;
  }

  .photo-dialog {
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .photo-dialog > h2 {
    padding: 18px 66px 16px 16px;
  }

  .photo-dialog .photo-controls {
    gap: 8px;
    padding: 12px 16px 6px;
  }

  .photo-dialog #photo-caption,
  .photo-dialog #photo-credit,
  .photo-dialog #photo-modified {
    padding-left: 16px;
    padding-right: 16px;
  }

  .photo-dialog > .card-actions {
    padding: 10px 16px 18px;
  }
}
