/* ============================================================
   Reward Flights — design tokens
   Type: Archivo Black (display) / B612 (UI) / B612 Mono (data)
   Cabin palette validated for CVD + contrast (light & dark).
   Cabin identity is encoded by POSITION (stack order) + color.
   ============================================================ */

@font-face { font-family: 'B612'; src: url('/assets/fonts/b612-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'B612'; src: url('/assets/fonts/b612-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'B612 Mono'; src: url('/assets/fonts/b612mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'B612 Mono'; src: url('/assets/fonts/b612mono-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Archivo Black'; src: url('/assets/fonts/archivo-black.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --surface: #FAFBFD;
  --panel: #FFFFFF;
  --panel-2: #F1F4F9;
  --ink: #16233B;
  --ink-2: #55647D;
  --ink-3: #5E6B82; /* ≥4.5:1 on --surface for the small muted text tier */
  --line: #E3E8F0;
  --line-2: #D2DAE6;
  --focus: #16233B;
  --gold: #A87908;
  --amber-bg: #FBF3DC;
  --amber-ink: #6B5106;
  --cab-m: #3B7CC9;
  --cab-w: #17A398;
  --cab-c: #8B5CF6;
  --cab-f: #A87908;
  --cell-empty: #EDF1F6;
  --shadow: 0 1px 2px rgba(22,35,59,.06), 0 8px 24px rgba(22,35,59,.08);
  --radius: 10px;
  --font-ui: 'B612', system-ui, -apple-system, sans-serif;
  --font-data: 'B612 Mono', ui-monospace, SFMono-Regular, monospace;
  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0D1826;
    --panel: #142238;
    --panel-2: #1B2C47;
    --ink: #E8EEF7;
    --ink-2: #9FAFC6;
    --ink-3: #92A1BA; /* ≥4.5:1 on --surface/--panel for small muted text */
    --line: #24344E;
    --line-2: #2F4160;
    --focus: #E8EEF7;
    --gold: #B0800D;
    --amber-bg: #33290C;
    --amber-ink: #E5C464;
    --cab-m: #3D7FD6;
    --cab-w: #12968C;
    --cab-c: #8B5CF6;
    --cab-f: #B0800D;
    --cell-empty: #1A2A44;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--panel); padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
body.modal-open { overflow: hidden; }
[inert] { user-select: none; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; font-family: var(--font-display);
  font-size: 15px; letter-spacing: .04em; text-transform: uppercase;
}
.wordmark b { font-weight: inherit; color: var(--gold); }
.mk-m { fill: var(--cab-m); } .mk-w { fill: var(--cab-w); }
.mk-c { fill: var(--cab-c); } .mk-f { fill: var(--cab-f); }
.freshness { font-family: var(--font-data); font-size: 12px; color: var(--ink-2); }
.freshness.stale { color: var(--amber-ink); }

/* ---------- banner (errors / stale) ---------- */
.banner {
  background: var(--amber-bg); color: var(--amber-ink);
  padding: 8px clamp(16px, 4vw, 40px); font-size: 13px;
}
.banner button { background: none; border: 1px solid currentColor; border-radius: 6px;
  padding: 2px 10px; margin-left: 10px; cursor: pointer; font-size: 12px; }

main { min-height: 62vh; padding: 0 clamp(16px, 4vw, 40px) 56px; max-width: 1080px; margin: 0 auto; }

/* ---------- hero / home ---------- */
.hero { padding-top: clamp(36px, 7vw, 84px); text-align: left; }
.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(30px, 5.4vw, 56px); line-height: 1.04;
  letter-spacing: -.01em; margin: 0 0 14px; max-width: 14em;
}
.hero-sub { color: var(--ink-2); font-size: clamp(15px, 1.7vw, 17px); margin: 0 0 30px; max-width: 34em; }

.search-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  max-width: 720px; position: relative;
}
@media (max-width: 640px) { .search-card { grid-template-columns: 1fr; } .swap-btn { justify-self: center; transform: rotate(90deg); } }
.field { position: relative; }
.field label {
  position: absolute; top: 7px; left: 13px;
  font-family: var(--font-data); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); pointer-events: none;
}
.field input {
  width: 100%; padding: 24px 12px 8px; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--surface); color: var(--ink);
  font: 700 16px var(--font-ui);
}
.field input::placeholder { color: var(--ink-3); font-weight: 400; }
.swap-btn {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 999px;
  width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center;
  color: var(--ink-2); transition: transform .18s ease;
}
.swap-btn:hover { color: var(--ink); transform: rotate(180deg); }
@media (max-width: 640px) { .swap-btn:hover { transform: rotate(270deg); } }

/* autocomplete */
.suggest {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; padding: 5px;
}
.suggest[hidden] { display: none; }
.sg-row {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 9px; border-radius: 8px; cursor: pointer; border: 0; width: 100%;
  background: none; text-align: left;
}
.sg-row.active, .sg-row:hover { background: var(--panel-2); }
.sg-code { font-family: var(--font-data); font-weight: 700; font-size: 14px; }
.sg-name { min-width: 0; }
.sg-name .nm { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-name .co { color: var(--ink-3); font-size: 12px; }
.sg-spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.sg-spark i { width: 5px; border-radius: 2px 2px 0 0; background: var(--cab-m); opacity: .75; min-height: 2px; }
.sg-days { font-family: var(--font-data); font-size: 11px; color: var(--ink-3); margin-left: 8px; }
.sg-empty { padding: 14px; color: var(--ink-2); font-size: 14px; }

.home-secondary { margin-top: 18px; font-size: 14px; color: var(--ink-2); }
.home-secondary a { font-weight: 700; }

/* skeletons */
.skeleton-search .sk-input, .sk-line, .sk-cell {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 50%, var(--panel-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px;
}
.skeleton-search { grid-template-columns: 1fr 1fr; }
.skeleton-search .sk-input { height: 54px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-search .sk-input, .sk-line, .sk-cell { animation: none; }
}

/* ---------- home modules ---------- */
.modules { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 46px; }
@media (max-width: 820px) { .modules { grid-template-columns: 1fr; } }
.module h2 {
  font-size: 13px; font-family: var(--font-data); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-2); margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.module h2 .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.card-list { display: flex; flex-direction: column; gap: 8px; }
.route-card {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; text-decoration: none; transition: border-color .15s ease;
}
.route-card:hover { border-color: var(--ink-3); }
.rc-route { font-family: var(--font-data); font-weight: 700; font-size: 14px; }
.rc-route .arrow { color: var(--ink-3); }
.rc-cities { grid-column: 1; color: var(--ink-2); font-size: 12.5px; }
.rc-meta { grid-column: 2; grid-row: 1 / 3; text-align: right; font-size: 12px; color: var(--ink-2); }
.rc-meta .when { font-family: var(--font-data); color: var(--ink-3); font-size: 11px; }
.chg-opened { color: var(--cab-w); font-weight: 700; }
.chg-closed { color: var(--ink-3); }
.stats-strip {
  margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 34px;
  font-family: var(--font-data); font-size: 12.5px; color: var(--ink-2);
}
.stats-strip b { color: var(--ink); font-size: 15px; margin-right: 6px; }

/* ---------- cabin legend chips (filters) ---------- */
.cabin-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 13px 6px 9px;
  background: var(--panel); cursor: pointer; font-size: 13px; font-weight: 700;
  transition: opacity .15s ease, border-color .15s ease;
}
.chip .swatch { width: 12px; height: 12px; border-radius: 3px; }
.chip .n { font-family: var(--font-data); font-weight: 400; font-size: 11.5px; color: var(--ink-3); }
/* Unpressed / no-availability chips: desaturate the SWATCH only and keep the
   label at readable contrast — dimming the whole button would drop the text
   below WCAG AA (the label must stay legible to operate the filter). */
.chip[aria-pressed="false"] { background: var(--panel-2); color: var(--ink-2); }
.chip[aria-pressed="false"] .swatch { background: var(--ink-3) !important; }
.chip.none { border-style: dashed; }
.chip.none .swatch { background: var(--ink-3) !important; }

.month-compact { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.month-compact h3 { margin: 0; color: var(--ink-3); font-weight: 400; }
.month-compact .month-empty { padding: 0; margin: 0; font-size: 11.5px; }

/* ---------- route page ---------- */
.route-head { padding-top: clamp(22px, 4vw, 44px); }
.crumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.crumbs a { color: var(--ink-2); }
.route-title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.route-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(30px, 6vw, 54px); margin: 0; letter-spacing: .01em;
  display: flex; align-items: center; gap: .35em; line-height: 1;
}
.route-title .arrow { color: var(--gold); font-size: .62em; position: relative; top: -.08em; }
.route-cities { color: var(--ink-2); font-size: 15px; margin: 8px 0 0; }
.route-cities .via { color: var(--ink-3); }
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 700;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { border-color: var(--ink-3); }
.route-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 26px 0 8px; position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); padding: 12px 0;
}
.new-legend { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.new-legend .new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }

/* year strip — 12 months at a glance */
.year-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin: 18px 0 34px; }
.ys-month {
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  padding: 7px 6px 6px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  transition: border-color .15s ease;
}
.ys-month:hover, .ys-month.current { border-color: var(--ink-3); }
.ys-label { font-family: var(--font-data); font-size: 10.5px; color: var(--ink-2); letter-spacing: .06em; }
.ys-bars { display: flex; align-items: flex-end; gap: 2px; height: 30px; }
.ys-bars i { width: 4px; min-height: 2px; border-radius: 2px 2px 0 0; }
.ys-count { font-family: var(--font-data); font-size: 10px; color: var(--ink-3); }
@media (max-width: 820px) { .year-strip { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 480px) { .year-strip { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: no-preference) {
  .ys-bars i { transform-origin: bottom; animation: grow .5s ease backwards; }
  @keyframes grow { from { transform: scaleY(0); } }
}

/* month calendars */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.month { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.month h3 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.month h3 .mc { font-family: var(--font-data); font-weight: 400; font-size: 11px; color: var(--ink-3); }
.dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.dow span { text-align: center; font-family: var(--font-data); font-size: 9.5px; color: var(--ink-3); text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

/* THE SIGNATURE: seat-stack day cell.
   Up to 4 thin bars, FIXED position order bottom→top = Economy→First,
   so cabin identity survives without color (position encodes it). */
.day {
  aspect-ratio: 1 / 1.15; border-radius: 7px; background: var(--cell-empty);
  border: 0; padding: 3px 4px; cursor: default; position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
}
.day .num {
  font-family: var(--font-data); font-size: 10px; color: var(--ink-3);
  line-height: 1; text-align: right;
}
.day .stack { display: flex; flex-direction: column-reverse; gap: 2px; min-height: 26px; justify-content: flex-start; }
.day .stack i { display: block; height: 5px; border-radius: 2.5px; }
.day.has { background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.day.has:hover { border-color: var(--ink-2); }
.day.has .num { color: var(--ink-2); font-weight: 700; }
.day.dim .stack i { background: var(--line-2) !important; }
.day.pad { visibility: hidden; }
.day.past { opacity: .35; }
.day.new::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--gold);
}
.cab-m { background: var(--cab-m); } .cab-w { background: var(--cab-w); }
.cab-c { background: var(--cab-c); } .cab-f { background: var(--cab-f); }
.cab-x { background: var(--ink-3); }
.month-empty { color: var(--ink-3); font-size: 12.5px; text-align: center; padding: 26px 0; }

/* tooltip */
.tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--surface);
  border-radius: 8px; padding: 8px 11px; font-size: 12.5px; max-width: 260px;
  box-shadow: var(--shadow);
}
.tip .t-date { font-family: var(--font-data); font-weight: 700; margin-bottom: 3px; }
.tip .t-cab { display: flex; align-items: center; gap: 7px; }
.tip .t-cab .swatch { width: 9px; height: 9px; border-radius: 2px; }

/* day detail panel */
.scrim { position: fixed; inset: 0; background: rgba(10,16,28,.45); z-index: 70; }
.day-panel {
  position: fixed; z-index: 80; top: 0; right: 0; bottom: 0;
  width: min(430px, 100vw); background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 26px; overflow-y: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .day-panel { animation: slide-in .22s ease; }
  @keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
}
.dp-close { position: absolute; top: 16px; right: 16px; background: none; border: 0;
  font-size: 22px; cursor: pointer; color: var(--ink-2); line-height: 1; padding: 6px; }
.dp-date { font-family: var(--font-data); font-size: 13px; color: var(--ink-2); margin: 0; }
.dp-route { font-family: var(--font-display); font-size: 24px; margin: 4px 0 20px; }
.dp-lead { font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; }
.dp-cabs { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.dp-cab {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: 8px; font-weight: 700; font-size: 14px;
  text-decoration: none; color: var(--ink); transition: border-color .15s ease, background .15s ease;
}
.dp-cab:hover { border-color: var(--ink-2); background: var(--panel-2); }
.dp-cab.off { opacity: .5; cursor: not-allowed; }
.dp-cab.off:hover { border-color: var(--line-2); background: none; }
.dp-cab.off .dp-cab-go { color: var(--ink-3); }
.dp-cab .swatch { width: 14px; height: 14px; border-radius: 4px; }
.dp-cab-label { flex: 1; }
.dp-cab-go { font-family: var(--font-data); font-weight: 400; font-size: 12px; color: var(--gold); white-space: nowrap; }
.dp-return { margin-bottom: 20px; }
.dp-return label {
  display: block; font-family: var(--font-data); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.dp-return select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: 400 14px var(--font-ui);
}
.dp-flights h4 { font-size: 12px; font-family: var(--font-data); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.flight {
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; margin-bottom: 9px;
  display: grid; gap: 3px;
}
.fl-head { display: flex; justify-content: space-between; font-family: var(--font-data); font-size: 13px; font-weight: 700; }
.fl-times { font-family: var(--font-data); font-size: 15px; }
.fl-times .via { color: var(--ink-3); font-size: 12px; }
.fl-seats { display: flex; gap: 10px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.fl-seats .s { display: inline-flex; align-items: center; gap: 5px; }
.fl-seats .swatch { width: 8px; height: 8px; border-radius: 2px; }
.fl-tags { display: flex; gap: 6px; }
.tag { font-size: 10.5px; font-family: var(--font-data); padding: 2px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2); }
.tag.peak { background: var(--amber-bg); color: var(--amber-ink); }
.dp-note { font-size: 12.5px; color: var(--ink-3); }
.dp-book { margin: 18px 0; }

/* ---------- explore (/from/XXX) ---------- */
.dest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 26px; }
.dest-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-decoration: none; display: grid; gap: 8px;
  transition: border-color .15s ease;
}
.dest-card:hover { border-color: var(--ink-3); }
.dc-head { display: flex; align-items: baseline; gap: 9px; }
.dc-code { font-family: var(--font-data); font-weight: 700; font-size: 15px; }
.dc-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-country { color: var(--ink-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.dc-spark { display: flex; align-items: flex-end; gap: 2.5px; height: 30px; }
.dc-spark i { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--cab-m); opacity: .8; }
.dc-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-2); }
.dc-cabs { display: flex; gap: 4px; }
.dc-cabs .swatch { width: 9px; height: 9px; border-radius: 2px; }

.page-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 4vw, 38px); margin: 0; }
.page-sub { color: var(--ink-2); margin: 8px 0 0; }
.section-pad { padding-top: clamp(22px, 4vw, 44px); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-2); }
.empty-state .big { font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-bottom: 8px; }

/* updated pulse */
.pulse { animation: pulse-bg 1.6s ease 1; }
@keyframes pulse-bg { 0% { background: var(--amber-bg); } 100% { background: transparent; } }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line); padding: 26px clamp(16px, 4vw, 40px) 40px;
  font-size: 12.5px; color: var(--ink-3); max-width: 1080px; margin: 0 auto;
}
.footer a { color: var(--ink-2); }
.footer p { margin: 0 0 8px; max-width: 72em; }

@media (max-width: 640px) {
  .day-panel { width: 100vw; border-left: 0; }
  .route-toolbar { position: static; }
}
