/* ------------------------------------------------------------------ */
/* Шрифт Inter — локальные vendor-файлы (web/vendor/fonts/), без CDN.  */
/* Начертания: 400 regular, 500 medium, 600 semibold, 700 bold.        */
/* ------------------------------------------------------------------ */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/inter-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/inter-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/vendor/fonts/inter-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/vendor/fonts/inter-cyrillic-700.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  /* Фон и панели осветлены на одну ступень: карта теперь светлая, и прежние
     почти чёрные поверхности давали слишком резкий контраст с подложкой. */
  --bg: #0e1220;
  --panel-bg: #181f2b;
  --border: #232c3b;
  --accent: #e8a13c;
  --water: #5ec8e5;
  --gas: #7fd1a8;
  --injection: #7d93a8;
  --text: #e8ecf2;
  --muted: #8b95a5;
  /* Цвет выбора скважины (подсветка строки в списке). На карте тот же оттенок
     задан в app.js (SELECTION_COLOR) — Leaflet красит SVG, а не CSS. */
  --selection: #2dd4bf;
  /* Подложка карты: пока тайлы грузятся, контейнер показывает этот цвет,
     а не тёмный фон страницы (иначе на первом кадре видна «чёрная дыра»). */
  --map-bg: #e9e8e4;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: 0.18s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Атрибут hidden должен побеждать display из классов (.skeleton-block, .error-block
   и т. п.): иначе скелетон остаётся видимым поверх загруженных данных. */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: #f0b96b;
}

/* ------------------------------------------------------------------ */
/* Шапка                                                               */
/* ------------------------------------------------------------------ */
/* Шапка: слева логотип с подписью страницы на одной строке, пилюли меню —
   строго по центру, третья колонка пустая. Симметричные колонки 1fr/auto/1fr
   держат меню в центре независимо от ширины левой группы. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 2000;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px 16px;
  min-height: 52px;
  padding: 6px 18px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
}

/* Левая группа: капля-маркер + «GeoPulse» + приглушённая подпись на одной строке. */
.brand-group {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  width: 18px;
  height: 18px;
  color: var(--accent);
  fill: currentColor;
  flex: none;
}

.topbar .subtitle {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  gap: 6px;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  background: #1f2836;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.topnav a:hover {
  color: var(--text);
  background: #2a3444;
}

.topnav a.active {
  color: var(--accent);
  background: rgba(232, 161, 60, 0.12);
}

/* Подпись уступает место центрированному меню: на средней ширине она скрывается,
   иначе левая группа наезжает на пилюли. */
@media (max-width: 1120px) {
  .topbar .subtitle {
    display: none;
  }
}

/* На мобильной ширине: компактные пилюли, привычный flex-ряд шапки. */
@media (max-width: 720px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-group {
    gap: 10px;
  }

  .topnav {
    margin-left: auto;
    flex-wrap: wrap;
  }

  .topnav a {
    padding: 6px 11px;
    font-size: 13px;
  }
}

/* ------------------------------------------------------------------ */
/* Карта                                                               */
/* ------------------------------------------------------------------ */
#map {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 0;
  background: var(--map-bg);
  isolation: isolate;
}

.leaflet-container {
  background: var(--map-bg);
  font-family: var(--font);
}

/* Leaflet двигает панели и карту сам (transform в кадре flyTo/zoom).
   Любые наши transition/animation на этих контейнерах дают «дрожание»
   и конфликт с анимацией масштаба — поэтому здесь их нет вообще.
   Анимируемые элементы внутри панелей (.leaflet-zoom-animated) не затрагиваются. */
#map,
.leaflet-container,
.leaflet-map-pane,
.leaflet-pane {
  transition: none;
  animation: none;
}

/* Контролы Leaflet находятся внутри #map, который начинается сразу под sticky-шапкой:
   штатный отступ .leaflet-top (top: 0 + margin 10px) не требует дополнительного смещения. */

.leaflet-bar a {
  background: var(--panel-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background: #1f2836;
  color: var(--text);
}

/* Атрибуция — единственный элемент Leaflet на самой карте: на светлых тайлах
   тёмная плашка выглядит инородно, поэтому светлая с тёмным текстом. */
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.82);
  color: #4a5566;
}

.leaflet-control-attribution a {
  color: #2f3b4b;
}

/* ------------------------------------------------------------------ */
/* Появление данных карты после прилёта (fade-in 400 мс)                */
/* ------------------------------------------------------------------ */
/* Пока на #map висит data-pending (идёт вводный полёт), панели слоёв
   прозрачны: с высоты космоса видна только карта, а не пятно из слитых
   маркеров. Снятие класса даёт плавное проявление. Анимируется только
   opacity — transform панелей принадлежит Leaflet (flyTo/zoom). */
#map .leaflet-overlay-pane,
#map .leaflet-trajectories-pane,
#map .leaflet-bottomholes-pane,
#map .leaflet-marker-pane,
#map .leaflet-tooltip-pane {
  transition: opacity 400ms ease;
}

#map.data-pending .leaflet-overlay-pane,
#map.data-pending .leaflet-trajectories-pane,
#map.data-pending .leaflet-bottomholes-pane,
#map.data-pending .leaflet-marker-pane,
#map.data-pending .leaflet-tooltip-pane {
  opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Подписи скважин у устьев (tooltip Leaflet, зум ≥ 13)                */
/* ------------------------------------------------------------------ */
/* Подложка светлая, текст тёмный — под светлую подложку карты. */
.well-label {
  background: rgba(255, 255, 255, 0.92);
  color: #2a3441;
  border: 1px solid rgba(35, 44, 59, 0.16);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 1px 4px rgba(16, 22, 32, 0.18);
}

/* Стрелка-указатель не нужна: подписи стоят колонкой справа от куста устьев. */
.well-label::before {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Подписи забоев (tooltip Leaflet, зум ≥ 13)                          */
/* ------------------------------------------------------------------ */
/* Глубина забоя — второстепенная подпись: мельче и приглушённее подписи
   устья, чтобы не спорить с ней на светлой подложке. */
.bottomhole-label {
  background: rgba(255, 255, 255, 0.88);
  color: #6b7280;
  border: 1px solid rgba(35, 44, 59, 0.12);
  border-radius: 4px;
  padding: 0 5px;
  font-family: var(--font);
  font-size: 10px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(16, 22, 32, 0.12);
}

/* Стрелка не нужна: подпись стоит справа от незалитого кружка забоя. */
.bottomhole-label::before {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Панель скважины                                                     */
/* ------------------------------------------------------------------ */
.panel {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 1200;
  width: 400px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 76px);
  display: none;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  /* Светлая карта под панелью: тень отделяет панель от тайлов. */
  box-shadow: 0 16px 40px rgba(6, 10, 16, 0.46), 0 2px 8px rgba(6, 10, 16, 0.28);
  overflow: hidden;
}

.panel.open {
  display: flex;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head button {
  flex: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition);
}

.panel-head button:hover {
  color: var(--text);
}

.panel-body {
  position: relative;
  height: 320px;
  padding: 12px 14px;
}

.panel-chart {
  position: absolute;
  inset: 0;
}

.panel-chart-skeleton {
  position: absolute;
  inset: 12px 14px;
}

/* Тело панели прокручивается целиком: график + сводка + список скважин
   выше экрана, а шапка с крестиком остаётся на месте. */
.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Сводка скважины под графиком: поля, которые раньше были в попапе Leaflet. */
.well-summary {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}

.summary-list {
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
}

.summary-row dt {
  color: var(--muted);
}

.summary-row dd {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.summary-report {
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Список скважин под сводкой: пункт = выбор скважины. Устья куста лежат в пятне
   ~10 м и на доступных зумах не разлепляются, поэтому список — гарантированный
   доступ к каждой скважине. */
.panel-list-block {
  padding: 8px 8px 12px;
  border-top: 1px solid var(--border);
}

.panel-section-title {
  padding: 0 8px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.well-list {
  list-style: none;
  display: grid;
  gap: 2px;
}

.well-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.well-row:hover {
  background: #1f2836;
}

/* Выбранная строка — тем же бирюзовым цветом, что подсветка на карте. */
.well-row[aria-pressed="true"] {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.45);
}

.well-row-name {
  font-weight: 500;
  color: var(--text);
}

.well-row-value {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.well-row[aria-pressed="true"] .well-row-value {
  color: var(--text);
}

.panel-error {
  padding: 0 14px 12px;
  color: #e8a13c;
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Общие компоненты (карточки, кнопки, ошибки, скелетоны)              */
/* ------------------------------------------------------------------ */
.card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #0e1220;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter var(--transition), background var(--transition), color var(--transition);
}

.button:hover {
  filter: brightness(1.08);
  color: #0e1220;
}

.button-secondary {
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: #1f2836;
  filter: none;
  color: var(--text);
}

.error {
  padding: 12px 14px;
  color: #e8a13c;
  font-size: 14px;
  background: rgba(232, 161, 60, 0.08);
  border: 1px solid rgba(232, 161, 60, 0.35);
  border-radius: 8px;
}

/* Блок ошибки с действием: текст слева, кнопка «Повторить» справа. */
.error-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.error-block p {
  flex: 1 1 260px;
  min-width: 0;
}

/* Скелетон-загрузка вместо «прыгающего» контента. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--border);
  border-radius: 6px;
  min-height: 14px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: gp-shimmer 1.4s infinite;
}

@keyframes gp-shimmer {
  100% {
    transform: translateX(100%);
  }
}

