/* Кооп Карта — mobile-first styles */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../assets/fonts/nunito-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("../assets/fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --cream: #fff7ec;
  --ink: #35323e;
  --ink-soft: #6d6878;
  --coral: #ff6b6b;
  --sunny: #ffc94d;
  --teal: #0fb5a6;
  --lilac: #9b8ce8;
  --white: #ffffff;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(53, 50, 62, 0.18);
  --sheet-z: 20;
  --detail-z: 30;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  overscroll-behavior: none;
}

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

/* ---- Brand chip ---- */
.brand {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  box-shadow: var(--shadow);
  border: 2px solid var(--sunny);
}
.brand strong {
  display: block;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
}
.brand span {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---- Markers ---- */
.marker {
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  background: var(--coral);
  border-radius: 50% 50% 50% 6px;
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(53, 50, 62, 0.3);
  border: 3px solid var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.marker span {
  transform: rotate(45deg);
  font-size: 20px;
  line-height: 1;
}
.marker--sunny { background: var(--sunny); }
.marker--teal  { background: var(--teal); }
.marker--lilac { background: var(--lilac); }
.marker--active {
  transform: rotate(-45deg) scale(1.25);
  z-index: 5;
}
.marker--approx {
  opacity: 0.8;
  border-style: dashed;
}
.marker:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ---- User pin + location bar ---- */
.user-pin {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(53, 50, 62, 0.4));
  cursor: grab;
}
.locbar {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--cream);
}
.locbar__row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.locbar__row input[type="search"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 2px solid var(--sunny);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}
.locbar__row input[type="search"]:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 1px;
}
.locbar__row button[type="submit"] {
  border: 0;
  background: var(--sunny);
  border-radius: 12px;
  font-size: 16px;
  padding: 0 14px;
  cursor: pointer;
  min-height: 40px;
}
.locbar__pin,
.locbar__clear {
  flex: 1;
  border: 2px solid var(--teal);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  min-height: 40px;
}
.locbar__pin--armed {
  background: var(--teal);
  color: var(--white);
}
.locbar__clear { border-color: var(--coral); color: var(--coral); }
.filter__hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* ---- Filters: bottom sheet on mobile ---- */
.filters {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--sheet-z);
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  padding-bottom: env(safe-area-inset-bottom);
}
.filters__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}
.filters__icon { font-size: 18px; }
.filters__count {
  margin-left: auto;
  background: var(--sunny);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 800;
}
.filters__chevron { transition: transform 0.2s ease; }
.filters--open .filters__chevron { transform: rotate(180deg); }

.filters__body {
  display: none;
  padding: 0 18px 18px;
  max-height: 55vh;
  overflow-y: auto;
}
.filters--open .filters__body { display: block; }

.filter {
  margin-bottom: 16px;
}
.filter__label {
  display: block;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 8px;
}

/* multi-select chips */
.filter__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 2px solid var(--chip-color, var(--lilac));
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}
.chip[aria-pressed="true"] {
  background: var(--chip-color, var(--lilac));
  color: var(--white);
}

/* range */
.filter__range {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter__range input[type="range"] {
  flex: 1;
  accent-color: var(--teal);
  min-height: 32px;
}
.filter__range output {
  min-width: 64px;
  text-align: center;
  font-weight: 800;
  background: var(--cream);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 14px;
}
.filter__range-clear {
  border: 0;
  background: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 6px;
}

/* toggle */
.filter--toggle label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}
.filter--toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--coral);
}

.filters__clear {
  width: 100%;
  border: 2px dashed var(--coral);
  background: none;
  color: var(--coral);
  font: inherit;
  font-weight: 800;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

/* ---- Detail card ---- */
.detail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--detail-z);
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 70vh;
  overflow-y: auto;
}
.detail__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--cream);
  font-size: 15px;
  cursor: pointer;
  color: var(--ink);
}
.detail h2 {
  margin: 0 32px 4px 0;
  font-size: 20px;
  font-weight: 800;
}
.detail__sample {
  display: inline-block;
  background: var(--sunny);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.detail__address {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 12px;
}
.detail__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.fact {
  background: var(--cream);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}
.fact--yes { background: #e2f7f0; color: #0b7c6f; }
.fact--type-cooperative { background: #ffe3e3; color: #b23b3b; }
.fact--type-private { background: #ece7fb; color: #5f4bb6; }
.fact--type-public { background: #dff5f2; color: #0b7c6f; }
.detail__travel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.fact--link {
  text-decoration: none;
  background: var(--lilac);
  color: var(--white);
}
.detail__transit {
  margin-bottom: 12px;
}
.detail__stop {
  font-size: 13px;
  margin: 6px 0;
  line-height: 1.7;
}
.detail__stop em {
  color: var(--ink-soft);
  font-style: normal;
  font-size: 12px;
}
.detail__stop--direct {
  background: #fff3d6;
  border-radius: 10px;
  padding: 6px 8px;
  font-weight: 700;
}
.line {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  padding: 1px 7px;
  margin: 0 3px 2px 0;
  background: var(--cream);
  border: 1.5px solid var(--teal);
}
.line--tram { border-color: var(--coral); }
.line--trolley { border-color: var(--lilac); }
.line--metro { background: var(--sunny); border-color: var(--sunny); }
.detail__note {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--cream);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 10px;
}
.detail__desc {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.detail__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail__contacts a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal);
  color: var(--white);
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 40px;
}
.detail__contacts a.detail__contact--alt { background: var(--lilac); }
.detail__photo {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* ---- Empty state ---- */
.empty {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  text-align: center;
  font-weight: 700;
}
.empty span { font-size: 34px; }
.empty p { margin: 8px 0 0; }

/* ---- Desktop / tablet ---- */
@media (min-width: 768px) {
  .filters {
    left: 16px;
    right: auto;
    top: 76px;
    bottom: auto;
    width: 300px;
    border-radius: var(--radius);
  }
  .filters__toggle { cursor: default; }
  .filters__chevron { display: none; }
  .filters__body {
    display: block;
    max-height: calc(100vh - 200px);
  }
  .detail {
    left: auto;
    right: 16px;
    top: 76px;
    bottom: auto;
    width: 360px;
    border-radius: var(--radius);
    max-height: calc(100vh - 120px);
  }
  .brand { top: 16px; left: 16px; }
}
