/* ==========================================================================
   Scenic Compass — Explorer Edition Beta
   Design tokens per LOCKED spec. No hard-coded colours below the token block.
   Font: Inter. Icons: Lucide-style outline, 24px grid, 2px stroke.
   Spacing: 8pt grid.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  /* ---- Locked palette ---- */
  --midnight: #0c1218;        /* Primary dark */
  --forest: #2e4e43;          /* Primary action */
  --summit: #f5f4f0;          /* Background */
  --stone: #ffffff;           /* Surface */
  --slate: #46525c;           /* Text & icons */
  --glacier: #a9c4ce;         /* Secondary accent */
  --scenic-gold: #b98e4e;     /* Highlights & favourites */
  --scenic-gold-soft: #d8bd8e;

  /* ---- Semantic tokens ---- */
  --bg: var(--summit);
  --surface: var(--stone);
  --surface-2: #faf9f6;
  --text: var(--midnight);
  --text-2: var(--slate);
  --text-3: #8a949c;
  --line: rgba(12, 18, 24, 0.08);
  --hero-fg: var(--summit);
  --hero-fg-2: rgba(245, 244, 240, 0.68);
  --shadow: 0 16px 40px -20px rgba(12, 18, 24, 0.35);
  --shadow-sm: 0 4px 16px -8px rgba(12, 18, 24, 0.25);

  /* ---- Type / shape / spacing (8pt grid) ---- */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
  --s1: 8px;  --s2: 16px;  --s3: 24px;  --s4: 32px;  --s5: 40px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0a0f14;
  --surface: #121a22;
  --surface-2: #17212b;
  --text: #eef0ee;
  --text-2: #a7b1b8;
  --text-3: #6d7880;
  --line: rgba(245, 244, 240, 0.09);
  --shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 4px 16px -8px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: 16px; }
img { display: block; }

.num { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* ---------- App shell ---------- */

.app {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

@media (min-width: 481px) {
  body { background: var(--midnight); }
  .app { box-shadow: var(--shadow); }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s2) var(--s3) var(--s1);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 30;
  transition: box-shadow 0.2s ease;
}
.app-header.scrolled { box-shadow: 0 1px 0 var(--line); }

.wordmark { display: flex; align-items: center; gap: 10px; }
.wordmark img { height: 26px; width: auto; }
.wordmark .name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.wordmark .name small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--scenic-gold);
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

main {
  flex: 1;
  padding: var(--s1) var(--s3) 112px;
  overflow-y: auto;
}

.view { animation: fade-up 0.35s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* ---------- Bottom navigation (SC-C005) ---------- */

.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 4px calc(10px + var(--safe-bottom));
  z-index: 30;
}

.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none;
  color: var(--text-3);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  min-width: 60px;
}
.tab svg { width: 24px; height: 24px; stroke-width: 2; }
.tab.active { color: var(--scenic-gold); }

/* ---------- Text primitives ---------- */

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--scenic-gold);
}

.screen-q {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 4px 0 var(--s3);
}

.muted { color: var(--text-2); }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3);
  margin-bottom: var(--s2);
  box-shadow: var(--shadow-sm);
}
.card .card-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-3);
  margin-bottom: var(--s2);
}

.pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.pill.gold { color: var(--scenic-gold); border-color: var(--scenic-gold-soft); background: color-mix(in srgb, var(--scenic-gold) 8%, transparent); }
.pill.forest { color: var(--forest); border-color: color-mix(in srgb, var(--forest) 40%, transparent); background: color-mix(in srgb, var(--forest) 8%, transparent); }
[data-theme="dark"] .pill.forest { color: #7fae9d; }

.divider { height: 1px; background: var(--line); border: none; margin: var(--s2) 0; }

/* ---------- Journey hero (SC-S001) ---------- */

.hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--midnight);
  color: var(--hero-fg);
  margin-bottom: var(--s2);
  box-shadow: var(--shadow);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero .media {
  position: absolute;
  inset: 0;
}
.hero .media svg, .hero .media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.hero .media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,18,24,0) 30%, rgba(12,18,24,0.62) 78%, rgba(12,18,24,0.85) 100%);
}

.hero .content {
  position: relative;
  padding: var(--s3);
  z-index: 1;
}
.hero .eyebrow { color: var(--scenic-gold-soft); }
.hero h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; color: var(--hero-fg); margin: 4px 0 2px; }
.hero .sub { font-size: 14px; color: var(--hero-fg-2); }

.hero .hero-stats {
  display: flex;
  gap: var(--s3);
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid rgba(245,244,240,0.18);
}
.hero .hero-stats div span { display: block; font-size: 17px; font-weight: 700; color: var(--hero-fg); }
.hero .hero-stats div small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--hero-fg-2); }

/* small destination media (cards & rows) */
.thumb {
  width: 64px; height: 64px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--midnight);
  position: relative;
}
.thumb svg, .thumb img { width: 100%; height: 100%; object-fit: cover; }

.banner {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  height: 148px;
  margin-bottom: var(--s2);
  background: var(--midnight);
}
.banner svg, .banner img { width: 100%; height: 100%; object-fit: cover; }

.banner.duo {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 3px;
}
.banner.duo .cell { position: relative; overflow: hidden; height: 148px; }
.banner:not(.duo) .cell { position: absolute; inset: 0; }
.banner .cell svg, .banner .cell img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.caption {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 8px 10px 4px;
}

/* ---------- Buttons (SC-C001 / SC-C002) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  width: 100%;
  padding: 16px var(--s3);
  border-radius: var(--r-md);
  border: none;
  background: var(--forest);
  color: var(--summit);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 20px; height: 20px; }

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.ghost {
  background: none;
  color: var(--text-2);
  border: none;
  width: auto;
  padding: var(--s1) var(--s2);
  font-size: 14px;
}
.btn.gold { background: var(--scenic-gold); color: var(--midnight); }

.btn-row { display: flex; gap: var(--s1); }
.btn-row .btn { flex: 1; }

.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible,
.row-btn:focus-visible, .switch:focus-visible {
  outline: 2px solid var(--scenic-gold);
  outline-offset: 2px;
}

/* ---------- Summary rows ---------- */

.info-row {
  display: flex;
  gap: var(--s2);
  align-items: center;
  padding: 12px 0;
}
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-row .ic {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--scenic-gold);
}
.info-row .ic svg { width: 20px; height: 20px; }
.info-row .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.info-row .v { font-size: 16px; font-weight: 600; margin-top: 1px; }
.info-row .s { font-size: 13px; color: var(--text-2); margin-top: 1px; }

/* ---------- Journey list ---------- */

.row-btn {
  display: flex;
  gap: var(--s2);
  align-items: center;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.row-btn:last-child { border-bottom: none; }

.row-main { flex: 1; min-width: 0; }
.row-main .t { font-size: 16px; font-weight: 600; }
.row-main .d { font-size: 13px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .m { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.row-num {
  width: 32px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
  flex-shrink: 0;
}
.milestone .row-num { color: var(--scenic-gold); }
.chev { color: var(--text-3); flex-shrink: 0; }
.chev svg { width: 18px; height: 18px; }

/* journey progress */
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: var(--s1) 0 6px;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--forest), var(--scenic-gold));
  transition: width 0.6s ease;
}
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s1);
  margin-top: var(--s2);
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
  text-align: center;
}
.stat b { display: block; font-size: 17px; font-weight: 700; }
.stat small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }

/* ---------- Timeline (Today) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 var(--s2) 26px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 5px; top: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--scenic-gold);
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 8px; top: 19px; bottom: -3px;
  width: 2px;
  background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .tl-t { font-size: 15px; font-weight: 600; }
.timeline .tl-s { font-size: 13px; color: var(--text-2); }

/* ---------- Lists ---------- */

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  display: flex; gap: 10px;
  padding: 10px 0;
  font-size: 15px;
  border-top: 1px solid var(--line);
}
.plain-list li:first-child { border-top: none; }
.plain-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--glacier); flex-shrink: 0; margin-top: 8px; }

/* ---------- Memories ---------- */

.memory-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--scenic-gold);
  border-radius: var(--r-sm);
  padding: var(--s2);
  margin-bottom: var(--s2);
}
.memory-card .meta { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.memory-card p { margin: 0; font-size: 15px; line-height: 1.5; }
.memory-card .actions { margin-top: var(--s1); }
.memory-card .actions button {
  background: none; border: none;
  font-size: 13px; color: var(--text-3);
  cursor: pointer; padding: 0;
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: var(--s5) var(--s3);
  color: var(--text-2);
}
.empty-state svg { width: 44px; height: 44px; color: var(--glacier); margin: 0 auto 12px; }
.empty-state b { display: block; font-size: 17px; color: var(--text); margin-bottom: 4px; }

/* ---------- Forms (SC-C003/4) ---------- */

textarea, select, input[type="text"] {
  width: 100%;
  font-family: var(--font);
  font-size: 16px;
  padding: 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  resize: vertical;
  appearance: none;
}
textarea:focus, select:focus, input:focus {
  outline: 2px solid var(--scenic-gold);
  outline-offset: 1px;
}

.field { margin-bottom: var(--s2); }
.field label {
  display: block;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 6px;
}

/* ---------- Settings ---------- */

.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s2);
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-child { border-top: none; }
.setting-row .t { font-size: 16px; font-weight: 600; }
.setting-row .s { font-size: 13px; color: var(--text-2); margin-top: 1px; }

.switch {
  width: 50px; height: 30px;
  border-radius: 999px;
  background: var(--line);
  border: none;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.22s ease;
}
.switch.on { background: var(--forest); }
.switch.on::after { transform: translateX(20px); }

.brand-block {
  text-align: center;
  padding: var(--s3) 0 var(--s1);
}
.brand-block img { height: 56px; width: auto; margin: 0 auto var(--s1); }
.brand-block .quote {
  font-size: 15px;
  font-style: italic;
  color: var(--text-2);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.55;
}
