/* aero — официальный-сдержанный стиль (белый фон, бордовый акцент, засечки в
   заголовках, много воздуха). Без внешних шрифтов/CDN — системные семейства. */
:root {
  --bg: #ffffff;
  --paper: #faf9f7;
  --ink: #1b1b1b;
  --muted: #6c6760;
  --line: #e4e0d9;
  --accent: #8a1538;            /* глубокий бордовый */
  --closed: #b3261e;            /* красный — ограничения */
  --partial: #946000;           /* янтарный — частично (затемнён до WCAG AA 4.5:1) */
  --open: #2e7d32;              /* зелёный — штатно */
  --serif: Georgia, "Times New Roman", "PT Serif", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }

/* Шапка */
.site-head { border-bottom: 3px solid var(--accent); background: var(--bg); }
.head-inner { display: flex; align-items: baseline; gap: 14px 18px; padding: 18px 20px; flex-wrap: wrap; justify-content: space-between; }
.brand { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--ink); letter-spacing: .3px; }
.brand:hover { text-decoration: none; }
.tagline { color: var(--muted); font-size: .95rem; margin-left: 10px; }
.indep { color: var(--muted); font-size: .8rem; margin: 0; align-self: center; }

/* Доступность: skip-link и визуально скрытый текст для скринридеров. */
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff;
  padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; text-decoration: none; }
.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; }

main.wrap { padding-top: 26px; padding-bottom: 40px; }
.intro h1 { font-family: var(--serif); font-size: 1.7rem; margin: 0 0 6px; font-weight: 700; }
.intro p { color: var(--muted); margin: 0 0 18px; }

/* Поиск */
.filter {
  width: 100%; padding: 11px 14px; font-size: 1rem; font-family: var(--sans);
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 18px; background: var(--paper);
}
.filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Сводка — цветные боксы (как в ИАС) */
.summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 4px; }
.s-box { padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .9rem; color: var(--muted); }
.s-box b { font-size: 1.4rem; margin-right: 4px; }
.s-closed { border-color: #e7b9b9; background: #fdf3f3; }
.s-closed b { color: var(--closed); }
.s-open { border-color: #c2e2cf; background: #f1f9f4; }
.s-open b { color: var(--open); }
.s-partial { border-color: #e7d2a6; background: #fdf7ec; }
.s-partial b { color: var(--partial); }
.s-updated { margin-left: auto; color: var(--muted); font-size: .8rem; }

/* Заголовки групп (логическая группировка) */
.group-h { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; margin: 22px 0 10px; }
.gh-closed { color: var(--closed); }
.gh-open { color: var(--open); }

/* Сетка карточек */
.grid { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-left: 5px solid var(--line);
  border-radius: 8px; transition: box-shadow .15s, transform .15s; }
.card a { display: block; padding: 12px 14px; color: var(--ink); }
.card a:hover { text-decoration: none; }
.card a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.10); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.badge { font-size: .76rem; font-weight: 700; letter-spacing: .3px; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap; color: #fff; }
.c-name { font-weight: 600; display: block; }
.c-region { display: block; color: var(--muted); font-size: .82rem; margin: 1px 0 4px; }
.c-status { display: block; font-size: .85rem; }
.c-ago { color: var(--muted); font-size: .76rem; }

/* Тонировка по статусу — открыт/закрыт читаются с первого взгляда */
.st-closed { border-left-color: var(--closed); background: #fdf3f3; }
.st-closed .badge { background: var(--closed); }
.st-closed .c-status { color: var(--closed); }
.st-partial { border-left-color: var(--partial); background: #fdf7ec; }
.st-partial .badge { background: var(--partial); }
.st-partial .c-status { color: var(--partial); }
.st-open { border-left-color: var(--open); background: #f1f9f4; }
.st-open .badge { background: var(--open); }
.st-open .c-status { color: var(--open); }
.card.hidden { display: none; }

/* Страница аэропорта */
.back { margin: 0 0 14px; font-size: .92rem; }
.hero { border: 1px solid var(--line); border-top: 4px solid var(--line);
  border-radius: 10px; padding: 22px 24px; background: var(--paper); margin-bottom: 22px; }
.hero.st-closed { border-top-color: var(--closed); }
.hero.st-partial { border-top-color: var(--partial); }
.hero.st-open { border-top-color: var(--open); }
.hero h1 { font-family: var(--serif); font-size: 1.8rem; margin: 0; }
.hero-region { color: var(--muted); margin: 4px 0 12px; }
.hero-status { font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; }
.hero-since { color: var(--muted); margin: 0 0 8px; }
.hero-src { margin: 8px 0 0; font-size: .9rem; }

.block { border-top: 1px solid var(--line); padding: 18px 0; }
.block h2 { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 10px; font-weight: 700; }
.block p { margin: 0 0 8px; }
.warn { color: var(--closed); font-weight: 600; }
.muted { color: var(--muted); font-size: .9rem; }
.disclaimer { color: var(--muted); font-size: .82rem; font-style: italic; }

/* Мини-график по часам */
.hours { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin: 6px 0 2px; }
.hours .hbar { flex: 1; min-height: 2px; background: var(--line); border-radius: 2px 2px 0 0; }
/* Высота баров классом (CSP-safe, без inline style). hb0..hb100 шаг 5 — общие для .hbar и .mbar. */
.hb0{height:2px}.hb5{height:5%}.hb10{height:10%}.hb15{height:15%}.hb20{height:20%}
.hb25{height:25%}.hb30{height:30%}.hb35{height:35%}.hb40{height:40%}.hb45{height:45%}
.hb50{height:50%}.hb55{height:55%}.hb60{height:60%}.hb65{height:65%}.hb70{height:70%}
.hb75{height:75%}.hb80{height:80%}.hb85{height:85%}.hb90{height:90%}.hb95{height:95%}.hb100{height:100%}
.hours .hbar.peak { background: var(--accent); }
.hours.chance .hbar { background: #cfe3d0; }      /* шанс вылета — зелёным (открыто=хорошо) */
.hours.chance .hbar.best { background: var(--open); }
.hours-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; margin-bottom: 8px; }

/* Помесячный график (/stats) */
.months { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin: 8px 0 2px; }
.months .mbar { flex: 1; min-height: 3px; background: var(--accent);
  border-radius: 3px 3px 0 0; position: relative; opacity: .85; }
.months .mbar span { position: absolute; top: -16px; left: 0; right: 0; text-align: center;
  font-size: .62rem; color: var(--muted); }
.months-axis { display: flex; gap: 4px; color: var(--muted); font-size: .62rem; }
.months-axis span { flex: 1; text-align: center; }

/* Топ-списки */
.toplist { margin: 0; padding-left: 1.4em; }
.toplist li { padding: 3px 0; }

/* Таймлайн истории */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 7px 0 7px 16px; border-left: 3px solid var(--line); position: relative; }
.timeline .tl-when { color: var(--muted); font-size: .85rem; margin-right: 10px; font-variant-numeric: tabular-nums; }
.tl-closed { border-left-color: var(--closed); }
.tl-partial { border-left-color: var(--partial); }
.tl-open { border-left-color: var(--open); }

/* Подвал */
.site-foot { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 0; background: var(--paper); }
.site-foot p { margin: 0 0 6px; color: var(--muted); font-size: .86rem; }
.notfound { text-align: center; }

/* Гистограмма распределения задержек (ширина КЛАССОМ wb0..wb100, CSP-safe) */
.dist { margin: 8px 0 2px; }
.dist-row { display: grid; grid-template-columns: 96px 1fr 34px; align-items: center;
  gap: 8px; margin: 4px 0; font-size: .86rem; }
.dist-label { color: var(--muted); }
.dist-track { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; height: 15px; }
.dist-bar { display: block; height: 15px; border-radius: 3px; min-width: 2px; background: var(--accent); }
.dist-bar.b-ontime { background: var(--open); }
.dist-bar.b-small { background: #cdbf6a; }
.dist-bar.b-mid { background: var(--partial); }
.dist-bar.b-big { background: var(--closed); }
.dist-bar.b-cancel { background: #7a1a16; }
.dist-bar.b-tod { background: var(--muted); }   /* нейтральный графит — без danger-коннотации (Codex) */
.dist-count { text-align: right; font-variant-numeric: tabular-nums; }
.wb0{width:2px}.wb5{width:5%}.wb10{width:10%}.wb15{width:15%}.wb20{width:20%}
.wb25{width:25%}.wb30{width:30%}.wb35{width:35%}.wb40{width:40%}.wb45{width:45%}
.wb50{width:50%}.wb55{width:55%}.wb60{width:60%}.wb65{width:65%}.wb70{width:70%}
.wb75{width:75%}.wb80{width:80%}.wb85{width:85%}.wb90{width:90%}.wb95{width:95%}.wb100{width:100%}

/* Поиск по номеру рейса */
.flight-search { display: flex; gap: 8px; margin: 6px 0 4px; }
.flight-search input { flex: 1; padding: 10px 13px; font-size: 1rem; font-family: var(--sans);
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.flight-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.flight-search button { padding: 10px 18px; font-size: 1rem; font-family: var(--sans); cursor: pointer;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; white-space: nowrap; }
.flight-search button:hover { opacity: .92; }
/* Подзаголовок «Совпало с ограничениями/погодой» */
.overlap-h { font-family: var(--serif); font-weight: 700; color: var(--accent); margin: 16px 0 4px; }
/* Текущая погода (METAR) под hero */
.weather-now { color: var(--muted); font-size: .92rem; margin: 2px 0 16px; }
.weather-now b { color: var(--ink); }

/* Кнопка/CTA Telegram-бота — в «сдержанном» бордовом стиле (без telegram-синего). */
.bot-btn { align-self: center; display: inline-flex; align-items: center; white-space: nowrap;
  padding: 7px 13px; border: 1px solid var(--accent); border-radius: 8px;
  color: var(--accent); font-size: .9rem; font-weight: 600; }
.bot-btn:hover { background: var(--accent); color: #fff; text-decoration: none; }
.bot-cta { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  padding: 11px 16px; border: 1px solid var(--accent); border-radius: 10px;
  color: var(--accent); font-weight: 600; }
.bot-cta:hover { background: var(--accent); color: #fff; text-decoration: none; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }   /* одна колонка — крупнее тач-цель, без обрезки */
  .brand { font-size: 1.25rem; }
  .hero h1 { font-size: 1.45rem; }
  .indep { font-size: .76rem; }
  .bot-btn { font-size: .82rem; padding: 6px 10px; }
  .bot-cta { display: flex; justify-content: center; text-align: center; }
}
