:root {
  --ink: #0b2545;
  --ink-2: #13385f;
  --paper: #eaeff4;
  --surface: #ffffff;
  --line: #d7dee7;
  --muted: #5c6b7d;
  --accent: #0e8f9c;
  --accent-ink: #0a6a74;
  --deal: #12784f;
  --deal-bg: #e3f3ea;
  --amber: #e0972a;
  --shadow: 0 1px 2px rgba(11, 37, 69, 0.06), 0 12px 30px -18px rgba(11, 37, 69, 0.35);
  --shadow-lift: 0 2px 4px rgba(11, 37, 69, 0.08), 0 20px 40px -20px rgba(11, 37, 69, 0.4);
  --radius: 14px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --display: "Space Grotesk", var(--sans);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eaf1f8;
    --ink-2: #cfe0ee;
    --paper: #0b1420;
    --surface: #111d2c;
    --line: #1f3247;
    --muted: #8ba0b6;
    --accent: #29c2d1;
    --accent-ink: #7fe0ea;
    --deal: #4fd190;
    --deal-bg: #103324;
    --amber: #f0ac4c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -18px rgba(0, 0, 0, 0.6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 24px 44px -20px rgba(0, 0, 0, 0.65);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 60%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
  max-width: 1040px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -18px rgba(0,0,0,0.4); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 9px;
  transform: rotate(-8deg);
  font-size: 16px;
  transition: transform 0.25s ease;
}
.brand:hover .brand-mark { transform: rotate(4deg) scale(1.06); }
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.lang { display: inline-flex; align-items: center; gap: 6px; }
.lang-btn {
  border: 0; background: none; cursor: pointer;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: var(--muted); padding: 4px 6px; border-radius: 6px;
}
.lang-btn.is-active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.lang-sep { color: var(--line); }

/* Layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 60px; }

.hero { position: relative; padding: 28px 0 30px; max-width: 640px; animation: fadeUp 0.5s ease both; }
.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 12px; color: var(--accent-ink); margin: 0 0 12px;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--accent-ink); display: inline-block;
}
.title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 5vw, 46px); line-height: 1.05;
  letter-spacing: -0.03em; margin: 0 0 12px;
}
.lede { color: var(--muted); font-size: 17px; margin: 0 0 4px; max-width: 520px; }

.hero-art {
  position: absolute; right: -20px; top: 6px; width: 220px; height: 90px;
  pointer-events: none; opacity: 0.9;
}
.hero-art .dot { fill: var(--accent); }
.hero-art .dot-end { fill: var(--ink); }
.hero-art .route {
  fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round;
}
.hero-art .plane {
  font-size: 15px;
  animation: fly 3.2s ease-in-out infinite;
}
@keyframes fly {
  0% { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}
.hero-art .plane-wrap {
  offset-path: path("M6,70 C60,10 140,90 206,20");
  animation: fly 3.2s ease-in-out infinite;
}
@media (max-width: 760px) { .hero-art { display: none; } }

/* Mode switch (Voos / Ônibus) */
.modes {
  display: inline-flex; gap: 6px; padding: 5px;
  background: var(--ink); border-radius: 14px; margin-bottom: 16px;
}
.mode {
  border: 0; background: none; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  color: #b8c6d8; padding: 10px 20px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.mode:hover { color: var(--paper); }
.mode.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.mode-panel { display: none; }
.mode-panel.is-active { display: block; }

/* Tabs */
.tabs {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 18px; flex-wrap: wrap;
}
.tab {
  border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 14px;
  color: var(--muted); padding: 9px 15px; border-radius: 8px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--ink); color: var(--paper); }

/* Panels + form */
.panel { display: none; }
.panel.is-active { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  padding: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; min-width: 0; }
.field--sm { flex: 0 1 190px; }
.field--xs { flex: 0 1 96px; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.opt {
  font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); background: var(--paper); padding: 1px 6px; border-radius: 20px;
}
.field input, .field select {
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; background: var(--surface); width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.swap {
  flex: 0 0 auto; align-self: flex-end; margin-bottom: 3px;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-size: 17px; color: var(--ink-2); transition: transform 0.15s ease, background-color 0.15s ease;
}
.swap:hover { background: var(--paper); transform: rotate(180deg); }
.go {
  flex: 1 1 100%;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  color: #fff; background: var(--accent); border: 0; border-radius: 10px;
  padding: 13px 18px; cursor: pointer; letter-spacing: -0.01em;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.go:hover { background: var(--accent-ink); }
.go:active { transform: scale(0.98); }
.go:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Notice (config / info) */
.notice {
  margin: 18px 0 0; padding: 14px 16px; border-radius: 10px;
  background: #fff7e6; border: 1px solid #f0dcae; color: #6b4f10; font-size: 14px;
  line-height: 1.55;
}
.notice a { color: var(--accent-ink); font-weight: 600; }
.notice strong { color: #5a4209; }

/* Status */
.status { margin: 18px 0 0; color: var(--muted); font-size: 15px; display: flex; align-items: center; }
.status.err {
  color: #b23b3b; background: color-mix(in srgb, #b23b3b 8%, transparent);
  border: 1px solid color-mix(in srgb, #b23b3b 30%, transparent);
  border-radius: 10px; padding: 10px 14px; font-weight: 500;
}
.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }

/* Results */
.results { margin-top: 18px; display: grid; gap: 14px; }
.results.grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.results .pass, .results .tile { animation: fadeUp 0.35s ease both; }
.results .pass:nth-child(2), .results .tile:nth-child(2) { animation-delay: 0.04s; }
.results .pass:nth-child(3), .results .tile:nth-child(3) { animation-delay: 0.08s; }
.results .pass:nth-child(4), .results .tile:nth-child(4) { animation-delay: 0.12s; }
.results .pass:nth-child(n+5), .results .tile:nth-child(n+5) { animation-delay: 0.16s; }

/* Skeleton loading state */
.pass.skeleton { pointer-events: none; }
.sk-line {
  height: 14px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, var(--line) 0%, color-mix(in srgb, var(--line) 40%, var(--surface)) 50%, var(--line) 100%);
  background-size: 200px 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk-line.w80 { width: 80%; }
.sk-line.w60 { width: 60%; }
.sk-line.w50 { width: 50%; }
.sk-line.w40 { width: 40%; }

/* Boarding-pass card (signature) */
.pass {
  display: grid; grid-template-columns: 1fr auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pass:hover:not(.skeleton) { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.pass-main { padding: 16px 18px; min-width: 0; }
.pass-route {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-weight: 600; font-size: 20px; color: var(--ink);
}
.pass-route .arrow { color: var(--accent); font-family: var(--sans); }
.pass-route.bus .pass-code { font-family: var(--sans); font-size: 16px; font-weight: 600; }
.panel-hint { margin: 0 0 12px; color: var(--muted); font-size: 14px; max-width: 640px; }
.pass-price.na { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--muted); }
.pass-route .city { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); display: block; margin-top: 2px; }
.pass-code { display: flex; flex-direction: column; }
.pass-meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px;
  font-size: 13px; color: var(--muted);
}
.pass-meta b { color: var(--ink); font-weight: 600; }
.chip {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; background: var(--paper); color: var(--ink-2);
}
.chip.nonstop { background: var(--deal-bg); color: var(--deal); }
.chip.klass { background: #eef0ff; color: #4b48b5; }
.chip.seats { background: #fff3e0; color: #a9670f; }

/* Perforated price stub */
.pass-stub {
  position: relative; display: flex; flex-direction: column;
  justify-content: center; align-items: flex-end; gap: 4px;
  padding: 16px 18px; min-width: 130px;
  background: linear-gradient(180deg, var(--surface), var(--paper));
  border-left: 2px dashed var(--line);
}
.pass-price { font-family: var(--mono); font-weight: 600; font-size: 22px; color: var(--ink); white-space: nowrap; }
.pass-price small { font-size: 12px; color: var(--muted); }
.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 20px;
}
.badge.cheap { background: var(--deal-bg); color: var(--deal); }
.badge.best { background: #eaf4ff; color: #1e5fa8; }
.offer-link {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  color: var(--accent-ink); text-decoration: none; margin-top: 4px; white-space: nowrap;
}
.offer-link:hover { text-decoration: underline; }

/* Destination + date tiles */
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile .code { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tile .place { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.tile .price { font-family: var(--mono); font-weight: 600; font-size: 18px; color: var(--accent-ink); margin-top: 4px; }
.tile .sub { font-size: 12px; color: var(--muted); }

.foot {
  max-width: 1040px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 40px;
  color: var(--muted); font-size: 13px;
}

@media (max-width: 640px) {
  .modes { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .mode { justify-content: center; }
  .tabs { width: 100%; }
  .tab { flex: 1 1 auto; text-align: center; }
}

@media (max-width: 560px) {
  .field, .field--sm, .field--xs { flex: 1 1 100%; }
  .swap { display: none; }
  .pass { grid-template-columns: 1fr; }
  .pass-stub { border-left: 0; border-top: 2px dashed var(--line); flex-direction: row; justify-content: space-between; align-items: center; }
}

@media (prefers-color-scheme: dark) {
  .notice {
    background: color-mix(in srgb, var(--amber) 16%, var(--surface));
    border-color: color-mix(in srgb, var(--amber) 40%, transparent);
    color: var(--ink);
  }
  .notice strong { color: var(--amber); }
  .chip.klass { background: color-mix(in srgb, #6a6ce0 28%, var(--surface)); color: #c7c8ff; }
  .chip.seats { background: color-mix(in srgb, var(--amber) 22%, var(--surface)); color: var(--amber); }
  .badge.best { background: color-mix(in srgb, #3a8ee0 26%, var(--surface)); color: #bcdcff; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
