/* Atlas — визуальная система каталога вебкамер online.mib.news.
   Регистр: тёплая бумага, две геометрии (пилюля и плита), единая обработка всех
   кадров, служебная строка как у атласной таблички. Тёмного каркаса нет
   намеренно: это сервис, а не витрина, и материал здесь светлый — кадры. */

/* ---------- 0. Гарнитуры ---------- */
/* Две переменные гарнитуры, обе self-hosted: у Fraunces оси opsz/SOFT/WONK, у
   Archivo — ширина. Начертания не докупаем, характер берём осями. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-v25-k3kQo8UDI-1M0wlSfdnoLg.de2f1fe81758.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-v25-k3kQo8UDI-1M0wlSfdfoLnnA.589f7bc0fac4.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/fraunces-v38-6NUV8FyLNQOQZAnv9ZwIlOk.9a1814381455.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/fraunces-v38-6NUV8FyLNQOQZAnv9ZwHlOk8yA.ef2c53e41231.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- 1. Токены ---------- */
:root {
  --paper: #F2EFE7;
  --paper-2: #E8E3D7;
  --plate: #FFFFFF;
  --ink: #14161A;
  --ink-2: #4C525C;
  --ink-3: #8A9098;
  --line: #DCD5C5;
  --line-2: #EBE6DB;
  --signal: #DE4324;
  --night: #101724;
  --sky: #1F5FD0;

  --r-plate: 20px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(20, 22, 26, .05), 0 10px 26px -14px rgba(20, 22, 26, .22);
  --sh-2: 0 2px 6px rgba(20, 22, 26, .07), 0 28px 54px -24px rgba(20, 22, 26, .32);

  /* Изинги разведены по ролям: появление, корпус, интерфейс. Одна кривая на всё
     читается механически (см. свод «дёшево против дорого», ось 6). */
  --e-display: cubic-bezier(.16, 1, .3, 1);
  --e-body: cubic-bezier(.25, .46, .45, .94);
  --e-ui: cubic-bezier(.4, 0, .2, 1);

  --shell: 1440px;
  --gutter: clamp(16px, 3.4vw, 40px);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- 2. Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--font-ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ровный заливочный фон читается «сгенерировано»: даём бумаге зерно и лёгкую
   неравномерность света, как у печатного листа. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 82% -10%, rgba(255, 246, 222, .55), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(206, 196, 170, .28), transparent 62%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/></filter><rect width='160' height='160' filter='url(%23g)' opacity='.38'/></svg>");
  background-size: cover, cover, 160px 160px;
  mix-blend-mode: multiply; opacity: .5;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; border-radius: 4px; }

.shell { width: min(100% - var(--gutter) * 2, var(--shell)); margin-inline: auto; }

/* Табличка атласа: служебная строка, которой подписан каждый объект. */
.plate-label {
  font: 600 11.5px/1 var(--font-ui);
  font-stretch: 112%;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.display {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 12, "WONK" 1, "opsz" 120;
  font-weight: 500;
  line-height: .92;
  letter-spacing: -.022em;
}

/* ---------- 3. Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-2);
  transition: transform .34s var(--e-ui), box-shadow .34s var(--e-ui);
}
.top.is-hidden { transform: translateY(-100%); }
.top.is-floating { box-shadow: 0 10px 30px -24px rgba(20, 22, 26, .5); }

.top-row {
  display: flex; align-items: center; gap: clamp(12px, 2vw, 28px);
  height: 62px;
}

.brand { display: flex; align-items: baseline; gap: 9px; flex: none; }
.brand-name {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 20, "WONK" 1, "opsz" 40;
  font-weight: 600; font-size: 23px; letter-spacing: -.01em;
}
.brand-dot {
  width: 7px; height: 7px; border-radius: var(--r-pill);
  background: var(--signal); align-self: center;
  animation: pulse 2.6s var(--e-body) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.top-nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.top-link {
  padding: 8px 14px; border-radius: var(--r-pill); white-space: nowrap;
  font-weight: 500; font-size: 15px; color: var(--ink-2);
  transition: background .2s var(--e-ui), color .2s var(--e-ui);
}
.top-link:hover { background: var(--paper-2); color: var(--ink); }
.top-link.is-active { background: var(--ink); color: var(--paper); }

.top-search {
  flex: none; display: flex; align-items: center; gap: 8px;
  background: var(--plate); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 14px; min-width: 190px;
  transition: border-color .2s var(--e-ui), box-shadow .2s var(--e-ui);
}
.top-search:focus-within { border-color: var(--ink-3); box-shadow: var(--sh-1); }
.top-search input { border: 0; background: none; outline: none; font: inherit; font-size: 15px; width: 100%; }
.top-search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }

/* ---------- 4. Первый экран ---------- */
.lede { padding: clamp(28px, 5vw, 64px) 0 clamp(20px, 3vw, 36px); }

.lede-grid {
  display: grid; gap: clamp(20px, 3vw, 40px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .lede-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: end; }
  /* Объект живёт больше своего контейнера: карта уходит за правый край листа.
     На узких это не переносится — там она остаётся в рамке блока. */
  .lede-grid > .atlas-map { width: calc(100% + var(--gutter)); margin-right: calc(var(--gutter) * -1); border-radius: var(--r-plate) 0 0 var(--r-plate); }
}

.lede-title {
  font-size: clamp(42px, 7.4vw, 104px);
  margin: 10px 0 0;
  max-width: 13ch;
}
.lede-title em { font-style: normal; color: var(--signal); }

.lede-sub { margin: 18px 0 0; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); max-width: 46ch; }

.counters { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.counter {
  background: var(--plate); border: 1px solid var(--line-2); border-radius: var(--r-plate);
  padding: 14px 18px; min-width: 116px; box-shadow: var(--sh-1);
}
.counter b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1; }
.counter span { display: block; margin-top: 6px; }

/* Полоса света: где сейчас день, а где ночь. Единственный контент страницы,
   который обновляет сам себя. */
.daylight {
  position: relative; border-radius: var(--r-plate); overflow: hidden;
  background: var(--night); box-shadow: var(--sh-2);
  aspect-ratio: 2 / 1;
}
.daylight canvas { width: 100%; height: 100%; display: block; }
.daylight-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 16px; color: rgba(255, 255, 255, .78);
  background: linear-gradient(to top, rgba(8, 12, 20, .78), transparent);
}
.daylight-foot .plate-label { color: rgba(255, 255, 255, .62); }

/* ---------- 5. Карточка камеры ---------- */
.rowhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: clamp(30px, 4vw, 54px) 0 16px;
}
.rowhead h2 { font-family: var(--font-display); font-variation-settings: "SOFT" 14, "WONK" 1, "opsz" 60; font-weight: 600; font-size: clamp(24px, 2.6vw, 34px); margin: 0; letter-spacing: -.015em; }
.rowhead a { font-weight: 500; font-size: 15px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.rowhead a:hover { color: var(--ink); border-color: var(--ink); }

.grid {
  display: grid; gap: clamp(16px, 1.8vw, 26px);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(266px, 1fr);
  gap: clamp(16px, 1.8vw, 26px); overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 6px; scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; }

.cam { display: flex; flex-direction: column; gap: 12px; }

.cam-frame {
  position: relative; border-radius: var(--r-plate); overflow: hidden;
  background: var(--paper-2); aspect-ratio: 16 / 9;
  box-shadow: var(--sh-1);
  transition: transform .42s var(--e-display), box-shadow .42s var(--e-display);
  transform-origin: 50% 60%;
}
.cam:hover .cam-frame, .cam:focus-within .cam-frame { transform: scale(1.018); box-shadow: var(--sh-2); }

.cam-frame img {
  width: 100%; height: 100%; object-fit: cover;
  /* Единая обработка: два десятка провайдеров дают разные экспозиции и цвет,
     один грейд поверх всех сводит полосу в один регистр. */
  filter: saturate(.9) contrast(1.05) brightness(1.02);
  transition: transform .6s var(--e-display);
}
.cam:hover .cam-frame img { transform: scale(1.03); }

.cam-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(190deg, rgba(255, 244, 214, .12), rgba(16, 23, 36, .16)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='.5'/></svg>");
  background-size: cover, 120px 120px;
  mix-blend-mode: multiply; opacity: .5;
}

.cam-frame.is-empty { display: grid; place-items: center; color: var(--ink-3); }

.live {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px 6px 9px; border-radius: var(--r-pill);
  background: rgba(16, 23, 36, .62); backdrop-filter: blur(8px) saturate(1.4);
  color: #fff; font: 600 11px/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase;
}
.live i { width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--signal); animation: pulse 2s var(--e-body) infinite; }

.clock {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  padding: 6px 11px; border-radius: var(--r-pill);
  background: rgba(16, 23, 36, .5); backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, .92); font: 500 12px/1 var(--font-ui);
}
.clock.is-night::before { content: "☾ "; opacity: .8; }
.clock.is-day::before { content: "☀ "; opacity: .8; }

.cam-name {
  font-weight: 600; font-size: 16.5px; line-height: 1.25; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cam-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cam-meta .dot { width: 3px; height: 3px; border-radius: var(--r-pill); background: var(--line); }

/* ---------- 6. Плиты справочников ---------- */
.plates { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.plate {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--plate); border: 1px solid var(--line-2); border-radius: var(--r-plate);
  padding: 15px 18px; box-shadow: var(--sh-1);
  transition: transform .3s var(--e-ui), box-shadow .3s var(--e-ui), border-color .3s var(--e-ui);
}
.plate:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line); }
.plate-name { display: flex; align-items: center; gap: 10px; font-weight: 500; min-width: 0; }
.plate-name img { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; flex: none; }
.plate-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate-count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 14px; flex: none; }

/* ---------- 7. Карта ---------- */
.atlas-map {
  position: relative; border-radius: var(--r-plate); overflow: hidden;
  background: var(--plate); border: 1px solid var(--line-2); box-shadow: var(--sh-1);
}
.atlas-map svg { display: block; width: 100%; height: auto; }
.atlas-map svg { background: #E6E2D6; display: block; }
.atlas-night {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; mix-blend-mode: multiply;
}
.atlas-map .land { fill: #C4BBA3; stroke: #B3A98D; stroke-width: .7; }
.atlas-map .lake { fill: #E6E2D6; stroke: none; }
.atlas-map .pin { fill: var(--sky); opacity: .72; transition: opacity .3s var(--e-ui); }
.atlas-map .pin.is-night { fill: var(--ink-3); }
.atlas-tip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 7px 10px; font-size: 13px; transform: translate(-50%, -140%);
  opacity: 0; transition: opacity .18s var(--e-ui);
}
.atlas-tip.is-on { opacity: 1; }

/* ---------- 8. Страница камеры ---------- */
.cam-page { padding-bottom: 60px; }
.stage {
  position: relative; border-radius: var(--r-plate); overflow: hidden;
  background: var(--night); box-shadow: var(--sh-2); aspect-ratio: 16 / 9;
}
.stage img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9) contrast(1.05); }

.stage-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(60% 60% at 50% 55%, rgba(16, 23, 36, .18), rgba(16, 23, 36, .58));
  border: 0; cursor: pointer;
}
.stage-play i {
  width: 82px; height: 82px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .94); box-shadow: var(--sh-2);
  display: grid; place-items: center;
  transition: transform .34s var(--e-display);
}
.stage-play:hover i { transform: scale(1.06); }
.stage-play svg { width: 26px; height: 26px; margin-left: 4px; color: var(--ink); }

.factsheet {
  display: grid; gap: 1px; background: var(--line-2);
  border: 1px solid var(--line-2); border-radius: var(--r-plate); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.fact { background: var(--plate); padding: 15px 18px; }
.fact b { display: block; margin-top: 5px; font-weight: 500; font-size: 17px; }
.fact b.mono { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- 9. Подвал ---------- */
.foot { margin-top: clamp(48px, 6vw, 90px); border-top: 1px solid var(--line); background: var(--paper-2); }
.foot-grid { display: grid; gap: 28px; padding: 40px 0; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.foot h3 { margin: 0 0 12px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot a { color: var(--ink-2); font-size: 15px; }
.foot a:hover { color: var(--ink); }
.foot-note { padding: 0 0 36px; color: var(--ink-3); font-size: 13.5px; max-width: 70ch; }

/* ---------- 10. Появление ---------- */
/* Появление живёт на translate/scale, наведение — на transform: иначе ховер
   наследует задержку интро и срабатывает через секунду. */
.rise { opacity: 0; translate: 0 14px; scale: .994; }
.is-ready .rise {
  opacity: 1; translate: none; scale: 1;
  transition: opacity .6s var(--e-body), translate .72s var(--e-display), scale .72s var(--e-display);
  transition-delay: calc(var(--i, 0) * 42ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; translate: none; scale: 1; }
}

/* ---------- 11. Узкий экран ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .top-row { height: 56px; gap: 10px; }
  .top-search { min-width: 0; width: 44px; padding: 7px; justify-content: center; }
  .top-search input { display: none; }
  .top-search.is-open { width: 100%; padding: 7px 14px; }
  .top-search.is-open input { display: block; }
  .lede-title { font-size: clamp(34px, 11vw, 52px); max-width: none; }
  .counter { flex: 1 1 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); }
  .rail { grid-auto-columns: minmax(78%, 1fr); }
  /* Тач-цель не меньше 44 px даже там, где рисунок мельче. */
  .top-link { padding: 11px 14px; }
}
