/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: #FAF7F2;
  color: #2C2420;
  line-height: 1.75;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ─── Homepage ─────────────────────────────────────────────── */
.page-header {
  text-align: center;
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid #E5DDD0;
  margin-bottom: 2rem;
}

.site-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #2C2420;
  margin-bottom: 0.4rem;
}

.site-subtitle {
  font-size: 0.95rem;
  color: #9A8B7A;
  letter-spacing: 0.3em;
}

/* Trip Grid */
.trip-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trip-card {
  display: block;
  background: #FFFCF8;
  border: 1px solid #EDE6D9;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.trip-card:hover {
  border-color: #C4B49C;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.trip-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.trip-date {
  font-size: 0.85rem;
  color: #A67C52;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.trip-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-tag {
  font-size: 0.8rem;
  color: #7A6B5D;
  background: #F5F0E8;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}

.empty {
  text-align: center;
  color: #9A8B7A;
  padding: 3rem 0;
}

/* ─── Homepage Checklist (通用出行清单) ──────────────────── */
.home-checklist {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid #E5DDD0;
}

.home-checklist-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #2C2420;
  margin-bottom: 0.3rem;
  text-align: center;
}

.home-checklist-sub {
  font-size: 0.85rem;
  color: #9A8B7A;
  text-align: center;
  margin-bottom: 1.25rem;
}

.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.checklist-cat {
  background: #FFFCF8;
  border: 1px solid #EDE6D9;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.checklist-cat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #A67C52;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.checklist-cat ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist-cat li {
  font-size: 0.82rem;
  color: #5A4E42;
  line-height: 1.6;
  padding: 0.1rem 0;
}

.checklist-cat li::before {
  content: "☐ ";
  color: #A67C52;
  font-size: 0.75rem;
}

/* Full-width category (其他) */
.checklist-cat.full {
  grid-column: 1 / -1;
}

/* Mobile: single column */
@media (max-width: 480px) {
  .checklist-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Trip Detail Page ─────────────────────────────────────── */
.top-nav {
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid #EDE6D9;
  margin-bottom: 1.5rem;
}

.back-link {
  color: #7A6B5D;
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.back-link:hover { color: #2C2420; }

.trip-article-header {
  text-align: center;
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid #EDE6D9;
  margin-bottom: 2rem;
}

.trip-article-date {
  font-size: 0.9rem;
  color: #A67C52;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.trip-article-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}

.trip-article-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.tag {
  font-size: 0.8rem;
  color: #7A6B5D;
  background: #F5F0E8;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

/* ─── Trip Content (rendered markdown) ─────────────────────── */
.trip-content {
  font-size: 0.95rem;
  line-height: 1.75;
}

/* ─── Day Cards (h2 that start with "Day" → post-processed in build.js) ─── */

/* Section headings — 住宿建议 / 交通方案 / 预算粗估 等 */
.trip-content .section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2C2420;
  padding: 1.5rem 0 0.5rem;
  margin: 2.5rem 0 0.5rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #EDE6D9;
  line-height: 1.4;
}

/* Day heading — styled as timeline marker */
.trip-content .day-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: #A67C52;
  margin: 2.5rem 0 0.6rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  padding-top: 0.5rem;
}

/* Day card wrapper */
.trip-content .day-card {
  background: #FFFCF8;
  border: 1px solid #EDE6D9;
  border-radius: 12px;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

/* Tables inside day cards — vertical timeline style, no grid */
.trip-content .day-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0;
}

.trip-content .day-card tr td {
  padding: 0.7rem 1rem;
  vertical-align: top;
  line-height: 1.55;
  border: none;
}

/* Inset row spacing — visual breathing between entries */
.trip-content .day-card tbody tr:not(:first-child) td {
  padding-top: 1.1rem;
}

/* Time column: subtle label */
.trip-content .day-card td:first-child {
  width: 24%;
  color: #9A8B7A;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.02em;
  padding-right: 0.75rem;
}

/* Activity column */
.trip-content .day-card td:nth-child(2) {
  font-weight: 500;
  color: #2C2420;
}

/* Notes column */
.trip-content .day-card td:nth-child(3) {
  color: #7A6B5D;
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Hide thead inside day cards */
.trip-content .day-card thead {
  display: none;
}

/* Two-column tables inside day cards */
.trip-content .day-card td:only-child,
.trip-content .day-card td:first-child:last-child {
  width: auto;
}

/* ─── Summary / Overview tables (整体节奏, 住宿建议, 交通方案) ─── */
/* Clean card-style tables with no grid borders */

.trip-content .summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #FFFCF8;
  border-radius: 10px;
  border: 1px solid #EDE6D9;
  margin: 0.5rem 0 1.5rem;
}

.trip-content .summary-table thead th {
  padding: 0.7rem 1rem 0.5rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: #9A8B7A;
  letter-spacing: 0.04em;
  text-align: left;
  border: none;
  border-bottom: 1px solid #EDE6D9;
}

.trip-content .summary-table td {
  padding: 0.65rem 1rem;
  vertical-align: top;
  line-height: 1.55;
  border: none;
}

.trip-content .summary-table tbody tr:not(:first-child) td {
  padding-top: 0.9rem;
}

.trip-content .summary-table td:first-child {
  font-weight: 500;
  color: #A67C52;
  white-space: nowrap;
  width: 28%;
  font-size: 0.85rem;
}

.trip-content .summary-table tr:hover {
  background: none;
}

/* ─── Strong ─────────────────────────────────────────────── */
.trip-content strong {
  color: #A67C52;
  font-weight: 600;
}

.trip-content p {
  margin-bottom: 0.8rem;
}

/* ─── Lists ──────────────────────────────────────────────── */
.trip-content ul, .trip-content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.trip-content li {
  margin-bottom: 0.3rem;
}

.trip-content li::marker {
  color: #A67C52;
}

/* ─── Blockquotes — styled as info cards ─────────────────── */
.trip-content blockquote {
  background: #FFFCF8;
  border: 1px solid #EDE6D9;
  border-left: 3px solid #A67C52;
  border-radius: 10px;
  margin: 1.25rem 0;
  padding: 0.8rem 1.1rem;
  color: #2C2420;
  font-size: 0.9rem;
  line-height: 1.7;
}

.trip-content blockquote p {
  margin-bottom: 0;
}

/* Blockquote with warning emoji */
.trip-content blockquote strong:first-child {
  color: #C23B22;
}

/* ─── Horizontal rules — visual breaks ────────────────────── */
.trip-content hr {
  border: none;
  border-top: 1px solid #E5DDD0;
  margin: 2.5rem 0;
}

/* Code / inline */
.trip-content code {
  font-size: 0.85em;
  background: #F0EBE3;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: #5A4E42;
}

/* Checklist items */
.trip-content input[type="checkbox"] {
  margin-right: 0.4rem;
  accent-color: #A67C52;
}

/* Image support */
.trip-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 1rem 0;
  border: 1px solid #EDE6D9;
}

/* ─── Prev/Next Navigation ─────────────────────────────────── */
.trip-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #EDE6D9;
}

.nav-link {
  color: #7A6B5D;
  text-decoration: none;
  font-size: 0.9rem;
  max-width: 50%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover { color: #2C2420; }

.nav-link.next {
  text-align: right;
}

/* ─── Footer ───────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 2rem 0 1rem;
  margin-top: 2rem;
  border-top: 1px solid #EDE6D9;
}

.page-footer a {
  color: #7A6B5D;
  text-decoration: none;
  font-size: 0.85rem;
}

.page-footer a:hover { color: #2C2420; }

/* ─── Categories (折叠卡片) ──────────────────────────────── */
.categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.category-card {
  background: #FFFCF8;
  border: 1px solid #EDE6D9;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.category-card[open] {
  border-color: #C4B49C;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  user-select: none;
  -webkit-user-select: none;
  list-style: none;
}

.category-header::-webkit-details-marker {
  display: none;
}

.category-header:hover {
  background: #F8F4ED;
}

.category-header:active {
  background: #F0EBE3;
}

.category-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.category-name {
  flex: 1;
  color: #2C2420;
}

.category-count {
  font-size: 0.8rem;
  color: #9A8B7A;
  font-weight: 400;
}

.category-arrow {
  font-size: 0.85rem;
  color: #9A8B7A;
  transition: transform 0.2s;
}

.category-card[open] .category-arrow {
  transform: rotate(180deg);
}

.category-body {
  border-top: 1px solid #EDE6D9;
  padding: 0.75rem 1.25rem 1rem;
}

/* Tables inside category body inherit the clean day-card styles */
.category-body .day-card {
  margin-bottom: 0.6rem;
}

.category-body .day-card:last-child {
  margin-bottom: 0;
}

.category-body .summary-table {
  margin: 0;
}

.category-body .summary-table + .summary-table {
  margin-top: 1rem;
}

.category-body blockquote {
  margin: 0.75rem 0 0;
}

/* Day subheading inside categories */
.day-subheading {
  font-weight: 600;
  color: #A67C52;
  font-size: 0.88rem;
  margin: 0.8rem 0 0.35rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.category-body .day-subheading:first-child {
  margin-top: 0;
}

/* ─── Mobile Responsive ────────────────────────────────────── */
@media (max-width: 480px) {
  .container {
    padding: 1.25rem 1rem;
  }

  .site-title {
    font-size: 1.6rem;
  }

  .trip-article-title {
    font-size: 1.3rem;
  }

  .trip-card {
    padding: 1rem 1.15rem;
  }

  .trip-content {
    font-size: 0.92rem;
  }

  /* Keep day-card tables clean on mobile — no grid, full-width */
  .trip-content .day-card tr td {
    padding: 0.6rem 0.85rem;
  }
  .trip-content .day-card tbody tr:not(:first-child) td {
    padding-top: 0.9rem;
  }
  .trip-content .day-card td:first-child {
    width: 22%;
    font-size: 0.75rem;
  }
  .trip-content .day-card td:nth-child(3) {
    font-size: 0.78rem;
  }

  /* Keep summary tables clean */
  .trip-content .summary-table td {
    padding: 0.55rem 0.85rem;
  }
  .trip-content .summary-table tbody tr:not(:first-child) td {
    padding-top: 0.75rem;
  }
  .trip-content .summary-table thead th {
    padding: 0.6rem 0.85rem 0.4rem;
    font-size: 0.75rem;
  }
  .trip-content .summary-table td:first-child {
    width: 30%;
    font-size: 0.8rem;
  }

  /* Category accordion mobile */
  .category-header {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }
  .category-body {
    padding: 0.5rem 1rem 0.75rem;
  }

  /* Day subheading mobile */
  .day-subheading {
    font-size: 0.82rem;
    margin: 0.65rem 0 0.3rem;
  }

  /* Checklist mobile */
  .checklist-cat {
    padding: 0.6rem 0.75rem;
  }
  .checklist-cat-title {
    font-size: 0.8rem;
  }
  .checklist-cat li {
    font-size: 0.78rem;
  }

  /* Generic table fallback — only for any remaining non-day-card/non-summary tables */
  .trip-content pre {
    font-size: 0.8rem;
  }
}

/* ─── Print ────────────────────────────────────────────────── */
@media print {
  body {
    background: white;
    color: black;
  }
  .top-nav, .page-footer, .trip-nav {
    display: none;
  }
  .trip-article-header {
    border-bottom: 1px solid #ccc;
  }
}
