/* ProtoTrip: S.A. Proto's lime + cyan, rebuilt dark-first with a departures-board heart.
   Proto cues: lime top bar, cyan buttons, cards with a cyan left accent, Lato, the rainbow ring. */

:root,
:root[data-theme='dark'] {
  --bg: #0d0f12;
  --bg-2: #13161a;
  --surface: #1a1e23;
  --surface-2: #22272d;
  --text: #eef1f4;
  --text-soft: #9aa3ad;
  --rule: #2b3138;
  --lime: #83b71a;
  --lime-bright: #a6e22e;
  --cyan: #00aac0;
  --cyan-bright: #26d4ea;
  --on-lime: #0d1200;
  --board: #07090b;
  --board-row: #11151a;
  --led: #b6f03c;
  --led-dim: #6f7a85;
  --board-strong: #ffffff;
  --board-line: #222830;
  --crazy: #ff3d6e;
  --great: #26d4ea;
  --good: #83b71a;
  --typical: #6f7a85;
  --pricey: #c98a3a;
  --ring: conic-gradient(from 210deg, #83b71a, #00aac0, #3d7bff, #b44bff, #ff3d6e, #ffb000, #83b71a);
  --glow-lime: 0 0 0 1px rgba(131, 183, 26, 0.35), 0 10px 40px -10px rgba(131, 183, 26, 0.45);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f3f3f3;
  --bg-2: #e9ecef;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --text: #212529;
  --text-soft: #5c6670;
  --rule: #dee2e6;
  --lime-bright: #6e9c12;
  --cyan-bright: #008ea1;
  --board: #ffffff;
  --board-row: #f3f5f7;
  --led: #3f6b00;
  --led-dim: #6b7580;
  --board-strong: #15181c;
  --board-line: #e3e7eb;
  --great: #0095a8;
  --good: #5f8f10;
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.25);
  color-scheme: light;
}

:root {
  --font-display: 'Space Grotesk', 'Lato', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-base: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  --text-hero: clamp(2.3rem, 1.3rem + 4.2vw, 4.6rem);
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 6px; /* Proto's radius */
  --radius-lg: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 92% -8%, rgba(0, 170, 192, 0.16), transparent 70%),
    radial-gradient(700px 380px at -5% 10%, rgba(131, 183, 26, 0.12), transparent 70%),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--cyan-bright); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cyan-bright); outline-offset: 2px; }
.dim { color: var(--text-soft); font-size: 0.82rem; }

/* ---------- Top bar (Proto lime) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px var(--gutter);
  background: var(--lime);
  color: var(--on-lime);
  box-shadow: 0 6px 24px -10px rgba(131, 183, 26, 0.7);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; color: #fff; }
.brand-name b { color: var(--on-lime); }
.brand-sub { font-size: 0.8rem; font-weight: 700; opacity: 0.8; }
.ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ring);
  display: grid;
  place-items: center;
  animation: spin 14s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 8px, #000 9px);
  mask: radial-gradient(circle, transparent 8px, #000 9px);
}
.ring-plane { display: none; }
.status-chip {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
}
.status-chip[data-mode='demo']::before { content: '● '; color: #ffd36b; }
.status-chip[data-mode='live']::before { content: '● '; color: #fff; }
.for-touch { display: none; }
@media (pointer: coarse) {
  .for-mouse { display: none; }
  .for-touch { display: block; }
}
.theme-toggle {
  border: 0;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  cursor: pointer;
  transition: background 0.15s;
}
.theme-toggle:hover { background: rgba(0, 0, 0, 0.35); }

main { padding: 0 var(--gutter) 64px; max-width: 1560px; margin: 0 auto; }
.search { max-width: 1280px; margin: 0 auto; }

/* ---------- Search ---------- */
.search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 5vw, 64px) 0 clamp(20px, 3vw, 36px);
}
.eyebrow { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; color: var(--lime-bright); margin: 0 0 10px; }
.search-title { font-family: var(--font-display); font-size: var(--text-hero); line-height: 0.98; letter-spacing: -0.035em; margin: 0; font-weight: 700; }
.hot {
  background: var(--ring);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 200%;
  animation: shimmer 6s ease-in-out infinite;
}
.search-lede { color: var(--text-soft); max-width: 46ch; margin: 18px 0 0; }

.search-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border-left: 5px solid var(--cyan); /* Proto card accent */
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* Stops wide date inputs from pushing everything past the card */
  gap: 14px;
  box-shadow: var(--shadow);
}
.more-options { display: contents; }
.more-toggle { display: none; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; flex: 1 1 135px; min-width: 0; }
.row-places .field { flex-basis: 210px; }
.field-narrow { flex: 1 1 90px; }
.field-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-soft); }
.field input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 170, 192, 0.25); }
.field input::placeholder { color: var(--text-soft); font-weight: 400; }

.group { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.segmented { display: flex; flex-wrap: wrap; background: var(--bg-2); border-radius: var(--radius); padding: 3px; gap: 3px; }
.segmented label { flex: 1 1 auto; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  text-align: center;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--cyan); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--cyan-bright); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--lime); transform: translateY(-1px); }
.chip[aria-pressed='true'] { background: var(--lime); color: var(--on-lime); border-color: var(--lime); }

.btn-primary {
  justify-self: start;
  background: var(--lime);
  color: var(--on-lime);
  border: 0;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: var(--glow-lime);
  transition: transform 0.12s var(--ease), box-shadow 0.2s, background 0.15s;
}
.btn-primary:hover { transform: translateY(-2px); background: var(--lime-bright); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }

/* Proto-style cyan button with the flat left edge */
.btn-cyan {
  background: var(--cyan);
  color: #fff;
  border: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, transform 0.12s var(--ease);
}
.btn-cyan:hover { background: var(--cyan-bright); transform: translateX(2px); }

.btn-ghost {
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan-bright); }

/* ---------- Notices ---------- */
.notice { border-left: 4px solid var(--pricey); background: var(--surface); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.88rem; }
.notice[data-kind='error'] { border-color: var(--crazy); }

/* ---------- Crazy deals spotlight ---------- */
.spotlight { margin-bottom: 28px; }
.spotlight-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.spotlight-head h2 { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); margin: 0; letter-spacing: -0.03em; }
.spotlight-head .ring { width: 30px; height: 30px; }
.spotlight-head p { margin: 0; color: var(--text-soft); font-size: 0.9rem; }
.only-crazy { margin-left: auto; }
.crazy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }

.crazy-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 2px;
  background: var(--ring);
  background-size: 300% 300%;
  animation: shimmer 8s ease-in-out infinite;
  opacity: 0;
  animation: shimmer 8s ease-in-out infinite, rise 0.5s var(--ease) forwards;
  animation-delay: 0s, calc(var(--i, 0) * 60ms);
}
.crazy-card:first-child { grid-column: span 2; }
.crazy-inner {
  height: 100%;
  background: var(--surface);
  border-radius: calc(var(--radius-lg) - 2px);
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.crazy-card:hover { box-shadow: 0 0 40px -6px rgba(255, 61, 110, 0.55); }
.crazy-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.crazy-city { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
.crazy-card:first-child .crazy-city { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); }
.crazy-save { font-family: var(--font-display); font-weight: 700; color: var(--crazy); font-size: 1.3rem; white-space: nowrap; }
.crazy-price { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1; }
.crazy-price small { font-size: 0.9rem; color: var(--text-soft); font-weight: 500; }
.crazy-why { display: flex; flex-wrap: wrap; gap: 6px; }
.why { font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); }
.why[data-on='true'] { background: color-mix(in srgb, var(--lime) 22%, transparent); color: var(--lime-bright); }
.why[data-on='true']::before { content: '✓ '; }

/* ---------- Explore (things to do) ---------- */
.explore { margin-top: 10px; }
.btn-explore {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 20px 22px;
  border: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, color-mix(in srgb, var(--cyan) 30%, var(--surface)), var(--surface) 60%);
  border-left: 5px solid var(--lime);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s var(--ease), box-shadow 0.2s;
}
.btn-explore:hover { transform: translateY(-2px); box-shadow: var(--glow-lime); }
.btn-explore[disabled] { cursor: progress; opacity: 0.8; }
.btn-explore b { display: block; font-family: var(--font-display); font-size: clamp(1.3rem, 1rem + 1.2vw, 1.9rem); letter-spacing: -0.02em; }
.btn-explore small { color: var(--text-soft); font-size: 0.88rem; }
.btn-explore .ring { flex: 0 0 auto; width: 44px; height: 44px; }
.explore-head { border-top: 3px solid var(--lime); padding-top: 18px; margin: 10px 0 18px; }
.explore-head h2 { font-family: var(--font-display); font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); margin: 0; letter-spacing: -0.03em; }
.stop-meta { color: var(--lime-bright) !important; font-weight: 700; }
.stop[data-kind='activity'] { --kind: #26d4ea; }
.flex-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.flex-toggle input { accent-color: var(--lime); width: 18px; height: 18px; }
.crazy-meta { font-size: 0.82rem; color: var(--text-soft); display: grid; gap: 2px; }
.crazy-meta b { color: var(--text); }

/* ---------- Departures board ---------- */
.board {
  background: var(--board);
  color: var(--led);
  border-radius: var(--radius-lg);
  padding: 18px clamp(10px, 2vw, 22px) 12px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--cyan);
  overflow: hidden;
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; color: var(--board-strong); padding: 0 6px 12px; border-bottom: 1px solid var(--board-line); }
.board-head h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; }
.board-head p { margin: 0; color: var(--led-dim); font-size: 0.8rem; }
.board-cols, .board-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.8fr) 1fr 1.4fr 1.3fr minmax(112px, 0.9fr) 1.1fr 112px;
  gap: 10px;
  align-items: center;
  padding: 10px 6px;
}
.board-cols { color: var(--led-dim); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.board-row {
  background: var(--board-row);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: flap 0.45s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.board-row:hover { outline: 1px solid var(--board-line); }
.board-row[data-tier='crazy'] { box-shadow: inset 3px 0 0 var(--crazy); }
.dest { font-weight: 700; color: var(--board-strong); text-transform: uppercase; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest small, .board-row small { display: block; color: var(--led-dim); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 0.75rem; }
.board-row .dim { color: var(--led-dim); }
.from { color: var(--board-strong); font-weight: 700; }
.price { font-size: 1.35rem; font-weight: 700; color: var(--led); }
.btn-plan {
  background: var(--cyan);
  color: #fff;
  border: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s;
}
.btn-plan:hover { transform: translateX(2px); background: var(--cyan-bright); }

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0b0d10;
  background: var(--typical);
  white-space: nowrap;
}
.badge[data-tier='crazy'] { background: var(--crazy); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
.badge[data-tier='great'] { background: var(--great); }
.badge[data-tier='good'] { background: var(--good); }
.badge[data-tier='pricey'] { background: var(--pricey); }

.compare { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 4px; font-size: 0.82rem; }
.compare-label { color: var(--text-soft); margin-right: 4px; }
.board .compare-label { color: var(--led-dim); }
.empty { padding: 30px 6px; color: var(--led-dim); }

/* ---------- Trip view ---------- */
.trip-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: end;
  padding: 26px 0 22px;
  border-bottom: 3px solid var(--lime);
  margin-bottom: 26px;
}
.back { margin-bottom: 12px; }
.trip-kicker { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lime-bright); margin: 0 0 6px; }
.trip-title { font-family: var(--font-display); font-size: var(--text-hero); line-height: 0.95; letter-spacing: -0.04em; margin: 0; font-weight: 700; }
.trip-dates { margin: 10px 0 0; color: var(--text-soft); }

.weather { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.wx { flex: 0 0 auto; min-width: 80px; background: var(--surface); border-left: 3px solid var(--cyan); border-radius: var(--radius); padding: 8px 10px; font-size: 0.75rem; }
.wx strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.wx-note { font-size: 0.72rem; color: var(--text-soft); margin: 6px 0 0; }

.trip-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: clamp(20px, 3vw, 40px); align-items: start; }
.trip-aside { position: sticky; top: 70px; display: grid; gap: 16px; }

.pass { display: grid; grid-template-columns: minmax(0, 1fr) auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 26px; border-left: 5px solid var(--cyan); }
.pass-main { padding: 18px 20px; display: grid; gap: 10px; }
.pass-stub {
  background: var(--bg-2);
  padding: 18px 20px;
  display: grid;
  align-content: center;
  gap: 8px;
  text-align: center;
  border-left: 2px dashed var(--rule);
  min-width: 170px;
}
.pass-stub .big-price { font-family: var(--font-display); font-size: 2.3rem; font-weight: 700; line-height: 1; }
.pass-stub .btn-primary { justify-self: stretch; text-align: center; padding: 10px 14px; font-size: 0.95rem; }
.pass-route { display: flex; align-items: center; gap: 14px; }
.pass-code { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.pass-line { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--text-soft) 0 6px, transparent 6px 12px); position: relative; }
.pass-line::after { content: '✈'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); background: var(--surface); padding: 0 6px; color: var(--lime-bright); }
.pass-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.82rem; color: var(--text-soft); }
.pass-meta b { color: var(--text); }
.pass-label { font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan-bright); }
.pass-train { font-size: 0.82rem; color: var(--lime-bright); font-weight: 700; }

.day { margin-bottom: 34px; }
.day-head { display: flex; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 14px; }
.day-num { font-family: var(--font-display); font-size: 2.8rem; font-weight: 700; line-height: 0.8; background: var(--ring); -webkit-background-clip: text; background-clip: text; color: transparent; }
.day-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.day-date { font-size: 0.8rem; color: var(--text-soft); margin-left: auto; white-space: nowrap; }

.stop { display: grid; grid-template-columns: 64px 1fr; gap: 14px; }
.stop-time { font-family: var(--font-display); font-weight: 700; font-size: 0.92rem; padding-top: 12px; }
.stop-time small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.66rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.1em; }
.stop-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  background: var(--surface);
  border-left: 4px solid var(--kind, var(--cyan));
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.stop-card:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.stop-card h4 { margin: 0; font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; }
.stop-card h4 a { color: var(--text); text-decoration-color: var(--rule); text-underline-offset: 3px; }
.stop-card h4 a:hover { color: var(--cyan-bright); }
.stop-card p { margin: 3px 0 0; font-size: 0.82rem; color: var(--text-soft); }
.stop-kind { font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--kind, var(--text-soft)); font-weight: 900; }
.stop-img { width: 86px; height: 64px; object-fit: cover; border-radius: var(--radius); }
.travel { grid-column: 2; font-size: 0.74rem; color: var(--text-soft); padding: 4px 0 4px 14px; border-left: 2px dotted var(--rule); margin-left: 10px; }

.stop[data-kind='sight'] { --kind: #ff8a3d; }
.stop[data-kind='museum'] { --kind: #b44bff; }
.stop[data-kind='nature'] { --kind: var(--lime-bright); }
.stop[data-kind='food'] { --kind: #ffc53d; }
.stop[data-kind='nightlife'] { --kind: var(--crazy); }
.stop[data-kind='shopping'] { --kind: #3d7bff; }
.stop[data-kind='flight'] { --kind: var(--cyan-bright); }
.stop[data-kind='flight'] .stop-card { background: color-mix(in srgb, var(--cyan) 12%, var(--surface)); }

.panel { background: var(--surface); border-left: 5px solid var(--cyan); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.1rem; }
.panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.85rem; }
.panel .compare { margin: 0; }
.xp { display: grid; grid-template-columns: 64px 1fr; gap: 10px; text-decoration: none; color: var(--text); }
.xp img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); }
.xp b { display: block; font-size: 0.84rem; line-height: 1.3; }
.xp span { font-size: 0.74rem; color: var(--text-soft); }
.xp:hover b { color: var(--cyan-bright); }
.alt-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

.loading { padding: 40px 0; text-align: center; color: var(--text-soft); }
.loading::before { content: ''; display: block; width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; background: var(--ring); -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px); animation: spin 1s linear infinite; }

.footer { padding: 24px var(--gutter) 40px; color: var(--text-soft); font-size: 0.75rem; border-top: 1px solid var(--rule); }
.footer p { max-width: 900px; margin: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes flap { from { opacity: 0; transform: rotateX(-70deg); transform-origin: top; } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 61, 110, 0.3); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .search { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .board-cols { display: none; }
  .board-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'dest price' 'from badge' 'when plan' 'air plan'; row-gap: 6px; }
  .board-row > .c-dest { grid-area: dest; }
  .board-row > .c-price { grid-area: price; text-align: right; }
  .board-row > .c-from { grid-area: from; }
  .board-row > .c-badge { grid-area: badge; text-align: right; }
  .board-row > .c-when { grid-area: when; }
  .board-row > .c-air { grid-area: air; font-size: 0.82rem; }
  .board-row > .c-air small { display: inline; }
  .board-row > .c-air small::before { content: ' · '; }
  .board-row > .c-plan { grid-area: plan; align-self: end; text-align: right; }
  .dest { white-space: normal; }
}
@media (max-width: 980px) {
  .trip-hero, .trip-layout { grid-template-columns: minmax(0, 1fr); }
  .trip-aside { position: static; }
}
@media (max-width: 600px) {
  .brand-sub, .status-sources, .search-lede { display: none; }
  .topbar { flex-wrap: nowrap; }
  .status-chip { font-size: 0.68rem; padding: 3px 8px; white-space: nowrap; }

  .search { padding-top: 22px; gap: 16px; }
  .search-title { font-size: clamp(1.85rem, 9.5vw, 2.6rem); }
  .search-card { padding: 14px; gap: 12px; }
  .mode-tab { padding: 10px 6px; font-size: 0.92rem; white-space: nowrap; }
  .field input { font-size: 16px; padding: 10px 9px; } /* Below 16px, iPhones zoom in on every tap */
  .btn-primary { justify-self: stretch; text-align: center; }
  .segmented span { padding: 10px 8px; }
  .chip { padding: 8px 14px; }
  .flex-toggle { font-size: 0.8rem; font-weight: 500; }
  .more-toggle {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 10px 2px; border: 0; border-top: 1px solid var(--rule); background: transparent; cursor: pointer;
    font-size: 0.82rem; font-weight: 700; color: var(--text-soft);
  }
  .more-toggle::after { content: '+'; font-size: 1.2rem; line-height: 1; color: var(--cyan-bright); }
  .more-toggle[aria-expanded='true']::after { content: '−'; }
  .more-options { display: none; }
  .more-options.is-open { display: grid; gap: 14px; }

  /* The crazy deals become a row to swipe through, so the full list stays close. */
  .spotlight { margin-bottom: 20px; }
  .only-crazy { margin-left: 0; }
  .crazy-grid {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 10px; scroll-padding-inline: var(--gutter);
  }
  .crazy-grid::-webkit-scrollbar { display: none; }
  .crazy-card, .crazy-card:first-child { flex: 0 0 min(84%, 320px); grid-column: auto; scroll-snap-align: start; }
  .crazy-card:first-child .crazy-city { font-size: 1.6rem; }
  .crazy-card:only-child { flex-basis: 100%; }

  .board-head { padding-bottom: 8px; }
  .btn-plan { padding: 10px 12px; }

  .trip-hero { padding-top: 18px; margin-bottom: 18px; }
  .route-map { height: 240px; margin-bottom: 18px; }
  .pass { grid-template-columns: minmax(0, 1fr); margin-bottom: 18px; }
  .pass-stub { border-left: 0; border-top: 2px dashed var(--rule); min-width: 0; }
  .pass-code { font-size: 2.1rem; }
  .btn-explore { padding: 16px; gap: 12px; }
  .stop { grid-template-columns: 50px minmax(0, 1fr); gap: 8px; }
  .stop-img { display: none; }
  .day-num { font-size: 2.2rem; }
  .day-head { flex-wrap: wrap; gap: 4px 12px; }
  .conn { grid-template-columns: minmax(0, 1fr) auto; }
  .conn .mode-pill { grid-column: 1 / -1; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .board-row, .crazy-card { opacity: 1; }
}

/* ---------- Deal map ---------- */
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.map-panel {
  position: relative;
  background: var(--surface);
  border-left: 5px solid var(--cyan);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}
.map-panel, .results { scroll-margin-top: 72px; }
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.map-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-clear { flex: none; white-space: nowrap; }
.deal-map { height: clamp(360px, 55vh, 620px); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.map-hint { margin: 0; font-size: 0.75rem; color: var(--text-soft); }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: var(--text-soft); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.lg-crazy { background: var(--crazy); box-shadow: 0 0 8px var(--crazy); }
.lg-great { background: var(--great); }
.lg-good { background: var(--good); }
.lg-train { width: 18px; height: 0; border-radius: 0; border-top: 3px dashed var(--lime-bright); }
.lg-flight { width: 18px; height: 3px; border-radius: 2px; background: var(--cyan-bright); }
.lg-home { width: 18px; height: 3px; border-radius: 2px; background: #b44bff; }
.lg-ground { width: 18px; height: 0; border-radius: 0; border-top: 3px dashed #ffb000; }

/* Leaflet theming */
.leaflet-container { font-family: var(--font-body); background: var(--bg-2); }
.leaflet-control-zoom a, .leaflet-control-layers { background: var(--surface) !important; color: var(--text) !important; border-color: var(--rule) !important; }
.leaflet-control-layers-expanded { padding: 8px 12px; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 70%, transparent) !important; color: var(--text-soft) !important; font-size: 9px; opacity: 0.7; transition: opacity 0.2s; }
.leaflet-control-attribution:hover { opacity: 1; }
.deal-map.is-outdated { outline: 2px dashed var(--pricey); outline-offset: -2px; }
.leaflet-control-attribution a { color: var(--cyan-bright) !important; }
.map-tip { background: var(--surface); color: var(--text); border: 1px solid var(--rule); border-radius: 6px; font-weight: 700; box-shadow: var(--shadow); }
.map-tip::before { display: none; }
.map-card {
  position: absolute; left: 10px; bottom: 10px; z-index: 1000; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 20px); padding: 8px 10px 8px 12px; cursor: default;
  background: var(--surface); color: var(--text); border-left: 4px solid var(--crazy); border-radius: 10px; box-shadow: var(--shadow);
}
.map-card-text { display: grid; min-width: 0; line-height: 1.25; }
.map-card-text b { font-family: var(--font-display); font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-card-text > small { font-size: 0.72rem; color: var(--text-soft); }
.map-card-price { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.map-card-price small { font-size: 0.72rem; color: var(--text-soft); }
.map-card .btn-cyan { flex: none; padding: 8px 12px; }

/* Paths: faint for all deals, bold + animated for the selected one */
.route-faint { stroke: var(--cyan-bright); stroke-opacity: 0.22; fill: none; }
.route-faint.tier-crazy { stroke: var(--crazy); stroke-opacity: 0.45; }
.has-selection .route-faint { stroke-opacity: 0.06; }
.has-selection .pin-dest { opacity: 0.35; }
.route-glow { stroke: var(--cyan-bright); stroke-opacity: 0.18; fill: none; }
.route-flight { stroke: var(--cyan-bright); fill: none; stroke-linecap: round; stroke-dasharray: 10 8; animation: route-dash 1.1s linear infinite; }
.route-flight.tier-crazy { stroke: var(--crazy); }
.route-train { stroke: var(--lime-bright); stroke-dasharray: 2 8; stroke-linecap: round; fill: none; }
.route-flight.route-home { stroke: #b44bff; }
.pin-origin { stroke: #fff; fill: var(--lime); fill-opacity: 1; stroke-width: 2; }
.pin-crazy { filter: drop-shadow(0 0 6px rgba(255, 61, 110, 0.9)); }
.pin-dest { cursor: pointer; transition: opacity 0.2s; }
@keyframes route-dash { to { stroke-dashoffset: -18; } }

.pin-home { position: relative; }
.pin-home-dot { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--lime); border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(131, 183, 26, 0.35), 0 0 16px rgba(131, 183, 26, 0.8); }
.pin-home-label { position: absolute; left: 20px; top: -2px; font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--text); text-shadow: 0 1px 3px var(--bg); white-space: nowrap; }
.pin-plane .plane { display: block; font-size: 22px; line-height: 26px; text-align: center; color: #fff; text-shadow: 0 0 8px rgba(0, 0, 0, 0.9); }

/* Selection in the list */
.crazy-card, .board-row { cursor: pointer; }
.crazy-card.is-selected { box-shadow: 0 0 0 3px var(--cyan-bright), 0 0 40px -6px rgba(38, 212, 234, 0.6); }
.board-row.is-selected { outline: 2px solid var(--cyan-bright) !important; background: color-mix(in srgb, var(--cyan) 18%, var(--board-row)); }

/* Route map on the trip screen */
.route-map { height: 320px; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 26px; border-left: 5px solid var(--cyan); }

@media (max-width: 600px) {
  .map-panel { padding: 8px; }
  .deal-map { height: 300px; }
  .map-legend { gap: 6px 10px; font-size: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) { .route-flight { animation: none; } }

/* ---------- Fly / Bus & train switch ---------- */
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 10px; }
.mode-tab {
  border: 0; background: transparent; padding: 10px 12px; border-radius: 7px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text-soft);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab[aria-selected='true'] { background: var(--lime); color: var(--on-lime); box-shadow: var(--glow-lime); }
.ground-from { margin: 0; font-size: 0.9rem; color: var(--text-soft); }
.ground-from b { color: var(--text); }
.route-ground { stroke: #ffb000; fill: none; stroke-linecap: round; stroke-dasharray: 10 8; animation: route-dash 1.1s linear infinite; }
.route-ground.tier-crazy { stroke: var(--crazy); }
.route-faint.mode-ground { stroke-dasharray: 4 6; }

/* Ground trip: connection lists */
.conn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.conn { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.85rem; }
.conn.is-best { outline: 2px solid var(--lime); }
.conn b { font-family: var(--font-display); }
.conn .conn-price { font-family: var(--font-display); font-weight: 700; }
.mode-pill { font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, #ffb000 22%, transparent); color: #ffb000; }
.price-split { font-size: 0.8rem; color: var(--text-soft); }

/* Flight price first; the train/bus to the airport as a smaller second number. */
.plus-travel { font-size: 0.62em; font-weight: 500; color: var(--text-soft); white-space: nowrap; }
.board-row .plus-travel { color: var(--led-dim); }

/* Leaflet's panes use z-indexes up to 1000: keep them inside the map so the sticky top bar stays on top. */
.deal-map, .route-map { position: relative; isolation: isolate; }
