/* Ideal neighbourhood map. Brand values from Ideal/brand.md (teal #0D7678 chosen by Darren, 29 Oct 2026). */
:root {
  --teal: #0D7678;
  --teal-ink: #2F5759;
  --teal-soft: #E3EEEE;
  --coral: #E26538;
  --coral-ink: #B04A22;
  --coral-soft: #FBE7DE;
  --ochre: #EC9A2F;
  --lime: #84CF08;
  --green: #04BE6A;
  --ground: #F5F4EF;
  --rule: #DFE3DF;
  --rule-2: #ECEEEA;
  --ink: #1D2B2B;
  --ink-2: #4E5D5C;
  --ink-3: #6F7C7B;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 40, .08), 0 4px 14px rgba(20, 40, 40, .08);
  --font: "Manrope", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-display: "Figtree", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --panel: 420px;
}
:lang(zh-Hant) { --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Manrope", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* ---------- layout ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--panel) 1fr;
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "brand map" "cats map" "results map";
}
.brand { grid-area: brand; }
.cats { grid-area: cats; }
.results { grid-area: results; }
.map-wrap { grid-area: map; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.brand, .cats, .results { background: var(--white); border-right: 1px solid var(--rule); }

/* ---------- header ---------- */
.stripe {
  height: 5px;
  background: linear-gradient(90deg, var(--coral) 0 25%, var(--ochre) 25% 50%, var(--lime) 50% 75%, var(--green) 75% 100%);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 6px; }
.logo { display: block; line-height: 0; }
.logo img { height: 30px; width: auto; }
.lang { display: inline-flex; background: var(--ground); border-radius: 999px; padding: 3px; flex: none; }
.lang button {
  border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; min-height: 32px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.lang button[aria-pressed="true"] { background: var(--white); color: var(--teal); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 20px 12px; flex-wrap: wrap; }
h1 { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -.01em; margin: 0; color: var(--teal-ink); }
:lang(zh-Hant) h1 { letter-spacing: .02em; font-weight: 700; }
.ideal-chip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule); background: var(--white);
  border-radius: 999px; padding: 6px 12px 6px 9px; font-size: 13px; color: var(--ink-2); min-height: 34px; text-align: left;
}
.ideal-chip:hover { border-color: var(--teal); color: var(--teal); }
.ideal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); flex: none; }

/* ---------- categories ---------- */
.cats { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 20px 14px; border-bottom: 1px solid var(--rule-2); }
.cat {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--white);
  border-radius: 999px; padding: 7px 12px 7px 10px; font-size: 13.5px; font-weight: 600; min-height: 36px; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.cat svg { width: 17px; height: 17px; color: var(--c, var(--teal)); flex: none; }
.cat .n { font-weight: 500; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat:hover { border-color: var(--c, var(--teal)); background: color-mix(in srgb, var(--c, var(--teal)) 7%, white); }
.cat[aria-selected="true"] { background: var(--c, var(--teal)); border-color: var(--c, var(--teal)); color: var(--white); }
.cat[aria-selected="true"] svg, .cat[aria-selected="true"] .n { color: rgba(255, 255, 255, .85); }

/* ---------- results ---------- */
.results { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.filters {
  position: sticky; top: 0; z-index: 2; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  padding: 12px 20px 10px; display: flex; flex-wrap: wrap; gap: 8px 6px; border-bottom: 1px solid var(--rule-2);
}
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); min-height: 32px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--teal)) 12%, white); color: var(--c, var(--teal)); }
.tog {
  border: 1px dashed var(--rule); background: var(--white); border-radius: 10px; padding: 6px 10px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); min-height: 32px;
}
.tog[aria-pressed="true"] { border-style: solid; border-color: var(--c, var(--teal)); background: color-mix(in srgb, var(--c, var(--teal)) 12%, white); color: var(--c, var(--teal)); }
.filters .break { flex-basis: 100%; height: 0; }
.note { margin: 12px 20px 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); background: var(--ground); border-radius: 10px; padding: 9px 12px; }
.note:empty { display: none; }
.count { margin: 12px 20px 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; }

.list { list-style: none; margin: 0; padding: 0 12px 8px; }
.item { border-radius: var(--radius); margin: 2px 0; transition: background-color .15s ease; }
.item.sel { background: color-mix(in srgb, var(--c, var(--teal)) 10%, white); }
.row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%;
  border: 0; background: transparent; text-align: left; padding: 10px 8px; border-radius: var(--radius);
}
.row:hover { background: var(--rule-2); }
.item.sel .row:hover { background: transparent; }
.badge {
  width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--c, var(--teal)) 12%, white); color: var(--c, var(--teal));
  display: grid; place-items: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; line-height: 1;
}
.badge svg { width: 20px; height: 20px; }
.badge.price { background: var(--white); border: 1.5px solid var(--c, var(--teal)); color: var(--c, var(--teal)); font-size: 13px; letter-spacing: -.02em; }
.badge.price small { display: block; font-size: 9.5px; font-weight: 600; color: var(--ink-3); margin-top: 2px; letter-spacing: 0; }
.badge.monthly { border-style: dashed; }
.item.sel .badge { background: var(--c, var(--teal)); color: var(--white); border-color: var(--c, var(--teal)); }
.item.sel .badge small { color: rgba(255, 255, 255, .8); }
.main { min-width: 0; }
.name, .meta { display: block; }
.name { font-weight: 700; font-size: 14.5px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.meta { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.meta .pick { color: var(--coral-ink); font-weight: 700; }
.meta .live { color: var(--teal); font-weight: 700; }
.walk { text-align: right; font-size: 12px; color: var(--ink-3); white-space: nowrap; line-height: 1.3; }
.walk b { display: block; font-size: 15px; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.detail { padding: 0 12px 14px 60px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; }
.detail dt { color: var(--ink-3); }
.detail dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.detail .raw { font-size: 12px; color: var(--ink-2); background: var(--white); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; }
.detail .raw summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.detail .raw p { margin: 6px 0 0; }
.detail .caveat { font-size: 12px; color: var(--ink-3); margin: 0 0 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px;
  text-decoration: none; border: 1.5px solid var(--teal); color: var(--teal); background: var(--white); min-height: 38px;
}
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--teal); color: var(--white); }
.btn:hover { filter: brightness(.95); }

.empty { padding: 24px 20px; color: var(--ink-2); font-size: 14px; }
.sources { margin: 8px 20px 24px; padding-top: 14px; border-top: 1px solid var(--rule-2); font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.sources p { margin: 0 0 6px; }

/* ---------- map markers ---------- */
.mk {
  border: 0; padding: 0; background: none; display: block; cursor: pointer;
  transition: transform .15s ease;
}
.mk .dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--white); color: var(--c, var(--teal)); border: 2px solid var(--c, var(--teal));
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.mk .dot svg { width: 16px; height: 16px; }
.mk .pill {
  display: inline-block; background: var(--white); color: var(--c, var(--teal)); border: 2px solid var(--c, var(--teal)); border-radius: 999px;
  padding: 2px 7px; font: 700 12.5px/1.2 var(--font); font-variant-numeric: tabular-nums; box-shadow: var(--shadow); white-space: nowrap;
}
.mk .pill.dash { border-style: dashed; }
.mk:hover { transform: scale(1.08); }
.mk.sel { z-index: 3; transform: scale(1.18); }
.mk.sel .dot, .mk.sel .pill { background: var(--c, var(--teal)); border-color: var(--white); color: var(--white); box-shadow: 0 0 0 3px var(--c, var(--teal)), var(--shadow); }
.mk-ideal { border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.mk-ideal .tag {
  background: var(--teal); border-radius: 12px; padding: 7px 10px 6px; box-shadow: 0 4px 16px rgba(13, 118, 120, .35);
  line-height: 0; border: 2px solid var(--white);
}
.mk-ideal img { width: 64px; height: auto; }
.mk-ideal .tip { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 9px solid var(--teal); margin-top: -1px; }
.ring-label {
  font: 600 11px/1 var(--font); color: var(--teal); background: rgba(255, 255, 255, .9); padding: 3px 6px; border-radius: 6px;
  pointer-events: none; white-space: nowrap;
}
.maplibregl-popup { z-index: 6; }
.maplibregl-popup-content { font-family: var(--font); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); max-width: 260px; }
.pop-name { font-weight: 700; font-size: 13.5px; color: var(--ink); line-height: 1.35; }
.pop-meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.pop-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.pop-actions .btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(220px, 42dvh) 1fr;
    grid-template-areas: "brand" "cats" "map" "results";
  }
  .brand, .cats, .results { border-right: 0; }
  .brand-row { padding: 10px 16px 2px; padding-top: max(10px, env(safe-area-inset-top)); }
  .logo img { height: 24px; }
  .title-row { padding: 2px 16px 8px; }
  h1 { font-size: 18px; }
  .ideal-chip { padding: 4px 10px 4px 8px; min-height: 30px; font-size: 12px; }
  .cats { flex-wrap: nowrap; overflow-x: auto; padding: 2px 16px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { scroll-snap-align: start; }
  .filters { padding: 10px 16px 8px; }
  .note { margin: 10px 16px 0; }
  .count { margin: 10px 16px 2px; }
  .list { padding: 0 6px 8px; }
  .detail { padding-left: 14px; }
  .sources { margin: 8px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .mk-ideal img { width: 52px; }
}

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