/* ===========================================================
   Kombi — SA road trip planner
   Warm postcard: cream paper, retro teal, sunset coral, mustard.
   Poppins throughout, Caveat for a couple of handwritten touches.
   Mobile-first; fluid grids so it works at any width.
   =========================================================== */

:root {
  --cream:   #fbf3e4;
  --card:    #fffdf8;
  --ink:     #3a2e27;
  --ink-dim: #7d6c5e;
  --teal:    #159a8a;
  --teal-dk: #0f7a6d;
  --coral:   #ef6b4e;
  --mustard: #f4b63f;
  --sky:     #cfeae6;
  --line:    #ece0cd;
  --shadow:  0 14px 34px rgba(90, 60, 30, 0.12);
  --shadow-sm: 0 6px 16px rgba(90, 60, 30, 0.10);
  --radius:  22px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Poppins", system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------------- HERO ---------------- */
.hero { position: relative; overflow: hidden; }
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero__inner {
  position: relative;
  z-index: 1;
  width: min(680px, 90vw);
  margin: 0 auto;
  padding: 2.4rem 0 3.4rem;
}
.script {
  font-family: "Caveat", cursive;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--teal-dk);
  margin: 0 0 0.1rem;
  transform: rotate(-2deg);
}
.hero__title {
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--ink);
}
.hero__sub {
  max-width: 40ch;
  font-size: 1.05rem;
  color: #5a4a3d;
  margin: 0;
}

/* ---------------- LAYOUT ---------------- */
.wrap { width: min(680px, 90vw); margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
}

/* pull the planner up so it overlaps the hero a touch */
.planner {
  position: relative;
  z-index: 2;
  margin-top: -1.6rem;
}

/* ---------------- FORM ---------------- */
.field { margin-bottom: 1.3rem; }
.field:last-of-type { margin-bottom: 0; }

.lbl {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot--from { background: var(--teal); }
.dot--to { background: var(--coral); border-radius: 3px; }

input[type="text"],
input[type="number"],
select {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;   /* >=16px: no iOS zoom */
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(21, 154, 138, 0.15);
}
input::placeholder { color: #b6a894; }

/* autocomplete suggestions */
.auto { position: relative; }
.sug {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.3rem;
  position: absolute;
  left: 0; right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
}
.sug li {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.98rem;
}
.sug li:hover, .sug li.is-active { background: var(--sky); }
.sug small { color: var(--ink-dim); }

/* car picker */
.cars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}
.car {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.9rem 0.4rem;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.car:hover { transform: translateY(-2px); border-color: var(--mustard); }
.car__emoji { font-size: 1.7rem; line-height: 1; margin-bottom: 0.2rem; }
.car small { font-weight: 500; color: var(--ink-dim); font-size: 0.78rem; }
.car.is-on { border-color: var(--teal); background: #eafaf6; }

.tweak {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.8rem;
}
.tweak label { font-size: 0.9rem; color: var(--ink-dim); white-space: nowrap; }
.tweak input { max-width: 130px; }

/* fuel + region split */
.field--split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field--split .lbl { margin-bottom: 0.5rem; }

.seg { display: flex; gap: 0.3rem; background: #f2ead9; border-radius: 14px; padding: 4px; }
.seg__btn {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 11px;
  padding: 0.7rem 0;
  cursor: pointer;
  transition: all 0.15s;
}
.seg__btn.is-on { color: #fff; background: var(--teal); box-shadow: var(--shadow-sm); }

/* the big button */
.go {
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  background: var(--coral);
  border: 0;
  border-radius: 16px;
  padding: 1.05rem;
  margin-top: 1.5rem;
  cursor: pointer;
  box-shadow: 0 12px 26px -8px rgba(239, 107, 78, 0.6);
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.go:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -8px rgba(239, 107, 78, 0.7); }
.go:active { transform: translateY(0); }
.go[disabled] { opacity: 0.65; cursor: wait; transform: none; }

.msg { min-height: 1.3rem; margin: 0.8rem 0 0; text-align: center; font-weight: 600; color: var(--coral); }

/* ---------------- RESULTS ---------------- */
.results { margin-top: 2.5rem; animation: rise 0.5s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .results, .stops li { animation: none !important; } }

.results__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.results__title {
  font-weight: 800;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}
.link {
  font: inherit; font-weight: 600;
  color: var(--teal-dk);
  background: none; border: 0; cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}
.results__summary {
  font-family: "Caveat", cursive;
  font-size: 1.5rem;
  color: var(--teal-dk);
  margin: 0.3rem 0 1.5rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat__icon { font-size: 1.4rem; display: block; margin-bottom: 0.3rem; }
.stat__num { display: block; font-weight: 800; font-size: 1.9rem; line-height: 1; letter-spacing: -0.02em; }
.stat__num small { font-size: 1rem; font-weight: 700; color: var(--ink-dim); }
.stat__unit { font-size: 0.82rem; color: var(--ink-dim); }
.stat--cost { background: #eafaf6; border-color: #bfe9e0; }
.stat--cost .stat__num { color: var(--teal-dk); }

.map {
  height: 340px;
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.leaflet-container { font: inherit; background: #dceee9; }

.section-title {
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.section-note { font-family: "Caveat", cursive; font-size: 1.15rem; color: var(--coral); font-weight: 700; }

.fun {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  margin-bottom: 2.2rem;
}
.fun__card {
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 1.2rem 0.8rem;
  text-align: center;
}
.fun__num { display: block; font-weight: 800; font-size: 2rem; color: var(--coral); line-height: 1; margin-bottom: 0.4rem; }
.fun__lbl { font-size: 0.85rem; color: var(--ink); line-height: 1.35; }
.fun__lbl em { font-style: normal; color: var(--ink-dim); font-size: 0.76rem; }

/* stops */
.stops { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.stops li {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  animation: slidein 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.stops .km {
  flex-shrink: 0;
  min-width: 62px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--teal-dk);
  background: #eafaf6;
  border-radius: 10px;
  padding: 0.4rem 0.3rem;
}
.stops .place { flex: 1; font-weight: 600; line-height: 1.25; }
.stops .kind {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--mustard);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  white-space: nowrap;
}
.stops__empty {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  color: var(--ink-dim);
}

/* recent */
.recent { margin-top: 2.5rem; }
.recent__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.recent__list li {
  font-size: 0.92rem;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  box-shadow: var(--shadow-sm);
}
.recent__list li:hover { border-color: var(--teal); transform: translateY(-1px); }
.recent__list .r-km { color: var(--ink-dim); font-size: 0.82rem; margin-left: 0.4rem; }

/* footer */
.foot {
  width: min(680px, 90vw);
  margin: 3rem auto 2.5rem;
  color: var(--ink-dim);
  font-size: 0.82rem;
  text-align: center;
}
.foot p { margin: 0; }

/* map markers */
.mk { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.35); }
.mk--stop { background: var(--mustard); }
.mk--start { background: var(--teal); }
.mk--end { background: var(--coral); }

:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

/* tiny screens: keep the fuel/region split from getting cramped */
@media (max-width: 380px) {
  .field--split { grid-template-columns: 1fr; }
  .card { padding: 1.2rem; }
}
