/* ============ Muan design tokens — night (default) ============ */
:root {
  --ink:   #131019;
  --ink2:  #1C1726;
  --ink3:  #241E31;
  --ink4:  #2E2740;
  --flame: #FF5A3C;
  --gold:  #FFC24B;
  --violet:#7C5CE0;
  --teal:  #1FBF9C;
  --bone:  #F5F1E8;
  --mute:  #8A8494;
  --dim:   #5A5468;
  --font:  'Space Grotesk', 'Noto Sans Lao', system-ui, sans-serif;
}

/* day theme */
[data-theme="light"] {
  --ink:   #F2F2F6;
  --ink2:  #FFFFFF;
  --ink3:  #E9E8EF;
  --ink4:  #D8D6E1;
  --bone:  #1C1726;
  --mute:  #6A6675;
  --dim:   #A5A2B0;
  --halo:  rgba(242,242,246,.9);
}
:root { --halo: rgba(0,0,0,.9); }

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  background: var(--ink);
  font-family: var(--font);
  color: var(--bone);
  overflow: hidden;
}

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ============ Map ============ */
#map { flex: 1; }
#map .maplibregl-ctrl-attrib { background: rgba(19,16,25,.7); }
#map .maplibregl-ctrl-attrib a { color: var(--dim); }

/* Custom markers */
.marker { cursor: pointer; text-align: center; transform: translateY(-4px); }
.marker svg { display: block; margin: 0 auto; filter: none; }
.marker .m-label {
  font-family: var(--font); font-size: 11px; font-weight: 700; color: var(--bone);
  text-shadow: 0 1px 3px var(--halo); white-space: nowrap; margin-top: 1px;
}
.marker .m-sub { font-size: 10px; font-weight: 700; text-shadow: 0 1px 3px var(--halo); }
.marker.is-hot svg { animation: pinbob 1.6s ease-in-out infinite; }
@keyframes pinbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .marker.is-hot svg { animation: none; } }

/* ============ Top bar ============ */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 0;
  pointer-events: none;
}
#topbar .row { display: flex; justify-content: space-between; align-items: center; }
.pill {
  pointer-events: auto;
  background: var(--ink); border: 1px solid var(--ink4); border-radius: 18px;
  padding: 6px 12px; display: flex; align-items: center; gap: 6px;
  color: var(--mute); font-family: var(--font); font-size: 12px; cursor: pointer;
}
.brand { font-weight: 700; font-size: 14px; letter-spacing: 1.5px; color: var(--bone); }
.chip-bar { display: flex; gap: 6px; margin-top: 8px; }
.chip {
  pointer-events: auto;
  background: var(--ink); color: var(--mute); border: 1px solid var(--ink4);
  font-family: var(--font); font-size: 12px; padding: 5px 12px; border-radius: 14px; cursor: pointer;
}
.chip.on { background: var(--flame); color: var(--ink); font-weight: 700; border-color: var(--flame); }

/* ============ Bottom sheet ============ */
#sheet {
  background: var(--ink2); border-radius: 18px 18px 0 0;
  padding: 9px 14px calc(env(safe-area-inset-bottom, 0px) + 16px);
  max-height: 55vh; overflow-y: auto; z-index: 6;
}
#sheet::before {
  content: ''; display: block; width: 36px; height: 4px;
  background: var(--ink4); border-radius: 2px; margin: 0 auto 10px;
}

.s-title { font-size: 17px; font-weight: 700; }
.s-sub   { font-size: 12px; color: var(--mute); margin-top: 2px; }
.lao     { font-family: 'Noto Sans Lao', sans-serif; }

.tag { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; }
.tag.flame  { color: var(--flame); }
.tag.violet { color: var(--violet); }
.tag.teal   { color: var(--teal); }
.tag.open   { color: var(--teal); }
.tag.closed { color: var(--dim); }

.card {
  background: var(--ink3); border-radius: 12px; padding: 11px 12px; margin-top: 9px; cursor: pointer;
}
.card .row { display: flex; justify-content: space-between; align-items: center; }
.t-name { font-size: 15.5px; font-weight: 700; margin-top: 4px; }
.t-sub  { font-size: 12px; color: var(--mute); margin-top: 2px; line-height: 1.45; }

.hcards { display: flex; gap: 8px; margin-top: 11px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.hcards::-webkit-scrollbar { display: none; }
.hcard { flex-shrink: 0; background: var(--ink3); border-radius: 10px; padding: 8px 11px; min-width: 128px; cursor: pointer; }

/* Venue detail */
.stat-row { display: flex; gap: 8px; margin-top: 12px; }
.stat { flex: 1; background: var(--ink3); border-radius: 10px; padding: 9px; text-align: center; }
.stat b { font-size: 15px; font-weight: 700; display: block; line-height: 1.3; }
.stat span { font-size: 10.5px; color: var(--mute); }

.btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  font-family: var(--font); font-weight: 700; border: none; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-back { flex-shrink: 0; width: 48px; height: 48px; background: var(--ink3); color: var(--mute); font-size: 18px; }
.btn-go   { flex: 1; height: 48px; background: var(--flame); color: var(--ink); font-size: 15px; }
.btn-fb   { flex: 1; height: 48px; background: var(--ink3); color: var(--bone); font-size: 14px; }

.hint { text-align: center; font-size: 11px; color: var(--dim); margin-top: 8px; }
.empty { text-align: center; color: var(--dim); font-size: 13px; padding: 18px 0 10px; }

/* selected pin + zoom labels */
.marker.is-selected svg { transform: scale(1.3); transform-origin: bottom center; }
.marker.is-selected .m-label { color: var(--flame); }
#map.labels-hidden .m-label, #map.labels-hidden .m-sub { display: none; }

/* desktop: sheet becomes a floating panel */
@media (min-width: 768px) {
  #app { position: relative; }
  #map { position: absolute; inset: 0; }
  #sheet {
    position: absolute; left: 16px; bottom: 16px; z-index: 6;
    width: 400px; max-height: 70vh;
    border-radius: 18px; border: 1px solid var(--ink4);
  }
  .chip:hover, .pill:hover { border-color: var(--dim); }
  .card:hover, .hcard:hover { background: var(--ink4); }
}

/* expanded venue sheet */
#sheet.expanded { max-height: 78vh; }
@media (min-width: 768px) { #sheet.expanded { max-height: 82vh; } }

.photo-strip { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip img, .photo-ph {
  flex-shrink: 0; width: 150px; height: 100px; border-radius: 10px; object-fit: cover;
}
.photo-ph {
  background: var(--ink3); display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; color: var(--dim); font-size: 11px;
}

.info-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--ink3); font-size: 13px;
}
.info-row:last-of-type { border-bottom: none; }
.info-ic { flex-shrink: 0; width: 20px; text-align: center; }
.info-main { flex: 1; color: var(--bone); line-height: 1.5; }
.info-main .sub { color: var(--mute); font-size: 12px; }

.hours-week { margin-top: 6px; font-size: 12px; color: var(--mute); display: none; }
.hours-week.show { display: block; }
.hours-week div { display: flex; justify-content: space-between; padding: 2px 0; }
.hours-week .today { color: var(--bone); font-weight: 700; }
.hours-toggle { color: var(--violet); cursor: pointer; font-size: 12px; }

.section-h { font-size: 13px; font-weight: 700; margin-top: 16px; letter-spacing: .5px; }
.comment-empty {
  background: var(--ink3); border-radius: 12px; padding: 14px;
  margin-top: 8px; text-align: center; color: var(--mute); font-size: 12.5px; line-height: 1.5;
}

/* sheet close + tracking */
.sheet-x {
  flex-shrink: 0; width: 34px; height: 34px; border: none; border-radius: 50%;
  background: var(--ink3); color: var(--mute); font-size: 15px; cursor: pointer;
  font-family: var(--font);
}
#trackChip {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 60px);
  left: 50%; transform: translateX(-50%); z-index: 7;
  background: var(--flame); color: #131019; font-weight: 700; font-size: 13px;
  padding: 8px 16px; border-radius: 18px; display: none; cursor: pointer;
  font-family: var(--font);
}
#trackChip.on { display: block; }

/* ============ motion ============ */
@media (prefers-reduced-motion: no-preference) {

  @keyframes pin-drop {
    0%   { transform: translateY(-18px); opacity: 0; }
    60%  { transform: translateY(3px);   opacity: 1; }
    100% { transform: translateY(0); }
  }
  .marker { animation: pin-drop .35s ease-out backwards; }

  @keyframes sheet-in {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  #sheet.anim > * { animation: sheet-in .3s ease-out backwards; }
  #sheet.anim > *:nth-child(2) { animation-delay: .04s; }
  #sheet.anim > *:nth-child(3) { animation-delay: .08s; }
  #sheet.anim > *:nth-child(4) { animation-delay: .12s; }
  #sheet.anim > *:nth-child(5) { animation-delay: .16s; }
  #sheet.anim > *:nth-child(6) { animation-delay: .20s; }
  #sheet.anim > *:nth-child(n+7) { animation-delay: .24s; }

  .chip, .pill, .card, .hcard, .btn, .sheet-x {
    transition: transform .12s ease, background .15s ease, border-color .15s ease;
  }
  .chip:active, .pill:active, .sheet-x:active { transform: scale(.94); }
  .card:active, .hcard:active { transform: scale(.98); }
  .btn:active { transform: scale(.97); }

  #sheet { transition: max-height .25s ease; }
}
