/* ---------------------------------------------------------------------
   Токены дизайна
   Палитра: холодная сталь + сигнальный teal-акцент (статус "онлайн"
   диспетчерской сети), без клишированных кремово-терракотовых
   AI-дефолтов. Тёмная тема — по умолчанию (профиль аудитории), светлая —
   по явному выбору или системной настройке.
--------------------------------------------------------------------- */
:root,
:root[data-theme="dark"] {
  --bg: #0a0e13;
  --bg-panel: #10161d;
  --bg-panel-raised: #161d26;
  --line: #232c37;
  --text: #d9e2ea;
  --text-dim: #7c8998;
  --accent: #2bd9c2;
  --accent-dim: #1a8f80;
  --danger: #ff5d5d;
}

:root[data-theme="light"] {
  --bg: #f4f6f8;
  --bg-panel: #ffffff;
  --bg-panel-raised: #eef1f4;
  --line: #dde3e8;
  --text: #16202b;
  --text-dim: #55636f;
  --accent: #0e9e8c;
  --accent-dim: #0b7c6e;
  --danger: #c8323b;
}

/* Если пользователь ещё не выбирал тему явно — берём системную. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f4f6f8;
    --bg-panel: #ffffff;
    --bg-panel-raised: #eef1f4;
    --line: #dde3e8;
    --text: #16202b;
    --text-dim: #55636f;
    --accent: #0e9e8c;
    --accent-dim: #0b7c6e;
    --danger: #c8323b;
  }
}

:root {
  --font-display: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 3px;
  --max-w: 1080px;
}

body { transition: background-color 0.15s ease, color 0.15s ease; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

.site-header { flex: 0 0 auto; }

.page-main { flex: 1 0 auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 19, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  font-size: 1.05rem;
}
.brand .dot { color: var(--accent); }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 0.92rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-controls { display: flex; align-items: center; gap: 10px; margin-right: 4px; }

.lang-switch {
  display: flex; align-items: center;
  font-family: var(--font-display); font-size: 0.78rem;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.lang-switch a { color: var(--text-dim); padding: 5px 9px; }
.lang-switch a:hover { color: var(--text); text-decoration: none; background: var(--bg-panel-raised); }
.lang-switch a.active { color: var(--bg); background: var(--accent); }
.lang-switch a.active:hover { background: var(--accent); }

.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.theme-toggle-btn:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle-btn svg { width: 16px; height: 16px; }
.theme-toggle-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle-btn .icon-sun { display: block; }
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent); color: var(--bg) !important; text-decoration: none; }
.btn-solid { background: var(--accent); color: var(--bg) !important; }
.btn-solid:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-full { width: 100%; text-align: center; }

/* ---- Hero + маршрутная диаграмма (signature element) ---- */
.hero { padding: 72px 0 48px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.eyebrow {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.25;
  margin: 0 0 18px;
  font-weight: 700;
}
.hero p.lead { color: var(--text-dim); font-size: 1.05rem; max-width: 46ch; margin: 0 0 28px; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }

.relay-diagram { width: 100%; height: auto; }
.relay-diagram .hop-line {
  stroke-dasharray: 6 6;
  animation: dash 20s linear infinite;
}
.relay-diagram .pulse {
  animation: pulse-move 3.2s ease-in-out infinite;
}
@keyframes dash { to { stroke-dashoffset: -240; } }
@keyframes pulse-move {
  0%   { offset-distance: 0%; opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* ---- Sections ---- */
section { padding: 56px 0; }
.section-head { margin-bottom: 32px; }
.section-head .eyebrow { margin-bottom: 8px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 0; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px) { .features-grid { grid-template-columns: 1fr; } }
.feature-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.feature-card h3 { font-family: var(--font-display); font-size: 1rem; margin: 0 0 10px; }
.feature-card ul { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 0.92rem; }
.feature-card li { margin-bottom: 6px; }

/* ---- News ---- */
.news-list { display: flex; flex-direction: column; gap: 0; }
.news-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
}
@media (max-width: 640px) { .news-item { grid-template-columns: 1fr; gap: 6px; } }
.news-date { font-family: var(--font-display); color: var(--text-dim); font-size: 0.85rem; white-space: nowrap; }
.news-item h3 { margin: 0 0 6px; font-size: 1.05rem; }
.news-item p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.news-empty { color: var(--text-dim); font-style: italic; }

.news-article { max-width: 68ch; }
.news-article h1 { font-family: var(--font-display); font-size: 1.6rem; }
.news-article .news-date { display: block; margin-bottom: 24px; }
.news-article p { margin: 0 0 16px; }

/* ---- Forms ---- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
}
.panel h1, .panel h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 0 0 6px; }
.panel .sub { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 24px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; font-family: var(--font-display); }
.field .hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; }

.input-group { display: flex; align-items: stretch; }
.input-group > * { border-radius: 0; }
.input-group > *:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > *:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group > * + * { border-left: none; }
.input-group input { flex: 1 1 auto; min-width: 0; }

.input-suffix {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--bg-panel-raised); border: 1px solid var(--line);
  color: var(--text-dim); font-family: var(--font-display); font-size: 0.9rem;
  white-space: nowrap;
}

/* Выпадающий список домена — оформлен как продолжение того же поля
   ввода (без нативной "чужеродной" стрелки браузера). */
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-panel-raised);
  border: 1px solid var(--line);
}
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.9rem;
  padding: 0 30px 0 12px;
  cursor: pointer;
}
.select-wrap select:focus { outline: none; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 13px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Кнопка показать/скрыть пароль — продолжение input-group */
.input-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 42px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
}
.input-icon-btn:hover { color: var(--text); }
.input-icon-btn svg { width: 18px; height: 18px; }
.input-icon-btn .icon-eye-off { display: none; }
.input-icon-btn[data-visible="true"] .icon-eye { display: none; }
.input-icon-btn[data-visible="true"] .icon-eye-off { display: block; }

.password-tools { margin-top: 8px; }
.btn-small { padding: 6px 12px; font-size: 0.78rem; }
input[type=text], input[type=password], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
textarea { min-height: 220px; resize: vertical; font-family: var(--font-display); font-size: 0.9rem; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid;
}
.alert-error { background: rgba(255, 93, 93, 0.08); border-color: var(--danger); color: #ffb3b3; }
.alert-success { background: rgba(43, 217, 194, 0.08); border-color: var(--accent); color: var(--accent); }

.captcha-row { display: flex; align-items: center; gap: 12px; }
.captcha-question { font-family: var(--font-display); color: var(--text); white-space: nowrap; }
.captcha-row input { width: 90px; }
.captcha-row-image img { border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.captcha-row-image .btn { padding: 0; width: 40px; height: 40px; line-height: 1; font-size: 1.1rem; }

.content-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
  margin: 20px 0;
}

/* ---- Footer ---- */
.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding: 32px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---- Admin ---- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
@media (max-width: 720px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-sidebar { background: var(--bg-panel); border-right: 1px solid var(--line); padding: 24px 20px; }
.admin-sidebar .brand { display: block; margin-bottom: 32px; }
.admin-sidebar nav a {
  display: block; padding: 9px 10px; border-radius: var(--radius);
  color: var(--text-dim); font-size: 0.9rem; margin-bottom: 4px;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: var(--bg-panel-raised); color: var(--text); text-decoration: none; }
.admin-main { padding: 32px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.admin-topbar h1 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
table.data th { color: var(--text-dim); font-family: var(--font-display); font-weight: 400; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.row-actions a { margin-right: 12px; font-size: 0.85rem; }
.row-actions .danger { color: var(--danger); }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.75rem; font-family: var(--font-display); }
.status-pill.published { background: rgba(43,217,194,0.12); color: var(--accent); }
.status-pill.draft { background: rgba(124,137,152,0.15); color: var(--text-dim); }