/* Distribution map. Internal page. A full-screen map with one glass panel
   over it. Colour and type come from css/tokens.css; the lockup comes from
   css/style.css. */

html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); }

.map { position: fixed; inset: 0; }

.cap { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.dim { color: var(--muted); }

.panel {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  width: min(360px, calc(100vw - 32px));
  padding: 16px 18px;
  background: var(--glass-heavy);
  -webkit-backdrop-filter: var(--blur-heavy); backdrop-filter: var(--blur-heavy);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-md);
}
.panel__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel .lockup { font-size: 1.05rem; }
.panel__h { font-size: var(--t-lg); font-weight: 800; margin: 12px 0 2px; }
.panel__sum { color: var(--muted); font-size: var(--t-sm); margin: 0 0 14px; }
.panel__note { color: var(--muted); font-size: var(--t-xs); margin: 12px 0 0; }

.legend__list {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  font-size: var(--t-xs); font-variant-numeric: tabular-nums; color: var(--ink);
}
/* Each tier is a column: dot on a shared baseline, number centred under it. */
.legend__list li {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 6px; min-height: 36px; white-space: nowrap;
}
.legend__dot { display: block; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 0 1px var(--line); }

/* Small screens: the panel shrinks to a strip so the map stays usable. */
@media (max-width: 36rem) {
  .panel { padding: 12px 14px; width: calc(100vw - 32px); }
  .panel__note, .panel__sum { display: none; }
  .panel__h { font-size: var(--t-base); margin-top: 8px; }
}

.nomap {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: min(420px, calc(100vw - 32px)); margin: 0;
  padding: 16px 18px; background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-md);
  font-size: var(--t-sm);
}

/* Popup */
.mapboxgl-popup-content { padding: 16px 18px; border-radius: var(--r-sm); box-shadow: var(--sh-md); font-family: var(--font); }
.pop__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pop__h { font-size: var(--t-base); font-weight: 800; line-height: var(--lh-snug); margin: 0; color: var(--ink); }
.pop__info {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font: italic 700 0.75rem/1 var(--font-logo); cursor: pointer;
}
.pop__info:hover { color: #fff; background: var(--rust); border-color: var(--rust); }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; line-height: 1.35; margin: 0; font-size: var(--t-sm); }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Metro stats. Always open on larger screens; a dropdown on phones. */
.metros { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.metros__h { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.metros__h::-webkit-details-marker { display: none; }
.metros__h::after { content: "▾"; color: var(--muted); font-size: 0.8rem; transition: transform 0.15s; }
.metros[open] .metros__h::after { transform: rotate(180deg); }
.metros__t { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.metros__t th { color: var(--muted); font-weight: 500; text-align: right; padding: 0 0 4px; }
.metros__t td { text-align: right; padding: 5px 0; border-top: 1px solid var(--line); color: var(--ink); }
.metros__t th:first-child, .metros__t td:first-child { text-align: left; }
.metros__t td:first-child { font-weight: 600; }
.metros__t th + th, .metros__t td + td { padding-left: 10px; }
.metros__t tbody tr { cursor: pointer; }
.metros__t tbody tr:hover td { color: var(--rust); }
@media (min-width: 36.01rem) {
  .metros__h { cursor: default; pointer-events: none; }
  .metros__h::after { display: none; }
}
@media (max-width: 36rem) {
  .metros { margin-top: 10px; padding-top: 10px; }
}

/* Keg eligibility on the club card */
.pop__min { color: var(--muted); font-weight: 400; }
.pop__have--ok { color: #1E7A3C; }
.pop__have--no { color: #B42318; }
.pop__tags { flex: none; display: flex; align-items: center; gap: 6px; }
.pop .flag { border: 0; font-family: var(--font); cursor: pointer; white-space: nowrap; }
.pop .flag:hover { filter: brightness(0.95); text-decoration: underline; }
.flag { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 700; }
.flag--ok   { color: #155E2F; background: #D7F0DF; }
.flag--warn { color: #7A4B00; background: #FBE8C4; }
.flag--no   { color: #8A1C1C; background: #F8D7D7; }

/* Calculations pop-up */
.calc {
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 0; border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font-family: var(--font); color: var(--ink); background: #fff;
}
.calc::backdrop { background: rgba(28, 21, 18, 0.35); }
.calc__head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line);
}
.calc__head h2 { margin: 0; font-size: var(--t-lg); font-weight: 800; }
.calc__x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--bg); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.calc__x:hover { background: var(--rust-soft); }
#calc-body { padding: 4px 22px 22px; font-size: var(--t-sm); line-height: 1.5; }
#calc-body h3 { margin: 20px 0 8px; font-size: var(--t-base); font-weight: 800; }
.calc__t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.calc__t th { text-align: left; color: var(--muted); font-weight: 500; padding: 0 12px 6px 0; }
.calc__t td { padding: 7px 12px 7px 0; border-top: 1px solid var(--line); }
.calc__eq {
  display: grid; grid-template-columns: max-content auto 1fr; gap: 8px 10px; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.calc__lhs { font-weight: 600; }
.calc__is { color: var(--muted); }
@media (max-width: 36rem) {
  .calc__eq { font-size: var(--t-xs); gap: 6px 8px; }
}
.calc__note { margin: 10px 0 0; color: var(--muted); font-size: var(--t-xs); }
