/* ==========================================================================
   Russia Webcams — тема
   ========================================================================== */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --line: #e3e6eb;
  --accent: #e0312b;
  --accent-ink: #ffffff;
  --jump: #187cc3;   /* ссылки-переходы к районам */
  /* шапка и подвал */
  --top: #ffffff;
  --top-ink: #16181d;
  --top-muted: #5d6470;
  --top-line: #e3e6eb;
  --top-hover: #f1f2f5;
  --top-field: #f4f5f7;
  --chip: #ffffff;
  --shadow: 0 1px 2px rgba(16, 19, 26, .06), 0 4px 16px rgba(16, 19, 26, .06);
  --radius: 14px;
  --wrap: 1240px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --surface: #171a21;
    --text: #e9ebef;
    --muted: #9aa1ad;
    --line: #262a33;
    --jump: #4ea3e0;   /* #187cc3 плохо читается на тёмном фоне */
    --top: #07080b;
    --top-ink: #f2f3f5;
    --top-muted: #9aa1ad;
    --top-line: #1c2028;
    --top-hover: rgba(255, 255, 255, .08);
    --top-field: rgba(255, 255, 255, .06);
    --chip: #1d2129;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 24px; } }

.screen-reader-text, .skip {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; padding: 8px 14px; background: var(--accent); color: #fff; border-radius: 8px; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--top); color: var(--top-ink);
  border-bottom: 1px solid var(--top-line);
}
.top__inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand__live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 6px; background: var(--accent); color: #fff; font-size: .72rem; letter-spacing: .08em;
}
.brand__live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.search { flex: 0 1 280px; margin-left: auto; }
.search input {
  width: 100%; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--top-line);
  background: var(--top-field); color: var(--top-ink); font: inherit; font-size: .92rem;
}
.search input::placeholder { color: var(--top-muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 560px) {
  .top__inner { gap: 12px; }
  .brand__name { display: none; }          /* на телефоне — только LIVE, чтобы поиск был шире */
  .search { flex: 1 1 auto; }
}

/* ---------- Общие блоки ---------- */
body { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1 0 auto; padding-bottom: 48px; }

/* Фото на главной (как на старом сайте) */
.banner {
  display: block; width: 100%; height: auto; margin: 24px 0 8px;
  aspect-ratio: 2400 / 970; object-fit: cover; object-position: 35% 50%;
  border-radius: var(--radius); background: #1b1f27; box-shadow: var(--shadow);
}
@media (max-width: 600px) {
  .banner { aspect-ratio: 16 / 9; margin-top: 16px; }
}

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; list-style: none; margin: 20px 0 8px; padding: 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .5; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.page-head { margin: 8px 0 24px; }
.page-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
.page-head__lead { max-width: 760px; margin: 10px 0 0; color: var(--muted); }

.section-title { font-size: 1.35rem; margin: 40px 0 16px; }
.group:first-of-type .section-title { margin-top: 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--jump { margin: 0 0 16px; }
.chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: var(--chip); border: 1px solid var(--line); text-decoration: none; font-size: .92rem; transition: .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
/* Переходы к районам на странице города */
.chips--jump .chip { color: var(--jump); }
.chips--jump .chip:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Сетка карточек ---------- */
.grid--home { margin-top: 24px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .18s, box-shadow .18s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(16, 19, 26, .14); }
.card__link { display: flex; flex-direction: column; height: 100%; text-decoration: none; }
.card__media { position: relative; aspect-ratio: 16 / 9; background: #1b1f27; }
.card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 14px 16px 18px; }
.card__title { font-size: 1.02rem; font-weight: 650; }
.card:hover .card__title { color: var(--accent); }
.card__text { margin: 6px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.badge {
  position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, .66); color: #fff; font-size: .75rem; font-weight: 600; backdrop-filter: blur(4px);
}
.badge--live { background: var(--accent); letter-spacing: .06em; }

/* ---------- Страница камеры ---------- */
.watch { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 1024px) { .watch { grid-template-columns: minmax(0, 1fr); } }
.watch__title { font-size: clamp(1.4rem, 2.8vw, 2rem); margin: 8px 0 16px; }
.watch__caption { margin: 14px 0 0; font-size: 1.05rem; color: var(--muted); text-align: center; }
.watch__side { display: grid; gap: 20px; }
@media (min-width: 1025px) { .watch__side { position: sticky; top: 84px; } }

.side-box { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.side-box__title { font-size: .95rem; margin-bottom: 10px; color: var(--muted); font-weight: 600; }
.weather { display: block; width: 100%; max-width: 240px; border: 0; margin: 0 auto; }


/* Описание: картинка в начале, текст обтекает её справа и продолжается под ней */
.about {
  display: flow-root;   /* блок охватывает плавающую картинку */
  margin-top: 40px; padding: 28px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.about .prose { max-width: none; }
.about__fig {
  float: left; width: clamp(220px, 38%, 380px);
  margin: 4px 28px 16px 0;
}
.about__fig img { display: block; width: 100%; border-radius: 10px; }
.about__fig figcaption { margin-top: 8px; font-size: .85rem; color: var(--muted); text-align: center; }
@media (max-width: 560px) {
  .about { padding: 20px; }
  .about__fig { float: none; width: 100%; margin: 0 0 16px; }
}

.prose { max-width: 78ch; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent); }

/* ---------- Реклама ---------- */
.rw-ad { margin: 20px 0; text-align: center; overflow: hidden; }
.rw-ad:empty { display: none; }
.watch__side .rw-ad { margin: 0; }

/* ---------- Подвал ---------- */
.foot { background: var(--top); color: var(--top-muted); font-size: .9rem; padding: 28px 0; border-top: 1px solid var(--top-line); text-align: center; }
.foot__inner > div { margin: 0 0 12px; }
.foot__inner > div:last-child { margin-bottom: 0; }
.foot__inner img { display: inline-block; vertical-align: middle; margin: 0 4px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li + li { margin-top: 6px; }
.foot p { margin: 0 0 10px; color: var(--top-ink); }

/* ---------- Кнопка «Наверх» ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 24px; z-index: 40;
  display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(16, 19, 26, .25);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .2s, transform .2s, visibility .2s, background .15s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: #c4221c; }
.to-top:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
@media (max-width: 560px) {
  .to-top { right: 14px; bottom: 90px; width: 44px; height: 44px; }   /* выше floorAd РСЯ на телефонах */
}

.page-404 { padding: 48px 16px; text-align: center; }
.page-404 .search-form { margin: 20px auto; max-width: 420px; }

.nav-links { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.nav-links .page-numbers { padding: 8px 14px; border-radius: 8px; background: var(--surface); text-decoration: none; }
.nav-links .current { background: var(--accent); color: #fff; }
