:root {
  --brand: #FCAF1A;        /* emart24 yellow */
  --brand-hover: #F5A200;
  --brand-ink: #2B2B2B;    /* text on yellow */
  --logo-grey: #57575A;
  --bg: #FEE8BC;           /* cream */
  --card: #FFFFFF;
  --card-hover: #FFF6E2;
  --text: #2B2B2B;
  --muted: #5F5A50;
  --border: #F3D59A;
  --shadow: 0 2px 0 rgba(0,0,0,.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Home ---------- */
.home { padding-top: 72px; }

.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.logo img { width: 240px; max-width: 72vw; height: auto; display: block; }

.tagline {
  margin: 64px 0 40px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  color: var(--text);
}

.links { list-style: none; margin: 0; padding: 0 10px; width: 100%; display: grid; gap: 18px; }
.link {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  background: var(--brand);
  border-radius: 18px;
  color: var(--brand-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  transition: transform .12s ease, background .12s ease;
}
.link .icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.35);
  color: var(--brand-ink);
}
.link .label { flex: 1; text-align: center; padding-right: 40px; }
.link:hover { background: var(--brand-hover); transform: translateY(-1px); }
.link:active { transform: translateY(1px); }
.link:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 3px; }

/* Social row */
.social { display: flex; gap: 14px; margin: 36px 0 0; padding: 0; list-style: none; }
.social a {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
  transition: background .12s ease;
}
.social a:hover { background: var(--brand-hover); }
.social a:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 3px; }

footer { margin-top: 32px; font-size: 12px; color: var(--muted); text-align: center; }

svg { width: 20px; height: 20px; }

/* ---------- Sub-pages ---------- */
.topbar {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.back {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.back:hover { background: var(--card-hover); }
.back:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.topbar h1 { margin: 0; font-size: 20px; }
.intro { margin: -12px 0 20px; color: var(--muted); font-size: 14px; align-self: flex-start; }

/* Promotions */
.promos { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 16px; }
.promo {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.promo-img {
  display: block; width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--brand);
}
.promo-img.placeholder {
  display: grid; place-items: center;
  color: var(--brand-ink); font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, #FCAF1A, #FFD27A);
}
.promo-img.poster { aspect-ratio: auto; height: auto; background: var(--card); }
.promo a { display: block; }
.promo-body { padding: 14px 16px 16px; }
.promo-body h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.promo-body p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }

/* Stores */
.stores { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 10px; }
.store {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: background .12s ease;
}
.store:hover { background: var(--card-hover); }
.store:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.store .icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center;
}
.store .info { flex: 1; min-width: 0; }
.store .name { display: block; font-weight: 600; font-size: 15px; }
.store .addr { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.store .chev { flex: none; color: var(--muted); }

/* Store search */
.search {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  padding: 0 14px;
  height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--muted);
}
.search:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  color: var(--text);
  font: inherit; font-size: 16px;
}
.empty { color: var(--muted); font-size: 14px; }
[lang="km"] { font-family: "Noto Sans Khmer", Montserrat, system-ui, sans-serif; }
li[hidden] { display: none; }

/* Store map */
.map {
  width: 100%;
  height: 340px;
  margin-bottom: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 0;
  background: var(--card);
}
.pin { background: none; border: 0; }
.pin span {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--brand);
  border: 2px solid var(--brand-ink);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.pin .store-ico {
  display: block;
  width: 18px; height: 18px;
  transform: rotate(45deg);
  background: url(store-icon.png) center / contain no-repeat;
}
.map-btn {
  font: 600 13px Montserrat, system-ui, sans-serif;
  padding: 8px 12px;
  border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  cursor: pointer;
}
.leaflet-popup-content { font: 14px/1.5 Montserrat, system-ui, sans-serif; margin: 12px 14px; }
.leaflet-popup-content a { color: #8A6200; font-weight: 600; }

/* Search + Near me row */
.tools { width: 100%; display: flex; gap: 10px; margin-bottom: 14px; }
.tools .search { margin-bottom: 0; }
.near {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  height: 48px; padding: 0 14px;
  border: 0; border-radius: 14px;
  background: var(--brand); color: var(--brand-ink);
  font: 600 14px Montserrat, system-ui, sans-serif;
  cursor: pointer;
}
.near:disabled { opacity: .7; cursor: wait; }
.near:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.tools + .intro { margin-top: 0; }

/* Store rows on the map page: pin button + link */
div.store { cursor: default; }
div.store:hover { background: var(--card); }
div.store .icon { border: 0; cursor: pointer; padding: 0; }
div.store .icon:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
div.store .info { color: var(--text); text-decoration: none; }
div.store .info:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
div.store:has(.info:hover) { background: var(--card-hover); }
.store .dist { display: block; color: #8A6200; font-size: 12px; font-weight: 600; margin-top: 2px; }
div.store .info { display: flex; align-items: center; gap: 8px; align-self: stretch; }
div.store .text { flex: 1; min-width: 0; align-self: center; }
.tools .search { flex: 1; min-width: 0; width: auto; }
.cluster { background: none; border: 0; }
.cluster span {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-ink); color: var(--brand);
  border: 3px solid var(--brand);
  font: 800 14px Montserrat, system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Small phones: keep the home buttons inside the screen */
@media (max-width: 360px) {
  .links { padding: 0; }
  .link { font-size: 15px; gap: 10px; }
  .link .label { padding-right: 0; white-space: normal; }
}
