/* =========================================================
   Palette: pure grayscale only (no saturation anywhere).
   0 = white … 900 = black, in steps of 100.
   ========================================================= */
:root {
  --gray-0:   #FFFFFF;
  --gray-100: #F5F5F5;
  --gray-200: #E6E6E6;
  --gray-300: #D1D1D1;
  --gray-400: #ADADAD;
  --gray-500: #8A8A8A;
  --gray-600: #6B6B6B;
  --gray-700: #4D4D4D;
  --gray-800: #2E2E2E;
  --gray-900: #000000;

  /* Brand color: bright blue. Used sparingly, for pins, the active filter,
     the main button and focus rings. Everything else stays grayscale. */
  --brand:     #1248FC;
  --brand-600: color-mix(in srgb, var(--brand) 82%, #000);  /* hover / active shade */

  /* Corner radius scale: smaller things get smaller corners. */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 12px;

  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .06);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, .08), 0 12px 32px rgba(0, 0, 0, .12);

  /* Sizes for big monitors; smaller screens step down in the media queries below. */
  --list-w: 640px;
  --gutter: 48px;
  --map-space: 56px;

  --font-body: "Google Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-head: "Google Sans", system-ui, sans-serif;
  font-family: var(--font-body);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--gray-0); color: var(--gray-800); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; height: 100dvh; }
h1, h2, h3 { font-family: var(--font-head); color: var(--gray-900); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Phosphor icons (regular weight): sized to sit with 15-16px text. */
.ic { width: 18px; height: 18px; flex: none; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- top ---------- */
.topbar { flex: none; padding: 24px var(--gutter) 16px; border-bottom: 1px solid var(--gray-200); display: grid; gap: 18px; position: relative; z-index: 600; background: var(--gray-0); }
.intro h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.intro p { display: none; /* subtitle hidden for now */ margin: 4px 0 0; color: var(--gray-600); font-size: 16px; max-width: 760px; }

.filters { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sep { width: 1px; height: 24px; background: var(--gray-200); flex: none; }

.search { width: 300px; flex: none; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 1px solid var(--gray-300); border-radius: var(--r); background: var(--gray-0); }
.search:focus-within { border-color: var(--brand); }
.search .ic { color: var(--gray-500); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; height: 100%; font-size: 15px; }
.search input::placeholder { color: var(--gray-500); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip { transition: background .15s, border-color .15s, color .15s, transform .15s ease; height: 38px; padding: 0 11px 0 14px; /* RTL: icon side (right) a bit tighter */ display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--gray-200); border-radius: var(--r); background: var(--gray-0); font-size: 15px; font-weight: 500; white-space: nowrap; }
.chip:hover { background: var(--gray-100); border-color: var(--gray-300); transform: scale(1.02); }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"]:hover { background: var(--brand); border-color: var(--brand); }
.chip__ic { position: relative; width: 18px; height: 18px; flex: none; }
.chip__ic .ic { position: absolute; inset: 0; transition: opacity .25s ease, color .25s ease; }
/* Hover: the icon morphs into its filled version in the brand color (selected chips are always filled). */
.chip .ic-fill { opacity: 0; color: var(--brand); }
.chip:hover .ic-line { opacity: 0; }
.chip:hover .ic-fill { opacity: 1; }
.chip[aria-pressed="true"] .ic-line { opacity: 0; }
.chip[aria-pressed="true"] .ic-fill { opacity: 1; color: currentColor; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--gray-0); }

.btn { height: 40px; padding: 0 16px; border: 1px solid var(--gray-300); border-radius: var(--r); background: var(--gray-0); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--gray-100); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--gray-0); }
.btn--primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.link { background: none; border: 0; padding: 0; color: var(--gray-900); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

/* ---------- dropdown ---------- */
.dropdown { position: relative; flex: none; }
.dropdown__button { height: 42px; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; border: 1px solid var(--gray-300); border-radius: var(--r); background: var(--gray-0); font-size: 15px; transition: background .15s, border-color .15s; }
.dropdown__button:hover { background: var(--gray-100); }
.dropdown__button[aria-expanded="true"] { border-color: var(--gray-900); }
.dropdown__icon { color: var(--gray-700); }
.dropdown__label { flex: 1; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown__chevron { width: 16px; height: 16px; color: var(--gray-600); transition: transform .2s; }
.dropdown__button[aria-expanded="true"] .dropdown__chevron { transform: rotate(180deg); }
/* A chosen neighborhood: a soft grey fill and dark icon, no colored border or bold text. */
.dropdown.is-set .dropdown__button { background: var(--gray-100); border-color: var(--gray-300); font-weight: 500; color: var(--gray-900); }
.dropdown.is-set .dropdown__icon { color: var(--gray-900); }

.dropdown__menu { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; min-width: 240px; max-height: min(420px, 60dvh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--gray-0); border: 1px solid var(--gray-200); border-radius: var(--r-md); box-shadow: var(--shadow-pop); z-index: 1000; overscroll-behavior: contain; }
.dropdown__menu[hidden] { display: none; }
.dropdown__option { padding: 9px 12px; border-radius: var(--r-sm); font-size: 15px; cursor: pointer; white-space: nowrap; }
.dropdown__option:hover, .dropdown__option.is-focus { background: var(--gray-100); }
.dropdown__option[aria-selected="true"] { font-weight: 700; color: var(--gray-900); }
.dropdown__divider { height: 1px; background: var(--gray-200); margin: 6px 4px; }

/* ---------- layout ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--list-w) 1fr; gap: var(--map-space); padding: 24px var(--gutter) 0; }
.panel { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; min-width: 0; padding: 0 12px var(--map-space) 0; direction: ltr; /* keeps the scrollbar on the right (page edge) */ }
.panel > * { direction: rtl; }
.map-card { position: relative; min-height: 0; margin-bottom: var(--map-space); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--gray-200); background: var(--gray-100); isolation: isolate; }
#map { position: absolute; inset: 0; background: var(--gray-100); direction: ltr; /* Leaflet assumes LTR when placing tooltips */ }

.results-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 0 14px; }
.results-head #count { font-family: var(--font-head); font-weight: 600; color: var(--gray-900); font-size: 17px; }

/* ---------- cards ---------- */
.cards { list-style: none; margin: 0; padding: 0 0 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
.card { width: 100%; padding: 0; border: 0; background: none; text-align: start; display: grid; gap: 2px; }
.card__media { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--gray-100); margin-bottom: 10px; }
.card__media img, .card__media .placeholder { transition: transform .6s cubic-bezier(.22, .61, .36, 1); }
.card__media img, .detail__media img { position: absolute; inset: 0; z-index: 1; opacity: 0; }
.card__media img.is-loaded, .detail__media img.is-loaded { opacity: 1; transition: transform .6s cubic-bezier(.22, .61, .36, 1), opacity .4s ease; }
/* Photo slider (Airbnb style). */
.gal-track { position: absolute; inset: 0; z-index: 1; display: flex; transition: transform .45s cubic-bezier(.25, .8, .25, 1); }
.gal-track { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.is-dragging .gal-track { cursor: grabbing; }
.gal-slide { position: relative; flex: 0 0 100%; height: 100%; overflow: hidden; }
.card__media .gal-track img, .detail__media .gal-track img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 1; background: var(--gray-100); }
.gal-nav { position: absolute; top: 50%; z-index: 3; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.94); color: var(--gray-900); box-shadow: 0 2px 6px rgba(0,0,0,.18);
  opacity: 0; transition: opacity .2s, transform .15s, background .15s; cursor: pointer; }
.gal-nav .ic { width: 16px; height: 16px; }
.gal-nav:hover { background: var(--gray-0); transform: scale(1.06); }
.gal-prev { inset-inline-start: 10px; }
.gal-next { inset-inline-end: 10px; }
.card:hover .gal-nav, .detail__media:hover .gal-nav { opacity: 1; }
@media (hover: none) { .gal-nav { opacity: 1; } }
/* no "back" on the first photo, no "next" on the last */
[data-gallery]:not([data-i]) .gal-prev, [data-gallery][data-i="0"] .gal-prev { opacity: 0 !important; pointer-events: none; }
[data-gallery].is-end .gal-next { opacity: 0 !important; pointer-events: none; }
/* Dots sit on a small dark glass pill so they read on bright photos too.
   In the list they appear on hover, like the arrows; on a place's page they stay. */
.gal-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 999px;
  background: rgba(0,0,0,.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none; transition: opacity .2s; }
.card .gal-dots { opacity: 0; }
/* In the list the credit gets the full width, and steps aside while the dots show. */
.card .credit { max-width: calc(100% - 16px); transition: opacity .2s; }
.card:hover [data-gallery] .credit { opacity: 0; }
.card:hover .gal-dots { opacity: 1; }
@media (hover: none) { .card .gal-dots { opacity: 1; } }
.gal-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5); transition: width .3s, background .3s; }
.gal-dots i.is-on { width: 16px; background: var(--gray-0); }
.credit { position: absolute; bottom: 8px; inset-inline-end: 8px; z-index: 2; max-width: calc(50% - 42px); /* leaves room for the dots */ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: var(--r-xs); background: rgba(0, 0, 0, .55); color: var(--gray-0); text-decoration: none; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .card__media img, .card.is-hover .card__media img,
.card:hover .card__media .placeholder, .card.is-hover .card__media .placeholder { transform: scale(1.06); }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; background: var(--gray-100); }
.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.placeholder .ic { width: 40px; height: 40px; color: var(--gray-400); }
.placeholder span { font-size: 13px; color: var(--gray-500); }
.tag { position: absolute; top: 10px; inset-inline-start: 10px; /* RTL: start = right */ background: linear-gradient(to left, rgba(255, 255, 255, .96), rgba(255, 255, 255, .72)); /* RTL: solid at the text start, fading toward the end */ -webkit-backdrop-filter: blur(6px) saturate(1.4); backdrop-filter: blur(6px) saturate(1.4); color: var(--gray-900); font-size: 13px; font-weight: 500; line-height: 1; padding: 6px 8px; border-radius: var(--r-sm); z-index: 2; }
.card__row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__name { margin: 0; font-family: var(--font-head); font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--gray-900); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__rating, .detail__rating { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.card__rating { font-size: 14px; color: var(--gray-700); flex: none; }
.card__count { font-size: 13px; color: var(--gray-500); margin-inline-start: 3px; }
.ic.star { width: 14px; height: 14px; color: var(--gray-900); }
.card__address { font-size: 15px; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 24px 0; color: var(--gray-600); text-align: center; }
.foot { margin-top: auto; padding-top: 16px; font-size: 13px; color: var(--gray-500); }

/* ---------- detail ---------- */
.detail { padding-bottom: 8px; }
.back { margin-bottom: 16px; padding-inline: 8px 12px; margin-inline-start: -8px; border: 0; background: none; }
.back:hover { background: var(--gray-100); }
.detail__media { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: var(--gray-100); margin-bottom: 18px; }
.detail__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail h2 { margin: 0 0 4px; font-size: 28px; line-height: 1.2; letter-spacing: -.01em; }
.detail__sub { color: var(--gray-600); margin: 0; }
.detail__rating { font-size: 15px; color: var(--gray-700); margin-top: 2px; display: flex; }
.section-title { margin: 28px 0 10px; font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--gray-900); }
.work { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--gray-100); border-radius: var(--r-md); padding: 12px 14px; }
.tile__label { font-size: 14px; color: var(--gray-600); }
.tile__value { margin-top: 2px; font-weight: 600; font-size: 15px; color: var(--gray-900); }
.tile__value.unknown { color: var(--gray-500); font-weight: 400; }
/* "Check before you go" note for places with doubtful info. */
.check { display: flex; align-items: flex-start; gap: 6px; margin: 12px 0 0; padding: 9px 12px; border-radius: var(--r); background: var(--gray-100); color: var(--gray-700); font-size: 14px; line-height: 1.45; }
.check .ic { width: 17px; height: 17px; margin-top: 1px; color: var(--gray-900); }
.facts dd.unknown { color: var(--gray-500); }
.facts { margin: 0; border: 1px solid var(--gray-200); border-radius: var(--r-md); overflow: hidden; }
.facts div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--gray-200); font-size: 15px; }
.facts div:first-child { border-top: 0; }
.facts dt { color: var(--gray-600); }
.facts dd { margin: 0; color: var(--gray-900); }
.notes { margin: 0; padding: 12px 14px; background: var(--gray-100); border-radius: var(--r-md); font-size: 15px; }
.summary { padding: 12px 14px; background: var(--gray-100); border-radius: var(--r-md); font-size: 15px; }
.summary p { margin: 0; }
.summary__note { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; color: var(--gray-500); }
.summary__note .ic { width: 14px; height: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* ---------- map ---------- */
.pin { width: 48px; height: 48px; color: var(--brand); transform: scale(.75); transform-origin: 50% 93%; transition: transform .15s, color .15s;
  filter: drop-shadow(0 0 1px rgba(255,255,255,.9)) drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.pin svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.pin.is-hover { transform: scale(.86); }
.pin.is-active { transform: scale(1); color: var(--brand-600); }
.leaflet-marker-icon.is-front { z-index: 10000 !important; }
.cluster { border-radius: 50%; display: grid; place-items: center; background: var(--gray-0); color: var(--gray-900); font-family: var(--font-head); font-weight: 700; font-size: 14px; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 3px 10px rgba(0,0,0,.18); transition: transform .15s; }
.cluster:hover { transform: scale(1.08); }
.leaflet-cluster-anim .leaflet-marker-icon { transition: transform .25s ease-out, opacity .25s ease-in; }
.peek-pop { position: absolute; z-index: 700; width: 240px; pointer-events: none; opacity: 0; visibility: hidden;
  transform: translate(var(--dx, 0), var(--dy, 6px)) scale(.96);
  transition: opacity .14s ease-out, transform .18s cubic-bezier(.2, .8, .3, 1), visibility 0s .18s; }
.peek-pop.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .14s ease-out, transform .18s cubic-bezier(.2, .8, .3, 1), visibility 0s; }
.peek-pop[data-dir="top"]    { --dy: 6px;  transform-origin: 50% 100%; }
.peek-pop[data-dir="bottom"] { --dy: -6px; transform-origin: 50% 0; }
.peek-pop[data-dir="right"]  { --dx: -6px; --dy: 0; transform-origin: 0 50%; }
.peek-pop[data-dir="left"]   { --dx: 6px;  --dy: 0; transform-origin: 100% 50%; }
.peek { position: relative; width: 240px; aspect-ratio: 3 / 2; border-radius: var(--r-md); overflow: hidden; background: var(--gray-100); direction: rtl; font-family: var(--font-body);
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 10px 28px rgba(0,0,0,.18); }
.peek__media { position: absolute; inset: 0; }
.peek__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.peek__media .placeholder .ic { width: 36px; height: 36px; }
.peek::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 32%, rgba(0,0,0,0) 58%); pointer-events: none; }
.peek .tag { top: 8px; inset-inline-start: 8px; }
.peek__name { position: absolute; z-index: 3; bottom: 10px; inset-inline: 12px; color: var(--gray-0); font-family: var(--font-head); font-size: 16px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-attribution { direction: ltr; font-size: 11px; }
.leaflet-control-attribution a { color: var(--gray-700) !important; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: var(--r) !important; overflow: hidden; }
.leaflet-bar a { width: 38px !important; height: 38px !important; line-height: 38px !important; font-size: 20px !important; color: var(--gray-900) !important; border-bottom-color: var(--gray-200) !important; }
.leaflet-top.leaflet-left { margin: 6px; }

/* ---------- smaller desktops ---------- */
@media (max-width: 1599px) {  /* 15-16" laptops and smaller desktops */
  :root { --list-w: 560px; --gutter: 40px; --map-space: 44px; }
}
@media (max-width: 1280px) {  /* 13-14" laptops */
  :root { --list-w: 480px; --gutter: 28px; --map-space: 32px; }
  .search { width: 270px; }
}
@media (max-width: 1024px) {  /* small laptops, tablets in landscape */
  :root { --list-w: 420px; --gutter: 24px; --map-space: 24px; }
}
@media (max-width: 1100px) {
  .filters { flex-wrap: wrap; }
  .filters .sep:last-of-type { display: none; }
  .chips { width: 100%; }
}

/* ---------- phone ---------- */
@media (max-width: 820px) {
  :root { --gutter: 16px; --map-space: 16px; }
  body { display: block; height: auto; }
  .topbar { padding: 16px var(--gutter) 12px; gap: 12px; }
  .intro h1 { font-size: 21px; }
  .intro p { font-size: 15px; }
  .filters { gap: 8px; }
  .filters .sep { display: none; }
  .search { width: auto; flex: 1 1 100%; }
  .dropdown { flex: 1; }
  .dropdown__button { width: 100%; min-width: 0; }
  .dropdown__menu { inset-inline-start: 0; inset-inline-end: 0; min-width: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); width: calc(100% + 2 * var(--gutter)); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .layout { display: flex; flex-direction: column; padding: 16px var(--gutter) 24px; gap: 20px; }
  .map-card { order: -1; height: 46dvh; flex: none; margin: 0; }
  .panel { overflow: visible; padding: 0; }
  .cards { grid-template-columns: 1fr; gap: 24px; }
  .detail { scroll-margin-top: 16px; }
}

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