/* Pyshka map. Everything lives under .pmap (theme rules: white body text, global * and h1). */

.pmap {
  --pmap-color-brand: #e2211c;
  --pmap-color-text: #661b00;
  --pmap-color-land: #ffdfbc;
  --pmap-color-land-stroke: #ffc079;
  --pmap-color-regions: rgba(102, 27, 0, 0.18);
  --pmap-map-land: #fff0d6;
  --pmap-map-stroke: #f5a04a;
  --pmap-map-has: #ffd36e;
  --pmap-map-hover: #ffbe45;
  --pmap-map-selected: #ffa62b;
  --pmap-chip-border: #ffc079;
  --pmap-color-bg: #fff;
  --pmap-color-pin: #e2211c;
  --pmap-color-pin-text: #fff;
  --pmap-color-pin-active: #661b00;
  --pmap-color-map-bg: #fff8ee;
  --pmap-color-muted: rgba(102, 27, 0, 0.62);
  --pmap-color-line: #ffdfbc;
  --pmap-font-display: "Tavolga", sans-serif;
  --pmap-font-body: "Rubik", sans-serif;
  --pmap-radius: 16px;
  --pmap-gap: 16px;
  --pmap-pin-r: 9px;
  --pmap-panel-w: 380px;
  --pmap-z-modal: 10000;
  --pmap-bleed: 20px;
  --pmap-anim: 0.3s;
  --pmap-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* The decor sticks out of the content column. The module widens itself by the free space beside the
     column (never past the viewport) and clips horizontally, so the page gets no horizontal scroll. */
  --pmap-out: max(0px, calc((100vw - 100% - 16px) / 2)); /* up to the viewport edges */

  display: block;
  position: relative;
  z-index: 0; /* own stacking layer: map controls and decor never cover the theme header or burger menu */
  margin: 0 calc(var(--pmap-out) * -1);
  padding: 0 var(--pmap-out) 72px; /* room for the stickers under the map */
  overflow-x: clip;
  color: var(--pmap-color-text);
  background: var(--pmap-color-bg);
  font-family: var(--pmap-font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  -webkit-text-size-adjust: 100%;
}

/* body-level wrapper of the popup (see main.js): no box, no stacking context of its own */
.pmap.pmap--portal {
  position: static;
  z-index: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: none;
}

.pmap,
.pmap *,
.pmap *::before,
.pmap *::after {
  box-sizing: border-box;
}

.pmap *,
.pmap input,
.pmap button {
  font-family: var(--pmap-font-body);
}

.pmap [hidden] {
  display: none !important;
}

.pmap p,
.pmap h1,
.pmap h2,
.pmap ul,
.pmap ol {
  margin: 0;
  padding: 0;
}

.pmap img {
  display: block;
  max-width: 100%;
  height: auto;
}

.pmap a {
  color: var(--pmap-color-brand);
}

.pmap button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
}

.pmap button:disabled {
  cursor: default;
}

.pmap :focus-visible {
  outline: 3px solid var(--pmap-color-pin-active);
  outline-offset: 2px;
}

/* ---- head ---- */
.pmap .pmap__head {
  position: relative;
  z-index: 10; /* above zoom (5), hint (6), region tip (7), chooser (8): the search list must cover them */
  margin: 0 0 20px;
}

/* on desktop the head tucks 20px over the map and the panel: only text and search take the pointer */
.pmap .pmap__head {
  pointer-events: none;
}

.pmap .pmap__title,
.pmap .pmap__search,
.pmap .pmap__intro p:not(:last-child),
.pmap .pmap__intro a {
  pointer-events: auto;
}

.pmap .pmap__title {
  margin: 0 0 12px;
  padding: 0;
  color: var(--pmap-color-brand);
  /* same as the theme's h1 (donut style.css): Tavolga, bold, uppercase, 44px up to 1076px, 70px above */
  font-family: "Tavolga", sans-serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: normal;
  text-transform: uppercase;
}

@media (min-width: 1077px) {
  .pmap .pmap__title {
    font-size: 70px;
  }
}

.pmap .pmap__intro {
  max-width: 720px;
  color: var(--pmap-color-text);
  font-size: 15px;
  line-height: 22px;
}

.pmap .pmap__intro p + p {
  margin-top: 0;
}

.pmap .pmap__intro strong {
  font-weight: 700;
}

.pmap .pmap__intro a {
  color: var(--pmap-color-brand);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- search ---- */
.pmap .pmap__search {
  position: relative;
  z-index: 30;
  max-width: 460px;
  margin: 16px 0 0;
}

.pmap .pmap__search-label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--pmap-color-muted);
}

.pmap .pmap__search-input {
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 2px solid var(--pmap-color-land-stroke);
  border-radius: 999px;
  background: var(--pmap-color-bg);
  color: var(--pmap-color-text);
  font-size: 16px; /* no iOS zoom on focus */
  line-height: 44px;
  box-shadow: none;
}

.pmap .pmap__search-input::placeholder {
  color: var(--pmap-color-muted);
  opacity: 1;
}

.pmap .pmap__search-input:focus {
  border-color: var(--pmap-color-brand);
  outline: none;
}

.pmap .pmap__search-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pmap .pmap__suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 6px 0 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--pmap-color-land-stroke);
  border-radius: 14px;
  background: var(--pmap-color-bg);
  box-shadow: 0 10px 30px rgba(102, 27, 0, 0.18);
  list-style: none;
}

.pmap .pmap__suggest-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
}

.pmap .pmap__suggest-item.is-active,
.pmap .pmap__suggest-item:hover {
  background: var(--pmap-color-land);
}

.pmap .pmap__suggest-name {
  font-weight: 500;
}

.pmap .pmap__suggest-meta {
  flex: none;
  color: var(--pmap-color-muted);
  font-size: 14px;
  text-align: right;
}

.pmap .pmap__suggest-empty {
  padding: 14px 16px;
  color: var(--pmap-color-muted);
}


/* ---- layout ---- */
.pmap .pmap__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pmap-gap);
  align-items: start;
}

.pmap .pmap__mapcol {
  min-width: 0;
}

/* stage = the map block the decor is measured against (the SVG at scale 1) */
.pmap .pmap__stage {
  position: relative;
}

.pmap .pmap__mapwrap {
  position: relative;
  margin: 0 calc(var(--pmap-bleed) * -1);
  overflow: hidden;
}

.pmap .pmap__decor {
  position: absolute;
  top: 0;
  right: calc(var(--pmap-bleed) * -1);
  left: calc(var(--pmap-bleed) * -1);
  z-index: 2;
  aspect-ratio: 1000 / 550;
  pointer-events: none;
}

.pmap .pmap__map {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 550;
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pmap.is-empty .pmap__map {
  opacity: 0.85;
}

.pmap .pmap__mapwrap.is-zoomed .pmap__map {
  cursor: grab;
  /* zoomed in: one finger pans the map (JS), the page does not scroll under it */
  touch-action: none;
}

.pmap .pmap__mapwrap.is-dragging .pmap__map {
  cursor: grabbing;
}

.pmap .pmap__map svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  overflow: hidden;
}

.pmap .pmap-land {
  fill: var(--pmap-map-land);
  stroke: none;
  pointer-events: none;
}

.pmap #pmap-land-shape {
  vector-effect: non-scaling-stroke;
}

.pmap .pmap-coast {
  fill: none;
  stroke: var(--pmap-map-stroke);
  stroke-width: 1.2px;
  stroke-linejoin: round;
  pointer-events: none;
}

.pmap #pmap-regions path {
  fill: var(--pmap-map-land);
  fill-rule: evenodd;
  stroke: var(--pmap-map-stroke);
  stroke-width: 0.9px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  outline: none;
}

.pmap #pmap-regions path.is-has-works {
  fill: var(--pmap-map-has);
  cursor: pointer;
}

.pmap #pmap-regions path.is-hover {
  fill: var(--pmap-map-hover);
}

.pmap #pmap-regions path.is-selected {
  fill: var(--pmap-map-selected);
}

.pmap #pmap-regions path.is-focus {
  stroke: var(--pmap-color-pin-active);
  stroke-width: 2.5px;
}

/* Moscow oblast districts (OSM): invisible and inert until the map is zoomed in (JS adds .is-units at k >= 3) */
.pmap #pmap-units path {
  fill: transparent;
  fill-rule: evenodd;
  stroke: transparent;
  stroke-width: 0.6px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  outline: none;
}

.pmap .pmap__mapwrap.is-units #pmap-units path {
  stroke: var(--pmap-map-stroke);
  pointer-events: all;
}

/* in district mode the oblast path stays plain; the districts carry the work / hover / selected colours */
.pmap .pmap__mapwrap.is-units #pmap-regions path[data-region="RU-MOS"] {
  fill: var(--pmap-map-land);
}

.pmap .pmap__mapwrap.is-units #pmap-units path.is-has-works {
  fill: var(--pmap-map-has);
  cursor: pointer;
}

.pmap .pmap__mapwrap.is-units #pmap-units path.is-hover {
  fill: var(--pmap-map-hover);
}

.pmap .pmap__mapwrap.is-units #pmap-units path.is-selected {
  fill: var(--pmap-map-selected);
}

.pmap .pmap-pin {
  pointer-events: none;
}

.pmap .pmap-chip {
  filter: drop-shadow(0 2px 3px rgba(102, 27, 0, 0.15));
}

.pmap .pmap-chip__box {
  fill: #fff;
  stroke: var(--pmap-chip-border);
  stroke-width: 1px;
}

.pmap .pmap-chip__text {
  fill: var(--pmap-color-text);
  font-family: var(--pmap-font-body);
  font-weight: 500;
}

/* zoom controls never lie on the map: a row under it (default), or at >=1024 without an open city a
   column just outside its right edge (see the desktop block below) */
.pmap .pmap__zoom {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding: 8px 0 10px;
}

.pmap .pmap__zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 2px solid var(--pmap-color-land-stroke);
  border-radius: 999px;
  background: var(--pmap-color-bg);
  color: var(--pmap-color-text);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.pmap .pmap__zoom-btn--reset {
  font-size: 13px;
  white-space: nowrap;
}

.pmap .pmap__zoom-btn:hover:not(:disabled) {
  border-color: var(--pmap-color-brand);
}

.pmap .pmap__zoom-btn:disabled {
  opacity: 0.45;
}


.pmap .pmap__rtip {
  position: absolute;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px 10px;
  border: 1.5px solid var(--pmap-chip-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(102, 27, 0, 0.16);
  white-space: nowrap;
  pointer-events: none;
}

.pmap .pmap__rtip-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.pmap .pmap__rtip-sub {
  color: var(--pmap-color-muted);
  font-size: 12px;
  line-height: 1.3;
}

.pmap .pmap__chooser {
  position: absolute;
  z-index: 8;
  display: flex;
  flex-direction: column;
  min-width: 168px;
  padding: 6px;
  border: 1.5px solid var(--pmap-chip-border);
  border-radius: 14px;
  background: var(--pmap-color-bg);
  box-shadow: 0 6px 18px rgba(102, 27, 0, 0.18);
}

.pmap .pmap__chooser-item {
  min-height: 35px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.pmap .pmap__chooser-item:hover,
.pmap .pmap__chooser-item:focus-visible {
  background: var(--pmap-map-land);
  outline: none;
}

.pmap .pmap__cta {
  margin: 14px 0 0;
  color: var(--pmap-color-brand);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.pmap.is-empty .pmap__cta {
  display: none;
}

/* desktop: the intro already says "choose a city on the map" and the region card shows on hover;
   under the map the line would sit among the stickers (client: no captions under the map) */
@media (min-width: 1024px) {
  .pmap .pmap__cta {
    display: none;
  }
}

/* ---- panel ---- */
.pmap .pmap__panel {
  min-width: 0;
}

.pmap .pmap__panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.pmap .pmap__panel-title {
  scroll-margin-top: 90px;
  color: var(--pmap-color-brand);
  font-family: var(--pmap-font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: none;
  outline: none;
}

.pmap .pmap__panel-close {
  flex: none;
  width: 40px;
  height: 40px;
  margin: -6px 0 0 0; /* no negative right margin: the scrollable panel would clip the hover circle */
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
  text-align: center;
}

.pmap .pmap__panel-close:hover {
  background: var(--pmap-color-land);
}

.pmap .pmap__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

.pmap .pmap-card {
  display: block;
  min-width: 0;
  border-radius: 14px;
  color: var(--pmap-color-text);
}

.pmap .pmap-card__img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  background: var(--pmap-color-land);
  transition: transform 0.2s ease;
}

.pmap .pmap-card:hover .pmap-card__img {
  transform: translateY(-2px);
}

.pmap .pmap-card__name {
  display: block;
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}

.pmap .pmap-card__dish {
  display: -webkit-box;
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--pmap-color-muted);
  font-size: 14px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}

.pmap .pmap__more {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 18px 0 0;
  border: 2px solid var(--pmap-color-brand);
  border-radius: 999px;
  color: var(--pmap-color-brand);
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

.pmap .pmap__more:hover {
  background: var(--pmap-color-brand);
  color: #fff;
}

/* ---- empty + credit ---- */
.pmap .pmap__empty {
  margin: 20px 0 0;
  padding: 28px 20px;
  border-radius: var(--pmap-radius);
  background: var(--pmap-color-map-bg);
  text-align: center;
}

.pmap .pmap__empty-title {
  font-family: var(--pmap-font-display);
  font-size: 26px;
  line-height: 1.15;
  color: var(--pmap-color-brand);
}

.pmap .pmap__empty-text {
  margin-top: 8px;
}

/* the bottom decor row hangs below the map on desktop (up to ~8.5% of the width, 122px at 1440+):
   the empty-state card starts below it so stickers never cover its text */
@media (min-width: 1024px) {
  .pmap.is-empty .pmap__empty {
    margin-top: calc(min(8.6vw, 124px) + 30px);
  }
}

/* ---- buttons ---- */
.pmap .pmap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--pmap-color-brand);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.pmap .pmap-btn:hover {
  background: var(--pmap-color-pin-active);
}

/* ---- modal ---- */
.pmap .pmap-modal {
  position: fixed;
  inset: 0;
  z-index: var(--pmap-z-modal);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.pmap .pmap-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(60, 14, 0, 0.7);
}

.pmap .pmap-modal__dialog {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--pmap-color-bg);
  color: var(--pmap-color-text);
}

.pmap .pmap-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pmap-color-text);
  font-size: 30px;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pmap .pmap-modal__media {
  position: relative;
  background: var(--pmap-color-land);
}

.pmap .pmap-modal__img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.pmap .pmap-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pmap-color-text);
  font-size: 34px;
  line-height: 44px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pmap .pmap-modal__nav--prev {
  left: 10px;
}

.pmap .pmap-modal__nav--next {
  right: 10px;
}

.pmap .pmap-modal__nav:disabled {
  opacity: 0.35;
}

.pmap .pmap-modal__body {
  padding: 20px 20px 32px;
}

.pmap .pmap-modal__counter {
  color: var(--pmap-color-muted);
  font-size: 14px;
}

.pmap .pmap-modal__name {
  margin: 4px 0 0;
  color: var(--pmap-color-brand);
  font-family: var(--pmap-font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
  text-transform: none;
}

.pmap .pmap-modal__city {
  margin: 4px 0 16px;
  color: var(--pmap-color-muted);
  font-weight: 500;
}

.pmap .pmap-modal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.pmap .pmap-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 12px 16px;
  border-radius: 100px;
  background: var(--pmap-color-brand);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}

.pmap .pmap-back:hover {
  background: var(--pmap-color-pin-active);
}

.pmap .pmap-back__icon {
  flex: none;
}

.pmap .pmap-modal__actions .pmap-btn {
  min-height: 0;
  padding: 10px 20px;
  border: 2px solid var(--pmap-color-brand);
  background: none;
  color: var(--pmap-color-brand);
}

.pmap .pmap-modal__actions .pmap-btn:hover {
  background: var(--pmap-color-brand);
  color: #fff;
}

.pmap .pmap-modal__recipe {
  margin: 0 0 44px;
  font-size: 16px;
  line-height: 1.6;
}

.pmap .pmap-modal__recipe p + p,
.pmap .pmap-modal__recipe ul,
.pmap .pmap-modal__recipe ol {
  margin-top: 10px;
}

.pmap .pmap-modal__recipe ul,
.pmap .pmap-modal__recipe ol {
  padding-left: 22px;
}

/* ---- phones ---- */
@media (max-width: 767px) {
  .pmap .pmap__cta {
    font-size: 12px;
  }
}

/* ---- tablet ---- */
@media (min-width: 768px) {
  .pmap {
    --pmap-bleed: 0px;
  }

  .pmap .pmap__cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pmap .pmap-modal {
    align-items: center;
    padding: 24px;
  }

  .pmap .pmap-modal__dialog {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    width: min(1040px, 100%);
    height: auto;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 20px;
  }

  .pmap .pmap-modal__media {
    display: flex;
    align-items: center;
    background: var(--pmap-color-land);
  }

  .pmap .pmap-modal__img {
    height: 100%;
    max-height: calc(100vh - 48px);
    aspect-ratio: auto;
    object-fit: cover;
  }

  .pmap .pmap-modal__body {
    max-height: calc(100vh - 48px);
    padding: 40px 32px 32px;
    overflow-y: auto;
  }
}

/* ---- desktop ---- */
@media (min-width: 1024px) {
  /* title + intro left, search right: the whole map fits the first screen */
  .pmap .pmap__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    column-gap: 40px;
    align-items: end;
    margin-bottom: 8px; /* the map starts below the intro: a zoomed map must not run under the VK link */
  }

  .pmap .pmap__title {
    grid-column: 1;
    margin-bottom: 10px;
  }

  .pmap .pmap__intro {
    grid-column: 1;
    grid-row: 2;
    font-size: 18px;
    line-height: 30px;
  }

  /* stickers under the map stick out below it; the map (and the overhang) grows with the viewport height */
  .pmap {
    padding-bottom: calc(64px + 10vh);
  }

  .pmap .pmap__search {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
    width: 100%;
    margin: 0 0 43px;
  }

  /* map never taller than what is left under the header (about 290px) */
  .pmap .pmap__stage {
    max-width: calc((100vh - 290px) * 1000 / 550);
    min-width: 560px;
    margin-right: auto;
    margin-left: auto;
  }

  /* room for the zoom column right of the map (a centred map leaves a gutter on both sides) */
  .pmap {
    --pmap-zoom-col: 112px;
  }

  .pmap .pmap__layout:not(.is-city) .pmap__stage {
    max-width: min(calc((100vh - 290px) * 1000 / 550), calc(100% - 2 * (var(--pmap-zoom-col) + 16px)));
  }

  .pmap .pmap__layout:not(.is-city) .pmap__zoom {
    position: absolute;
    top: 0;
    left: calc(100% + 16px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
  }

  .pmap .pmap__mapwrap {
    margin: 0;
  }

  /* Two tracks at all times so the panel column can animate from 0 to its width (a 1-track to 2-track
     switch would jump). The gap lives inside the second track. */
  .pmap .pmap__layout {
    grid-template-columns: minmax(0, 1fr) 0px;
    column-gap: 0;
    transition: grid-template-columns var(--pmap-anim) var(--pmap-ease);
  }

  .pmap .pmap__layout.is-city {
    grid-template-columns: minmax(0, 1fr) calc(var(--pmap-panel-w) + var(--pmap-gap));
    align-items: stretch;
  }

  .pmap .pmap__layout.is-city .pmap__panel {
    position: relative;
    animation: pmap-panel-in var(--pmap-anim) var(--pmap-ease) both;
  }

  .pmap .pmap__layout.is-city .pmap__panel-inner {
    position: absolute;
    inset: -6px 0 0 var(--pmap-gap);
    padding: 6px 6px 0 0; /* room for the close button's hover circle, which sits 6px above the title */
    overflow-y: auto;
  }

  @keyframes pmap-panel-in {
    from {
      opacity: 0;
      transform: translateX(24px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .pmap .pmap__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- decor: stickers and doodles (templates/decor.html, layout from design/v2/decor_layout.json) ----
   Percentages are relative to .pmap__decor = the map block at scale 1. Default = mobile layout (--m*),
   >=1024 = desktop (--d*), >=1024 with the city panel open = --p* (items without it fade out). */
.pmap .pdec {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  width: var(--mw);
  transform: translate(-50%, -50%) translate(var(--fx, 0px), var(--fy, 0px)) rotate(var(--mr)) scale(var(--fit, 1));
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.pmap .pdec--nomobile {
  display: none;
}

/* While the map is zoomed it fills its whole block: decor lying over the map fades out (flags per layout
   come from tools/make_decor_assets.py: -m mobile, -d desktop, -p desktop with the city panel). */
.pmap .pdec {
  transition: opacity var(--pmap-anim) ease, visibility var(--pmap-anim);
}

/* decor-fit.js measures stickers at rest; items with no room on this screen are hidden */
.pmap.pmap--fitting .pdec {
  transition: none !important;
}

.pmap .pdec.pdec--cut {
  visibility: hidden;
}

/* a city pin with its name label always wins over decor (decor-fit.js) */
.pmap .pdec.pdec--yield {
  opacity: 0;
  visibility: hidden;
}

/* wide phones and tablets: decor keeps its 390px size; items under the map keep their distance to the
   zoom row and the hint line (both fixed in px). Variables --m?q come from tools/make_decor_assets.py. */
@supports (width: 1cqw) {
  @media (max-width: 1023px) {
    .pmap .pmap__decor {
      container-type: inline-size;
    }

    .pmap .pdec {
      left: var(--mxq, var(--mx));
      top: var(--myq, var(--my));
      width: var(--mwq, var(--mw));
    }
  }
}

@media (max-width: 1023px) {
  .pmap.is-zoomed .pdec--onmap-m {
    opacity: 0;
    visibility: hidden;
  }
}

.pmap .pdec__img,
.pmap .pdec__svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 1024px) {
  .pmap .pdec {
    left: var(--dx);
    top: var(--dy);
    width: var(--dw);
    transform: translate(-50%, -50%) translate(var(--fx, 0px), var(--fy, 0px)) rotate(var(--dr)) scale(var(--fit, 1));
    transition:
      left var(--pmap-anim) var(--pmap-ease),
      top var(--pmap-anim) var(--pmap-ease),
      width var(--pmap-anim) var(--pmap-ease),
      transform var(--pmap-anim) var(--pmap-ease),
      opacity var(--pmap-anim) ease,
      visibility var(--pmap-anim);
  }

  .pmap .pdec--nomobile {
    display: block;
  }

  .pmap .pmap__layout.is-city .pdec {
    left: var(--px, var(--dx));
    top: var(--py, var(--dy));
    width: var(--pw, var(--dw));
    transform: translate(-50%, -50%) translate(var(--fx, 0px), var(--fy, 0px)) rotate(var(--pr, var(--dr))) scale(var(--fit, 1));
  }

  .pmap .pmap__layout.is-city .pdec--nopanel {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) translate(var(--fx, 0px), var(--fy, 0px)) rotate(var(--dr)) scale(calc(var(--fit, 1) * 0.8));
  }

  .pmap.is-zoomed .pmap__layout:not(.is-city) .pdec--onmap-d,
  .pmap.is-zoomed .pmap__layout.is-city .pdec--onmap-p {
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pmap .pdec,
  .pmap .pmap__layout {
    transition: none;
  }

  .pmap .pmap__layout.is-city .pmap__panel {
    animation: none;
  }
}
