/* Field + Supply brand tokens (from fieldandsupply.com's theme) */
:root {
  --bg: #fcfbfa;           /* nav / page */
  --paper: #f6f5f2;        /* accent background, badges */
  --card: #ffffff;
  --text: #55524d;         /* primary text */
  --ink: #312c24;          /* dark text, headings */
  --black: #191008;        /* secondary — emphasis, active states */
  --muted: #888682;
  --line: #e8e7e3;
  --line-strong: #111111;
  --shadow: 0 6px 24px rgba(25, 16, 8, .10);
  --sheet-peek: 136px;
  --serif: "Domine", Georgia, serif;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* Small uppercase label — the site's "A MODERN MAKERS MARKET" style */
.label, .sub, .chip, .booth-tag, .btn, .back, .also h3, .cat, .section-label, #source {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- Map ---------- */
#map { position: fixed; inset: 0; background: #fff; }
.leaflet-container { font-family: var(--sans); background: #fff; }
.leaflet-control-attribution { display: none; }

.pin {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--card);
  color: var(--black);
  border: 1.5px solid var(--black);
  box-shadow: 0 1px 3px rgba(25,16,8,.25);
  font: 600 10px/1 var(--sans);
  transition: transform .15s, background .15s, opacity .15s;
}
.pin b { display: none; letter-spacing: 0; font-weight: 600; }
.z-detail .pin b { display: block; }
.pin.area { border-style: dashed; border-width: 2px; }
.pin.dim { opacity: .2; }
.pin.hit { background: var(--black); color: #fff; }
.pin.selected {
  background: var(--black); color: #fff;
  transform: scale(1.35);
  box-shadow: 0 0 0 5px rgba(25, 16, 8, .16), 0 2px 6px rgba(25,16,8,.35);
}

.section-label {
  font-size: 12px; font-weight: 600; line-height: 1;
  color: var(--black);
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 10px #fff, 0 0 14px #fff;
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.z-far .section-label { font-size: 9px; letter-spacing: .6px; }
/* Facilities: bar, restrooms, check-in */
.amen {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: var(--card); color: var(--black);
  border: 1.5px solid var(--black);
  box-shadow: 0 1px 4px rgba(25,16,8,.3);
  transition: transform .15s, background .15s;
}
.amen svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.amen.hit, .amen.selected { background: var(--black); color: #fff; }
.amen.selected { transform: scale(1.2); box-shadow: 0 0 0 5px rgba(25,16,8,.16), 0 2px 6px rgba(25,16,8,.35); }
.z-far .amen { transform: scale(.8); }
.leaflet-tooltip.amen-tip {
  font: 600 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase;
  background: var(--black); color: #fff; border: 0; border-radius: 0; padding: 6px 8px; box-shadow: none;
}
.leaflet-tooltip-top.amen-tip::before { border-top-color: var(--black); }
.amen-thumb { border: 1px solid var(--line-strong); color: var(--black); }
.amen-thumb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chip.amenity-chip { border-color: var(--line-strong); }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1000;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 8px;
  background: linear-gradient(var(--bg) 78%, rgba(252,251,250,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brandline {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 2px 10px;
}
.brand-left { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.logo { display: block; height: 46px; width: auto; }
.brand { margin: 0; line-height: 0; }
.sub { font-size: 10px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tickets {
  flex: none; font: 600 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase;
  color: var(--black); text-decoration: none;
  border: 1px solid var(--line-strong); padding: 10px 12px; background: var(--card);
}

.search { position: relative; display: flex; align-items: center; }
.search input {
  width: 100%; height: 46px;
  padding: 0 44px 0 42px;
  border: 1px solid var(--line-strong); border-radius: 0;
  background: var(--card); color: var(--ink);
  font: 16px var(--sans); /* 16px stops iOS zoom-on-focus */
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: 2px solid var(--black); outline-offset: -2px; }
.search-icon { position: absolute; left: 14px; width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.icon-btn { position: absolute; right: 5px; width: 36px; height: 36px; border: 0; background: none; display: grid; place-items: center; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

.chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 0;
  background: var(--card); color: var(--text);
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--black); color: #fff; border-color: var(--black); }

/* ---------- Zoom controls ---------- */
.zoom-ctl {
  position: fixed; right: 12px; z-index: 900;
  bottom: calc(var(--sheet-peek) + 16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); background: var(--card);
  transition: bottom .25s;
}
.zoom-ctl button {
  width: 40px; height: 40px; border: 0; background: none; border-radius: 0;
  font: 300 22px/1 var(--sans); color: var(--ink);
  display: grid; place-items: center;
}
.zoom-ctl button + button { border-top: 1px solid var(--line); }
.zoom-ctl svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 1.8; }

/* ---------- Bottom sheet ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  height: 86dvh; max-height: calc(100dvh - 70px);
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -6px 24px rgba(25,16,8,.10);
  display: flex; flex-direction: column;
  transform: translateY(calc(100% - var(--sheet-peek) - env(safe-area-inset-bottom)));
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  touch-action: pan-y;
}
.sheet[data-state="half"] { transform: translateY(calc(100% - 42dvh)); }
.sheet[data-state="open"] { transform: translateY(0); }
.sheet.dragging { transition: none; }

.handle { flex: none; width: 100%; height: 24px; border: 0; background: none; display: grid; place-items: center; touch-action: none; }
.handle span { width: 36px; height: 3px; background: var(--line); }

.view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.list-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 2px 0 10px; position: sticky; top: 0; background: var(--paper); z-index: 1;
  border-bottom: 1px solid var(--line);
}
.list-head h2 { font: 400 18px/1.2 var(--serif); color: var(--ink); margin: 0; }
#source { font-size: 9px; font-weight: 500; }

.results { list-style: none; margin: 0; padding: 0; }
.results li + li { border-top: 1px solid #e3e1db; }
.row {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px;
  width: 100%; padding: 12px 0; border: 0; background: none; text-align: left;
}
.row:active { background: #eceae5; }
.thumb {
  width: 48px; height: 48px; overflow: hidden;
  background: var(--card);
  display: grid; place-items: center;
  font: 400 16px/1 var(--serif); color: var(--muted);
}
.thumb, .hero { position: relative; }
.thumb img, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.thumb img.loaded, .hero img.loaded { opacity: 1; }
.row-name { font: 400 15px/1.3 var(--serif); color: var(--ink); }
.row-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.booth-tag {
  font-size: 10px; font-weight: 600; padding: 5px 8px;
  color: var(--black); background: var(--card); border: 1px solid var(--line-strong); white-space: nowrap;
}
.booth-tag.none { color: var(--muted); border-color: var(--line); font-weight: 500; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }

/* ---------- Detail ---------- */
.back {
  border: 0; background: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 0 12px; font-size: 10px; font-weight: 600; color: var(--text);
}
.back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.hero {
  width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  background: var(--card);
  display: grid; place-items: center; font: 400 48px/1 var(--serif); color: var(--muted);
}
.thumb.big { width: 64px; height: 64px; font-size: 22px; }
.detail h2 { font: 400 26px/1.2 var(--serif); color: var(--ink); margin: 16px 0 6px; }
.where { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); margin: 4px 0 10px; }
.where .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--black); flex: none; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.cat { font-size: 9px; font-weight: 600; padding: 5px 9px; background: var(--card); color: var(--text); }
.cat.act { background: var(--black); color: #fff; }
.blurb { color: var(--text); margin: 0 0 12px; }
.actions { display: flex; gap: 8px; margin: 16px 0 20px; }
.btn {
  flex: 1; height: 48px; border-radius: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11px; font-weight: 600; text-decoration: none; border: 1px solid var(--line-strong);
}
.btn.primary { background: var(--black); border-color: var(--black); color: #fff; }
.btn.ghost { background: var(--card); color: var(--black); }
.also h3 { font-size: 10px; font-weight: 600; color: var(--muted); margin: 8px 0 4px; }

/* ---------- Desktop: sheet becomes a sidebar ---------- */
@media (min-width: 900px) {
  :root { --side: 400px; }
  .topbar { right: auto; width: var(--side); background: none; padding: 16px; }
  .brandline { background: var(--card); border: 1px solid var(--line); padding: 14px; margin-bottom: 10px; }
  .search input { box-shadow: var(--shadow); }
  .sheet {
    top: 236px; bottom: 16px; left: 16px; right: auto; width: calc(var(--side) - 32px);
    height: auto; max-height: none;
    border: 1px solid var(--line-strong);
    transform: none !important; box-shadow: var(--shadow);
  }
  .handle { display: none; }
  .view { padding-top: 14px; }
  .zoom-ctl { bottom: 24px !important; right: 24px; }
}

/* ---------- Team layout editor (?edit) ---------- */
body.editing .topbar { display: none; }
body.placing #map { cursor: crosshair; }
.edit-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: var(--black); color: #fff;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.edit-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.edit-title strong { font: 600 11px/1.2 var(--sans); letter-spacing: 1px; text-transform: uppercase; }
.edit-status { font-size: 11px; opacity: .75; }
.edit-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.edit-actions button {
  height: 34px; padding: 0 10px; border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff;
  font: 600 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase;
}
.edit-actions button.primary { background: #fff; color: var(--black); border-color: #fff; }
.edit-actions button:disabled { opacity: .35; cursor: default; }

.eb {
  width: 100%; height: 100%; display: grid; place-items: center;
  border-radius: 50%; background: var(--card); color: var(--black);
  border: 1.5px dashed var(--black);
  font: 600 9px/1 var(--sans); cursor: grab;
  box-shadow: 0 1px 3px rgba(25,16,8,.25);
}
.eb.used { background: var(--black); color: #fff; border-style: solid; border-color: #fff; }
.eb.sel { outline: 3px solid #d9480f; outline-offset: 1px; }
.z-far .eb { transform: scale(.55); }
.z-far .eb b { display: none; }
.el-label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  font: 600 12px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;
  background: rgba(255,255,255,.9); border: 1px dashed var(--black); padding: 5px 7px; cursor: grab;
}
.el-label.sel { outline: 3px solid #d9480f; }
.amen.selected { outline: 3px solid #d9480f; }

.edit-gate {
  position: fixed; inset: 0; z-index: 2000; background: rgba(25,16,8,.45);
  display: grid; place-items: center; padding: 16px;
}
.edit-gate-card { width: min(420px, 100%); background: var(--card); padding: 22px; border: 1px solid var(--line-strong); display: grid; gap: 10px; }
.edit-gate-card h2, .edit-panel h2 { font: 400 22px/1.2 var(--serif); color: var(--ink); margin: 0 0 4px; }
.edit-gate-card input, .edit-field input, .edit-field select {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 0;
  background: var(--card); font: 16px var(--sans); color: var(--ink);
}
.edit-field { display: grid; gap: 4px; margin: 10px 0; }
.edit-field span { font: 600 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.edit-err { color: #b3261e; min-height: 1em; margin: 4px 0; font-size: 13px; }
.edit-help { padding-left: 18px; margin: 8px 0; }
.edit-help li { margin: 6px 0; }
.edit-brands { margin: 4px 0 8px; padding-left: 18px; }
.small { font-size: 12px; }
.btn.danger { background: var(--card); color: #b3261e; border-color: #b3261e; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.version-row .booth-tag { cursor: pointer; }
@media (min-width: 900px) {
  body.editing .sheet { top: 76px; }
}

.edit-brands { list-style: none; padding: 0; margin: 4px 0 10px; }
.edit-brands li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #e3e1db; font-family: var(--serif); color: var(--ink); }
.icon-x { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--card); font-size: 18px; line-height: 1; color: var(--text); flex: none; }
.edit-picker input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--card); font: 16px var(--sans); }
.picker { list-style: none; padding: 0; margin: 0 0 8px; border: 1px solid var(--line); border-top: 0; background: var(--card); }
.picker:empty { display: none; }
.picker li > button { width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.picker li > button:disabled { opacity: .5; }
.picker small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.picker li.muted { padding: 10px 12px; }
.edit-rename { margin: 14px 0 4px; }
.edit-rename summary { cursor: pointer; font: 600 10px/1 var(--sans); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
