:root {
  --bg: #fbf9f5;
  --surface: #ffffff;
  --text: #0c0c0c;
  --text-dim: #6a6a6a;
  --accent: #ff5b2e;
  --accent-soft: #fff1ec;
  --border: #ececea;
  --shadow: 0 20px 40px -20px rgba(0,0,0,0.25);
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Buttons ---------- */
.btn-pill {
  border-radius: 100px;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn-pill:hover { transform: translateY(-2px); }
.btn-pill:active { transform: translateY(0); }

.btn-pill-solid { background: var(--text); color: #fff; }
.btn-pill-solid:hover { background: var(--accent); box-shadow: 0 10px 24px -8px rgba(255,91,46,0.6); }

.btn-pill-outline { background: transparent; color: var(--text); border-color: var(--text); }
.btn-pill-outline:hover { background: var(--text); color: #fff; }

.btn-pill-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-pill-ghost:hover { border-color: var(--text); color: var(--text); }

.btn-pill-small { padding: 9px 18px; font-size: 13px; }

/* ---------- Topnav ---------- */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 5vw 0;
}

.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.3px; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-cta { display: none; }
@media (min-width: 640px) { .nav-cta { display: inline-flex; } }

/* ---------- Hero ---------- */
.hero {
  background: var(--bg);
  padding-bottom: 40px;
  position: relative;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 44px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 0 18px;
  padding: 6px 16px;
  background: var(--accent-soft);
  border-radius: 100px;
}

.hero h1 {
  font-size: clamp(34px, 6.4vw, 68px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.03;
  margin: 0 0 20px;
  text-transform: uppercase;
}

.accent-text {
  color: var(--accent);
  display: inline-block;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.subtitle {
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 36px;
  font-size: 16.5px;
}

/* ---------- Ask AI ---------- */
.ask-ai {
  max-width: 640px;
  margin: 0 auto 28px;
}

.ask-bar {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 8px 8px 8px 20px;
  border-radius: 100px;
  box-shadow: var(--shadow);
}

.ask-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
}

.ask-bar input:focus { outline: none; }
.ask-bar input::placeholder { color: var(--text-dim); }

.chat-thread {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-height: 360px;
  overflow-y: auto;
  text-align: left;
  padding: 4px;
}

.chat-thread.open { display: flex; }

.chat-msg {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 88%;
}

.chat-msg p { margin: 0; white-space: pre-wrap; }
.chat-msg a { color: var(--accent); font-weight: 700; text-decoration: underline; }
.chat-user a { color: #fff; }
.chat-msg strong { font-weight: 800; }

.chat-msg .chat-role {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.chat-user {
  align-self: flex-end;
  background: var(--text);
  color: #fff;
}

.chat-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1.5px solid var(--border);
}

.chat-assistant.pending { opacity: 0.6; }
.chat-assistant.chat-error { border-color: #ffb4a0; background: #fff4f0; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 28px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.filter-field label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  padding-left: 4px;
}

.filter-field select,
.filter-field input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 100px;
  font-size: 14px;
  min-width: 120px;
  font-family: inherit;
}

.filter-field select:focus,
.filter-field input:focus { outline: none; border-color: var(--accent); }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  background: var(--text);
  padding: 14px 0;
  margin-top: 20px;
}

.marquee-track {
  display: flex;
  width: max-content;
  gap: 40px;
  animation: scroll-left 40s linear infinite;
}

.marquee-track span {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0.85;
}

.marquee-track span.sep { color: var(--accent); opacity: 1; }

@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Main / grid ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 44px 24px 60px; }

.results-meta {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#resultCount { color: var(--text-dim); font-size: 14px; font-weight: 600; }

.results-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 100px;
  font-size: 13.5px;
  font-family: inherit;
  min-width: 220px;
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Save / bucket list ---------- */
.save-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.save-btn:hover { transform: scale(1.1); }
.save-btn.saved { background: var(--accent); color: #fff; }

.save-btn-modal { margin: 14px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px 26px;
}

.card {
  background: var(--surface);
  border-radius: 26px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.card:hover { transform: translateY(-8px); }
.card:hover .card-photo img { transform: scale(1.08); }

.card-photo {
  height: 210px;
  border-radius: 26px;
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.card-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.card-photo .fallback-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
}

.card-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0) 55%);
}

.card-country {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  padding: 5px 13px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  z-index: 2;
}

.card-cost-badge {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

.card-cost-badge .label { font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.4px; }
.card-cost-badge .value { font-weight: 800; font-size: 18px; }

.card-body { padding: 20px 6px 6px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 0 0 5px; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.tagline { color: var(--accent); font-size: 13px; margin: 0 0 10px; font-weight: 700; }
.desc { color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; flex: 1; }

.view-flights { width: 100%; }

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 30px 20px 50px;
  border-top: 1px solid var(--border);
}
.photo-credit { margin-top: 4px; font-size: 11.5px; opacity: 0.7; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 30px;
  max-width: 660px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.modal-overlay.open .modal { transform: scale(1); opacity: 1; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.9);
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  z-index: 2;
}

.modal-photo {
  height: 220px;
  border-radius: 30px 30px 0 0;
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
}

.modal-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.modal-photo .fallback-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 56px; }
.modal-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.5), rgba(0,0,0,0) 50%); }

.modal-body { padding: 26px 28px 30px; }
.modal-body h2 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.4px; }
.modal-body h4 { margin: 26px 0 12px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); font-weight: 700; }

.cost-breakdown {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-top: 20px;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 13px;
}

.breakdown-grid div, .breakdown-total div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.breakdown-grid span, .breakdown-total span { color: var(--text-dim); }

.breakdown-total {
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
}

.breakdown-total strong { color: var(--accent); }

.flight-list { display: flex; flex-direction: column; gap: 10px; }

.flight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.flight-row:hover { transform: translateX(4px); }
.flight-row.best-deal { border-color: var(--accent); background: var(--accent-soft); }

.flight-main { display: flex; flex-direction: column; gap: 4px; }
.flight-airline { font-weight: 700; }
.flight-meta { font-size: 12.5px; color: var(--text-dim); }

.badge {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.flight-side { display: flex; align-items: center; gap: 12px; }
.flight-price { font-weight: 800; font-size: 14.5px; }
.flight-price small { color: var(--text-dim); font-weight: 400; }

.disclaimer { color: var(--text-dim); font-size: 12px; margin-top: 18px; text-align: center; }

/* ---------- Loading / error states ---------- */
.loading-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
}

.error-box {
  grid-column: 1 / -1;
  background: #fff4f0;
  border: 1.5px solid #ffcfc0;
  border-radius: 18px;
  padding: 22px;
  text-align: left;
  max-width: 560px;
  margin: 20px auto;
}

.error-box strong { display: block; margin-bottom: 8px; font-size: 15px; }
.error-box p { margin: 6px 0; color: var(--text-dim); font-size: 13.5px; }
.error-box .error-hint { font-size: 12.5px; opacity: 0.85; }
.error-box code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

@media (max-width: 520px) {
  .filter-bar { padding: 14px; border-radius: 24px; }
  .filter-field select, .filter-field input { min-width: 100px; }
  .breakdown-grid { grid-template-columns: 1fr; }
  .flight-row { flex-direction: column; align-items: stretch; }
  .flight-side { justify-content: space-between; }
}
