/* Страница «Как добраться из Эстонии в Россию» (border.html, border.js).
   Палитра сайта (style.css, legal.css) + цвета карты в духе дорожного атласа: море с сеткой координат,
   тёплая суша, дороги с белой обводкой. Светлая тема, тёмная по системе и выбранная вручную (theme.js). */
:root {
  color-scheme: light;
  --page: #eceeeb;
  --surface: #fbfcfa;
  --surface-2: #eff1ee;
  --ink: #0f1e2b;
  --ink-2: #3e4b57;
  --muted: #5c6873;
  --faint: #5f6b76; /* 4,7:1 на фоне страницы — мелкие подписи читаются (WCAG AA) */
  --axis: #c2c9cc;
  --border: rgba(15, 30, 43, 0.11);
  --series: #0072ce;
  /* Статусы: текст и линии */
  --tone-open: #22754a;
  --tone-until: #7a5600; /* 5,6:1 и на светлой жёлтой плашке «Средний риск» */
  --tone-closed: #b3352c;
  --line-open: #2f8f5b;
  --line-until: #d99a00;
  --line-closed: #c8443a;
  --line-onward: #7f8aa3;
  --line-plane: #7a5cc0;
  --plane-text: #6a4bb3;
  /* Карта */
  --sea: #d5e3ea;
  --sea-label: #6c8ca1;
  --graticule: rgba(40, 90, 120, 0.12);
  --land-europe: #f5f4ef;
  --land-russia: #efe4cc;
  --land-belarus: #e6e4de;
  --land-walk: #e9cf96;
  --land-border: #ffffff;
  --label-strong: #8a7450;
  --map-halo: #fbfcfa;
  --casing: #ffffff;
  --gutter: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b1016;
    --surface: #121921;
    --surface-2: #1a232c;
    --ink: #e8edf1;
    --ink-2: #b8c2ca;
    --muted: #8a96a1;
    --faint: #808c97;
    --axis: #36434e;
    --border: rgba(232, 237, 241, 0.1);
    --series: #3d9bf0;
    --tone-open: #4cc38a;
    --tone-until: #e0b23d;
    --tone-closed: #ff7b6e;
    --plane-text: #a98ee6;
    --sea: #0c1a24;
    --sea-label: #4f6f86;
    --graticule: rgba(120, 170, 200, 0.08);
    --land-europe: #1c252e;
    --land-russia: #2d281e;
    --land-belarus: #222830;
    --land-walk: #54452a;
    --land-border: #0b1016;
    --label-strong: #c9b089;
    --map-halo: #121921;
    --casing: #0b1016;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1016;
  --surface: #121921;
  --surface-2: #1a232c;
  --ink: #e8edf1;
  --ink-2: #b8c2ca;
  --muted: #8a96a1;
  --faint: #808c97;
  --axis: #36434e;
  --border: rgba(232, 237, 241, 0.1);
  --series: #3d9bf0;
  --tone-open: #4cc38a;
  --tone-until: #e0b23d;
  --tone-closed: #ff7b6e;
  --plane-text: #a98ee6;
  --sea: #0c1a24;
  --sea-label: #4f6f86;
  --graticule: rgba(120, 170, 200, 0.08);
  --land-europe: #1c252e;
  --land-russia: #2d281e;
  --land-belarus: #222830;
  --land-walk: #54452a;
  --land-border: #0b1016;
  --label-strong: #c9b089;
  --map-halo: #121921;
  --casing: #0b1016;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 16px/1.5 "Onest", "Onest Fallback", "Onest Fallback R", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; border-radius: 8px; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }

.border-page {
  display: flex; flex-direction: column; gap: 32px;
  width: min(1120px, 100%); margin: 0 auto;
  padding: 24px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px));
}

/* Цвета статусов в тексте */
.tone-open { color: var(--tone-open); }
.tone-until { color: var(--tone-until); }
.tone-closed { color: var(--tone-closed); }
.muted { color: var(--muted); }

/* ---------- Шапка ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  color: var(--faint); font-size: 13px; text-decoration: none; transition: color 0.15s;
}
.back-link:hover { color: var(--ink); }
.lang-switch { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.lang-switch a {
  display: grid; place-items: center; min-width: 44px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none;
}
.lang-switch a[aria-current="true"] { border-color: var(--series); color: var(--series); font-weight: 600; }
.topbar-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Светлая / тёмная тема — круглая кнопка в ряд с языками, как на главной */
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.theme-toggle:active { transform: scale(0.96); }
@media (hover: hover) { .theme-toggle:hover { color: var(--ink); border-color: var(--series); } }
.banner { display: flex; align-items: center; gap: 8px; margin-top: 24px; font-size: 15px; font-weight: 600; }
.closed-badge { flex: none; }
.page-title { max-width: 18ch; margin-top: 8px; font-size: clamp(32px, 5.4vw, 54px); font-weight: 700; line-height: 1.06; letter-spacing: -0.025em; text-wrap: balance; }

/* ---------- Сводка по странам: табло, цвет полосы — статус ---------- */
.countries {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--border);
}
.country { position: relative; padding: 18px 18px 16px; background: var(--surface); }
.country::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.bar-open::before { background: var(--line-open); }
.bar-until::before { background: var(--line-until); }
.bar-closed::before { background: var(--line-closed); }
.country:last-child:nth-child(odd) { grid-column: 1 / -1; }
.country-name { font-size: 20px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.country-rule { margin-top: 6px; font-size: 13px; line-height: 1.35; }

/* ---------- Разделы ---------- */
.border-section { padding-top: 32px; border-top: 1px solid var(--border); }
.section-title { font-size: clamp(26px, 4vw, 38px); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; }
.section-note { margin-top: 6px; color: var(--muted); font-size: 14px; }

/* Полоса «откуда → куда» */
.stops { max-width: 600px; margin-top: 24px; }
.stops-line { display: flex; align-items: center; }
.stops-dot { flex: none; width: 12px; height: 12px; border: 3px solid var(--ink); border-radius: 50%; background: var(--page); }
.stops-dot:first-child { background: var(--ink); }
.stops-leg { position: relative; flex: 1; }
.stops-leg-rule { display: block; border-top: 3px solid var(--line-open); }
.leg-plane .stops-leg-rule { border-top: 3px dotted var(--line-plane); }
.stops-leg-icon {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
}
.stops-names { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.stops-names li { font-size: 15px; font-weight: 600; line-height: 1.25; }
.stops-names li:nth-child(2) { text-align: center; }
.stops-names li:last-child { text-align: right; }

.section-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 28px; }

/* Переключатель «Автобус / Пешком / На машине» */
.mode-switch { display: inline-flex; max-width: 100%; padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; transition: color 0.15s, background 0.15s;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active { background: var(--ink); color: var(--page); font-weight: 600; }

/* ---------- Карта ---------- */
.map-frame {
  margin: 14px calc(-1 * var(--gutter)) 0; overflow: hidden; background: var(--sea);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.route-map { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; font-family: inherit; }
.sea { fill: var(--sea); }
.graticule line { stroke: var(--graticule); stroke-width: 0.6; }
.land { stroke: var(--land-border); stroke-width: 1.2; stroke-linejoin: round; }
.land-europe { fill: var(--land-europe); }
.land-russia { fill: var(--land-russia); }
.land-belarus { fill: var(--land-belarus); }
.land-walk { fill: var(--land-walk); }
.lake { fill: var(--sea); stroke: var(--land-border); stroke-width: 0.6; }
.sea-label { fill: var(--sea-label); font-size: 9px; font-style: italic; letter-spacing: 0.6px; }
.country-label { fill: var(--faint); font-size: 7.5px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; opacity: 0.85; }
.country-label.strong { fill: var(--label-strong); font-size: 14px; font-style: italic; font-weight: 500; letter-spacing: 3px; text-transform: none; opacity: 1; }
.halo { stroke: var(--map-halo); stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; }
.flight-line { stroke-width: 2; stroke-dasharray: 0.5 4.5; stroke-linecap: round; }
.flight-label { fill: var(--plane-text); font-size: 9.5px; font-weight: 600; }
.badge-ring { stroke: var(--map-halo); stroke-width: 1.4; }

/* Дороги: обводка + линия; выбранная — толще и прорисовывается */
.route-hit { cursor: pointer; }
.route-casing { stroke: var(--casing); stroke-width: 5; transition: stroke-width 0.15s; }
.route-casing.is-hover { stroke-width: 6.4; }
.route-casing.is-selected { stroke-width: 8; }
.route-line { stroke-width: 2.6; transition: stroke-width 0.15s; }
.route-line.is-onward { stroke-dasharray: 6 4; }
.route-line.is-hover { stroke-width: 3.6; }
.route-line.is-selected { stroke-width: 4.6; }
.route-line.is-drawing { stroke-dasharray: 1; stroke-dashoffset: 1; animation: route-draw 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) forwards; }
@keyframes route-draw { to { stroke-dashoffset: 0; } }

.xing-ring { fill: var(--map-halo); }
.dot-idle { fill: var(--map-halo); }
.crossing-label { fill: var(--muted); font-size: 8.5px; font-weight: 500; }
.crossing-label.is-closed { font-weight: 600; }
.city-dot { fill: var(--ink); stroke: var(--map-halo); stroke-width: 1.5; }
.city-label { fill: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: -0.1px; }

.map-caption { min-height: 22px; margin-top: 10px; font-size: 14px; line-height: 1.35; }
.caption-title { color: var(--ink); font-weight: 600; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { display: inline-block; width: 22px; height: 4px; border-radius: 2px; box-shadow: 0 0 0 1.5px var(--casing); }
.line-open { background: var(--line-open); }
.line-until { background: var(--line-until); }
.line-onward { background: repeating-linear-gradient(90deg, var(--line-onward) 0 6px, transparent 6px 9px); }

/* ---------- Карточки маршрутов ---------- */
.cards-col { display: grid; gap: 8px; align-content: start; }
.list-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.list-label svg { flex: none; color: var(--faint); }
.list-label.spaced { margin-top: 18px; }
.empty-note { padding: 16px; border: 1px dashed var(--axis); border-radius: 14px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.route-card {
  position: relative; padding: 14px 16px 14px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.route-card::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; }
.rail-open::before { background: var(--line-open); }
.rail-until::before { background: var(--line-until); }
.rail-closed::before { background: var(--line-closed); }
.rail-onward::before { background: repeating-linear-gradient(180deg, var(--line-onward) 0 6px, transparent 6px 9px); }
.route-card:hover { border-color: var(--axis); }
.route-card.is-selected { border-color: var(--ink); }
.route-title { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.35; }
.route-title svg { flex: none; }
/* Кнопка-заголовок карточки: выглядит как текст, нажимается Enter и пробелом */
.route-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; line-height: inherit; text-align: left; cursor: pointer;
}
.route-mode { color: var(--faint); }
.route-status { margin-top: 4px; font-size: 14px; line-height: 1.35; }
.route-detail { margin-top: 6px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.route-warning {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  color: var(--ink-2); font-size: 13px; line-height: 1.4;
}
.route-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 12px; color: var(--faint); font-size: 12px; }
.stale { color: var(--tone-until); }
.source-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 24px; /* палец попадает: не меньше 24 px */
  text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 4px;
}
.source-link svg { flex: none; }
.source-link:hover { color: var(--ink); }

.onward-card { padding: 14px 16px; border: 1px dashed var(--line-plane); border-radius: 14px; }
.onward-note { margin-top: 4px; color: var(--plane-text); font-size: 14px; line-height: 1.35; }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pill-row.spaced { margin-top: 16px; }
.pill-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink);
  font-size: 13px; text-decoration: none; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill-link:hover { border-color: var(--ink); background: var(--ink); color: var(--page); }

/* ---------- Самолёт ---------- */
.lead-text { max-width: 600px; margin-top: 12px; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.hubs-lead { margin-top: 20px; color: var(--muted); font-size: 14px; }
.hubs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.hub-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 17px; font-weight: 600; text-decoration: none;
  transition: border-color 0.15s;
}
.hub-link:hover { border-color: var(--line-plane); }

/* ---------- Действия и подвал ---------- */
.actions { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.actions-lead { color: var(--muted); font-size: 14px; }
.actions-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.action-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.action-btn:hover { border-color: var(--ink); background: var(--ink); color: var(--page); }
.page-foot { max-width: 640px; margin: 0 auto; color: var(--faint); font-size: 12px; line-height: 1.6; text-align: center; }
.foot-legal { margin-top: 4px; font-size: 12px; }
/* «Версии сайта» и счётчик посещений — как внизу главной (style.css .footer-langs, .site-counter) */
.footer-langs {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 14px;
  color: var(--muted); font-size: 13px;
}
.footer-langs svg { flex: none; color: var(--series); }
.footer-langs a {
  display: inline-flex; align-items: center; min-height: 24px;
  color: var(--ink-2); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); text-underline-offset: 3px;
}
.footer-langs a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: none; }
@media (hover: hover) { .footer-langs a:hover { color: var(--series); } }
.site-counter {
  display: inline-flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 6px 14px 6px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--muted); white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums;
}
.site-counter[hidden] { display: none; }
.site-counter svg { flex: none; margin-right: -4px; color: var(--series); }
.site-counter strong { color: var(--ink); font-weight: 600; }

/* Без скрипта: маршруты простыми списками */
.static-lead { margin-top: 12px; color: var(--muted); font-size: 14px; }
.static-routes { display: grid; gap: 8px; max-width: 768px; margin: 12px 0 0; padding: 0; list-style: none; }
.static-routes li { padding-left: 12px; border-left: 3px solid var(--line-open); color: var(--ink-2); font-size: 14px; line-height: 1.4; }

/* ---------- Анимации карты ---------- */
/* Бегущие точки по выбранному маршруту — направление движения */
.route-flow {
  stroke: rgba(255, 255, 255, 0.95); stroke-width: 1.7; stroke-dasharray: 0.1 9; pointer-events: none; opacity: 0;
  animation: route-flow 1.1s linear infinite, map-show 0.4s ease 0.9s forwards;
}
@keyframes route-flow { to { stroke-dashoffset: -9.1; } }
@keyframes map-show { to { opacity: 1; } }
/* Значок транспорта, который едет по маршруту */
.vehicle { pointer-events: none; opacity: 0; animation: map-show 0.4s ease 0.5s forwards; }
.vehicle circle { filter: drop-shadow(0 1px 2px rgba(15, 30, 43, 0.35)); }
/* Пульс на переходах выбранного маршрута */
.pulse { pointer-events: none; transform-box: fill-box; transform-origin: center; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(3.2); opacity: 0; } }
/* После смены вида транспорта маршруты проявляются */
.is-entering .route-hit { animation: route-enter 0.45s ease both; }
@keyframes route-enter { from { opacity: 0; } }

/* ---------- Вводный текст и навигация ---------- */
.hero-lead { max-width: 60ch; margin-top: 16px; color: var(--ink-2); font-size: 17px; line-height: 1.5; }
.updated {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px;
}
.section-nav {
  position: sticky; top: 0; z-index: 20; margin: 0 calc(-1 * var(--gutter)); padding: 10px var(--gutter);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
}
.section-nav ul { position: relative; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.section-nav ul::-webkit-scrollbar { display: none; }
.section-nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background 0.15s, color 0.15s;
}
.section-nav a:hover { background: var(--surface-2); color: var(--ink); }
.section-nav a[aria-current="true"] { background: var(--ink); color: var(--page); }
.border-section { scroll-margin-top: 72px; }
.section-lead { max-width: 60ch; margin-top: 8px; color: var(--muted); font-size: 15px; line-height: 1.45; }

/* ---------- Какой путь выбрать ---------- */
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; margin-top: 20px; }
.option-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px 24px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
}
.option-card::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: 18px; width: 3px; border-radius: 2px; }
.option-modes { display: flex; gap: 6px; }
.mode-chip { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.chip-plane, .chip-train { color: var(--plane-text); }
.option-title { font-size: 18px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.option-path { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.option-path li + li::before { content: "→"; margin: 0 6px; color: var(--faint); }
.option-time { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 15px; font-weight: 600; }
.option-time svg { color: var(--faint); }
.option-who { color: var(--muted); font-size: 14px; line-height: 1.4; }
.option-who.tone-until { color: var(--tone-until); }
.option-more {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 38px; margin-top: auto; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.option-more:hover { border-color: var(--ink); background: var(--ink); color: var(--page); }

/* ---------- Документы ---------- */
.doc-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 12px; margin-top: 20px; }
.doc-card { padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.doc-title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; line-height: 1.25; }
.doc-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.doc-grey .doc-icon { color: var(--faint); }
.doc-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.doc-list li { position: relative; padding-left: 16px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.doc-list li::before { content: ""; position: absolute; left: 1px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--axis); }
.check-lead { margin-top: 20px; color: var(--muted); font-size: 14px; }

/* ---------- Перед поездкой ---------- */
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 22px 32px; margin: 22px 0 0; padding: 0; list-style: none; }
.tip { display: flex; align-items: flex-start; gap: 14px; }
.tip-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); }
.tip-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.tip-text { margin-top: 4px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }

/* ---------- Частые вопросы ---------- */
.faq { max-width: 820px; margin-top: 16px; border-top: 1px solid var(--border); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 2px;
  font-size: 16px; font-weight: 600; line-height: 1.35; list-style: none; cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--series); }
.faq-chevron { flex: none; color: var(--faint); transition: transform 0.2s; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-answer { max-width: 68ch; padding: 0 2px 18px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }

/* ---------- Значки ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.section-title { display: flex; align-items: center; gap: 14px; }
.title-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink);
}
.title-risks { color: var(--tone-closed); }
.title-air { color: var(--plane-text); }
.country-rule { display: flex; align-items: flex-start; gap: 6px; }
.country-rule svg { flex: none; margin-top: 1px; }
.route-status { display: flex; align-items: center; gap: 6px; }
.route-detail { display: flex; align-items: flex-start; gap: 8px; }
.detail-icon { flex: none; margin-top: 3px; color: var(--line-open); }
.route-warning { display: flex; align-items: flex-start; gap: 8px; }
.warning-icon { flex: none; margin-top: 1px; color: var(--tone-until); }

/* ---------- Пошаговые инструкции ---------- */
.guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; margin-top: 20px; }
.guide-card { display: flex; flex-direction: column; gap: 18px; padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.guide-head { display: flex; align-items: center; gap: 14px; }
.guide-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--ink); color: var(--page); }
.guide-plane, .guide-train { background: var(--line-plane); color: #fff; }
.guide-title { font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.guide-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.guide-steps { position: relative; display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
/* Вертикальная линия, соединяющая номера шагов */
.guide-steps::before { content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px; background: var(--border); }
.guide-step { position: relative; display: flex; gap: 14px; }
.step-num {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-open); color: var(--ink); font-size: 13px; font-weight: 700;
}
.guide-step:last-child .step-num { background: var(--line-open); color: #fff; }
.step-title { margin: 3px 0 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.step-text { margin-top: 4px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.guide-card .option-more { margin-top: auto; }

/* ---------- Риски ---------- */
.risks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: 20px; }
.risk-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.risk-high { border-color: color-mix(in srgb, var(--line-closed) 45%, var(--border)); }
.risk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.risk-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; }
.risk-high .risk-icon { background: color-mix(in srgb, var(--line-closed) 14%, transparent); color: var(--tone-closed); }
.risk-medium .risk-icon { background: color-mix(in srgb, var(--line-until) 16%, transparent); color: var(--tone-until); }
.risk-level { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.risk-high .risk-level { background: color-mix(in srgb, var(--line-closed) 14%, transparent); color: var(--tone-closed); }
.risk-medium .risk-level { background: color-mix(in srgb, var(--line-until) 16%, transparent); color: var(--tone-until); }
.risk-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.risk-text { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.risk-how { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.risk-how strong { color: var(--ink); }
.how-icon { flex: none; margin-top: 1px; color: var(--line-open); }
.emergency { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.emergency-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line-closed); color: #fff; }

/* ---------- Ширина ---------- */
@media (min-width: 640px) {
  :root { --gutter: 28px; }
  .map-frame { margin-left: 0; margin-right: 0; border: 1px solid var(--border); border-radius: 18px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; }
  .border-page { gap: 44px; padding-top: 48px; }
  .countries { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .country:last-child:nth-child(odd) { grid-column: auto; }
  .section-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; gap: 44px; }
  /* Карта «прилипает», пока листаются карточки маршрутов */
  .map-col { position: sticky; top: 76px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .route-line.is-drawing { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
  .route-flow, .vehicle, .pulse { display: none; }
  .is-entering .route-hit { animation: none; }
}
