/* Lunch & WiFi — Apple Maps-style chrome */

/* Always dark. */
:root {
  color-scheme: dark;
  --bg: #1B1B1D;
  --surface: rgba(34, 34, 38, 0.82);
  --surface-solid: #242428;
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #F2F2F4;
  --text-2: rgba(235, 235, 245, 0.62);
  --text-3: rgba(235, 235, 245, 0.36);
  --accent: #2E93FF;
  --hot: #FF5D3A;
  --ok: #34C77B;
  --shut: #E8A33D;
  --closed: #8E8E93;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --radius: 18px;
  --blur: saturate(180%) blur(22px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
.leaflet-container { font: inherit; background: var(--bg); }
/* Dark-map trick: invert the light OSM tiles (MapKit uses its native dark scheme instead) */
.leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(88%) saturate(60%);
}
.leaflet-control-attribution {
  font-size: 10px;
  background: var(--surface) !important;
  color: var(--text-3) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.leaflet-control-attribution a { color: var(--text-2) !important; }

/* ---------------- map pins ---------------- */
.lw-pin-wrap { background: none; border: none; }
.lw-pin { position: relative; width: 34px; height: 44px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); transition: transform .15s ease; }
.lw-pin .pin-head {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--pin); border: 2.5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; position: relative;
}
.lw-pin .pin-tip {
  width: 0; height: 0; margin: -3px auto 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 9px solid var(--pin);
}
.lw-pin .pin-flame {
  position: absolute; top: -9px; right: -9px; font-size: 14px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.3));
}
.pin--selected { transform: scale(1.28); z-index: 10; }
.pin--closed { opacity: .55; filter: grayscale(.7) drop-shadow(0 2px 4px rgba(0,0,0,.3)); }

.lw-userdot-wrap { background: none; border: none; }
.lw-userdot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #0A7AFF; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(10, 122, 255, 0.22), 0 1px 4px rgba(0,0,0,.3);
}

/* ---------------- top chrome ---------------- */
.topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 12px; right: 12px;
  z-index: 20;
  display: flex; gap: 10px; align-items: flex-start;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 9px 16px 9px 12px;
  box-shadow: var(--shadow);
  font-weight: 700; font-size: 15px; letter-spacing: -0.2px;
  white-space: nowrap;
}
.brand .logo { font-size: 17px; }

.searchwrap {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 0 14px;
  box-shadow: var(--shadow);
}
.searchwrap .icon { color: var(--text-3); font-size: 14px; }
#search {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 15px; color: var(--text);
  padding: 11px 0; min-width: 0;
}
#search::placeholder { color: var(--text-3); }

.citymenu { position: relative; }
.citybtn {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 9px 16px; box-shadow: var(--shadow);
  font: inherit; font-size: 14px; font-weight: 700; color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.citybtn .chev { color: var(--text-3); font-size: 13px; margin-top: -4px; }
.citydrop {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 172px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 5px; z-index: 30;
}
.cityopt {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; border: none; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
  padding: 8px 11px; border-radius: 9px; cursor: pointer; text-align: left;
}
.cityopt:hover { background: rgba(255,255,255,0.07); }
.cityopt--on { color: var(--accent); }
.cityopt--soon { color: var(--text-3); font-weight: 500; }
.soon-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  background: var(--stroke); color: var(--text-3);
  border-radius: 999px; padding: 2px 7px;
}

.toast {
  position: fixed; z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  left: 50%; transform: translateX(-50%);
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke); border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 9px 16px; pointer-events: none;
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } }

/* ---------------- right controls ---------------- */
.mapctl {
  position: fixed;
  right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
}
.ctl {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  font-size: 17px; cursor: pointer; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.ctl.locating { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ---------------- panel (desktop) / sheet (mobile) ---------------- */
.panel {
  position: fixed;
  z-index: 15;
  left: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 68px);
  bottom: 12px;
  width: 390px;
  display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet-handle { display: none; }

.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 14px 4px;
}
.chip {
  border: 1px solid var(--stroke); background: transparent;
  color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.chip--on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--hot.chip--on { background: var(--hot); border-color: var(--hot); }

.count {
  padding: 6px 16px 8px;
  font-size: 12px; color: var(--text-3); font-weight: 500;
  letter-spacing: 0.1px;
}

.list {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 10px 14px;
}

/* ---------------- cards ---------------- */
.card {
  display: flex; gap: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card--selected { border-color: var(--accent); }
.card--dim { opacity: .62; }
.card--hot { cursor: pointer; }

.card-glyph {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--pin); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.15);
}
.card-glyph--lg { width: 52px; height: 52px; font-size: 24px; }

.card-body { flex: 1; min-width: 0; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-top h3 {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.2px;
  flex: 1; min-width: 0;
}
.card-dist { font-size: 12px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-sub { margin: 2px 0 6px; font-size: 12.5px; color: var(--text-2); }

.card-meters { display: flex; gap: 14px; margin-bottom: 6px; }
.meter { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); opacity: .35; display: inline-block; margin-right: 1px;
}
.dot.on { background: var(--accent); opacity: 1; }

.card-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.2px;
  padding: 2.5px 8px; border-radius: 999px;
}
.badge--open { background: rgba(46, 158, 91, 0.14); color: var(--ok); }
.badge--shut { background: rgba(180, 83, 9, 0.12); color: var(--shut); }
.badge--closed { background: rgba(142, 142, 147, 0.18); color: var(--closed); }
.badge--hot { background: rgba(255, 93, 58, 0.14); color: var(--hot); }

.empty { text-align: center; color: var(--text-3); font-size: 14px; padding: 32px 12px; }

/* ---------------- hot view ---------------- */
.hot-intro {
  font-size: 13px; color: var(--text-2); line-height: 1.45;
  padding: 10px 6px 12px;
}
.demo-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  background: rgba(255, 93, 58, .14); color: var(--hot);
  border-radius: 999px; padding: 2px 7px; vertical-align: 1px;
}
.ev {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--text-2);
  padding: 7px 0 0;
}
.ev p { margin: 1px 0 0; }
.ev strong { color: var(--text); }
.ev-when { color: var(--hot); font-weight: 600; font-size: 12px; }
.ev--closure .ev-when { color: var(--closed); }
.ev-icon { font-size: 14px; margin-top: 1px; }

/* ---------------- detail (Apple Maps place-card style) ---------------- */
.detail { padding: 10px 8px 14px; position: relative; }
.detail-close {
  position: absolute; top: 2px; right: 2px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--stroke); color: var(--text-2);
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

.dhead { text-align: center; padding: 6px 34px 2px; }
.dhead .card-glyph--lg { margin: 0 auto 8px; }
.dhead h2 {
  margin: 0; font-size: 21px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance;
}
.dsub { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }

.dactions { display: flex; gap: 8px; margin: 14px 2px 8px; }
.dact {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; padding: 10px 8px;
  border-radius: 12px; background: var(--surface-solid);
  color: var(--accent); font-size: 12.5px; font-weight: 650;
  transition: transform .1s ease-out;
}
.dact-icon { font-size: 16px; line-height: 1; }
.dact--primary { background: var(--accent); color: #fff; }
.dact:active { transform: scale(0.97); }

.dstats {
  display: flex; overflow-x: auto;
  background: var(--surface-solid); border-radius: 12px;
  margin: 0 2px 8px; scrollbar-width: none;
}
.dstats::-webkit-scrollbar { display: none; }
.dstat {
  flex: 1; min-width: 76px;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  padding: 10px 10px 11px;
  border-right: 1px solid var(--stroke);
}
.dstat:last-child { border-right: none; }
.dstat-k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; white-space: nowrap; }
.dstat-v { font-size: 14px; font-weight: 650; display: flex; align-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.v-open { color: var(--ok); }
.v-shut { color: var(--shut); }
.v-closed { color: var(--closed); }

.dlabel {
  margin: 14px 4px 6px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
}
.dgroup {
  background: var(--surface-solid); border-radius: 12px;
  margin: 0 2px; padding: 2px 12px;
}
.dgroup--events { padding: 6px 12px 10px; margin-bottom: 8px; }
.drow {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--stroke);
}
.drow:last-child { border-bottom: none; }
.drow-icon { font-size: 15px; margin-top: 1px; }
.drow-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }
.drow-v { margin: 1px 0 0; font-size: 13px; color: var(--text); line-height: 1.45; }
.dabout { font-size: 13.5px; line-height: 1.55; color: var(--text-2); margin: 0; padding: 10px 0; }

.engine-tag {
  position: fixed; z-index: 5; right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  font-size: 10px; color: var(--text-3);
  background: var(--surface); border-radius: 6px; padding: 2px 6px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  pointer-events: none;
}

/* ---------------- mobile: bottom sheet ---------------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .brand { order: 1; padding: 8px 12px 8px 10px; font-size: 14px; }
  .citymenu { order: 2; margin-left: auto; }
  .searchwrap { order: 3; flex-basis: 100%; max-width: none; }

  .mapctl { top: auto; bottom: 46vh; }

  .panel {
    left: 0; right: 0; width: auto;
    top: auto; bottom: 0;
    height: 42vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .panel--expanded { height: calc(100% - env(safe-area-inset-top, 0px) - 118px); }
  .panel--expanded ~ .mapctl { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 124px); }

  .sheet-handle {
    display: block; width: 100%; padding: 10px 0 4px;
    background: transparent; border: none; cursor: grab;
    touch-action: none;
  }
  .sheet-handle:active { cursor: grabbing; }
  .sheet-handle::before {
    content: ""; display: block; width: 38px; height: 4.5px;
    border-radius: 3px; background: var(--text-3); opacity: .5; margin: 0 auto;
  }
}

/* ---------------- feel ---------------- */
.card, .chip, .ctl, .cityopt, .citybtn, .detail-close { -webkit-tap-highlight-color: transparent; }
.card:active { transform: scale(0.985); }
.chip:active, .ctl:active, .citybtn:active, .detail-close:active { transform: scale(0.94); }
.chip, .ctl, .citybtn, .detail-close { transition: transform .1s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .lw-pin, .card, .chip, .ctl, .citybtn, .dact { transition: none; }
  .toast { animation: none; }
  .ctl.locating { animation: none; opacity: .6; }
}
@media (prefers-reduced-transparency: reduce) {
  .brand, .searchwrap, .citybtn, .citydrop, .panel, .ctl, .toast, .engine-tag {
    background: var(--surface-solid);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
}
