/* ============================================================
   «Почему стоит стать диспетчером» — слайдер с глобусом (21.10.2026).
   Перенос компонента globe-feature-section (ruixen.ui, 21st.dev) на
   чистый CSS+JS: большая скруглённая карточка, текст слева, справа
   вращающийся глобус (cobe, js/vendor). Внутри — 6 слайдов: стрелки,
   точки, свайп и автопереключение (js/why-slider.js).
   Цвета — только токены (css/tokens.css), они сами переворачиваются в
   светлой теме; что токенами не выразить — правила :root[data-theme].
   ============================================================ */

.why-slider {
  --why-dur: 6.5s;            /* сколько стоит один слайд при автопрокрутке */
  --why-orange: #f97316;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 28px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(120% 90% at 100% 100%, rgba(var(--brand-rgb), .14), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015));
  box-shadow: var(--shadow-card);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: left;
  margin-bottom: 32px;        /* отступ до блока «Рынок грузоперевозок» */
}
/* Шапка секции ближе к карточке — секция должна помещаться в один экран */
.profession-section .section-header { margin-bottom: 26px; }
:root[data-theme="light"] .why-slider {
  --why-orange: #c2410c;
  border-color: var(--border-subtle);
  background:
    radial-gradient(120% 90% at 100% 100%, rgba(var(--brand-rgb), .10), transparent 55%),
    linear-gradient(160deg, #f8fafc, #e9eef5);
}

/* ── Глобус: справа, срезан краем карточки, как в образце ── */
.why-globe {
  position: absolute;
  z-index: 0;
  right: -100px;
  bottom: -170px;
  width: 500px;
  aspect-ratio: 1;
  pointer-events: none;
}
.why-globe canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .9s ease;
  contain: layout paint size;
  pointer-events: auto;
  cursor: grab;
  touch-action: pan-y;
}
.why-globe.is-ready canvas { opacity: 1; }
.why-globe canvas:active { cursor: grabbing; }
/* Без WebGL — мягкий круг-заглушка, чтобы правая часть не пустовала */
.why-globe.is-fallback {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(var(--brand-rgb), .22), rgba(var(--brand-rgb), .04) 60%, transparent 70%);
}

/* ── Текстовая часть ── */
.why-body {
  position: relative;
  z-index: 1;
  width: min(100%, 530px);
  padding: 26px 0 22px 36px;
}
/* Счётчик «01 / 06» — в строке с меткой слайда, отдельной строки не занимает */
.why-top {
  position: absolute;
  z-index: 2;
  top: 26px;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
}
.why-count {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.why-count b { color: var(--text-primary); font-weight: 800; }

/* Слайды лежат в одной ячейке сетки: высота = самому высокому, ничего не прыгает */
.why-viewport {
  display: grid;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.why-slide {
  grid-area: 1 / 1;
  min-width: 0;
  visibility: hidden;
  transform: translateX(100%);
  opacity: 0;
}
.why-slide.is-active { visibility: visible; transform: none; opacity: 1; }
/* Без JS виден первый слайд — остальные тексты всё равно в разметке (для поиска) */

.why-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--brand-ink, var(--brand));
  background: rgba(var(--brand-rgb), .10);
  border: 1px solid rgba(var(--brand-rgb), .30);
}
.why-chip svg {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(var(--brand-rgb), .16);
  flex: none;
}

.why-title {
  margin: 12px 0 0;
  font-size: clamp(19px, 2.1vw, 23px);
  font-weight: 600 !important;          /* main.css задаёт h3 800/1.4 с !important */
  line-height: 1.3 !important;
  letter-spacing: -.3px !important;
  color: var(--text-primary) !important;
}
.why-title .why-accent { color: var(--brand-ink, var(--brand)); font-weight: 800; }
.why-title .why-muted { color: var(--text-muted); font-weight: 500; }

.why-points {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.why-points li {
  position: relative;
  padding-left: 26px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.why-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(var(--brand-rgb), .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306b6d4' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 10px no-repeat;
}
:root[data-theme="light"] .why-points li::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b5c74' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}
.why-points b { color: var(--text-primary); font-weight: 700; }

.why-note {
  margin: 10px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--why-orange);
  font-size: 12.5px !important;         /* main.css: p { 18px; белый } с !important */
  line-height: 1.45 !important;
  color: var(--text-muted) !important;
}

/* ── Низ: кнопка + управление ── */
.why-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
}
.why-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  color: var(--surface-base);
  background: var(--text-primary);
  transition: transform .2s ease, box-shadow .2s ease;
}
.why-cta svg { width: 16px; height: 16px; transition: transform .2s ease; }
.why-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(var(--brand-rgb), .28); }
.why-cta:hover svg { transform: translateX(3px); }

.why-nav { display: flex; align-items: center; gap: 8px; }
.why-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--glass-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.why-btn:hover { border-color: rgba(var(--brand-rgb), .6); background: rgba(var(--brand-rgb), .12); }
.why-btn svg { width: 16px; height: 16px; }
.why-btn--play { width: 32px; height: 32px; }
.why-btn--play svg { width: 12px; height: 12px; }
.why-btn--play .i-play { display: none; }
.why-slider.is-paused .why-btn--play .i-play { display: block; }
.why-slider.is-paused .why-btn--play .i-pause { display: none; }

.why-dots { display: flex; align-items: center; }
/* Кнопка-точка крупнее, чем видимая полоска: по точкам надо попадать пальцем */
.why-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: width .35s ease;
}
.why-dot.is-active { width: 40px; }
.why-dot i {
  position: relative;
  display: block;
  width: calc(100% - 10px);
  height: 8px;
  border-radius: 100px;
  overflow: hidden;
  background: var(--border-strong);
  transition: background .2s ease;
}
.why-dot:hover i { background: rgba(var(--brand-rgb), .5); }
.why-dot.is-active i { background: rgba(var(--brand-rgb), .22); }
/* Заполнение активной точки = таймер автопрокрутки: по его animationend идёт
   следующий слайд, поэтому пауза (наведение, касание, кнопка) — это просто
   animation-play-state: paused, и таймер с полоской не расходятся никогда. */
.why-dot i::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--brand);
}
.why-dot.is-active i::after { transform: scaleX(1); }
.why-slider.is-auto .why-dot.is-active i::after { animation: whyFill var(--why-dur) linear both; }
.why-slider.is-hold .why-dot.is-active i::after,
.why-slider.is-paused .why-dot.is-active i::after { animation-play-state: paused; }
@keyframes whyFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Общие правила кнопок сайта (interactive-feedback.css: подъём, тень, overflow)
   здесь не нужны — у стрелок и точек своё поведение */
.why-slider button:hover,
.why-slider button:active { transform: none; filter: none; box-shadow: none; }
.why-slider .why-btn:active { transform: scale(.94); }
.why-slider .why-dot { overflow: visible; }

.why-btn:focus-visible,
.why-dot:focus-visible,
.why-cta:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ── Телефон: глобус встаёт «горизонтом» над текстом ── */
@media (max-width: 720px) {
  .why-slider { border-radius: 22px; }
  .why-globe {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 118px;
    aspect-ratio: auto;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 72%, transparent);
    mask-image: linear-gradient(#000 72%, transparent);
  }
  .why-globe-box {
    position: absolute;
    left: 50%;
    top: -22px;
    width: 300px;
    height: 300px;
    transform: translateX(-50%);
  }
  .why-globe.is-fallback { border-radius: 0; background: radial-gradient(60% 100% at 50% 100%, rgba(var(--brand-rgb), .2), transparent 70%); }
  .why-body { width: 100%; padding: 0 16px 16px; }
  .why-top { top: 0; right: 16px; }
  .why-title { font-size: 17.5px; margin-top: 10px; }
  .why-points { margin-top: 10px; }
  .why-points li { font-size: 13.5px; }
  .why-foot { margin-top: 14px; }
  .why-cta { order: 2; width: 100%; justify-content: center; }
  .why-nav { order: 1; width: 100%; justify-content: space-between; }
  .why-btn { width: 32px; height: 32px; }
  .why-btn--play { width: 30px; height: 30px; }
  .why-dot { width: 16px; }
  .why-dot.is-active { width: 34px; }
  /* interactive-feedback.css даёт на телефоне каждой кнопке min-width 44px:
     шесть точек по 44px плюс стрелки не влезали, и «вперёд» с паузой уезжали
     за правый край карточки. Тройной селектор — чтобы перебить
     button:not(…):not(…) (0,2,1), который подключён позже. Палец попадает:
     у точки высота 28px, у стрелок 30–32px. */
  .why-slider .why-nav .why-btn,
  .why-slider .why-nav .why-dot { min-width: 0; min-height: 0; }
}
@media (min-width: 721px) {
  .why-globe-box { width: 100%; height: 100%; }
}
@media (min-width: 721px) and (max-width: 900px) {
  .why-globe { right: -190px; bottom: -180px; width: 480px; }
  .why-body { width: min(100%, 500px); padding-left: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .why-dot, .why-cta, .why-cta svg, .why-globe canvas { transition: none; }
}
