/* Layout: a slim white header with the logo; below it the satellite map fills the
   screen, with one dock at the bottom on phones holding the search bar and the exhibitor
   list opening above it, a left-hand panel with search on top on wide screens. The
   header, hall signs and the position dot keep one look in both themes. */
:root {
  --brand-h: 44px;

  --bg: #eef1f3;
  --surface: #ffffff;
  --fg: #161b1f;
  --muted: #5a6670;
  --line: #d6dce0;
  --accent: #c94d0b;
  --accent-soft: #fbe3d4;
  --on-accent: #ffffff;
  --shadow: 0 6px 24px rgb(10 14 18 / 0.18);

  --hall: #ff6b1a;
  --sign-bg: rgb(18 22 25 / 0.84);
  --sign-fg: #ffffff;
  --me: #1a73e8;

  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121619;
    --surface: #1b2024;
    --fg: #e7ebee;
    --muted: #98a4ac;
    --line: #2c343a;
    --accent: #ff7d33;
    --accent-soft: #3b2417;
    --on-accent: #1a0c03;
    --shadow: 0 6px 24px rgb(0 0 0 / 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.45 var(--font-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand {
  position: fixed;
  z-index: 1100;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--brand-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: #ffffff;
  box-shadow: 0 1px 0 rgb(10 14 18 / 0.08), 0 2px 10px rgb(10 14 18 / 0.12);
}

.brand img { display: block; height: 28px; width: auto; }

#map {
  position: fixed;
  inset: calc(var(--brand-h) + env(safe-area-inset-top, 0px)) 0 0 0;
  background: #2b3034;
}

.leaflet-container { font-family: var(--font-body); }

.leaflet-control-attribution.leaflet-control {
  font-size: 10px;
  background: rgb(255 255 255 / 0.7);
}

/* ---- Your position ------------------------------------------------------ */

.where {
  position: fixed;
  z-index: 1000;
  top: calc(var(--brand-h) + env(safe-area-inset-top, 0px) + 10px);
  left: max(12px, env(safe-area-inset-left, 0px));
  max-width: calc(100% - 24px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
}

.where::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--me);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--me);
}

.where.is-problem::before { background: var(--muted); box-shadow: none; }

.where .acc { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- Map buttons -------------------------------------------------------- */

.fabs {
  position: fixed;
  z-index: 900;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--sheet-h, 0px) + var(--kb, 0px) + 12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}

.fab[data-mode="on"] { color: var(--me); }
.fab[data-mode="follow"] { background: var(--me); border-color: var(--me); color: #ffffff; }

body[data-size="full"] .fabs,
body[data-size="full"] .leaflet-bottom { visibility: hidden; }

.leaflet-bottom { bottom: calc(var(--sheet-h, 0px) + var(--kb, 0px)); }

/* ---- Hall signs on the map ---------------------------------------------- */

.hall-label { background: none; border: 0; }

.hall-sign {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  padding: 4px 8px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--hall);
  border-radius: 6px;
  background: var(--sign-bg);
  color: var(--sign-fg);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
  font-family: var(--font-display);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.hall-sign b { font-size: 26px; font-weight: 700; }
.hall-sign small { font-size: 12px; font-weight: 600; opacity: 0.85; font-variant-numeric: tabular-nums; }
.hall-sign.is-selected { background: var(--hall); color: #1a0c03; }
.hall-sign.is-dim { opacity: 0.5; border-color: rgb(255 255 255 / 0.6); }

/* As halls draw together on screen the signs drop their counts, then shrink, then go. */
#map[data-labels="compact"] .hall-sign { min-width: 30px; padding: 2px 6px; }
#map[data-labels="compact"] .hall-sign b { font-size: 19px; }
#map[data-labels="mini"] .hall-sign { min-width: 0; padding: 1px 4px; border-width: 1.5px; border-radius: 4px; }
#map[data-labels="mini"] .hall-sign b { font-size: 13px; }
#map[data-labels="compact"] .hall-sign small,
#map[data-labels="mini"] .hall-sign small { display: none; }
#map[data-labels="none"] .hall-label { display: none; }

/* ---- Dock: the list above, the search bar below ------------------------- */

.sheet {
  position: fixed;
  z-index: 1000;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  color: var(--fg);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgb(0 0 0 / 0.25);
}

.sheet[data-size="closed"] { background: none; box-shadow: none; pointer-events: none; }
.sheet[data-size="closed"] .grip,
.sheet[data-size="closed"] .sheet-body { display: none; }
.sheet[data-size="collapsed"] { height: calc(170px + env(safe-area-inset-bottom, 0px)); }
.sheet[data-size="half"] { height: calc(var(--vvh, 100dvh) * 0.58); }
.sheet[data-size="full"] { height: calc(var(--vvh, 100dvh) - var(--brand-h) - env(safe-area-inset-top, 0px) - 8px); }

.grip {
  flex: none;
  height: 24px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}

.grip span { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.sheet[data-size="collapsed"] .sheet-body { overflow: hidden; }

.search {
  flex: none;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
  padding: 0 6px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  pointer-events: auto;
}

.sheet[data-size="closed"] .search { box-shadow: var(--shadow); }

.search:focus-within { border-color: var(--accent); }

.search-icon { flex: none; color: var(--muted); }

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* below 16px iOS zooms the page on focus */
  outline: none;
}

.search input::-webkit-search-cancel-button { display: none; }

.scope {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 15px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scope svg { opacity: 0.8; }

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-block: 2px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.head-text { flex: 1; min-width: 0; }

.sheet-head h2 {
  margin: 0;
  font: 700 26px/1.05 var(--font-display);
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.sheet-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.head-btn {
  flex: none;
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-weight: 600;
  font-size: 14px;
}

.empty { color: var(--muted); padding-block: 16px; max-width: 46ch; }

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stand-code {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* Lists */

.list { list-style: none; margin: 0; padding: 0; }

.list li { content-visibility: auto; contain-intrinsic-size: auto 62px; }

.row {
  width: 100%;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}

.row .stand-code { color: var(--accent); font-size: 17px; }
.row .stand-code small { color: var(--muted); font-size: 12px; margin-left: 2px; }
.row-name { display: block; font-weight: 600; line-height: 1.25; }
.row-sub { display: block; overflow: hidden; color: var(--muted); font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }

/* Exhibitor detail */

.detail { padding-bottom: 16px; }

.detail-top { display: flex; gap: 12px; align-items: center; padding-top: 14px; }

.logo {
  flex: none;
  width: 60px;
  height: 60px;
  padding: 4px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.detail h2 { margin: 0; font: 700 26px/1.08 var(--font-display); text-wrap: balance; }
.detail .place { margin: 4px 0 0; color: var(--muted); }

.stands { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }

.stand-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 12px 7px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: none;
  color: var(--accent);
  line-height: 1.05;
  text-align: left;
}

.stand-btn .stand-code { font-size: 22px; font-weight: 700; }
.stand-btn small { color: var(--muted); font-size: 12px; font-weight: 600; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }

.pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.detail h3 {
  margin: 20px 0 6px;
  color: var(--muted);
  font: 700 13px/1.2 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose { margin: 0; max-width: 65ch; white-space: pre-line; overflow-wrap: anywhere; }

.products { margin: 0; padding-left: 18px; max-width: 65ch; }
.products li + li { margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
}

.links { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 20px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* ---- Wide screens: the dock becomes a side panel with search on top ----- */

@media (min-width: 900px) {
  .sheet,
  .sheet[data-size] {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: auto;
    top: calc(var(--brand-h) + 12px);
    bottom: auto;
    width: 400px;
    height: auto;
    max-height: calc(100vh - var(--brand-h) - 24px);
    max-height: calc(100dvh - var(--brand-h) - 24px);
    padding-bottom: 0;
    border-radius: 14px;
  }

  .sheet[data-size]:not([data-size="closed"]) { bottom: 12px; box-shadow: var(--shadow); }

  .search { order: -1; margin: 12px; }
  .sheet[data-size="closed"] .search { margin: 0; }

  .grip { display: none; }

  .where { left: calc(max(12px, env(safe-area-inset-left, 0px)) + 412px); }

  .fabs { bottom: 24px; }
  body[data-size="full"] .fabs,
  body[data-size="full"] .leaflet-bottom { visibility: visible; }

  .leaflet-bottom { bottom: 0; }
}
