/* ---------- Theme tokens ---------- */
:root {
  color-scheme: light;
  --page: #fdf8f0;
  --surface: #ffffff;
  --ink: #2b2118;
  --ink-2: #5f5548;
  --muted: #9a8f80;
  --hairline: #f0e5d4;
  --border: rgba(60, 40, 20, 0.10);
  --accent: #f4743b;
  --accent-2: #12a5a0;
  --accent-soft: #ffe4d1;
  --good: #1a8f3c;
  --sun: #ffc247;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #191412;
    --surface: #242019;
    --ink: #fff7ec;
    --ink-2: #d8c9b4;
    --muted: #9a8f80;
    --hairline: #362f26;
    --border: rgba(255, 220, 180, 0.12);
    --accent: #ff8b52;
    --accent-2: #2fc4be;
    --accent-soft: #5a2f14;
    --good: #3ecf6a;
    --sun: #ffc247;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #191412;
  --surface: #242019;
  --ink: #fff7ec;
  --ink-2: #d8c9b4;
  --muted: #9a8f80;
  --hairline: #362f26;
  --border: rgba(255, 220, 180, 0.12);
  --accent: #ff8b52;
  --accent-2: #2fc4be;
  --accent-soft: #5a2f14;
  --good: #3ecf6a;
  --sun: #ffc247;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 85% -60px, rgba(255, 194, 71, 0.16), transparent 70%),
    radial-gradient(700px 380px at -60px 30%, rgba(18, 165, 160, 0.08), transparent 70%),
    var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---------- Site header ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
}
.site-header .brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-right: auto;
}
.site-header .brand::before { content: "🧭 "; }
.site-header .brand:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: 14px; }
.site-nav a { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.site-nav a:hover { color: var(--accent); }
.theme-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Auth ---------- */
.auth-slot { display: flex; align-items: center; }
.auth-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.auth-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-user { display: flex; align-items: center; gap: 8px; }
.auth-user .avatar { width: 24px; height: 24px; border-radius: 50%; }
.auth-user .auth-name { font-size: 13px; color: var(--ink-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Save button (city hero) ---------- */
.save-btn {
  align-self: flex-start;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.save-btn:hover { background: rgba(255, 255, 255, 0.26); transform: scale(1.04); }
.save-btn.is-saved { background: var(--sun); color: #2b2118; border-color: var(--sun); }

/* ---------- Suggest-a-country form ---------- */
.request-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
#request-form .auth-btn { margin-top: 10px; }
#request-form .sub { margin: 8px 0 0; }

/* ---------- Index: intro ---------- */
.intro { margin: 28px 0 8px; }
.intro h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}
.intro p { color: var(--ink-2); max-width: 620px; margin: 0; }

/* ---------- Index: city cards ---------- */
.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin: 28px 0;
}
.city-card,
.country-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  color: inherit;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.city-card:hover {
  text-decoration: none;
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: 0 14px 32px rgba(244, 116, 59, 0.18);
  border-color: var(--accent);
}
.country-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(244, 116, 59, 0.14);
  border-color: var(--accent);
}
.country-card a.banner:hover { text-decoration: none; filter: brightness(1.08); }
.country-cities {
  border-top: 1px solid var(--hairline);
  margin-top: 12px;
}
.country-cities a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.country-cities a:last-child { border-bottom: none; }
.country-cities a:hover { color: var(--accent); text-decoration: none; }
.country-cities .bud {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.city-card .banner.has-photo,
.country-card .banner.has-photo { height: 156px; }
.city-card .banner,
.country-card .banner {
  height: 88px;
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.city-card .banner .flag,
.country-card .banner .flag { font-size: 26px; margin-right: 10px; }
.city-card .banner h2,
.country-card .banner h2 { margin: 0; font-size: 21px; letter-spacing: -0.01em; }
.city-card .banner .country,
.country-card .banner .country { font-size: 13px; opacity: 0.9; display: block; margin-top: -2px; }
.city-card .body,
.country-card .body { padding: 12px 16px 14px; }
.city-card .tagline,
.country-card .tagline { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }
.card-stats { display: flex; gap: 0; border-top: 1px solid var(--hairline); padding-top: 10px; }
.card-stats div { flex: 1; }
.card-stats .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card-stats .val { font-size: 14px; font-weight: 600; }

/* ---------- Index: budget comparison ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin: 28px 0;
}
.panel h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.budget-row {
  display: grid;
  grid-template-columns: 110px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}
.budget-row .name { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.budget-row .track { position: relative; height: 14px; }
.budget-row .bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--sun), var(--accent));
  border-radius: 999px;
  min-width: 3px;
}
.budget-row .val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.budget-row .val .range { color: var(--muted); font-weight: 400; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
}
td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.muted { color: var(--ink-2); }
.table-scroll { overflow-x: auto; }

/* ---------- City page: hero ---------- */
.hero {
  border-radius: 16px;
  color: #ffffff;
  padding: 32px 28px 24px;
  margin-top: 8px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.hero.has-photo {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero .crumb { font-size: 13px; opacity: 0.85; }
.hero .crumb a { color: #ffffff; }
.hero h1 { margin: 6px 0 2px; font-size: 36px; letter-spacing: -0.02em; }
.hero .flag { margin-right: 10px; }
.hero .country { font-size: 15px; opacity: 0.9; }
.hero .tagline { margin: 10px 0 0; max-width: 560px; font-size: 15px; opacity: 0.95; }

/* ---------- City page: KPI tiles ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 28px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.kpi .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.kpi .val { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.kpi .note { font-size: 12px; color: var(--ink-2); margin-top: 1px; }

/* ---------- City page: sections ---------- */
.section { margin: 26px 0; }
.section > h2 {
  font-size: 21px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.section > h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 44px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--sun));
}
.section > h3 { font-size: 15px; margin: 18px 0 6px; }
.section p { color: var(--ink-2); margin: 8px 0; }
.section p strong, .section li strong { color: var(--ink); }
.section ul { margin: 8px 0; padding-left: 20px; color: var(--ink-2); }
.section li { margin: 5px 0; }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 12px 0;
  color: var(--ink-2);
  font-size: 14px;
}
.callout strong { color: var(--ink); }

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.fact .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.fact .val { font-size: 14px; margin-top: 2px; }

/* Photo gallery strip */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.photo-strip figure { margin: 0; }
.photo-strip img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.photo-strip a:hover img { filter: brightness(1.05); }
.photo-strip figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 5px;
}
.photo-strip .credit {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* Definition-style lists (getting around, where to stay) */
.dl-row { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.dl-row:last-child { border-bottom: none; }
.dl-row dt { font-weight: 600; font-size: 14px; margin: 0; }
.dl-row dd { margin: 0; color: var(--ink-2); font-size: 14px; }
dl { margin: 0; }

/* FAQs */
details {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 8px 0;
}
details summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details p { margin: 8px 0 4px; color: var(--ink-2); font-size: 14px; }

/* Footer */
.site-footer {
  margin: 40px 0 32px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 13px;
}

.error-box { margin: 60px auto; text-align: center; }

@media (max-width: 560px) {
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
  .budget-row { grid-template-columns: 84px 1fr 80px; }
  .hero h1 { font-size: 28px; }
}
