:root {
  --ink: #1c2b33;
  --ink-soft: #52646c;
  --paper: #faf7f1;
  --card: #ffffff;
  --accent: #2f7a78;
  --accent-dark: #1f5654;
  --gold: #c8912f;
  --gold-soft: #e9c98a;
  --sand: #ecdfc4;
  --border: #e6ddca;
  --shadow: 0 6px 20px rgba(28, 43, 51, 0.08);
  --shadow-lift: 0 14px 34px rgba(28, 43, 51, 0.16);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(47, 122, 120, 0.05), transparent 45%),
    radial-gradient(circle at 85% 8%, rgba(200, 145, 47, 0.06), transparent 40%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

.voyage-line {
  height: 4px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--gold-soft), var(--gold), var(--accent));
  background-size: 300% 100%;
  animation: driftLine 14s linear infinite;
}

@keyframes driftLine {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 247, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: inline-block;
  transform: rotate(-8deg);
}

.crumbs {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.crumbs a:hover { color: var(--accent); }

.crumbs .sep {
  margin: 0 6px;
  color: var(--border);
}

main#app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

h1, h2, h3 { font-family: var(--serif); }

/* ---------- Hero ---------- */
.hero {
  margin: 30px 0 46px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lift);
}

.hero img {
  width: 100%;
  display: block;
  max-height: 440px;
  object-fit: cover;
  object-position: center 30%;
}

.hero-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 32px 32px 24px;
  background: linear-gradient(to top, rgba(10,16,18,0.72), rgba(10,16,18,0.1) 70%, transparent);
  color: #fff;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-soft);
  font-weight: 600;
  margin-bottom: 6px;
}

.hero-caption h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
  font-weight: 700;
}

.hero-caption p {
  margin: 0;
  opacity: 0.92;
}

/* ---------- Section headings ---------- */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-title .count {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 400;
}

/* ---------- Map ---------- */
.map-section { margin-top: 8px; }

.home-map {
  height: 420px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.trip-map {
  height: 220px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 22px;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.map-popup {
  font-family: var(--sans);
  min-width: 160px;
}

.map-popup img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
  display: block;
}

.map-popup strong {
  font-family: var(--serif);
  font-size: 1rem;
  display: block;
}

.map-popup-loc {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 2px 0 6px;
}

.map-popup a {
  font-size: 0.82rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.map-popup a:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline-section {
  overflow: visible;
}

.timeline-track {
  position: relative;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 6px 22px;
  scrollbar-width: thin;
}

.timeline-rail {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 26px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--gold-soft) 0 8px, transparent 8px 14px);
}

.timeline-stop {
  position: relative;
  flex: 0 0 auto;
  width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 6px 0;
  text-align: center;
  color: var(--ink);
}

.timeline-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--accent);
  margin-bottom: 10px;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
  z-index: 1;
}

.timeline-stop:hover .timeline-dot {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.25);
}

.timeline-year {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
}

.timeline-count {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* ---------- Year grid (home) ---------- */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 12px;
}

.year-card, .trip-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: block;
  border: 1px solid var(--border);
  position: relative;
}

.year-card::after, .trip-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.year-card:hover::after, .trip-card:hover::after {
  transform: scaleX(1);
}

.year-card:hover, .trip-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.year-card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--sand);
  overflow: hidden;
}

.year-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.year-card:hover .thumb img { transform: scale(1.05); }

.year-card .meta {
  padding: 14px 16px;
}

.year-card .meta h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  color: var(--accent-dark);
}

.year-card .meta p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Trip grid (year page) ---------- */
.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.trip-card .thumb {
  aspect-ratio: 3 / 2;
  background: var(--sand);
  overflow: hidden;
}

.trip-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.trip-card:hover .thumb img { transform: scale(1.05); }

.trip-card .meta {
  padding: 14px 16px;
}

.trip-card .meta h3 {
  margin: 0 0 4px;
  font-size: 1.12rem;
}

.trip-card .meta .loc {
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.trip-card .meta .count {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ---------- Photo grid (trip page) ---------- */
.trip-header {
  margin: 8px 0 20px;
}

.trip-header h1 {
  margin: 0 0 6px;
  font-size: 1.9rem;
}

.trip-header .loc-line {
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 1rem;
}

.trip-header .year-line {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 2px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.photo-grid figure {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  background: var(--sand);
  box-shadow: var(--shadow);
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.photo-grid figure:hover img {
  transform: scale(1.08);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 16, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox.hidden { display: none; }

.lightbox img {
  max-width: 88vw;
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.55);
}

.lb-caption {
  color: #f4efe4;
  margin-top: 16px;
  font-size: 0.98rem;
  max-width: 80vw;
  text-align: center;
  font-family: var(--serif);
}

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: var(--accent);
  transform: scale(1.06);
}

.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

.site-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 34px 20px 54px;
}

.empty-state {
  color: var(--ink-soft);
  padding: 40px 0;
  text-align: center;
}

/* ---------- Empty year placeholders ---------- */
.year-card--empty {
  opacity: 0.72;
}

.year-card--empty:hover {
  opacity: 1;
}

.thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--gold-soft);
  background: linear-gradient(135deg, var(--sand), var(--paper));
}

.timeline-stop--empty {
  opacity: 0.55;
}

.timeline-stop--empty .timeline-dot {
  border-color: var(--border);
}

.timeline-stop--empty:hover {
  opacity: 0.9;
}

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  .header-inner { padding: 12px 16px; }
  main#app { padding: 0 16px 60px; }
  .brand { font-size: 1.1rem; }
  .crumbs { font-size: 0.78rem; }
  .section-title { font-size: 1.25rem; margin: 30px 0 14px; }
  .hero { margin: 18px 0 30px; border-radius: 14px; }
  .hero-caption { padding: 20px 18px 16px; }
  .hero-caption h1 { font-size: 1.6rem; }
  .hero-caption p { font-size: 0.9rem; }
  .home-map { height: 280px; border-radius: 14px; }
  .trip-map { height: 180px; }
  .year-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .trip-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
  .photo-grid figure, .trip-card, .year-card { border-radius: 10px; }
  .timeline-stop { width: 84px; }
  .timeline-year { font-size: 0.88rem; }
  .timeline-count { font-size: 0.66rem; }
}

@media (max-width: 600px) {
  .hero img { max-height: 220px; }
  .hero-caption h1 { font-size: 1.4rem; }
  .home-map { height: 240px; }
  .trip-header h1 { font-size: 1.5rem; }
  .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 1.2rem; }
  .lb-close { width: 40px; height: 40px; font-size: 1.3rem; top: 10px; right: 10px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lightbox img { max-width: 94vw; max-height: 68vh; }
  .lb-caption { font-size: 0.85rem; max-width: 90vw; margin-top: 12px; }
}

@media (hover: none) and (pointer: coarse) {
  .year-card:hover, .trip-card:hover,
  .year-card:hover::after, .trip-card:hover::after,
  .year-card:hover .thumb img, .trip-card:hover .thumb img,
  .photo-grid figure:hover img {
    transform: none;
    box-shadow: var(--shadow);
  }
  a, button { -webkit-tap-highlight-color: rgba(47, 122, 120, 0.15); }
}