/* Lark — coastal New England palette: harbour ink, sea glass, marigold light.
   One bold element (the plan ticket), everything else quiet. */

:root {
  --ink: #0b2434;
  --ink-80: #2a4658;
  --ink-60: #57707f;
  --ink-40: #8ea0ab;
  --paper: #eef2f1;
  --surface: #ffffff;
  --sand: #f6efe3;
  --teal: #0e6e6b;
  --teal-dark: #0a5250;
  --sea: #dcebe8;
  --marigold: #f3b32c;
  --raspberry: #c42f5c;
  --line: rgba(11, 36, 52, 0.12);
  --line-strong: rgba(11, 36, 52, 0.24);
  --shadow-card: 0 1px 2px rgba(11, 36, 52, 0.06), 0 8px 24px -12px rgba(11, 36, 52, 0.22);
  --shadow-lift: 0 18px 48px -20px rgba(11, 36, 52, 0.45);
  --radius: 18px;
  --radius-sm: 10px;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ui: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shell: 660px;
}

* { box-sizing: border-box; }

/* a class-level display must not defeat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.is-locked { overflow: hidden; }

a { color: var(--teal-dark); }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; margin: 0; }

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 16px 120px; }

/* ---------------------------------------------------------------- app bar */

.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(238, 242, 241, 0.92);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.appbar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wordmark {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.wordmark svg { display: block; }

.appbar__spacer { flex: 1 1 auto; min-width: 4px; }

.appbar__inner > .wordmark { flex: 0 0 auto; }

.wx-chip {
  min-width: 0;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px 5px 8px;
  font-size: 13px;
  color: var(--ink-80);
  white-space: nowrap;
}

.avatar-stack { display: flex; }

.avatar-stack { flex: 0 0 auto; }

.avatar-stack span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--sand);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  margin-left: -8px;
}

.avatar-stack span:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- hero */

.hero { padding: 26px 0 14px; }

.hero h1 {
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1.02;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  margin-bottom: 8px;
}

.hero p {
  margin: 0;
  color: var(--ink-60);
  max-width: 34ch;
}

/* ---------------------------------------------------------------- ticket */

.ticket {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-top: 18px;
  isolation: isolate;
}

/* the stub notches — the one flourish on the page */
.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--paper);
  border-radius: 50%;
  bottom: 78px;
}

.ticket::before { left: -10px; }
.ticket::after { right: -10px; }

.ticket__rows { padding: 4px 4px 0; }

.ticket__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  border-radius: 12px;
  border-bottom: 1px dashed var(--line);
}

.ticket__row:last-child { border-bottom: none; }
.ticket__row:hover { background: var(--sea); }
.ticket__row:active { background: var(--sea); }

.ticket__icon { font-size: 19px; width: 24px; text-align: center; }

.ticket__label {
  font-size: 12px;
  color: var(--ink-60);
  display: block;
  margin-bottom: 1px;
}

.ticket__value {
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.15;
  display: block;
}

.ticket__value small { font-family: var(--ui); font-size: 13px; color: var(--ink-60); }

.ticket__edit { margin-left: auto; color: var(--ink-40); font-size: 20px; }

.ticket__foot {
  border-top: 1px solid var(--line);
  padding: 14px;
  display: flex;
  gap: 10px;
}

.btn {
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.985); }

.btn--primary { background: var(--teal); color: #fff; flex: 1; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--ghost { background: var(--sand); color: var(--ink); }
.btn--quiet { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn--block { width: 100%; }
.btn--sm { padding: 9px 14px; font-size: 14px; border-radius: 10px; }

/* ---------------------------------------------------------------- ask box */

.ask { margin-top: 18px; }

.ask__field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 6px 6px 14px;
}

.ask__field input {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 0;
  font-size: 16px;
  min-width: 0;
}

.ask__field input:focus { outline: none; }

.ask__chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.ask__chips::-webkit-scrollbar { display: none; }

.chip {
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  color: var(--ink-80);
}

.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------------------------------------------------------- results */

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 10px;
}

.results-head h2 { font-size: 22px; }
.results-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-60); }

.toolbar {
  position: sticky;
  top: 53px;
  z-index: 30;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  background: linear-gradient(var(--paper) 70%, rgba(238, 242, 241, 0));
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar::-webkit-scrollbar { display: none; }

.section { margin-top: 26px; }

.section__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.section__head h3 { font-size: 20px; }
.section__head p { margin: 0; font-size: 13px; color: var(--ink-60); flex-basis: 100%; }

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  margin: 0 -16px;
  padding-inline: 16px;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

.stack { display: grid; gap: 14px; }

/* ---------------------------------------------------------------- card */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
}

.card__media { position: relative; aspect-ratio: 16 / 9; background: var(--sea); }

.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card__badges {
  position: absolute;
  inset: 10px 10px auto 10px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  backdrop-filter: blur(4px);
}

.badge--deal { background: var(--raspberry); color: #fff; }
.badge--urgent { background: var(--marigold); color: var(--ink); }
.badge--free { background: var(--teal); color: #fff; }
.badge--sponsored { background: rgba(11, 36, 52, 0.82); color: var(--sand); font-weight: 500; }
.badge--done { background: rgba(11, 36, 52, 0.82); color: #fff; }

.card__dial { margin-left: auto; }

.dial { display: block; filter: drop-shadow(0 2px 6px rgba(11, 36, 52, 0.28)); }
.dial text { font-family: var(--display); font-weight: 600; }

.card__body { padding: 14px; display: grid; gap: 8px; }

.card__title { font-family: var(--display); font-size: 20px; line-height: 1.15; }

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 13.5px;
  color: var(--ink-60);
}

.card__meta b { color: var(--ink); font-weight: 600; }

.card__why {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-80);
  background: var(--sand);
  border-radius: 12px;
  padding: 10px 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--paper);
  color: var(--ink-80);
}

.pill--good { background: var(--sea); color: var(--teal-dark); }
.pill--warn { background: #fdf0d8; color: #8a6212; }
.pill--bad { background: #fbe4ea; color: #8f2144; }

.card__actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 14px; }
.card__actions .btn { flex: 1 1 40%; white-space: nowrap; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: 0 0 auto;
}

.icon-btn[aria-pressed="true"] { background: var(--raspberry); border-color: var(--raspberry); color: #fff; }

/* --------------------------------------------------------------- detail */

.detail__hero { position: relative; margin: 0 -16px; }
.detail__hero img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }

.detail h1 { font-size: 30px; margin-top: 18px; }

.detail__sub { color: var(--ink-60); margin: 4px 0 16px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.facts div { background: var(--surface); padding: 12px 14px; }
.facts dt { font-size: 12px; color: var(--ink-60); }
.facts dd { margin: 2px 0 0; font-family: var(--display); font-size: 17px; }

.bars { display: grid; gap: 9px; }

.bar { display: grid; grid-template-columns: 118px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.bar__track { height: 7px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--teal); border-radius: 999px; }
.bar__val { text-align: right; color: var(--ink-60); font-variant-numeric: tabular-nums; }

#detail-map, #results-map { height: 260px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#results-map { height: 62vh; }

.map-pin {
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
}

.map-pin--top { background: var(--teal); }

/* ---------------------------------------------------------------- sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 36, 52, 0.45);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lift);
}

.sheet.is-open { transform: translateY(0); }

@media (min-width: 700px) {
  .sheet { max-width: var(--shell); margin: 0 auto; border-radius: 22px; bottom: 24px; left: 16px; right: 16px; }
}

.sheet__grip { width: 42px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 6px auto 14px; }
.sheet h2 { font-size: 22px; margin-bottom: 4px; }
.sheet__hint { color: var(--ink-60); font-size: 14px; margin: 0 0 16px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 13px; color: var(--ink-60); }

.input, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  font-size: 16px;
}

.options { display: flex; flex-wrap: wrap; gap: 8px; }

.person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.person-row input[type="number"] { width: 78px; }
.person-row select { width: auto; flex: 1; }

.segmented { display: flex; background: var(--paper); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; padding: 9px 8px; border-radius: 9px; font-size: 14px; color: var(--ink-60); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-card); }

/* ---------------------------------------------------------------- misc */

.empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
}

.empty h3 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--ink-60); margin: 0 0 14px; }

.skeleton {
  background: linear-gradient(100deg, #e6ebea 30%, #f2f5f4 50%, #e6ebea 70%);
  background-size: 200% 100%;
  animation: sweep 1.1s linear infinite;
  border-radius: var(--radius);
  height: 300px;
}

@keyframes sweep { to { background-position: -200% 0; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 80;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

.footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-60);
}

.footer a { color: var(--ink-60); }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: none;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar.is-visible { display: flex; }

.tabbar button {
  flex: 1;
  padding: 10px 4px 12px;
  font-size: 11px;
  color: var(--ink-60);
  display: grid;
  gap: 2px;
  justify-items: center;
}

.tabbar button[aria-current="page"] { color: var(--teal-dark); font-weight: 600; }
.tabbar span { font-size: 19px; line-height: 1; }

.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;
}

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

@media (min-width: 700px) {
  .stack { grid-template-columns: 1fr 1fr; }
  .stack > .card--wide { grid-column: 1 / -1; }
  .rail { grid-auto-columns: 46%; }
  .hero { padding-top: 42px; }
}
