:root {
  /* Cream palette */
  --ink: #2B2118;
  --muted: #6B5E4E;
  --soft: #4E4336;
  --land: #F5EEDF;
  --surface: #FFFBF3;
  --tint: #EFE5D2;
  --line: #E6DBC6;
  --chipline: #E0D3BB;
  --primary: #B4532A;      /* terracotta: buttons, actions, "other" pins */
  --primary-ink: #8A3A17;
  --olive: #6F8A34;        /* Montessori */
  --navy: #24507A;         /* International */
  --mustard: #D49A2A;      /* Islamic */
  --olive-ink: #45591B;
  --olive-bg: #E9EFD9;
  --navy-ink: #1D4268;
  --navy-bg: #DFE8F1;
  --accent: #B4532A;
  --warn-bg: #FBEFD4;
  --warn-ink: #6B4A0B;
  --red-bg: #F7E3D8;
  --red-ink: #8A3A17;
  --star: #C58A1F;
  --shadow: 0 6px 20px rgba(43, 33, 24, .14), 0 1px 2px rgba(43, 33, 24, .08);
  --sheet-peek: 214px;
  --sheet-list: 62vh;
  --sheet-detail: 72vh;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--land);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none; /* no pull-to-refresh while swiping the sheet */
}
.detail-body, .list { overscroll-behavior-y: contain; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; }

/* Top bar */
.topbar {
  position: fixed; z-index: 30;
  left: 12px; right: 12px; top: calc(12px + var(--top));
}
.search {
  display: flex; align-items: center; gap: 4px;
  height: 52px; padding: 0 4px 0 14px;
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
}
.search-brand { display: flex; color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: 44px; border: 0; outline: none; background: transparent;
  font-size: 15px; font-weight: 500; padding: 0 6px;
}
.search input::placeholder { color: #7A6D5C; }
.search input::-webkit-search-cancel-button { display: none; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: transparent;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.icon-btn--tint { background: var(--tint); color: var(--primary); }

.sug {
  margin-top: 8px; padding: 6px; border-radius: 16px; background: var(--surface);
  box-shadow: 0 10px 28px rgba(43, 33, 24, .16); max-height: 50vh; overflow-y: auto;
}
.sug-item {
  width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 6px 10px;
  border: 0; background: transparent; border-radius: 10px; text-align: left;
}
.sug-item:hover, .sug-item[aria-selected="true"] { background: var(--tint); }
.sug-icon { width: 32px; height: 32px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.sug-icon--place { background: var(--red-bg); color: var(--red-ink); }
.sug-icon--school { background: var(--olive-bg); color: var(--olive-ink); }
.sug-icon--web { background: var(--tint); color: var(--soft); }
.sug-text { flex: 1; min-width: 0; }
.sug-title { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-sub { display: block; font-size: 12px; color: var(--muted); }

.chips { display: flex; gap: 8px; margin: 10px -12px 0; padding: 0 12px 4px; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
  font-size: 13px; font-weight: 700; border: 1px solid var(--chipline); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.dot { width: 9px; height: 9px; flex: none; border-radius: 50%; display: inline-block; }
.kind-m { background: var(--olive); }
.kind-i { background: var(--navy); }
.kind-s { background: var(--mustard); }
.kind-o { background: var(--primary); }
.tag { padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.tag--montessori { background: var(--olive-bg); color: var(--olive-ink); }
.tag--international { background: var(--navy-bg); color: var(--navy-ink); }
.tag--islamic { background: var(--warn-bg); color: var(--warn-ink); }
.chips .chip { box-shadow: 0 2px 8px rgba(43, 33, 24, .10); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip--sm { height: 32px; padding: 0 10px; }

.toast {
  position: fixed; z-index: 40; left: 24px; right: 24px; top: calc(132px + var(--top));
  max-width: 420px; margin: 0 auto; padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 20px rgba(43, 33, 24, .25);
}

/* Map controls & popup */
.maplibregl-ctrl-top-right { top: calc(124px + var(--top)); }
.maplibregl-ctrl-group { border-radius: 14px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(var(--sheet-peek) + 4px); }
.tip-popup .maplibregl-popup-content {
  padding: 14px; border-radius: 18px; width: 270px; font-family: inherit;
  box-shadow: 0 12px 32px rgba(43, 33, 24, .22), 0 1px 3px rgba(43, 33, 24, .1);
}
.tip-popup .maplibregl-popup-tip { display: none; }
.tip-head { display: flex; align-items: flex-start; gap: 10px; }
.tip-name { flex: 1; font-size: 15px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.tip-place { margin-top: 3px; font-size: 12px; color: var(--muted); }
.tip-curr { margin-top: 8px; font-size: 12px; line-height: 1.4; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.origin-marker { width: 34px; height: 42px; filter: drop-shadow(0 3px 6px rgba(43, 33, 24, .3)); }

/* Pills */
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.card-foot { min-width: 0; }
.card-foot .dist { overflow: hidden; text-overflow: ellipsis; }
.pill--price { background: var(--olive-bg); color: var(--olive-ink); }
.pill--plain { background: var(--tint); color: var(--soft); font-weight: 600; }
.pill--dist { background: var(--red-bg); color: var(--red-ink); }
.rating { display: inline-flex; align-items: center; gap: 3px; padding: 4px 7px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; font-weight: 800; white-space: nowrap; }
.btn {
  height: 44px; border: 0; border-radius: 12px; padding: 0 14px; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn--primary { background: var(--primary); color: #fff; width: 100%; margin-top: 10px; }
.btn--outline { background: transparent; color: var(--ink); border: 1px solid rgba(43, 33, 24, .16); width: 100%; margin-top: 10px; }
.btn--soft { background: var(--tint); color: var(--primary); margin-top: 10px; }
.btn--small { height: 40px; font-size: 13px; }

/* Bottom sheet */
.sheet {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
  height: calc(var(--sheet-peek) + var(--bottom));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(43, 33, 24, .14);
  transition: height .28s ease, transform .22s ease; overflow: hidden;
  overscroll-behavior: contain;
  padding-bottom: var(--bottom);
}
.sheet[data-mode="peek"][data-origin="true"] { height: calc(var(--sheet-peek) + 46px + var(--bottom)); }
.sheet[data-mode="list"] { height: var(--sheet-list); }
.sheet[data-mode="detail"] { height: var(--sheet-detail); }
.handle { width: 100%; height: 22px; flex: none; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.handle span { width: 40px; height: 5px; border-radius: 3px; background: #DCCFB7; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 2px 16px 0; }
.sheet-head h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.sheet-sub { margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle {
  height: 44px; padding: 0 14px; border: 1px solid rgba(43, 33, 24, .14); border-radius: 12px; background: var(--surface);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex: none;
}
.radius-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px 0; }
.radius-row .label { font-size: 12px; font-weight: 700; color: var(--muted); }
.link-btn { margin-left: auto; height: 36px; padding: 0 10px; border: 0; background: transparent; font-size: 13px; font-weight: 700; color: var(--primary); }
.empty { margin: 14px 16px 0; padding: 14px; border-radius: 14px; background: #EFE5D2; font-size: 13px; color: var(--soft); display: flex; align-items: center; gap: 12px; }
.empty span { flex: 1; }

.cards { display: flex; gap: 10px; padding: 12px 16px 16px; scroll-snap-type: x mandatory; }
.card {
  flex: none; width: 236px; scroll-snap-align: start; text-align: left; padding: 12px 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.card[aria-current="true"] { border: 2px solid var(--accent); }
.card-name { font-size: 14px; font-weight: 800; line-height: 1.3; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-place { margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 700; }
.card-foot .dist { color: var(--red-ink); white-space: nowrap; }
.card-foot .star { margin-left: auto; display: flex; align-items: center; gap: 2px; color: var(--warn-ink); }

.list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 24px; }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 8px;
  border: 0; border-bottom: 1px solid #EFE5D2; background: transparent; text-align: left;
}
.row:hover { background: #F8F1E4; }
.num { width: 28px; height: 28px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; background: var(--primary); }
.row[aria-current="true"] .num { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.row-main { flex: 1; min-width: 0; }
.row-name, .row-sub, .card-place { display: block; }
.row-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 700; }
.row-foot .price { color: var(--olive-ink); }
.row-foot .star { display: flex; align-items: center; gap: 2px; color: var(--warn-ink); }
.row-dist { font-size: 13px; font-weight: 800; color: var(--red-ink); white-space: nowrap; text-align: right; }
.row-dist small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }

/* Detail */
.detail-head { display: flex; align-items: flex-start; gap: 8px; padding: 0 12px 12px 8px; border-bottom: 1px solid #EFE5D2; }
.detail-head h2 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.detail-place { margin-top: 4px; font-size: 13px; color: var(--muted); }
.detail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 18px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; line-height: 1.45; }
.note svg { flex: none; margin-top: 1px; }
.box { padding: 14px; border-radius: 16px; background: #EFE5D2; }
.box--line { background: transparent; border: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; margin-top: 10px; }
.grid2 .wide { grid-column: 1 / -1; }
.k { font-size: 12px; color: var(--muted); }
.v { margin-top: 2px; font-size: 14px; font-weight: 700; line-height: 1.35; }
.v--big { font-size: 15px; font-weight: 800; }
.para { margin-top: 6px; font-size: 14px; line-height: 1.5; }
.quote { margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--navy); color: var(--surface); }
.quote figcaption { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #F2D9A0; }
.quote blockquote { margin: 6px 0 0; font-size: 14px; line-height: 1.55; }
.updated { margin-top: 6px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.updated strong { color: var(--olive-ink); }
.contact { min-height: 48px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #EFE5D2; color: var(--ink); text-decoration: none; }
.contact-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--tint); display: flex; align-items: center; justify-content: center; color: var(--primary); }
.contact-text { flex: 1; min-width: 0; }
.contact-text span { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-text small { display: block; font-size: 11px; font-weight: 700; color: #8A5A00; }

/* Getting there */
.travel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.travel-modes { display: flex; gap: 6px; }
.travel-main { margin-top: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.eta { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.eta-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.traffic { flex: none; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.traffic--light { background: var(--olive-bg); color: var(--olive-ink); }
.traffic--moderate { background: var(--warn-bg); color: var(--warn-ink); }
.traffic--heavy { background: var(--red-bg); color: var(--red-ink); }
.times { display: flex; gap: 6px; margin: 12px -14px 0; padding: 0 14px; }
.times .chip { padding: 0 12px; }
.bars-title { margin-top: 16px; font-size: 12px; font-weight: 700; color: var(--soft); }
.bars { margin-top: 8px; height: 64px; display: flex; align-items: flex-end; gap: 4px; }
.bar { flex: 1; min-width: 0; border-radius: 3px 3px 0 0; opacity: .5; }
.bar.sel { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.bar--light { background: #A8BE7C; }
.bar--moderate { background: #E0B04F; }
.bar--heavy { background: #B4532A; }
.axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--soft); }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.fine { margin-top: 12px; font-size: 12px; line-height: 1.45; color: var(--muted); }

.loading { position: fixed; z-index: 20; left: 50%; top: 45%; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }

/* Desktop: sheet becomes a side panel */
@media (min-width: 900px) {
  .topbar { right: auto; width: 400px; }
  .sheet, .sheet[data-mode="list"], .sheet[data-mode="detail"] {
    left: 12px; right: auto; bottom: 12px; top: calc(128px + var(--top));
    width: 400px; height: auto; border-radius: 20px; box-shadow: var(--shadow);
  }
  .handle { display: none; }
  .sheet-head { padding-top: 14px; }
  .toggle { display: none; }
  .maplibregl-ctrl-top-right { top: 12px; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 0; }
  .toast { left: 436px; right: 24px; top: 24px; margin: 0; }
}
