/* ============================================================
   «История Калининского района в памятниках» — стили
   Палитра: бумага + гранит + бронза. Шрифты: Unbounded / Manrope.
   ============================================================ */

:root {
  --paper: #f4f1ea;
  --paper-2: #ece7dc;
  --ink: #1b2430;
  --ink-soft: #46505c;
  --bronze: #a8823c;
  --bronze-strong: #8a6729;
  --line: #d9d2c3;
  --card: #fffdf8;
  --dark: #161c25;
  --dark-2: #1d2530;
  --theme-blockade: #9e3b3b;
  --theme-revolution: #b3541e;
  --theme-district: #2f6f8f;
  --theme-peace: #4a7c59;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(27, 36, 48, .09);
  --shadow-sm: 0 4px 14px rgba(27, 36, 48, .08);
  --font-display: 'Unbounded', 'Arial Black', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -100px, rgba(168, 130, 60, .10), transparent 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--bronze-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

.container { width: min(1160px, 92%); margin-inline: auto; }

/* ---------- Типографика ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.22; }
h1 { font-size: clamp(1.7rem, 4.6vw, 3.05rem); letter-spacing: .01em; }
h1 em { font-style: normal; color: var(--bronze); }
h2 { font-size: clamp(1.35rem, 3vw, 2.1rem); margin-bottom: 14px; }
h3 { font-size: clamp(1.02rem, 2vw, 1.2rem); }

.overline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bronze-strong);
  margin-bottom: 10px;
}
.overline--light { color: #d8b877; }

.section { padding: clamp(48px, 8vw, 88px) 0; }
.section--tint { background: var(--paper-2); }
.section--dark {
  background:
    radial-gradient(900px 400px at 15% 0%, rgba(200, 154, 74, .12), transparent 55%),
    var(--dark);
  color: #eef0f2;
}
.section__intro { max-width: 760px; color: var(--ink-soft); margin-bottom: 26px; }
.section__intro--light { color: #c6ccd4; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(22, 28, 37, .92);
  backdrop-filter: blur(10px);
  color: #f0ede4;
}
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; color: #f0ede4; text-decoration: none; }
.brand:hover { color: #fff; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(145deg, #c39a52, #8a6729);
  display: grid; place-items: center; color: #161c25;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.brand__text { font-family: var(--font-display); font-size: .78rem; line-height: 1.25; letter-spacing: .02em; }
.brand__text small { font-family: var(--font-body); font-weight: 600; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: #cfa963; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #d7d3c8; text-decoration: none; font-weight: 600; font-size: .88rem;
  padding: 8px 11px; border-radius: 999px; transition: .18s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.is-active { color: #161c25; background: #d8b877; }

.burger { display: none; background: none; border: 0; cursor: pointer; padding: 10px; }
.burger span { display: block; width: 24px; height: 2.5px; background: #f0ede4; margin: 5px 0; border-radius: 2px; transition: .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.topbar__progress { height: 3px; background: rgba(255,255,255,.12); }
.topbar__progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c39a52, #e8c88a); }

/* ---------- Герой ---------- */
.hero { padding: clamp(44px, 7vw, 84px) 0 clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--line); }
.hero__in { display: grid; grid-template-columns: 1.25fr .85fr; gap: clamp(24px, 4vw, 56px); align-items: start; }
.hero__lead { margin-top: 16px; font-size: clamp(1rem, 1.6vw, 1.13rem); color: var(--ink-soft); max-width: 560px; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero__stats {
  list-style: none; display: flex; gap: clamp(18px, 3vw, 38px); flex-wrap: wrap;
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line);
}
.hero__stats b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.65rem; color: var(--bronze-strong); }
.hero__stats span { font-size: .82rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }

.btn {
  display: inline-block; padding: 13px 22px; border-radius: 999px;
  font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; transition: .18s;
}
.btn--primary { background: var(--ink); color: #f6ecd8; }
.btn--primary:hover { background: var(--bronze-strong); color: #fff; }
.btn--ghost { border-color: var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #f6ecd8; }

.hero__card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.hero__photo { position: relative; }
.hero__photo img { width: 100%; height: 240px; object-fit: cover; }
.hero__photo-caption {
  position: absolute; inset: auto 0 0 0; padding: 26px 14px 10px;
  font-size: .78rem; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(22, 28, 37, .82));
}
.hero__qr { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 18px; align-items: center; }
.hero__qr p { font-size: .85rem; color: var(--ink-soft); }
.qr { width: 128px; height: 128px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }

/* ---------- О проекте ---------- */
.about__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 26px; }
.about__item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 22px; box-shadow: var(--shadow-sm);
}
.about__item h3 { color: var(--bronze-strong); margin-bottom: 10px; }
.about__item p { font-size: .95rem; color: var(--ink-soft); }

/* ---------- Темы ---------- */
.themes__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; }
.theme-card {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: .18s; font: inherit; color: inherit;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.theme-card.is-active { outline: 2.5px solid var(--tc, var(--ink)); outline-offset: 2px; }
.theme-card__chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--tc); margin-bottom: 10px;
}
.theme-card__chip::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--tc); }
.theme-card h3 { font-size: 1rem; margin-bottom: 8px; }
.theme-card p { font-size: .88rem; color: var(--ink-soft); }
.theme-card__count { margin-top: 12px; font-size: .8rem; font-weight: 700; color: var(--bronze-strong); }

/* ---------- Карта ---------- */
.map__legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--ink-soft); }
.legend-item i { width: 14px; height: 14px; border-radius: 50%; background: var(--tc); border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--tc); }
.map__frame { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.map { height: 560px; background: #dfe6e3; }
.map__note { margin-top: 12px; font-size: .84rem; color: var(--ink-soft); }

/* Метки Leaflet */
.pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 6px;
  transform: rotate(-45deg);
  background: var(--pc, var(--ink));
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(27, 36, 48, .45);
  display: grid; place-items: center;
}
.pin span { transform: rotate(45deg); font: 800 14px/1 var(--font-body); color: #fff; }
.pin.is-start { background: var(--pc); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.popup__title { font-weight: 800; font-size: .95rem; margin-bottom: 3px; }
.popup__addr { font-size: .8rem; color: #5a6470; margin-bottom: 8px; }
.popup__link { font-size: .84rem; font-weight: 700; color: var(--bronze-strong); text-decoration: none; }
.popup__link:hover { text-decoration: underline; }

/* ---------- Фильтры и карточки ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line);
  font: 700 .86rem var(--font-body); color: var(--ink-soft); transition: .18s;
}
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--tc, #98a0aa); }
.chip:hover { border-color: var(--tc, var(--ink)); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #f6ecd8; }
.chip.is-active::before { background: var(--tc, #d8b877); }

.cards { display: grid; gap: 22px; }
.obj-card {
  display: grid; grid-template-columns: minmax(260px, 380px) 1fr;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); scroll-margin-top: 96px;
  transition: box-shadow .2s;
}
.obj-card:hover { box-shadow: var(--shadow); }
.obj-card:nth-child(even) { grid-template-columns: 1fr minmax(260px, 380px); }
.obj-card:nth-child(even) .obj-card__photo { order: 2; }
.obj-card.is-highlight { outline: 3px solid var(--bronze); outline-offset: -3px; }
.obj-card__photo { position: relative; min-height: 250px; }
.obj-card__photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.obj-card__num {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tc, var(--ink)); color: #fff;
  font: 800 1.05rem var(--font-body);
  border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(27,36,48,.35);
}
.obj-card__credit {
  position: absolute; right: 10px; bottom: 8px; z-index: 2;
  font-size: .66rem; color: rgba(255,255,255,.85);
  background: rgba(22,28,37,.55); padding: 2px 8px; border-radius: 999px;
}
.obj-card__body { padding: clamp(18px, 2.6vw, 30px); }
.obj-card__theme {
  display: inline-block; font-size: .72rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--tc);
  margin-bottom: 8px;
}
.obj-card__body h3 { margin-bottom: 4px; }
.obj-card__addr { font-size: .86rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 12px; }
.obj-card__addr::before { content: "📍 "; font-size: .8rem; }
.obj-card__text { font-size: .94rem; color: #333c46; margin-bottom: 14px; }
.obj-card__value {
  border-left: 3px solid var(--tc, var(--bronze));
  background: color-mix(in srgb, var(--tc, var(--bronze)) 7%, #fffdf8);
  padding: 10px 14px; border-radius: 0 10px 10px 0;
  font-size: .88rem; margin-bottom: 14px;
}
.obj-card__value b { color: var(--tc); }
.obj-card__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: .84rem; }
.obj-card__meta a { font-weight: 700; }
.obj-card__show { font-weight: 800; color: var(--tc); background: none; border: 0; cursor: pointer; font-size: .84rem; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.obj-card__show:hover { color: var(--ink); }

/* ---------- База данных ---------- */
.db__actions { margin: 4px 0 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card); }
.db { width: 100%; border-collapse: collapse; min-width: 880px; font-size: .88rem; }
.db thead th {
  background: var(--ink); color: #f0ede4; text-align: left;
  padding: 13px 14px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  position: sticky; top: 0;
}
.db tbody td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.db tbody tr:nth-child(even) { background: #f7f4ec; }
.db tbody tr:hover { background: #efe9da; }
.db .db__num { font-weight: 800; color: var(--bronze-strong); }
.db .db__name { font-weight: 700; }
.db .db__desc { min-width: 260px; color: var(--ink-soft); font-size: .84rem; }
.db .db__theme { white-space: nowrap; }
.db .db__theme i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--tc); margin-right: 7px; }
.db .db__src a { font-size: .82rem; }

/* ---------- Маршрут ---------- */
.route__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3.4vw, 44px); margin-top: 8px; }
.route__list { list-style: none; counter-reset: step; display: grid; gap: 0; }
.route__point { counter-increment: step; position: relative; padding: 0 0 26px 58px; }
.route__point::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tc, var(--bronze)); color: #fff;
  font: 800 1rem var(--font-body);
  border: 2.5px solid #3a4450;
}
.route__point::after {
  content: ""; position: absolute; left: 19px; top: 44px; bottom: 4px;
  width: 2.5px; background: repeating-linear-gradient(to bottom, #3f4a58 0 7px, transparent 7px 13px);
}
.route__point:last-child::after { display: none; }
.route__point h3 { font-size: 1.02rem; margin-bottom: 4px; color: #f2f0ea; }
.route__point .route__addr { font-size: .84rem; color: #aeb6c0; margin-bottom: 6px; }
.route__point p { font-size: .9rem; color: #c6ccd4; }
.route__leg {
  margin-top: 10px; display: inline-block;
  font-size: .8rem; font-weight: 700; color: #d8b877;
  background: rgba(216, 184, 119, .12);
  border: 1px dashed rgba(216, 184, 119, .5);
  padding: 5px 12px; border-radius: 999px;
}
.route__leg b { color: #f0d9a8; }
.route__map-wrap { position: sticky; top: 92px; }
.route__map { height: 470px; border-radius: var(--radius); overflow: hidden; border: 1px solid #39424f; }
.route__meta { margin-top: 12px; font-size: .9rem; color: #aeb6c0; }
.route__meta b { color: #e8c88a; }
.route__finish {
  margin-top: 26px; padding: 16px 20px; border-radius: var(--radius);
  background: rgba(216, 184, 119, .1); border: 1px solid rgba(216, 184, 119, .35);
  color: #e9dcc0; font-size: .95rem; max-width: 760px;
}

/* ---------- Источники ---------- */
.sources { counter-reset: src; max-width: 880px; }
.sources li {
  counter-increment: src; position: relative;
  padding: 12px 16px 12px 56px; border-radius: 12px;
  font-size: .94rem;
}
.sources li:nth-child(even) { background: var(--paper-2); }
.sources li::before {
  content: counter(src);
  position: absolute; left: 12px; top: 14px;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--ink); color: #e8c88a;
  font: 800 .84rem var(--font-body);
}
.sources .src-date { color: var(--ink-soft); font-size: .82rem; }

/* ---------- Подвал ---------- */
.footer { background: var(--dark); color: #b9c0c9; padding: 44px 0 40px; }
.footer__in { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px; }
.footer__title { font-family: var(--font-display); font-size: 1.02rem; color: #f0ede4; margin-bottom: 6px; }
.footer__sub { font-size: .85rem; color: #8d96a1; }
.footer__credits p { font-size: .88rem; margin-bottom: 4px; }
.footer__note p { font-size: .78rem; line-height: 1.6; color: #8d96a1; }
.footer a { color: #d8b877; }

/* ---------- Адаптив ---------- */
@media (max-width: 1020px) {
  .hero__in { grid-template-columns: 1fr; }
  .hero__card { max-width: 480px; }
  .themes__grid { grid-template-columns: repeat(2, 1fr); }
  .about__grid { grid-template-columns: 1fr; }
  .route__grid { grid-template-columns: 1fr; }
  .route__map-wrap { position: static; }
  .footer__in { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 860px) {
  .nav {
    position: fixed; inset: 66px 0 auto 0; z-index: 999;
    flex-direction: column; gap: 2px;
    background: rgba(22, 28, 37, .98);
    padding: 14px 6%;
    border-bottom: 1px solid #2a3340;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 13px 10px; border-radius: 10px; font-size: 1rem; }
  .burger { display: block; }
  .map { height: 420px; }
}

@media (max-width: 700px) {
  body { font-size: 15.5px; }
  .obj-card, .obj-card:nth-child(even) { grid-template-columns: 1fr; }
  .obj-card:nth-child(even) .obj-card__photo { order: 0; }
  .obj-card__photo { min-height: 210px; }
  .obj-card__photo img { position: relative; height: 210px; }
  .themes__grid { grid-template-columns: 1fr; }
  .hero__qr { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero__stats { gap: 16px 24px; }
  .map { height: 380px; }
  html { scroll-padding-top: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
