/* =========================================================
   attention-panel v2 — светлая версия (вариант 4b)

   Развёрнуто: «Свернуть ›» мелкой строкой, баннер «Дизайнерам интерьера»
   с логотипом TextileData, ниже «Акции и полезная информация»
   и два мессенджера строками.
   Свёрнуто (.td-panel.is-collapsed): плашка 60 px — шеврон «‹»,
   знак TextileData, Telegram, MAX; иконки по центру.

   Скругления — одна система:
   --td-r  (22) — вложенный блок: баннер, строки мессенджеров;
   панель = --td-r + --td-pad (30) — концентрично;
   кнопка = --td-r - её отступ (12); круглые элементы — половина высоты.
   ========================================================= */

.td-panel {
  --td-ease: cubic-bezier(.4, 0, .2, 1);
  --td-dur: .36s;

  --td-w: 244px;                  /* ширина в развёрнутом виде */
  --td-icon: 44px;                /* иконка в свёрнутом виде */
  --td-pad: 12px;                 /* внутренний отступ панели */
  --td-r: 22px;                   /* радиус вложенного блока */

  --td-ink: #1d1d1f;
  --td-mute: #5f666c;
  --td-line: #eceff1;
  --td-fill: #f4f6f8;
  --td-petrol: #0e7fa6;
  --td-petrol-dk: #064e6a;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;

  box-sizing: border-box;
  width: var(--td-w);
  padding: 8px;

  font-family: inherit;
  line-height: 1.2;
  color: var(--td-ink);
  -webkit-tap-highlight-color: transparent;

  background: #fff;
  /* радиус панели один в обоих состояниях: 30 = половина ширины свёрнутой плашки */
  border-radius: 30px;
  /* содержимое имеет постоянную ширину и при сужении панели просто обрезается —
     так текст не переверстывается и высота не дёргается */
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(29, 29, 31, .16), 0 2px 6px rgba(29, 29, 31, .07);

  transition:
    width var(--td-dur) var(--td-ease),
    padding var(--td-dur) var(--td-ease);
}

.td-panel * ,
.td-panel *::before,
.td-panel *::after { box-sizing: border-box; }

.td-panel:not(.is-collapsed) { padding: var(--td-pad); }

.td-panel.is-collapsed {
  width: calc(var(--td-icon) + 16px);            /* 44 + 8 + 8 = 60 */
}

/* ===== ПЛАШКА «СВЕРНУТЬ» ===== */

.td-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  width: 100%;
  height: 26px;
  padding: 0 2px;
  margin-bottom: 10px;

  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--td-mute);

  background: none;
  border: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.is-collapsed .td-toggle {
  justify-content: center;
  height: 30px;
  margin-bottom: 6px;
}

.td-toggle__label {
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: max-width var(--td-dur) var(--td-ease), opacity .2s ease .1s;
}

.is-collapsed .td-toggle__label {
  max-width: 0;
  opacity: 0;
  transition: max-width var(--td-dur) var(--td-ease), opacity .1s ease;
}

/* круг с шевроном: развёрнуто «›», свёрнуто «‹» */
.td-toggle__chev {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 13px;
  background: #f2f4f6;
  transition: background .15s ease;
}

.is-collapsed .td-toggle__chev { background: none; }
.td-toggle:hover .td-toggle__chev { background: #e8ebee; }

.td-toggle__chev::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--td-ink);
  border-right: 2px solid var(--td-ink);
  transform: rotate(45deg) translateX(-1px);
  transition: transform var(--td-dur) var(--td-ease);
}

.is-collapsed .td-toggle__chev::before {
  width: 8px;
  height: 8px;
  transform: rotate(-135deg) translateX(-1px);
}

/* ===== СЕКЦИИ ===== */

.td-section {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows var(--td-dur) var(--td-ease),
    opacity .2s ease;
}

.td-section__inner {
  min-height: 0;
  overflow: hidden;
}

/* карточка и плашка всегда своей ширины — никакой переверстки во время анимации */
.td-card { width: calc(var(--td-w) - var(--td-pad) * 2); }

.td-section--dock,
.is-collapsed .td-section--card {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.is-collapsed .td-section--dock {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}

/* ===== БАННЕР «ДИЗАЙНЕРАМ» ===== */

.td-promo {
  position: relative;
  display: block;
  padding: 14px;
  overflow: hidden;
  text-decoration: none;
  /* петрольный градиент — он же фолбэк, если фото не загрузилось */
  background: linear-gradient(160deg, var(--td-petrol), var(--td-petrol-dk));
  border-radius: var(--td-r);
}

.td-promo__bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 1;
}

.td-promo__bg::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* пока фото не загрузилось — только градиент баннера, без тёмной вуали */
.td-promo__bg:not(.is-ready) { opacity: 0; }
.td-promo__bg { transition: opacity .3s ease; }

.td-promo__in { position: relative; display: block; }

.td-promo__mark { display: block; width: auto; height: 20px; }

.td-promo__title {
  display: block;
  margin-top: 11px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: #fff;
}

.td-promo__text {
  display: block;
  margin-top: 7px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  text-wrap: pretty;
}

/* кнопка: отступы слева/справа/снизу одинаковые (14 px баннера),
   радиус 12 = радиус баннера минус его отступ */
.td-promo__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  height: 42px;
  margin-top: 14px;
  padding: 0 6px 0 14px;

  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: #065775;

  background: #fff;
  border-radius: 12px;
  transition: background .15s ease;
}

.td-promo:hover .td-promo__cta { background: #eef4f7; }

.td-promo__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  font-size: 14px;
  font-style: normal;
  color: #fff;
  background: var(--td-petrol);
  border-radius: 8px;
}

/* ===== МЕССЕНДЖЕРЫ ===== */

.td-hr { height: 1px; margin: 14px 4px 12px; background: var(--td-line); }

.td-kicker {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--td-ink);
}

.td-channels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 11px;
}

.td-ch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  text-decoration: none;
  background: var(--td-fill);
  border-radius: calc(var(--td-r) - 5px);
  transition: background .15s ease;
}

.td-ch:hover { background: #eaeef2; }

.td-ch img {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 11px;
}

.td-ch span {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--td-ink);
}

/* ===== СВЁРНУТО: ЗНАК + МЕССЕНДЖЕРЫ ===== */

.td-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: var(--td-icon);
  min-width: var(--td-icon);
}

.td-dock__hr { width: 28px; height: 1px; background: #e7eaed; }

.td-dock a {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--td-icon);
  height: var(--td-icon);
  border-radius: 15px;                 /* как на макете: 44 px иконка — 15 px радиус */
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s ease;
}

.td-dock a:hover { opacity: .88; }

.td-dock a img {
  display: block;
  width: var(--td-icon);
  height: var(--td-icon);
  border-radius: 15px;
}

.td-dock a.td-dock__mark { background: linear-gradient(160deg, var(--td-petrol), var(--td-petrol-dk)); }

.td-dock a.td-dock__mark img {
  width: auto;
  height: 20px;
  border-radius: 0;
}

/* ===== FOCUS ===== */

.td-panel a,
.td-panel button,
.td-panel a:focus,
.td-panel button:focus { outline: none; box-shadow: none; }

.td-toggle:focus-visible,
.td-promo:focus-visible,
.td-ch:focus-visible,
.td-dock a:focus-visible {
  outline: 2px solid var(--td-petrol);
  outline-offset: 2px;
}

/* ===== БЕЗ АНИМАЦИИ ===== */

.td-noanim, .td-noanim * { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .td-panel, .td-panel * { transition: none !important; }
}

/* ===== НИЗКИЕ ОКНА ===== */

/* панель не может закрыть больше 78% высоты окна — внутри прокрутка */
@media (max-height: 700px) {
  .td-panel:not(.is-collapsed) .td-section--card .td-section__inner {
    max-height: calc(78vh - 60px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

/* ===== ТЕЛЕФОН ===== */

@media (max-width: 768px) {
  .td-panel {
    --td-w: min(252px, calc(100vw - 32px));
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .td-panel:not(.is-collapsed) .td-section--card .td-section__inner {
    max-height: 70svh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
