/* ============================================================
   benz.ink — раздел «Эфир»: страна в прямом эфире, с запада на восток.

   Сигнатура раздела — местное время каждой точки, набранное моноширинным как на
   приборе, и лента долгот под плеером. Превью у живых потоков нет, а врать картинками
   мы не хотим, поэтому карточка держится на времени, городе и одном слове о типе эфира.
   Палитра и шрифты — только токены app.css; чужих CDN здесь нет и не будет.
   ============================================================ */

/* Переключение разделов: app.css гасит по два раздела на двух вкладках,
   здесь добавляем правила для третьей — «Эфир». */
html[data-tab="svyaz"]   .view-efir { display: none; }
html[data-tab="toplivo"] .view-efir { display: none; }
html[data-tab="efir"]    .view-fuel { display: none; }
html[data-tab="efir"]    .view-link { display: none; }

.view-efir {
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--bg);
}

.efir { max-width: 1180px; margin: 0 auto; padding: 0 0 36px; }

/* ---------- сцена: плеер + описание + лента долгот. На телефоне липнет к верху ---------- */
.efir-stage {
  position: sticky; top: 0; z-index: 3;
  background: var(--bg);
  padding: 10px 10px 8px;
  box-shadow: 0 10px 18px -14px rgba(0,0,0,.6);
}
.efir-player {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #000; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line);
}
.efir-player video, .efir-player iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000;
}
.efir-overlay {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #d4d4d4;
  background: #000;
}
.efir-overlay .eyebrow { color: #8f8f8f; margin: 0; }
.efir-overlay p { margin: 0; font-size: 14px; max-width: 34ch; }
.efir-overlay .efir-acts { justify-content: center; margin-top: 6px; }
/* тонкая «строка развёртки» на время загрузки — единственная анимация кроме точки LIVE */
.efir-scan { width: 120px; height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; position: relative; }
.efir-scan::after {
  content: ""; position: absolute; left: -40%; top: 0; width: 40%; height: 100%;
  background: var(--color-accent); animation: efir-scan 1.1s linear infinite;
}
@keyframes efir-scan { to { left: 100%; } }

.efir-hud {
  position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; align-items: center;
  pointer-events: none; z-index: 2;
}
.efir-hud > span {
  font-family: var(--fm); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: rgba(0,0,0,.58); padding: 5px 9px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 6px; backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
}
.efir-live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-danger);
  box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: efir-live 1.7s ease-out infinite;
}
@keyframes efir-live {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
  70%  { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.efir-stalled::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
}
.efir-consent-note { color: #8f8f8f !important; font-size: 12px !important; }

.efir-now { padding: 12px 4px 0; }
.efir-now .eyebrow { margin-bottom: 5px; }
.efir-title { margin: 0; font-size: 20px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.efir-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.efir-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.efir-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.efir-btn:hover { border-color: var(--text-3); }
.efir-btn svg { width: 15px; height: 15px; fill: currentColor; }
.efir-btn.is-accent { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.efir-btn.is-accent:hover { background: var(--accent-strong); }
.efir-overlay .efir-btn { background: #161616; color: #fafafa; border-color: #333; }
.efir-overlay .efir-btn.is-accent { background: var(--color-accent); color: var(--color-accent-fg); }

/* ---------- лента долгот: засечка на каждую точку, текущая — бирюзовая ---------- */
.efir-lon { position: relative; height: 46px; margin: 10px 4px 0; }
.efir-lon::before {
  content: ""; position: absolute; left: 3%; right: 3%; top: 21px; height: 1px; background: var(--line-2);
}
.efir-lon-ticks { position: absolute; inset: 0; }
.efir-lon-ends {
  position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between;
  font-family: var(--fm); font-size: 10.5px; letter-spacing: .14em; color: var(--text-3); pointer-events: none;
}
/* left/width и --x (положение штриха внутри кнопки) считает media.js: области нажатия соседних
   засечек не перекрываются, а точки одного города сливаются в одну засечку-группу (is-group). */
.efir-tick {
  position: absolute; top: 6px; width: 18px; height: 30px; padding: 0; --x: 50%;
  background: none; border: 0; cursor: pointer; border-radius: 4px;
}
.efir-tick::before {
  content: ""; position: absolute; left: calc(var(--x) - 1px); top: 9px; width: 2px; height: 13px; border-radius: 1px;
  background: var(--text-3); transition: background .15s var(--ease), height .15s var(--ease), top .15s var(--ease);
}
.efir-tick.is-group::before { left: calc(var(--x) - 2px); width: 4px; }
.efir-tick:hover::before { background: var(--text); }
.efir-tick.is-off::before { opacity: .3; }
.efir-tick[aria-selected="true"]::before {
  background: var(--accent); top: 5px; height: 21px; width: 3px; left: calc(var(--x) - 1.5px);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.efir-tick.is-group[aria-selected="true"]::before { width: 5px; left: calc(var(--x) - 2.5px); }
.efir-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

/* ---------- инструменты: тип, поиск, округа ---------- */
.efir-side { padding-top: 6px; }
.efir-count { padding: 6px 14px 4px; margin: 0; }
.efir-tools { display: flex; gap: 8px; align-items: center; padding: 6px 10px 8px; }
.efir-seg {
  display: flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2);
  border: 1px solid var(--line); flex: 0 0 auto;
}
.efir-seg button {
  padding: 6px 11px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700;
  color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; transition: color .15s, background .15s;
}
.efir-seg button b { font-family: var(--fm); font-weight: 500; font-size: 11px; opacity: .75; }
.efir-seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-fg); }
.efir-seg button[aria-checked="true"] b { opacity: .9; }
.efir-search {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.efir-search svg { width: 16px; height: 16px; fill: var(--text-3); flex: 0 0 auto; }
.efir-search input {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; outline: none; color: var(--text);
  font-family: inherit; font-size: 16px;
}
.efir-search input::placeholder { color: var(--text-3); }
.efir-districts {
  display: flex; gap: 6px; overflow-x: auto; padding: 0 10px 10px; scrollbar-width: none;
}
.efir-districts::-webkit-scrollbar { display: none; }
.efir-districts button {
  flex: 0 0 auto; font-family: var(--fm); font-size: 11px; letter-spacing: .05em;
  padding: 7px 10px; border-radius: var(--r-pill); border: 1px solid var(--line);
  color: var(--text-2); background: var(--surface); display: inline-flex; gap: 6px; align-items: center;
  transition: border-color .15s, color .15s;
}
.efir-districts button b { font-weight: 500; opacity: .6; }
.efir-districts button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
.efir-districts button[aria-pressed="true"] b { opacity: .9; }

/* ---------- список: время | город и место | тип ---------- */
.efir-list { display: flex; flex-direction: column; padding: 0 10px; }
.efir-item {
  display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 0 12px; align-items: center;
  width: 100%; padding: 11px 10px; text-align: left; color: var(--text);
  border-top: 1px solid var(--line); border-radius: 0; background: none;
  transition: background .12s var(--ease);
}
.efir-item:first-child { border-top-color: transparent; }
.efir-item:hover { background: var(--surface); }
.efir-item[aria-selected="true"] { background: var(--accent-soft); border-radius: var(--r); border-top-color: transparent; }
.efir-item[aria-selected="true"] + .efir-item { border-top-color: transparent; }
.efir-time { display: flex; flex-direction: column; gap: 4px; }
.efir-time .mono { font-size: 20px; font-weight: 500; letter-spacing: -.02em; line-height: 1; color: var(--text); }
.efir-tz { font-family: var(--fm); font-size: 10px; letter-spacing: .08em; color: var(--text-3); }
.efir-item[aria-selected="true"] .efir-time .mono { color: var(--accent-ink); }
.efir-meta { min-width: 0; }
.efir-city { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.efir-region { font-size: 11.5px; font-weight: 500; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.efir-place { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.efir-kind {
  font-family: var(--fm); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap;
}
.efir-item[aria-selected="true"] .efir-kind { border-color: var(--accent); color: var(--accent-ink); }
.efir-empty { padding: 28px 16px; text-align: center; color: var(--text-2); font-size: 14px; }
.efir-empty .eyebrow { margin-bottom: 8px; }

/* ---------- десктоп: сцена слева и липкая, список справа ---------- */
@media (min-width: 960px) {
  .efir { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 0 28px; padding: 18px 18px 40px; align-items: start; }
  .efir-stage { top: 18px; padding: 0; box-shadow: none; }
  .efir-title { font-size: 26px; }
  .efir-side { padding-top: 0; }
  .efir-count { padding-left: 4px; }
  .efir-tools { padding-left: 0; padding-right: 0; }
  .efir-districts { padding-left: 0; padding-right: 0; }
  .efir-list { padding: 0; }
}

/* ---------- телефон и планшет: список прокрутили — сцена сжимается до плеера и одной строки ---------- */
@media (max-width: 959px) {
  .efir-stage.is-compact .efir-lon,
  .efir-stage.is-compact .efir-now .eyebrow,
  .efir-stage.is-compact .efir-sub,
  .efir-stage.is-compact .efir-src { display: none; }
  .efir-stage.is-compact .efir-now { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
  .efir-stage.is-compact .efir-title {
    flex: 1 1 auto; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .efir-stage.is-compact .efir-acts { flex: 0 0 auto; margin-top: 0; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 520px) {
  .efir-count-tail { display: none; }
  .efir-stage { padding: 8px 8px 6px; }
  .efir-title { font-size: 18px; }
  .efir-sub { font-size: 13px; }
  .efir-lon { height: 40px; margin-top: 6px; }
  .efir-lon::before { top: 18px; }
  .efir-tick { top: 3px; }
  .efir-item { grid-template-columns: 56px minmax(0, 1fr) auto; padding: 10px 8px; }
  .efir-time .mono { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .efir-live::before { animation: none; }
  .efir-scan::after { animation: none; left: 30%; }
  .efir-tick::before, .efir-item, .efir-btn { transition: none; }
}
