/* CAMRA Pubs on the site: pub preview cards and pub maps, styled after camra.org.uk's own pub listings.
   Themes can change these: */
:root {
  --camra-pubs-font: arboria, "Helvetica Neue", Helvetica, Arial, sans-serif; /* Arboria, as camra.org.uk */
  --camra-pubs-ink: #1f1f1f;        /* text, numbers and pins */
  --camra-pubs-pin: var(--camra-pubs-ink);
  --camra-pubs-hot: #eb5a25;        /* CAMRA orange: what you're pointing at */
  --camra-pubs-hot-text: #b5400f;   /* the orange, dark enough for small text */
  --camra-pubs-closed: #a7a7ad;     /* closed pubs */
  --camra-pubs-alert: #a30900;      /* "Closed" */
  --camra-pubs-panel: #f3f3f3;      /* camra.org.uk's grey panels */
  --camra-pubs-line: #c5c4c5;       /* camra.org.uk's card border */
  --camra-pubs-lift: .08em;         /* Arboria Bold digits sit this far below centre in a line-height 1 box (measured) */
}

/* ---- Card ------------------------------------------------------------------------------------------------ */

.camra-pub-card {
  position: absolute;
  z-index: 100000;
  width: min(352px, calc(100vw - 16px));
  box-sizing: border-box;
  background: #fff;
  color: var(--camra-pubs-ink);
  border: 1px solid var(--camra-pubs-line);
  border-radius: 0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
  font-family: var(--camra-pubs-font);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transform-origin: var(--cpc-arrow, 50%) 0;
  transition: opacity .16s ease, transform .18s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;
  outline: none;
}
.camra-pub-card.is-above { transform: translateY(-6px); transform-origin: var(--cpc-arrow, 50%) 100%; }
.camra-pub-card.is-open { opacity: 1; transform: none; pointer-events: auto; }
.camra-pub-card.no-anim { transition: none; }
.camra-pub-card[hidden] { display: none; }
.camra-pub-card *, .camra-pub-card *::before, .camra-pub-card *::after { box-sizing: border-box; }

/* The little pointer to the link */
.camra-pub-card::before {
  content: "";
  position: absolute;
  left: var(--cpc-arrow, 50%);
  top: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #fff;
  border: 1px solid var(--camra-pubs-line);
  border-width: 1px 0 0 1px;
  transform: rotate(45deg);
  z-index: 1;
}
.camra-pub-card.is-above::before { top: auto; bottom: -7px; border-width: 0 1px 1px 0; }

.camra-pub-card .cpc-media {
  position: relative;
  height: 136px;
  overflow: hidden;
  background: #ecebe7;
}
.camra-pub-card .cpc-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.camra-pub-card .cpc-tiles { position: absolute; left: 50%; top: 4px; }
.camra-pub-card .cpc-tiles img {
  position: absolute;
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  user-select: none;
}
.camra-pub-card .cpc-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--camra-pubs-hot);
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(235, 90, 37, .22), 0 1px 4px rgba(0, 0, 0, .3);
}
.camra-pub-card .cpc-pin.is-closed { background: var(--camra-pubs-closed); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.camra-pub-card .cpc-credit {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 1px 5px;
  font: 9.5px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #555;
  background: rgba(255, 255, 255, .8);
}
.camra-pub-card .cpc-credit a { color: inherit; text-decoration: none; }

.camra-pub-card .cpc-icon {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.camra-pub-card .cpc-body { padding: 14px 16px 12px; }
.camra-pub-card .cpc-head { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--camra-pubs-hot); }
.camra-pub-card .cpc-flag {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.camra-pub-card .cpc-flag .cpc-icon { width: 13px; height: 13px; stroke-width: 1.8; }
.camra-pub-card .cpc-flag.is-closed { color: var(--camra-pubs-alert); }
.camra-pub-card .cpc-flag.is-gbg { color: var(--camra-pubs-hot-text); }
.camra-pub-card .cpc-name { font-size: 20px; font-weight: 700; line-height: 1.25; }
.camra-pub-card .cpc-sub { margin-top: 2px; font-size: 14px; line-height: 1.25; }

.camra-pub-card .cpc-beers { display: flex; align-items: flex-start; gap: 7px; font-size: 14px; line-height: 1.35; }
.camra-pub-card .cpc-beers .cpc-icon { margin-top: 1px; }
.camra-pub-card .cpc-beers.is-none { color: #6b6b6b; }
.camra-pub-card .cpc-typical { color: #6b6b6b; }
.camra-pub-card .cpc-desc {
  margin: 9px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.camra-pub-card .cpc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; }
.camra-pub-card .cpc-tag {
  margin: 0;
  padding: calc(2px - var(--camra-pubs-lift)) 9px calc(2px + var(--camra-pubs-lift));
  border-radius: 999px;
  background: var(--camra-pubs-panel);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.camra-pub-card .cpc-tag[title] { cursor: help; }
.camra-pub-card .cpc-tag.is-camra { background: #fdeee7; color: var(--camra-pubs-hot-text); }

.camra-pub-card .cpc-infos { margin-top: 10px; }
.camra-pub-card .cpc-infos:empty { display: none; }
.camra-pub-card .cpc-info { display: flex; align-items: flex-start; gap: 7px; margin-top: 4px; font-size: 13px; line-height: 1.35; }
.camra-pub-card .cpc-info .cpc-icon { margin-top: 1px; }
.camra-pub-card .cpc-info > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.camra-pub-card .cpc-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid #e5e5e5;
}
.camra-pub-card .cpc-btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: calc(6px - var(--camra-pubs-lift)) 15px calc(6px + var(--camra-pubs-lift));
  border: 1px solid var(--camra-pubs-ink);
  border-radius: 999px;
  background: #fff;
  color: var(--camra-pubs-ink) !important;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.camra-pub-card .cpc-btn:hover, .camra-pub-card .cpc-btn:focus-visible { background: var(--camra-pubs-panel); }
.camra-pub-card .cpc-btn.is-primary { background: #000; border-color: #000; color: #fff !important; }
.camra-pub-card .cpc-btn.is-primary:hover, .camra-pub-card .cpc-btn.is-primary:focus-visible { background: var(--camra-pubs-hot); border-color: var(--camra-pubs-hot); }
.camra-pub-card .cpc-out { margin-left: 5px; font-weight: 400; }
.camra-pub-card .cpc-btn:focus-visible { outline: 2px solid var(--camra-pubs-hot); outline-offset: 2px; }

/* ---- Numbers in the text ------------------------------------------------------------------------------- */

.camra-pubs-link { white-space: nowrap; }
.camra-pubs-link > a { white-space: normal; }
.camra-pubs-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.6em;          /* a circle, up to two digits */
  height: 1.6em;
  padding: 0 .2em calc(var(--camra-pubs-lift) * 2);
  margin-right: .3em;
  border-radius: 999px;
  background: var(--camra-pubs-pin);
  color: #fff;
  font-family: var(--camra-pubs-font); /* not the theme's, so the lift fits it */
  font-size: .7em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: .15em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background .15s, transform .15s;
}
.camra-pubs-num.is-big { font-size: .55em; vertical-align: .3em; }
.camra-pubs-num.is-closed { background: var(--camra-pubs-closed); }
.camra-pubs-num:hover, .camra-pubs-num.is-hot, .camra-pubs-num:focus-visible { background: var(--camra-pubs-hot); transform: scale(1.12); }
.camra-pubs-num:focus-visible { outline: 2px solid var(--camra-pubs-hot); outline-offset: 2px; }

a.camra-pubs-hot { background: rgba(235, 90, 37, .1); box-shadow: 0 0 0 2px rgba(235, 90, 37, .1); border-radius: 2px; }
a.camra-pubs-flash { animation: camra-pubs-flash 1.8s ease-out; border-radius: 2px; }
@keyframes camra-pubs-flash {
  0%, 30% { background: rgba(235, 90, 37, .28); box-shadow: 0 0 0 4px rgba(235, 90, 37, .28); }
  100% { background: transparent; box-shadow: 0 0 0 4px transparent; }
}

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

.camra-pubs-map {
  position: relative;
  margin: 1.5em 0;
  overflow: hidden;
  border: 1px solid var(--camra-pubs-line);
  isolation: isolate;
}
.camra-pubs-map__canvas { height: clamp(280px, 55vh, 540px); background: #ecebe7; font: inherit; }
.camra-pubs-map .leaflet-container { font: 13px/1.4 var(--camra-pubs-font); }
.camra-pubs-map img { max-width: none !important; box-shadow: none !important; }

.camra-pubs-pin { background: none; border: 0; }
.camra-pubs-pin span {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;    /* 28px including the border, so it sits on its spot */
  width: 28px;
  height: 28px;
  padding-bottom: calc(var(--camra-pubs-lift) * 2);
  border-radius: 50%;
  background: var(--camra-pubs-pin);
  color: #fff;
  font: 700 13px/1 var(--camra-pubs-font);
  font-variant-numeric: tabular-nums;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transition: transform .15s, background .15s;
  cursor: pointer;
}
.camra-pubs-pin.is-closed span { background: var(--camra-pubs-closed); }
.camra-pubs-pin.is-hot span, .camra-pubs-pin:hover span, .camra-pubs-pin:focus-visible span { background: var(--camra-pubs-hot); transform: scale(1.18); }
.camra-pubs-pin:focus-visible { outline: none; }
.camra-pubs-pin.is-pulse span { animation: camra-pubs-pulse 1s ease-out 2; }
@keyframes camra-pubs-pulse {
  0% { box-shadow: 0 0 0 0 rgba(235, 90, 37, .55), 0 1px 4px rgba(0, 0, 0, .35); }
  100% { box-shadow: 0 0 0 16px rgba(235, 90, 37, 0), 0 1px 4px rgba(0, 0, 0, .35); }
}
/* A pin hiding others on the same spot gets an extra ring, until pointing at (or tapping) it fans them out */
.camra-pubs-pin.is-stacked span {
  box-shadow: 0 0 0 2px var(--camra-pubs-ink), 0 0 0 4px #fff, 0 1px 6px 2px rgba(0, 0, 0, .3);
}
/* Where a fanned-out pin's pub really is */
.camra-pubs-map path.camra-pubs-leader { fill: none; stroke: var(--camra-pubs-ink); stroke-width: 1.5; stroke-opacity: .55; }
.camra-pubs-map path.camra-pubs-dot { fill: var(--camra-pubs-ink); fill-opacity: 1; stroke: #fff; stroke-width: 1.5; stroke-opacity: 1; }
.camra-pubs-map path.camra-pubs-leader.is-hot { stroke: var(--camra-pubs-hot); stroke-opacity: 1; stroke-width: 2; }
.camra-pubs-map path.camra-pubs-dot.is-hot { fill: var(--camra-pubs-hot); }
.camra-pubs-tip { font-weight: 700; border-radius: 6px; padding: 3px 8px; }

.camra-pubs-edges { position: absolute; inset: 0; pointer-events: none; z-index: 800; }
.camra-pubs-edge {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 5px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #1d1d1f;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .25);
  font: 700 12px/1.2 var(--camra-pubs-font);
  cursor: pointer;
  white-space: nowrap;
}
.camra-pubs-edge:hover, .camra-pubs-edge.is-hot { background: var(--camra-pubs-hot); color: #fff; }
.camra-pubs-edge__label { position: relative; top: calc(-1 * var(--camra-pubs-lift)); }
.camra-pubs-edge__arrow {
  display: block;
  flex: none;
  width: 10px !important;
  height: 10px !important;
  margin: 0 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  border: 0 !important;
}

/* ---- Border colours the theme can't override ------------------------------------------------------------ *
 * Some themes force every border's colour (e.g. ".category-pubs * { border-color: … !important }"), which turns
 * the pins' white rings, Leaflet's controls and the edge arrows (drawn with borders) the theme's colour. Only
 * !important can win against that, so each border here says its colour that way. */

.camra-pubs-map.camra-pubs-map { border-color: var(--camra-pubs-line) !important; }
.camra-pubs-map .camra-pubs-pin span { border-color: #fff !important; }
.camra-pubs-map .camra-pubs-edge,
.camra-pubs-map .leaflet-control-attribution,
.camra-pubs-map .leaflet-control-attribution a { border-color: transparent !important; }
.camra-pubs-map .leaflet-bar { border-color: rgba(0, 0, 0, .2) !important; }
.camra-pubs-map .leaflet-bar a { border-color: #ccc !important; }
.camra-pubs-map .leaflet-tooltip { border-color: #fff !important; }
.camra-pubs-map .leaflet-zoom-box { border-color: #38f !important; }
.camra-pub-card.camra-pub-card { border-color: var(--camra-pubs-line) !important; }
.camra-pub-card .cpc-head { border-color: var(--camra-pubs-hot) !important; }
.camra-pub-card .cpc-foot { border-color: #e5e5e5 !important; }
.camra-pub-card .cpc-pin { border-color: #fff !important; }
.camra-pub-card .cpc-btn { border-color: var(--camra-pubs-ink) !important; }
.camra-pub-card .cpc-btn.is-primary { border-color: #000 !important; }
.camra-pub-card .cpc-btn.is-primary:hover, .camra-pub-card .cpc-btn.is-primary:focus-visible { border-color: var(--camra-pubs-hot) !important; }
.camra-pub-card .cpc-media, .camra-pub-card .cpc-body, .camra-pub-card .cpc-tag, .camra-pub-card .cpc-tags,
.camra-pub-card .cpc-info, .camra-pub-card .cpc-beers { border-color: transparent !important; }

@media (prefers-reduced-motion: reduce) {
  .camra-pub-card, .camra-pubs-num, .camra-pubs-pin span { transition: none; }
  a.camra-pubs-flash, .camra-pubs-pin.is-pulse span { animation: none; }
}
@media print {
  .camra-pub-card, .camra-pubs-edges { display: none !important; }
}
