/* station-bilet.ru — дизайн-система */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --ink: #0e1a2b;
  --ink-2: #3d4b5f;
  --muted: #66758a;
  --line: #e2e7f0;
  --brand: #2153d9;
  --brand-600: #1a45b8;
  --brand-50: #edf2ff;
  --brand-100: #dbe5ff;
  --suburban: #0b8f4f;
  --suburban-50: #e5f5ec;
  --train: #5a43d4;
  --train-50: #efecff;
  --express: #c25e05;
  --express-50: #fff0e2;
  --now: #ff6b1a;
  --now-50: #fff3eb;
  --ok: #0f7a40;
  --ok-50: #e3f4ea;
  --closed: #b42318;
  --closed-50: #fdeceb;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(14, 26, 43, .06);
  --shadow: 0 1px 2px rgba(14, 26, 43, .05), 0 8px 28px rgba(14, 26, 43, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; }
h2, .h2 { font-size: clamp(21px, 2.6vw, 26px); font-weight: 750; }
h3, .h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 28px; height: 28px; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 820px; }
/* Широкие экраны: контейнер 1320 px (было 1200 - «узко» по аудиту); сетки получают колонку - см. .grid */
@media (min-width: 1440px) {
  .container { max-width: 1320px; }
  .container.narrow { max-width: 820px; }
}
@media (min-width: 768px) { .container { padding: 0 24px; } }

/* --- Шапка ----------------------------------------------------------------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
/* Логотип: билет с рельсами и красным компостером; текст - «station» тонкое, «bilet» жирное синее */
.logo { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.logo:hover { text-decoration: none; color: var(--ink); }
.logo-mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 2px 6px rgba(33, 83, 217, .28)); transition: transform .2s; }
.logo-mark svg { width: 40px; height: 40px; display: block; }
.logo:hover .logo-mark { transform: translateY(-1px) rotate(-3deg); }
/* надпись капителью: «STATION» тёмным, «BILET» синим, плотный трекинг - как станционная табличка */
.logo-text { display: inline-flex; align-items: baseline; font-size: 24px; line-height: 1; font-weight: 800;
  text-transform: uppercase; letter-spacing: .03em; }
.logo-w1 { color: var(--ink); }
.logo-w2 { color: var(--brand); margin-left: .08em; }
.logo-tld { font-size: .6em; font-weight: 700; color: var(--muted); margin-left: 3px; letter-spacing: .02em; text-transform: none;
  align-self: flex-end; padding-bottom: 1px; }
@media (max-width: 599px) {
  .logo-mark, .logo-mark svg { width: 34px; height: 34px; }
  .logo-text { font-size: 19px; }
}
.header-search { position: relative; flex: 1 1 320px; max-width: 520px; order: 3; width: 100%; }
@media (min-width: 900px) {
  .header-search { order: 0; width: auto; margin-left: auto; }
}
@media (max-width: 899px) { .header-search { flex-basis: 100%; max-width: none; } }
@media (max-width: 599px) {
  .header-inner { gap: 10px; min-height: 56px; }
  .header-search input { height: 42px; }
}

/* --- Поиск ------------------------------------------------------------------- */

.header-search .icon, .hero-search .icon, .filter-input .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.header-search input, .filter-input input {
  width: 100%; height: 44px; padding: 0 14px 0 42px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font: inherit; color: var(--ink); transition: border-color .15s, background .15s;
}
.header-search input:focus, .filter-input input:focus, .hero-search input:focus {
  outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-50);
}
.filter-input { position: relative; display: block; min-width: 220px; flex: 1 1 220px; max-width: 340px; }
.filter-input input { height: 40px; background: var(--surface); }

.suggest {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 420px; overflow-y: auto;
}
.suggest a { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: var(--radius-xs); color: var(--ink); }
.suggest a:hover, .suggest .is-active a { background: var(--brand-50); text-decoration: none; }
.suggest .icon { position: static; transform: none; color: var(--brand); }
.suggest b { display: block; font-weight: 650; }
.suggest small { display: block; color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px;
  border: 0; border-radius: var(--radius-sm); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }

/* --- Главная ------------------------------------------------------------------ */

.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(33, 83, 217, .14), transparent 60%),
    linear-gradient(180deg, var(--brand-50), var(--bg));
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 18px; height: 10px; opacity: .35;
  background:
    linear-gradient(var(--brand-100), var(--brand-100)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--brand-100), var(--brand-100)) 0 8px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--brand-100) 0 3px, transparent 3px 22px);
}
.hero-inner { padding-top: 48px; padding-bottom: 64px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin-bottom: 14px; }
.hero-lead { font-size: 18px; color: var(--ink-2); }
.hero-search { position: relative; display: flex; gap: 10px; margin: 26px 0 12px; }
.hero-search input {
  flex: 1; min-width: 0; height: 58px; padding: 0 16px 0 48px; font: inherit; font-size: 18px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.hero-search .btn { height: 58px; border-radius: var(--radius); padding: 0 28px; }
.hero-search .icon { left: 16px; width: 22px; height: 22px; }
.hero-search-sm input, .hero-search-sm .btn { height: 50px; font-size: 16px; }
.hero-search .suggest { right: auto; width: 100%; }
@media (max-width: 560px) { .hero-search .btn { padding: 0 16px; } .hero-search input { font-size: 16px; } }
.hero-examples { color: var(--muted); font-size: 15px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; list-style: none; padding: 0; margin: 22px 0 0; color: var(--ink-2); }
.hero-stats b { font-size: 22px; color: var(--ink); margin-right: 4px; }
.hero-widget { margin-top: 26px; }  /* виджет билетов внутри шапки, над линией «рельсов» */

.section { margin: 40px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.count { display: inline-block; min-width: 26px; padding: 1px 8px; margin-left: 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 700; text-align: center; vertical-align: middle; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 99px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600;
}
.chip span { color: var(--muted); font-weight: 600; font-size: 13px; }
a.chip:hover, button.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.letter-index { columns: 4 220px; column-gap: 28px; }
.letter-block { break-inside: avoid; margin-bottom: 18px; }
.letter { font-size: 22px; font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.letter-block ul, .columns { list-style: none; margin: 0; padding: 0; }
.letter-block li { padding: 2px 0; }
.columns { columns: 3 260px; column-gap: 28px; }
.columns li { padding: 3px 0; break-inside: avoid; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); vertical-align: middle; margin-left: 2px; }

/* --- Сетки и карточки ---------------------------------------------------------- */

.grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1440px) {  /* контейнер 1320 px: блоки станций - в 3 колонки, карточки вокзалов - в 4 */
  .grid-2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; }

.station-card { display: flex; align-items: center; gap: 14px; color: var(--ink); padding: 14px 16px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.station-card:hover { text-decoration: none; color: var(--ink); border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); }
.station-card.is-muted { opacity: .75; }
.station-card-body { flex: 1; min-width: 0; }
.station-card-body b { display: block; font-weight: 700; }
.station-card-body .muted { display: block; font-size: 14px; }
.station-card .chevron { color: var(--muted); }
.station-card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; flex: none; }
.type-train_station { background: var(--brand-50); color: var(--brand); }
.type-station, .type-crossing, .type-post, .type-checkpoint, .type-overtaking_point { background: var(--train-50); color: var(--train); }
.type-platform, .type-stop, .type-unknown { background: var(--suburban-50); color: var(--suburban); }

/* --- Страница станции / города -------------------------------------------------- */

.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 18px 0 0; padding: 0; font-size: 14px; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 6px 0 2px; color: var(--line); }
.page-head { padding: 18px 0 8px; }
.page-head h1 { margin-bottom: 12px; }
.type-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 0; color: var(--ink-2); }
.facts li { display: inline-flex; align-items: center; gap: 7px; }
.facts .icon { color: var(--muted); width: 18px; height: 18px; }
.prose { color: var(--ink-2); font-size: 17px; max-width: 78ch; }
.prose h2 { color: var(--ink); margin-top: 1.4em; }
.intro p { margin-bottom: .55em; }
.intro p:last-child { margin-bottom: 0; }
.intro { max-width: none; }  /* вводный текст — во всю ширину, как виджет и блоки станций ниже */


.widget-card { margin: 18px 0; }
.widget-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.widget-head .icon { color: var(--brand); }
.widget-head h2 { margin: 0 0 2px; }
.widget-head p { margin: 0; font-size: 14px; }
/* Скелет формы до загрузки виджета партнёра. Высоты - как у готовой формы, она перестраивается по своей ширине:
   от 728 px - одна строка (90 px), 576-727 - две (148 px), уже - четыре (264 px). Контейнер запросов - сам скелет,
   а не .widget-body: layout-containment у .widget-body сломал бы всплывающие окна партнёра (position: fixed). */
.widget-skeleton { container-type: inline-size; }
.ws-form, .ws-fail { height: 264px; padding: 16px 0; }
.ws-form { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); align-content: center; }
@container (min-width: 576px) {
  .ws-form, .ws-fail { height: 148px; }
  .ws-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 728px) {
  .ws-form, .ws-fail { height: 90px; }
  .ws-form { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
}
.ws-field {
  display: flex; align-items: center; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden;
  background: linear-gradient(90deg, var(--surface-2) 0, var(--surface) 45%, var(--surface-2) 90%) 0 0 / 300% 100%;
  animation: ws-shimmer 1.4s linear infinite;
}
.ws-btn {
  display: flex; align-items: center; justify-content: center; height: 48px; padding: 0 24px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 700; opacity: .55; white-space: nowrap;
}
@keyframes ws-shimmer { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .ws-field { animation: none; } }
.ws-fail { display: none; align-content: center; gap: 12px; }
.ws-fail p { margin: 0; color: var(--ink-2); }
.ws-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ws-actions .btn { height: 42px; padding: 0 18px; }
.widget-body.is-loaded .widget-skeleton { display: none; }
.widget-body.is-failed .ws-form, html:not(.js) .ws-form { display: none; }
.widget-body.is-failed .ws-fail, html:not(.js) .ws-fail { display: grid; }

.station-block { display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 16px; }
.station-block:target { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.station-block .type-badge { margin: 0; flex: none; }
.station-block .attribution { margin: 6px 0 0; font-size: 13px; }
.group-title { margin: 22px 0 12px; font-size: 18px; }
.small { font-size: 14px; }
.office-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.office-head h3 { margin: 0; font-size: 17px; }
.office-props { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.office-props li { display: flex; gap: 10px; align-items: flex-start; }
.office-props .icon { color: var(--muted); width: 18px; height: 18px; margin-top: 2px; }
.office-props .phone { font-weight: 700; white-space: nowrap; }
.hours { display: grid; gap: 2px; }
.hours b { display: inline-block; min-width: 64px; font-weight: 600; color: var(--ink-2); }
.office-status { flex: none; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.office-status.is-open { background: var(--ok-50); color: var(--ok); }
.office-status.is-closed { background: var(--closed-50); color: var(--closed); }

.map { position: relative; height: 380px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 640px) { .map { height: 300px; } }
.map-placeholder {
  position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font: inherit; font-weight: 700; color: var(--brand);
  background:
    linear-gradient(0deg, rgba(240, 243, 249, .85), rgba(240, 243, 249, .85)),
    repeating-linear-gradient(0deg, transparent 0 39px, var(--line) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, var(--line) 39px 40px);
}
.link-ext { font-weight: 600; font-size: 15px; }

/* --- Расписание (информер Яндекса) ------------------------------------------------ */

.informer-switch { margin-bottom: 12px; }
.informer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* Высота окна = высота информера Яндекса (замерено): она фиксирована для размера и раскладки, от станции не зависит.
   Раскладка переключается при ширине окна 599 px: уже - 504 px (5 строк) и 1144 px (15), шире - 299 и 639. */
.informer { container-type: inline-size; }
.informer iframe { display: block; width: 100%; height: 504px; border: 0; }
.informer iframe[data-size="15"] { height: 1144px; }
@container (min-width: 599px) {
  .informer iframe { height: 299px; }
  .informer iframe[data-size="15"] { height: 639px; }
}
.attribution { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* --- Поиск по сайту --------------------------------------------------------- */

.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* --- Подвал ------------------------------------------------------------------- */

.site-footer { margin-top: 64px; background: #0e1a2b; color: #b8c3d4; font-size: 15px; }
.site-footer a { color: #e6ecf5; }
.site-footer .muted { color: #8d9bb0; }
.footer-grid { display: grid; gap: 28px; padding-top: 40px; padding-bottom: 28px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.3fr .7fr 1.3fr; } }
.logo-footer .logo-text { font-size: 21px; }
.logo-footer .logo-w1 { color: #fff; }
.logo-footer .logo-w2 { color: #8fb0ff; }
.logo-footer .logo-tld { color: rgba(255, 255, 255, .55); }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-note p { margin-bottom: 10px; }
.footer-bottom { padding-top: 16px; padding-bottom: 24px; border-top: 1px solid rgba(255, 255, 255, .08); color: #8d9bb0; font-size: 14px; }

/* --- Кнопка «Наверх» ------------------------------------------------------------ */

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--brand); box-shadow: var(--shadow); cursor: pointer;
  display: grid; place-items: center; padding: 0;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top .icon { width: 22px; height: 22px; transform: rotate(-90deg); }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.to-top:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 640px) { .to-top { right: 12px; bottom: 12px; width: 42px; height: 42px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Страница станции */
.page-head .facts .type-badge { margin: 0; }
.station-block .more { margin-top: 4px; font-weight: 600; font-size: 14px; }
.services { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.services li { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }

/* Ссылка «Купить ЖД билеты» в шапке: на телефоне - в первой строке рядом с логотипом, поиск уходит во вторую */
.header-cta {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; margin-left: auto;
  border-radius: var(--radius-sm); background: var(--brand); color: #fff; font-weight: 700; white-space: nowrap;
}
.header-cta:hover { background: var(--brand-600); color: #fff; text-decoration: none; }
.header-cta.is-active { background: var(--brand-600); }
.header-cta .icon { width: 20px; height: 20px; }
@media (min-width: 900px) { .header-search + .header-cta { margin-left: 0; } }
@media (max-width: 599px) {
  .header-cta { height: 38px; padding: 0 12px; font-size: 14px; gap: 6px; }
  .header-cta .icon { width: 18px; height: 18px; }
}
@media (max-width: 359px) { .header-cta .icon { display: none; } }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Страница «Купить ЖД билеты» */
.page-tickets .lead { color: var(--ink-2); font-size: 17px; max-width: 78ch; margin: 0; }
.steps { margin: 0 0 .8em; padding-left: 1.3em; display: grid; gap: 6px; }
.hint { margin: 12px 0 0; font-size: 15px; }
