/* ════════════════════════════════════════════════════
   EVAN的夢遊世界 – Global Styles
   ════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────── */
:root {
  --primary:      #2c6e49;
  --primary-dark: #1b4332;
  --accent:       #e76f51;
  --accent-light: #f4a261;
  --bg:           #fafaf8;
  --card-bg:      #ffffff;
  --text:         #2d2d2d;
  --text-muted:   #757575;
  --border:       #e8e8e4;
  --shadow:       0 4px 20px rgba(0,0,0,.08);
  --radius:       14px;
  --font-serif:   'Noto Serif TC', Georgia, serif;
  --font-sans:    'Noto Sans TC', system-ui, sans-serif;
  --header-h:     68px;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Container ──────────────────────────────────────── */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.logo-icon {
  font-size: 2rem;
  line-height: 1;
}
.logo-main {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary-dark);
  letter-spacing: .04em;
}
.logo-sub {
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.site-nav {
  margin-left: auto;
  display: flex;
  gap: .25rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background .2s, color .2s;
}
.nav-link:hover {
  background: var(--primary);
  color: #fff;
}
.burger {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: .5rem;
}

/* ════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #40916c 100%);
  color: #fff;
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='1.5' fill='rgba(255,255,255,.12)'/%3E%3C/svg%3E");
}
.hero-content { position: relative; }
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: .06em;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
  margin-bottom: .75rem;
}
.hero-subtitle {
  font-size: 1.1rem;
  opacity: .85;
  letter-spacing: .08em;
}

/* ════════════════════════════════════════════════════
   MAP SECTION
   ════════════════════════════════════════════════════ */
.map-section {
  padding: 4rem 0;
  background: #fff;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--primary-dark);
}
.section-title i { margin-right: .4rem; color: var(--accent); }
.section-desc {
  font-size: .9rem;
  color: var(--text-muted);
}
.map-wrapper {
  position: relative;
  background: #e8f4f8;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
#world-map {
  width: 100%;
  display: block;
}
#world-map svg {
  width: 100%;
  height: auto;
  display: block;
}
/* Country paths */
#world-map path {
  fill: #c8dfe8;
  stroke: #fff;
  stroke-width: .4px;
  transition: fill .2s, transform .2s;
  transform-origin: center;
  cursor: default;
}
#world-map path.country--post {
  fill: var(--primary);
  cursor: pointer;
}
#world-map path.country--post:hover {
  fill: var(--accent);
  transform: scale(1.06);
  filter: drop-shadow(0 2px 6px rgba(231,111,81,.4));
}
#world-map path.country--visited {
  fill: #c0392b;
  cursor: default;
}
#world-map path.country--visited:hover {
  fill: #e74c3c;
  transform: scale(1.04);
  filter: drop-shadow(0 2px 6px rgba(192,57,43,.4));
}
/* Tooltip */
.map-tooltip {
  position: absolute;
  background: rgba(27,67,50,.92);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.map-tooltip.visible { opacity: 1; }
.map-tooltip .tooltip-hint {
  font-size: .7rem;
  font-weight: 400;
  opacity: .8;
  margin-top: .1rem;
}
/* Legend */
.legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: .5rem; }
.dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #c8dfe8;
  display: inline-block;
}
.dot--post    { background: var(--primary); }
.dot--visited { background: #c0392b; }
.dot--none    { background: #c8dfe8; border: 1px solid #aac6d0; }

/* ── Travel Stats ──────────────────────────────── */
.travel-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.travel-stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  border: 2px solid transparent;
  transition: transform .2s, box-shadow .2s;
}
.travel-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.travel-stat-card--post    { border-color: var(--primary); }
.travel-stat-card--visited { border-color: #c0392b; }
.travel-stat-card--region  { border-color: var(--accent); }
.travel-stat-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  font-family: 'Noto Sans TC', sans-serif;
}
.travel-stat-card--visited .travel-stat-num { color: #c0392b; }
.travel-stat-card--region  .travel-stat-num { color: var(--accent); }
.travel-stat-label {
  font-size: .82rem;
  color: #666;
  margin-top: .4rem;
  font-weight: 500;
}
.travel-stat-label i { margin-right: .3rem; }
.stat-regions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .9rem;
  justify-content: center;
}
.stat-region-tag {
  background: #f0f4f8;
  border-radius: 20px;
  padding: .3rem .85rem;
  font-size: .8rem;
  color: #555;
  border: 1px solid #dce3ea;
}
.stat-region-tag strong { color: var(--primary); margin-left: .2rem; }
@media (max-width: 640px) {
  .travel-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ════════════════════════════════════════════════════
   POSTS SECTION
   ════════════════════════════════════════════════════ */
.posts-section {
  padding: 4rem 0 6rem;
}
.category-tabs {
  display: flex;
  gap: .5rem;
}
.tab {
  padding: .4rem 1.1rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: all .2s;
}
.tab:hover, .tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}
@media (max-width: 900px)  { .posts-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px)  { .posts-grid { grid-template-columns: 1fr; } }

/* ── Post Card ───────────────────────────────────────── */
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .25s, box-shadow .25s;
}
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
}
.post-card-link { display: block; }
.post-card-image {
  height: 210px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.post-card-cat {
  position: absolute;
  top: .75rem;
  left: .75rem;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tag--travel { background: var(--primary); color: #fff; }
.tag--food   { background: var(--accent); color: #fff; }
.tag--plain  {
  background: #f0f0ec;
  color: var(--text-muted);
  font-size: .75rem;
  padding: .2rem .6rem;
  border-radius: 12px;
  display: inline-block;
}
.post-card-body { padding: 1.1rem 1.25rem 1.25rem; }
.post-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: .5rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-excerpt {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: .9rem;
}
.post-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: .7rem;
}

/* ════════════════════════════════════════════════════
   PAGE HERO (category / country)
   ════════════════════════════════════════════════════ */
.page-hero {
  padding: 4rem 1.5rem;
  text-align: center;
  color: #fff;
}
.page-hero--travel  { background: linear-gradient(135deg, #1b4332, #2c6e49); }
.page-hero--food    { background: linear-gradient(135deg, #923d1a, #e76f51); }
.page-hero--country { background: linear-gradient(135deg, #1a3a5c, #2e7ab6); }
.page-hero-icon { font-size: 3rem; margin-bottom: .75rem; display: block; }
.flag-big { font-size: 4rem; display: block; margin-bottom: .5rem; }
.page-hero h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.page-hero p { opacity: .85; }

/* ════════════════════════════════════════════════════
   SINGLE POST PAGE
   ════════════════════════════════════════════════════ */
.post-cover {
  height: min(60vh, 500px);
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
}
.post-cover-overlay {
  width: 100%;
  padding: 3rem 0 2rem;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  color: #fff;
}
.post-meta-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.post-date { font-size: .85rem; opacity: .85; }
.post-date i { margin-right: .3rem; }
.post-title-big {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: .75rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.post-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.post-body-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  padding: 3rem 1.5rem;
}
@media (max-width: 760px) { .post-body-wrap { grid-template-columns: 1fr; } }
.post-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
}
.post-excerpt {
  font-size: 1.12rem;
  color: var(--primary-dark);
  font-style: italic;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.post-placeholder { color: var(--text-muted); font-size: .9rem; margin-top: 1.5rem; }

/* ── Markdown rendered content ──────────────────────────────────────── */
.post-body h2 {
  font-size: 1.5rem; font-weight: 700;
  color: var(--primary-dark);
  margin: 2rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--primary);
}
.post-body h3 {
  font-size: 1.2rem; font-weight: 600;
  color: var(--primary);
  margin: 1.5rem 0 .5rem;
}
.post-body h4 {
  font-size: 1.05rem; font-weight: 600;
  margin: 1.2rem 0 .4rem;
}
.post-body p { margin: .6rem 0; }
.post-body ul {
  padding-left: 1.5rem;
  margin: .75rem 0;
}
.post-body ul li {
  list-style: disc;
  margin: .3rem 0;
}
.post-body blockquote {
  border-left: 4px solid var(--accent);
  background: rgba(231,111,81,.06);
  margin: 1.25rem 0;
  padding: .75rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body blockquote p {
  margin: 0;
  font-style: italic;
  color: var(--primary-dark);
}
.post-body code {
  background: #f1f5f0;
  padding: .15em .45em;
  border-radius: 4px;
  font-size: .9em;
  font-family: 'Courier New', monospace;
  color: #b44;
}
/* Markdown table */
.post-body .md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: .97rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.post-body .md-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: .65rem 1rem;
  text-align: left;
}
.post-body .md-table td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.post-body .md-table tbody tr:nth-child(even) td {
  background: rgba(44,110,73,.04);
}
.post-body .md-table tbody tr:hover td {
  background: rgba(44,110,73,.09);
}
.post-body strong { font-weight: 700; color: var(--primary-dark); }
.post-body em { font-style: italic; }

/* Markdown images */
.post-body .md-figure {
  margin: 1.75rem 0;
  text-align: center;
}
.post-body .md-img {
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  display: block;
  margin: 0 auto;
}
.post-body figcaption {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .5rem;
  font-style: italic;
}

/* Markdown images */
.post-body .md-figure {
  margin: 1.5rem 0;
  text-align: center;
}
.post-body .md-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  display: block;
  margin: 0 auto;
}
.post-body figcaption {
  margin-top: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Sidebar */
.post-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sidebar-card h3 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.country-link {
  font-size: 1.4rem;
  font-weight: 600;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ── Misc ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--primary);
  font-size: .9rem;
  font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

.not-found {
  text-align: center;
  padding: 8rem 1.5rem;
}
.not-found-emoji { font-size: 5rem; margin-bottom: 1.5rem; }
.not-found h1 { font-family: var(--font-serif); font-size: 2rem; margin-bottom: .75rem; }
.not-found p { color: var(--text-muted); margin-bottom: 2rem; }
.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: .75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 2rem;
  font-size: .85rem;
}

/* ── Search Page ─────────────────────────────────────── */
.search-hero {
  background: linear-gradient(135deg, #1b4332, #2c6e49);
  padding: 3rem 1.5rem;
  color: #fff;
}
.search-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin-bottom: 1.25rem;
}
.search-title i { margin-right: .5rem; }
.search-form {
  display: flex;
  gap: .75rem;
  max-width: 620px;
}
.search-input {
  flex: 1;
  padding: .75rem 1.1rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font-sans);
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.search-input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.4); }
.search-btn {
  padding: .75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  font-family: var(--font-sans);
}
.search-btn:hover { background: #c1440e; }
.search-result-info {
  padding: 1rem 0;
  color: var(--text-muted);
  font-size: .95rem;
}
.search-result-info strong { color: var(--primary-dark); }

/* ── Responsive mobile ───────────────────────────────── */
@media (max-width: 640px) {
  .burger { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem;
    gap: .25rem;
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
  }
  .site-nav.open { display: flex; }
  .section-header { flex-direction: column; align-items: flex-start; }
}
