/* Фирменный стиль «Альметьевск»
   Цвет города: Pantone 7502 C  #D0B787
   Графит: Pantone 419 C  #212322 (крупные заливки), чёрный #000 (текст, мелкие элементы)
   Серый: Pantone 427 C  #CFD2D3 + тона 75/50/25 %
   Шрифты: TT UVT Origin Bold (заголовки, цифры), Montserrat (текст) */

@font-face {
  font-family: 'TT UVT Origin';
  src: url('fonts/TTUVTOrigin-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold: #D0B787;            /* цвет города */
  --gold-soft: #F3EDE1;       /* 25 % цвета города */
  --gold-mid: #E6D9BF;        /* 50 % цвета города */
  --graphite: #212322;
  --ink: #000000;
  --grey: #CFD2D3;
  --grey-75: #DBDDDE;
  --grey-50: #E7E8E9;
  --grey-25: #F3F4F4;
  --text-2: #4A4D4C;          /* второстепенный текст, контраст 8:1 на белом */
  --bg: #ffffff;
  --radius: 22px;
  --font: 'Montserrat', system-ui, sans-serif;
  --font-head: 'TT UVT Origin', 'Montserrat', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--graphite); outline-offset: 2px; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 40px;
  background: var(--graphite);
  color: var(--gold);
}
.logo {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--gold);
  font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: .01em;
}
.logo-svg { width: 38px; height: 42px; display: block; fill: currentColor; }
.pillnav {
  margin: 0 auto;
  display: flex; gap: 6px;
  border: 2px solid var(--gold); border-radius: 999px;
  padding: 5px 10px;
}
.pillnav a {
  text-decoration: none; color: var(--gold);
  font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 14px; border-radius: 999px;
  transition: background .2s, color .2s;
}
.pillnav a:hover { background: var(--gold); color: var(--ink); }
.btn-round {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--gold); border-radius: 50%;
  background: transparent; color: var(--gold);
}
.btn-round:hover { background: var(--gold); color: var(--ink); }

/* ---------- Первый экран ---------- */
.hero { background: var(--gold); color: var(--ink); }
.hero-inner { padding: 48px 40px 56px; max-width: 1400px; margin: 0 auto; }
.hero-title {
  margin: 0; text-align: center;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(40px, 13vw, 210px); line-height: .95;
  color: var(--ink); letter-spacing: -.01em;
}
.hero-sub {
  margin: 26px 0 0; text-align: center;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(16px, 2.4vw, 32px);
  letter-spacing: .3em;
}
.hero-sub .ghost { color: var(--graphite); opacity: .55; }
.hero-bottom {
  display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center;
  margin-top: 48px;
}
.hero-text { margin: 0; justify-self: end; max-width: 780px; font-size: 20px; line-height: 1.8; font-weight: 500; }
.hero-text .muted { color: var(--graphite); font-weight: 400; opacity: .78; }

.spin-badge {
  position: relative; width: 200px; height: 200px; border-radius: 50%;
  display: grid; place-items: center; text-decoration: none;
  background: var(--graphite); color: var(--gold);
}
.spin-text { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 18s linear infinite; }
.spin-text text { fill: var(--gold); font-family: var(--font); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.spin-arrow { font-size: 40px; font-weight: 300; transition: transform .3s; }
.spin-badge:hover .spin-arrow { transform: translateY(6px); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin-text { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Планировщик ---------- */
.planner {
  display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 16px;
  padding: 24px 24px 24px;
  height: calc(100vh - 70px); min-height: 620px;
  scroll-margin-top: 70px;
}
.panel {
  display: flex; flex-direction: column; min-height: 0;
  border: 1.5px solid var(--grey); border-radius: var(--radius);
  background: #fff; overflow: hidden;
}
.tabs { display: flex; gap: 6px; padding: 14px; border-bottom: 1px solid var(--grey-75); }
.tab {
  flex: 1; padding: 11px 8px; border-radius: 999px;
  border: 1.5px solid var(--graphite); background: #fff; color: var(--ink);
  font-family: var(--font-head); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.tab:hover { background: var(--gold-soft); }
.tab.active { background: var(--graphite); color: var(--gold); border-color: var(--graphite); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; }

.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 0; }
#map { width: 100%; height: 100%; background: var(--grey-25); }
.leaflet-tile-pane { filter: sepia(.28) saturate(.85); }
.map-hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: var(--graphite); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500; pointer-events: none;
}
.map-summary {
  position: absolute; left: 16px; bottom: 16px; z-index: 500;
  display: flex; gap: 22px; align-items: flex-end;
  background: var(--graphite); color: #fff; border-radius: 18px; padding: 14px 20px;
}
.map-summary b { display: block; font-family: var(--font-head); font-size: 28px; font-weight: 700; color: var(--gold); line-height: 1; }
.map-summary span { font-size: 11px; color: var(--grey); }

/* ---------- Заголовки панели ---------- */
.eyebrow {
  display: inline-block; margin: 0 0 10px;
  font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: var(--gold); padding: 5px 12px; border-radius: 999px;
}
.section-title { margin: 0 0 6px; font-family: var(--font-head); font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.section-lead { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--grey); background: #fff; color: var(--ink);
  font-size: 12px; font-weight: 600;
}
.chip:hover { border-color: var(--graphite); }
.chip.active { border-color: var(--graphite); background: var(--graphite); color: var(--gold); }

/* ---------- Карточки маршрутов ---------- */
.route-card {
  position: relative; display: block; width: 100%; text-align: left;
  border: none; border-radius: var(--radius); padding: 20px 20px 18px;
  margin-bottom: 12px; min-height: 170px;
  transition: transform .2s, box-shadow .2s;
}
.route-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(0,0,0,.5); }
.route-card.dark  { background: var(--graphite); color: #fff; }
.route-card.gold  { background: var(--gold); color: var(--ink); }
.route-card.light { background: #fff; color: var(--ink); border: 1.5px solid var(--graphite); }
.route-card .eyebrow { background: var(--gold); color: var(--ink); }
.route-card.gold .eyebrow { background: var(--graphite); color: var(--gold); }
.route-card h3 { margin: 0 0 6px; font-family: var(--font-head); font-size: 23px; font-weight: 700; }
.route-card p { margin: 0; font-size: 13px; line-height: 1.5; opacity: .88; max-width: 90%; }
.route-stats { display: flex; gap: 26px; margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.28); }
.route-card.gold .route-stats { border-top-color: rgba(0,0,0,.25); }
.route-card.light .route-stats { border-top-color: var(--grey); }
.route-stats b { display: block; font-family: var(--font-head); font-size: 34px; font-weight: 700; line-height: 1; }
.route-card.dark .route-stats b { color: var(--gold); }
.route-stats span { font-size: 11px; opacity: .85; }

/* ---------- Таймлайн ---------- */
.back {
  border: none; background: none; padding: 0; margin-bottom: 14px;
  font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.timeline { list-style: none; margin: 18px 0 0; padding: 0; }
.stop { position: relative; display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding-bottom: 6px; }
.stop-time { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--ink); padding-top: 12px; }
.stop-card {
  border: 1.5px solid var(--grey); border-radius: 16px; padding: 12px 14px;
  background: #fff; cursor: pointer; transition: border-color .2s;
}
.stop-card:hover, .stop.active .stop-card { border-color: var(--graphite); }
.stop.active .stop-card { background: var(--gold-soft); }
.stop-head { display: flex; align-items: center; gap: 10px; }
.num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--graphite); color: var(--gold); font-family: var(--font-head); font-size: 12px; font-weight: 700;
}
.stop-name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.stop-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.stop-text { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); display: none; }
.stop.active .stop-text { display: block; }
.walk {
  grid-column: 2; margin: 2px 0 6px 12px; padding: 4px 0 4px 18px;
  border-left: 2px dotted var(--gold);
  font-size: 11.5px; color: var(--text-2);
}
.stop-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 1px solid var(--grey); background: #fff; color: var(--ink); font-size: 13px; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--graphite); background: var(--gold-soft); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.stay-ctl { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-2); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; text-decoration: none;
  font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border: 1.5px solid var(--graphite); background: #fff; color: var(--ink);
}
.btn:hover { background: var(--gold-soft); }
.btn.primary { background: var(--graphite); color: var(--gold); }
.btn.primary:hover { background: #000; }

.row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.row label { font-size: 13px; color: var(--text-2); }
.row input[type=time] {
  font-family: inherit; font-size: 14px; padding: 6px 10px;
  border: 1.5px solid var(--grey); border-radius: 10px;
}
.empty {
  border: 1.5px dashed var(--gold); border-radius: 16px; padding: 22px;
  text-align: center; font-size: 13px; line-height: 1.6; color: var(--text-2); background: var(--gold-soft);
}

/* ---------- Список мест ---------- */
.place {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--grey-50);
}
/* цвет иконки категории задаётся в data.js (--c) — цвета «городов» палитры */
.place-ico {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: var(--c, var(--gold-soft)); font-size: 18px;
}
.place-info { flex: 1; min-width: 0; cursor: pointer; }
.place-name { font-size: 14px; font-weight: 700; }
.place-meta { font-size: 11px; color: var(--text-2); }
.add-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--graphite); background: #fff; color: var(--ink); font-size: 18px; font-weight: 500;
}
.add-btn:hover { background: var(--gold-soft); }
.add-btn.added { background: var(--graphite); color: var(--gold); }

/* ---------- Маркеры и попапы ---------- */
.pin {
  width: 32px; height: 32px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--graphite); border: 2px solid var(--gold);
  display: grid; place-items: center; box-shadow: 0 6px 14px -6px rgba(0,0,0,.5);
}
.pin span { transform: rotate(45deg); color: var(--gold); font: 700 13px var(--font-head); }
.pin.active { background: var(--gold); border-color: var(--graphite); }
.pin.active span { color: var(--ink); }
.pin.custom { background: #fff; border-color: var(--graphite); }
.pin.custom span { color: var(--ink); }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--graphite);
}
.leaflet-popup-content-wrapper { border-radius: 16px; font-family: var(--font); }
.leaflet-popup-content { margin: 14px 16px; }
/* Фото места */
.ph {
  position: relative; width: 100%; aspect-ratio: 16 / 10; margin-bottom: 10px;
  border-radius: 12px; overflow: hidden;
  background: var(--gold-soft); border: 1.5px dashed var(--gold);
  display: grid; place-items: center;
}
.ph-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--text-2);
}
.ph-empty span { font-size: 26px; }
.ph-strip {
  position: absolute; inset: 0; display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.ph-strip::-webkit-scrollbar { display: none; }
.ph-strip img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.ph-count {
  position: absolute; right: 8px; bottom: 8px; padding: 3px 9px; border-radius: 999px;
  background: rgba(33,35,34,.8); color: #fff; font-size: 10px; font-weight: 700; pointer-events: none; display: none;
}
.ph.loaded .ph-count { display: block; }
.ph.loaded { border-color: transparent; }
.ph.loaded .ph-empty { display: none; }
.stop-photo { display: none; margin-top: 10px; }
.stop-photo .ph { margin-bottom: 0; }
.stop.active .stop-photo { display: block; }

.pop-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.pop-text { font-size: 12px; line-height: 1.5; color: var(--text-2); margin-bottom: 10px; }
.pop-btn {
  border: none; border-radius: 999px; padding: 9px 14px;
  background: var(--graphite); color: var(--gold); font-family: var(--font-head); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.pop-input {
  width: 100%; font: inherit; font-size: 13px; padding: 7px 10px; margin-bottom: 8px;
  border: 1.5px solid var(--grey); border-radius: 10px;
}

/* ---------- Поиск ---------- */
.search-pop {
  position: fixed; inset: 0; z-index: 2000; background: rgba(33,35,34,.55);
  display: flex; justify-content: center; padding-top: 110px;
}
.search-box { width: min(560px, calc(100% - 32px)); }
.search-box input {
  width: 100%; font: inherit; font-size: 18px; padding: 16px 22px;
  border: 2px solid var(--gold); border-radius: 999px; outline: none; background: #fff;
}
.search-box ul { list-style: none; margin: 10px 0 0; padding: 6px; background: #fff; border-radius: 18px; max-height: 50vh; overflow: auto; }
.search-box ul:empty { display: none; }
.search-box li { padding: 10px 14px; border-radius: 12px; cursor: pointer; font-size: 14px; }
.search-box li:hover, .search-box li.sel { background: var(--gold-soft); }
.search-box li small { color: var(--text-2); margin-left: 6px; }

/* ---------- Подвал ---------- */
.foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px;
  padding: 22px 40px; background: var(--graphite); color: var(--grey); font-size: 12px;
}
.foot-brand { display: flex; align-items: center; gap: 12px; color: var(--gold); font-family: var(--font-head); font-size: 15px; }
.foot-brand .logo-svg { width: 26px; height: 29px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 3000;
  background: var(--graphite); color: var(--gold); padding: 12px 20px; border-radius: 999px; font-size: 13px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .pillnav { display: none; }
  .logo { margin-right: auto; font-size: 19px; }
  .hero-inner { padding: 28px 16px 36px; }
  .hero-sub { letter-spacing: .14em; font-size: 14px; }
  .map-summary { left: 10px; bottom: 10px; gap: 16px; padding: 10px 14px; }
  .map-summary b { font-size: 18px; }
  .hero-bottom { grid-template-columns: 1fr; gap: 24px; justify-items: center; }
  .hero-text { justify-self: stretch; font-size: 16px; }
  .spin-badge { width: 150px; height: 150px; order: 2; }
  .planner { grid-template-columns: 1fr; height: auto; padding: 16px 12px; }
  .map-wrap { order: -1; height: 55vh; min-height: 340px; }
  .panel { max-height: none; }
  .panel-body { overflow: visible; }
  .foot { padding: 18px 16px; }
}
