/* "Stamp blues" palette, from the Figma component sheet (node 213:555).
   Indigo carries the dark surfaces, Paper white the light; Airmail aqua always
   pairs with Night indigo ink; Lavender highlights; Perforation for rules. */
:root {
  --surface-1: #1a1856; /* Night indigo: ink, borders */
  --surface-2: #33308a; /* Stamp indigo: buttons, selected, eyebrows */
  --surface-3: #a6dcd9; /* Airmail aqua: page background, soft pills */
  --surface-4: #f2f1ea; /* Paper white: cards */
  --accent-1: #c6c3f0;  /* Lavender sheen: highlights */
  --accent-2: #16151c;  /* Perforation: rules */
  --error: #a32d2d;
}

* { box-sizing: border-box; }
body {
  font-family: 'Manrope', system-ui, sans-serif; color: var(--surface-1);
  background: var(--surface-3); max-width: 720px; margin: 0 auto; padding: 48px 16px;
}

/* Header */
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--surface-2); }
h1 { margin: 10px 0 0; font-size: 36px; font-weight: 700; }
.lede { margin: 10px 0 32px; font-size: 16px; line-height: 1.5; }

/* Cards */
.card {
  background: var(--surface-4); border: 1px solid var(--surface-1); border-radius: 10px;
  padding: 24px; margin-bottom: 24px;
}
.card-head { display: flex; flex-direction: column; gap: 6px; }
.card-num { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--surface-2); }
.card-title { margin: 0; font-size: 18px; font-weight: 700; }
.card-desc { margin: 0; font-size: 13px; line-height: 1.45; }
.rule { height: 1px; background: var(--accent-2); border: none; margin: 16px 0; }

/* Inputs and buttons */
#q, #ask-input, #home-station-input {
  width: 100%; font: inherit; font-size: 16px; color: var(--surface-1); background: var(--surface-4);
  border: 1px solid var(--surface-1); border-radius: 8px; padding: 10px 12px;
}
#q:focus, #ask-input:focus, #home-station-input:focus { outline: none; border: 2px solid var(--surface-2); padding: 9px 11px; }
#ask-form { display: flex; gap: 10px; }
#ask-input { flex: 1; }
#ask-button {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--surface-4); background: var(--surface-2);
  border: none; border-radius: 8px; padding: 11px 18px; cursor: pointer;
}
#ask-button:disabled { opacity: 0.5; cursor: default; }

/* Results (rendered by index.html) */
h2 { margin: 20px 0 8px; font-size: 13px; font-weight: 500; }
ul { list-style: none; padding: 0; margin: 0; }
li { padding: 8px 4px; border-bottom: 1px solid rgba(22, 21, 28, 0.15); font-size: 14px; }
li:last-child { border-bottom: none; }
.meta { font-size: 12px; opacity: 0.75; }
.status { font-size: 13px; margin-top: 16px; }
.status.error { color: var(--error); }
.clickable { cursor: pointer; border-radius: 8px; }
.clickable:hover, .clickable:focus { background: rgba(198, 195, 240, 0.45); outline: none; }
.clickable:active { background: var(--accent-1); }
.answer { margin-top: 16px; font-size: 15px; line-height: 1.6; }
.answer p { margin: 0 0 8px; }
.answer-lead { font-size: 16px; font-weight: 700; }
/* One train per row: times | train | duration, an optional note underneath. */
.train-row {
  display: grid; grid-template-columns: 11.5em 1fr auto; column-gap: 12px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid rgba(22, 21, 28, 0.15); font-size: 14px;
}
.train-row:first-of-type { border-top: 1px solid rgba(22, 21, 28, 0.15); }
.train-times { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.train-dur { font-weight: 500; font-variant-numeric: tabular-nums; }
.train-note { grid-column: 2 / -1; font-size: 12px; opacity: 0.75; }
.answer-note { margin-top: 12px !important; font-size: 12px; opacity: 0.75; }
@media (max-width: 520px) {
  .train-row { grid-template-columns: 1fr auto; }
  .train-times { grid-column: 1 / -1; }
  .train-note { grid-column: 1 / -1; }
}
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* Pill: small tag. Soft = aqua + indigo ink (Figma "Pill · Tone=Soft"). */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--surface-1); vertical-align: 1px;
}

/* What the model looked up: aqua callout with an indigo bar (Figma card 05 note). */
.lookups {
  display: flex; gap: 10px; margin-top: 16px; padding: 12px; border-radius: 10px;
  background: var(--surface-3); font-size: 12px; font-weight: 500; line-height: 1.45;
}
.lookups::before { content: ''; flex: 0 0 3px; border-radius: 2px; background: var(--surface-2); }

/* "Your station" picker: top right of the page; above the heading on narrow screens. */
.home-station { position: absolute; top: 16px; right: 16px; text-align: right; font-size: 13px; }
#home-station-button {
  font: inherit; font-weight: 500; color: var(--surface-1); background: var(--surface-4);
  border: 1px solid var(--surface-1); border-radius: 999px; padding: 6px 14px; margin-left: 6px; cursor: pointer;
}
#home-station-button[aria-expanded="true"] { background: var(--surface-2); border-color: var(--surface-2); color: var(--surface-4); }
.home-station-picker {
  position: absolute; right: 0; top: 100%; margin-top: 6px; width: 300px; text-align: left;
  background: var(--surface-4); border: 1px solid var(--surface-1); border-radius: 8px; padding: 10px;
  box-shadow: 0 6px 16px rgba(26, 24, 86, 0.18); z-index: 10;
}
.home-station-picker[hidden] { display: none; }
#home-station-results li { padding: 6px 4px; }
#home-station-results .status { margin-top: 4px; border: none; }
@media (max-width: 760px) {
  body { padding-top: 16px; }
  .home-station { position: relative; top: auto; right: auto; margin-bottom: 24px; text-align: left; }
  .home-station-picker { left: 0; right: auto; width: 100%; }
  h1 { font-size: 30px; }
}

/* Bullets in ask answers (prompt v6 "- " lines). The global ul/li rules strip
   markers and add row borders for search results; undo both here. */
.answer-list { list-style: disc; padding-left: 22px; margin: 8px 0; }
.answer-list li { padding: 3px 0; border-bottom: none; font-size: 15px; line-height: 1.5; }
.answer-list li::marker { color: var(--surface-2); }

/* Destination header (PRD §7.1 B3, Figma sheet 07): indigo title block, stat
   tiles, route pills. Shown under the search box when a station is clicked. */
.dest { margin-top: 16px; }
.dest-title { background: var(--surface-1); color: var(--surface-4); border-radius: 10px; padding: 18px 20px; }
.dest-eyebrow { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent-1); }
.dest-name { margin: 6px 0 2px; font-size: 26px; font-weight: 700; line-height: 1.2; }
.dest-id { margin: 0; font-size: 13px; opacity: 0.8; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { border: 1px solid var(--surface-1); border-radius: 10px; padding: 12px 13px; }
.stat-value { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { display: block; font-size: 12px; opacity: 0.75; margin-top: 2px; }
.dest-routes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.dest-actions { display: flex; gap: 10px; margin-top: 14px; }
.dest-link {
  font-size: 14px; font-weight: 700; color: var(--surface-4); background: var(--surface-2);
  border-radius: 8px; padding: 11px 18px; text-decoration: none;
}
.dest-close {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--surface-1); background: transparent;
  border: 1px solid var(--surface-1); border-radius: 8px; padding: 10px 16px; cursor: pointer;
}
.stat-grid + .answer-note, .dest-actions + .answer-note { margin-top: 12px; }

/* Station map (card 03, map.js). MapLibre fills the box; rounded like the cards. */
.map { height: 380px; border: 1px solid var(--surface-1); border-radius: 10px; overflow: hidden; }
.map .maplibregl-popup-content {
  font-family: 'Manrope', system-ui, sans-serif; font-size: 13px; font-weight: 700;
  color: var(--surface-1); background: var(--surface-4); border-radius: 8px; padding: 6px 10px;
}
@media (max-width: 520px) { .map { height: 420px; } }

/* Map popups: a station preview, or a cluster's list of stations as dropdowns. */
.map .maplibregl-popup-content { padding: 10px 12px; }
.map-pop-title { margin: 0 18px 0 0; font-size: 14px; font-weight: 700; line-height: 1.3; }
.map-pop-id { margin: 1px 0 6px; font-size: 11px; font-weight: 500; opacity: 0.7; }
.map-preview { font-weight: 500; }
.map-preview-from { margin: 0 0 6px; font-size: 11px; opacity: 0.75; }
.map-preview-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.map-preview-stat:last-child { grid-column: 1 / -1; }
.map-preview-value { display: block; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.map-preview-label { display: block; font-size: 11px; opacity: 0.7; }
.map-preview-routes { margin: 6px 0 0; font-size: 11px; color: var(--surface-2); font-weight: 700; }
.map-preview-status { margin: 4px 0; font-size: 12px; font-weight: 500; opacity: 0.8; }
.map-cluster-list { max-height: 180px; overflow-y: auto; margin: 6px 0; border-top: 1px solid rgba(22, 21, 28, 0.15); }
.map-cluster-item { border-bottom: 1px solid rgba(22, 21, 28, 0.15); padding: 6px 0; }
.map-cluster-item summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.map-cluster-item summary::marker { color: var(--surface-2); }
.map-cluster-item[open] summary { margin-bottom: 6px; }
.map-zoom-in {
  font: inherit; font-size: 12px; font-weight: 700; color: var(--surface-4); background: var(--surface-2);
  border: none; border-radius: 6px; padding: 6px 12px; cursor: pointer; margin-top: 4px;
}
