:root { --red: #da131c; --r: 15px; }

/* === Burger === */
#mcm-burger {
  position: fixed;
  top: 32px;
  left: 32px;
  z-index: 1001;
  width: 52px;
  height: 52px;
  background: #fff;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-radius .15s;
}
#mcm-burger.mcm-corner-bl { border-bottom-left-radius: 0; }

#mcm-burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
  transform-origin: center;
}
.mcm-burger-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mcm-burger-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mcm-burger-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Quartier bar === */
#mcm-bar {
  position: fixed;
  top: 32px;
  left: 32px;
  height: 52px;
  z-index: 1000;
  background: #fff;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  max-width: 52px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-width .35s cubic-bezier(.4,0,.2,1), opacity .25s, border-radius .15s;
}
#mcm-bar.mcm-open {
  max-width: 900px;
  opacity: 1;
  pointer-events: all;
}
/* Fix 2: remove bottom corners whenever ANY street panel is visible */
#mcm-bar.mcm-corner-bl { border-bottom-left-radius: 0; }
#mcm-bar.mcm-corner-br { border-bottom-right-radius: 0; }

.mcm-q-wrap { display: flex; flex-direction: column; }

.mcm-q-item {
  height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--red);
  white-space: nowrap;
  cursor: pointer;
  border-right: none;
  user-select: none;
  transition: color .15s;
}
.mcm-q-wrap:first-child .mcm-q-item { padding-left: 64px; }
.mcm-q-wrap:last-child .mcm-q-item  { border-right: none; }
.mcm-q-item:hover   { color: #a30010; }
.mcm-q-item.mcm-active { color: #a30010; }

/* External link items (Parkhaus, WC) */
.mcm-q-ext-item {
  color: var(--red);
  border-left: none;
}
.mcm-q-ext-item:hover { color: #a30010; }

/* === Street panel === */
#mcm-s-panel {
  position: fixed;
  z-index: 999;
  background: #fff;
  border-radius: 0 0 var(--r) var(--r);
  min-width: 160px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height .28s cubic-bezier(.4,0,.2,1), opacity .22s, border-radius .15s;
}
#mcm-s-panel.mcm-visible { max-height: 500px; opacity: 1; pointer-events: all; }
#mcm-s-panel.mcm-has-objects { border-bottom-right-radius: 0; }

.mcm-s-item {
  padding: 11px 20px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: #222;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.06);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  user-select: none;
  transition: color .12s;
}
.mcm-s-item:last-child { border-bottom: none; }
.mcm-s-item::after {
  content: '›';
  font-size: 18px;
  line-height: 1;
  color: rgba(218,19,28,.3);
  transition: color .12s, transform .15s;
}
.mcm-s-item:hover  { color: var(--red); }
.mcm-s-item:hover::after { color: var(--red); transform: translateX(3px); }
.mcm-s-item.mcm-active { color: var(--red); }
.mcm-s-item.mcm-active::after { color: var(--red); transform: translateX(3px); }

/* === Object panel — Fix 1: slides left→right via width animation === */
#mcm-o-panel {
  position: fixed;
  z-index: 998;
  background: #fff;
  border-radius: 0 var(--r) var(--r) 0;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-width .28s cubic-bezier(.4,0,.2,1), opacity .22s, border-radius .15s;
}
#mcm-o-panel.mcm-visible { max-width: 400px; opacity: 1; pointer-events: all; }
#mcm-o-panel.mcm-last    { border-bottom-right-radius: 0; }

.mcm-o-item {
  padding: 10px 20px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.05);
  white-space: nowrap;
  user-select: none;
  transition: color .12s;
}
.mcm-o-item:last-child { border-bottom: none; }
.mcm-o-item:hover      { color: var(--red); }
.mcm-o-item.mcm-visited { color: var(--red); font-weight: 400; }

/* ================================================================
   MOBILE & TABLET  ≤ 1024px
   ================================================================ */
@media (max-width: 1024px) {

  /* Fix 3: burger sits on top of bar with transparent bg so quartiers show */
  #mcm-burger {
    top: 32px;
    left: 32px;
    width: 52px;
    height: 52px;
    z-index: 1002;
    /* transparent so first quartier text is visible through/below */
    background: transparent;
    box-shadow: none;
    border-radius: var(--r);
    transition: background .2s, border-radius .15s;
  }
  /* Show white background only when bar is closed (burger standalone) */
  #mcm-burger:not(.mcm-burger-open) {
    background: #fff;
  }
  #mcm-burger.mcm-corner-bl { border-bottom-left-radius: var(--r); }

  #mcm-bar {
    top: 32px;
    left: 32px;
    height: auto;
    max-height: 0;
    max-width: 220px;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: var(--r);
    transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .25s;
  }
  #mcm-bar.mcm-open {
    /* Push content below burger (52px) so cross icon does not overlap text */
    padding-top: 52px;
    max-height: 75vh;
    opacity: 1;
    pointer-events: all;
  }
  #mcm-bar.mcm-corner-bl { border-bottom-left-radius: var(--r); }
  #mcm-bar.mcm-corner-br { border-bottom-right-radius: var(--r); }

  .mcm-q-wrap {
    flex-direction: column;
    border-bottom: 1px solid rgba(0,0,0,.06);
  }
  .mcm-q-wrap:last-child { border-bottom: none; }

  .mcm-q-item {
    height: auto;
    padding: 13px 16px;
    border-right: none;
    font-size: 15px;
    font-weight: 300;
    justify-content: space-between;
    display: flex;
    align-items: center;
  }
  /* Reset desktop first-child override */
  .mcm-q-wrap:first-child .mcm-q-item { padding-left: 16px; }

  .mcm-q-item::after {
    content: '▾';
    font-size: 13px;
    color: var(--red);
    transition: transform .2s;
    line-height: 1;
  }
  .mcm-q-wrap.mcm-mob-open > .mcm-q-item::after { transform: rotate(180deg); }
  /* No arrow for external link items */
  .mcm-q-external .mcm-q-item::after { content: none; }

  .mcm-q-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s cubic-bezier(.4,0,.2,1);
  }
  .mcm-q-wrap.mcm-mob-open > .mcm-q-sub { max-height: 400px; }

  .mcm-s-item {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 300;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .mcm-s-item::after { content: none; }
  .mcm-s-item:hover { color: var(--red); }

  .mcm-s-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s cubic-bezier(.4,0,.2,1);
  }
  .mcm-s-wrap.mcm-mob-open > .mcm-s-sub { max-height: 300px; }

  .mcm-o-item {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 300;
    border-bottom: none;
    white-space: normal;
    width: auto;
  }
  .mcm-o-item::before { display: none !important; }
  .mcm-o-item.mcm-visited { font-weight: 400; }
  .mcm-o-empty { padding: 8px 16px; font-size: 12px; color: #aaa; }


/* Mobile street row variants */
.mcm-s-direct { cursor: pointer; }

/* Long-press hint: subtle underline on streets with objects */
.mcm-s-item .mcm-s-label {
  -webkit-user-select: none;
  user-select: none;
}

.mcm-s-label { flex: 1; }

.mcm-s-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mcm-s-arrow {
  font-size: 12px;
  color: var(--red);
  transition: transform .2s;
  line-height: 1;
}
.mcm-s-wrap.mcm-mob-open > .mcm-s-item .mcm-s-arrow { transform: rotate(180deg); }
  #mcm-s-panel, #mcm-o-panel { display: none !important; }
}
