/* ============================================================
   Фитнес-СКУД «Периметр» — общий стиль
   ============================================================ */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #eef2f8;
  --text: #1c2430; --text-muted: #5b6b7f; --border: #d8e0ea;
  --primary: #0b5cab; --primary-hover: #084a8c; --accent: #c8102e;
  --success: #1f7a3d; --warning: #8a6d00;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.12);
  --sidebar-w: 250px; --header-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0f141b; --surface: #161d27; --surface-2: #1e2733;
  --text: #e6edf5; --text-muted: #9fb0c3; --border: #2a3646;
  --primary: #4a9eff; --primary-hover: #79b8ff; --accent: #ff5c77;
  --success: #4ade80; --warning: #fbbf24;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Плавная прокрутка */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  background: var(--bg); color: var(--text);
  transition: background .2s ease, color .2s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }

a:focus-visible, button:focus-visible, input:focus-visible, .dl-btn:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px;
}

/* ============================================================
   Каркас
   ============================================================ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: transform .25s ease;
}

/* --- Бренд (логотип + название-ссылка) --- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}
.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.brand-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  transition: color .15s ease;
}
.brand-name:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text); font-size: 14px; margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a.active:hover { background: var(--primary-hover); color: #fff; }
.nav a.ext { color: var(--text-muted); }
.nav .sep { height: 1px; background: var(--border); margin: 8px 6px; }

/* Иконки в меню */
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.75;
}
.nav a:hover .nav-icon,
.nav a.active .nav-icon { opacity: 1; }
.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 {
  font-size: 18px; margin: 0; font-weight: 600; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 8px; cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }

.content { padding: 24px; max-width: 1000px; width: 100%; }
.content h1, .content h2, .content h3 { line-height: 1.3; }
.content h2 { font-size: 22px; margin: 28px 0 12px; }
.content h3 { font-size: 17px; margin: 22px 0 8px; }
.content p { margin: 0 0 12px; }
.content ul, .content ol { margin: 0 0 14px; padding-left: 22px; }
.content li { margin-bottom: 6px; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); font-weight: 600; }
.text-warning { color: var(--warning); font-weight: 600; }

/* ============================================================
   Анимация появления (Scroll Reveal)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}
.reveal.delay-1 { transition-delay: .1s; }
.reveal.delay-2 { transition-delay: .2s; }
.reveal.delay-3 { transition-delay: .3s; }

html:not(.js) .reveal { opacity: 1; transform: none; transition: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ============================================================
   Карточки
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin: 0 0 18px;
}
.card h3 { margin-top: 0; }
.card > p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid .card img { max-height: 90px; width: auto; object-fit: contain; display: block; margin: 0 auto; }

/* ============================================================
   Кнопки-скачивания
   ============================================================ */
.dl-list { list-style: none; padding: 0; margin: 0; }
.dl-list li { margin: 0 0 10px; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff; padding: 9px 16px;
  border-radius: 8px; font-weight: 600; font-size: 14px;
  transition: background .15s ease;
}
.dl-btn:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.dl-btn::before { content: "⬇"; font-size: 15px; speak: never; }

/* ============================================================
   Таблицы реквизитов
   ============================================================ */
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table.req {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; font-size: 14px;
}
table.req th, table.req td {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: top;
}
table.req tr:last-child td { border-bottom: none; }
table.req th { background: var(--surface-2); width: 220px; font-weight: 600; }
table.req td { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ============================================================
   Таблица «Режимы работы»
   ============================================================ */
.modes-table th { width: auto; }
.modes-table td { font-family: var(--font); }
.modes-table td p:last-child { margin-bottom: 0; }
.modes-table img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-top: 8px;
}

/* ============================================================
   Форма подписки (не используется, оставлена на будущее)
   ============================================================ */
.subscribe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subscribe input[type=email] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px; min-width: 180px;
}
.subscribe button {
  padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14px;
}
.subscribe button:hover { background: var(--primary-hover); }
.subscribe label { display: none; }

/* ============================================================
   Промо-блок
   ============================================================ */
.promo {
  border-left: 4px solid var(--accent); background: var(--surface-2);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 18px;
}
.promo b { color: var(--accent); }

/* ============================================================
   Подвал
   ============================================================ */
.footer {
  margin-top: auto; padding: 18px 24px; border-top: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 13px;
}
.footer .foot-nav { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.footer .foot-nav a { color: var(--text-muted); }
.footer .foot-nav a:hover { color: var(--primary); }
.footer .foot-nav span { color: var(--border); }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; display: none; }
.backdrop.show { display: block; }

/* ============================================================
   ЛАЙТБОКС
   ============================================================ */
a[data-lightbox] { cursor: zoom-in; display: inline-block; }

.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.9);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.lightbox.show { display: flex; }

.lightbox img {
  max-width: 90vw; max-height: 85vh; width: auto; height: auto;
  object-fit: contain; box-shadow: 0 4px 20px rgba(0,0,0,.5);
  border-radius: 4px; background: transparent;
}

/* Белая подложка — для светлых скриншотов/документов */
.lightbox img[src*="reg_step"],
.lightbox img[src*="index.1"],
.lightbox img[src*="index.2"],
.lightbox img[src*="index.3"] {
  background: #fff;
  padding: 4px;
}

.lightbox-close {
  position: fixed; top: 20px; right: 20px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 28px; width: 48px; height: 48px;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 101; transition: background .2s;
}
.lightbox-close:hover { background: rgba(255,255,255,.4); }

/* ============================================================
   Хлебные крошки
   ============================================================ */
.breadcrumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { margin: 0 6px; opacity: .5; }

/* ============================================================
   Превью картинок
   ============================================================ */
.zoomable {
  display: block; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 4px;
  transition: opacity .2s;
}
.zoomable:hover { opacity: .8; }

.reg-step-preview { max-width: 50%; height: auto; }

html[data-theme="dark"] .zoomable[src*="reg_step"],
html[data-theme="dark"] .zoomable[src*="index.1"],
html[data-theme="dark"] .zoomable[src*="index.2"],
html[data-theme="dark"] .zoomable[src*="index.3"] {
  background: #fff;
  padding: 4px;
}

/* ============================================================
   Блок «Проверка на вирусы»
   ============================================================ */
.virus-check {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fdfaf0; border: 1px solid #e6d28a;
  border-radius: 12px; padding: 16px 18px; margin: 0 0 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.virus-check .virus-icon {
  font-size: 22px; line-height: 1; flex-shrink: 0;
  filter: drop-shadow(0 0 2px rgba(200, 16, 46, .3));
}
.virus-check p { margin: 0; color: #7a4a00; font-weight: 600; font-size: 14px; }
.virus-check a { color: #0000ee; text-decoration: underline; text-underline-offset: 2px; }
.virus-check a:hover { color: #0000aa; text-decoration: none; }

html[data-theme="dark"] .virus-check {
  background: #1f1a0e; border-color: #8a7a2a;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
html[data-theme="dark"] .virus-check .virus-icon {
  filter: drop-shadow(0 0 4px rgba(255, 193, 7, .4));
}
html[data-theme="dark"] .virus-check p { color: #f5e6a8; }
html[data-theme="dark"] .virus-check a { color: #7fb2ff; }
html[data-theme="dark"] .virus-check a:hover { color: #a8c8ff; }

/* ============================================================
   Кнопка «Наверх»
   ============================================================ */
.scroll-top {
  position: fixed; bottom: 24px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: opacity .25s ease, visibility .25s ease, transform .25s ease, background .15s;
  z-index: 90;
}
.scroll-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: var(--primary-hover); transform: translateY(-4px); }
.scroll-top svg { width: 22px; height: 22px; display: block; }

/* ============================================================
   404
   ============================================================ */
.error-page { text-align: center; padding: 40px 20px; }
.error-page h1.error-code {
  font-size: 80px; font-weight: 700; color: var(--primary);
  line-height: 1; margin: 0 0 16px;
}
.error-msg { font-size: 24px; margin: 0 0 16px; font-weight: 600; }
.error-desc { color: var(--text-muted); margin: 0 0 24px; }

/* ============================================================
   Offline-страница
   ============================================================ */
.offline-page { text-align: center; padding: 40px 20px; }
.offline-page h1 { font-size: 28px; margin: 0 0 12px; }
.offline-page p { color: var(--text-muted); margin: 0 0 12px; }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 20;
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  table.req th { width: auto; }
  .reg-step-preview { max-width: 100%; }
  .scroll-top { bottom: 16px; right: 16px; width: 44px; height: 44px; }
}

/* ============================================================
   Печать
   ============================================================ */
@media print {
  .sidebar, .topbar, .footer, .backdrop, .icon-btn,
  .subscribe, .lightbox, .breadcrumbs, .promo,
  .scroll-top, .dl-btn::before { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; }
  .card, table.req { box-shadow: none; border-color: #ccc; }
  .content { padding: 0; max-width: none; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 11px; color: #555; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   Снижение анимаций (a11y)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}