/* Кирпичи страниц шаблонов поверх integration-base.css и crm-integrations.css: живая схема, кнопки в
   диалоге, каталог. Героя и остальные блоки страницы верстает рутина — своими классами в <style> страницы. */
.template-page .template-frame {
  --frame-height: 640px;
  position: relative;
  margin: 40px 0 32px;
  border: 1px solid #dce0e8;
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(180deg, #f6f7fb, #eceef4);
  box-shadow: 0 24px 60px #151a2614;
}
.template-page .template-frame iframe {
  display: block;
  width: 100%;
  height: var(--frame-height);
  border: 0;
  border-radius: 8px;
  background: var(--paper);
}
.template-page .template-buttons {
  display: grid;
  gap: 6px;
  max-width: 78%;
  margin: -8px 0 17px auto;
}
.template-page .template-buttons span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: #2f5dae;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.template-page .template-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.template-page .template-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.template-page .template-card:hover {
  border-color: #b9c6df;
  box-shadow: 0 12px 30px #151a260f;
}
.template-page .template-card strong {
  font-size: 20px;
  line-height: 1.25;
}
.template-page .template-card span:not(.template-card-channel):not(.text-link) {
  color: var(--muted);
}
.template-page .template-card-cover {
  display: block;
  width: calc(100% + 48px);
  height: auto;
  margin: -24px -24px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: #f6f7fb;
}
.template-page .template-related-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.template-page .template-card .text-link {
  margin-top: auto;
}
.template-page .template-card-channel {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--channel);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 850px) {
  .template-page .template-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .template-page .template-frame {
    --frame-height: 520px;
    padding: 6px;
  }
}

/* Переписка в герое: окно мессенджера на подложке цвета канала, реплики появляются по очереди. */
.template-page .tpl-chat-wrap {
  position: relative;
  margin: 0;
  padding: 28px 0 0 28px;
}
.template-page .tpl-chat-wrap::before {
  content: "";
  position: absolute;
  inset: 0 28px 36px 0;
  border-radius: 28px;
  background: linear-gradient(140deg, var(--channel), #ffffff00 85%), var(--highlight);
  transform: rotate(-2.5deg);
}
.template-page .tpl-chat-caption {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.template-page .tpl-chat {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #f4f5f9;
  box-shadow: 0 30px 60px #151a261f;
}
.template-page .tpl-chat-top {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.template-page .tpl-chat-top strong {
  display: block;
  font-size: 15px;
}
.template-page .tpl-chat-top div > span {
  font-size: 12px;
  color: #2f9e5b;
}
.template-page .tpl-chat-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #376cc3;
  color: #fff;
  font-weight: 700;
}
.template-page .tpl-chat-feed {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  max-height: 420px;
  margin: 0;
  padding: 18px;
  list-style: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #0000 0, #000 56px);
  mask-image: linear-gradient(180deg, #0000 0, #000 56px);
}
.template-page .tpl-chat-line {
  display: grid;
  gap: 6px;
  max-width: 84%;
  animation: tpl-chat-in 0.45s ease-out both;
  animation-delay: calc(var(--step) * 1.1s + 0.3s);
}
.template-page .tpl-chat-line.is-user {
  align-self: flex-end;
}
.template-page .tpl-chat-bubble {
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 1px 0 #0000000d;
}
.template-page .tpl-chat-line.is-user .tpl-chat-bubble {
  border-radius: 16px 16px 4px 16px;
  background: #376cc3;
  color: #fff;
}
.template-page .tpl-chat-buttons {
  display: grid;
  gap: 6px;
  margin: 0;
}
.template-page .tpl-chat-buttons span {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--paper);
  color: #2f5dae;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 1px 0 #0000000d;
}
.template-page .tpl-chat-buttons span.is-pressed {
  background: #376cc3;
  color: #fff;
  animation: tpl-chat-press 0.3s ease-out both;
  animation-delay: calc(var(--step) * 1.1s + 1.1s);
}
@keyframes tpl-chat-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes tpl-chat-press {
  from { background: var(--paper); color: #2f5dae; transform: scale(1); }
  50% { transform: scale(0.96); }
  to { background: #376cc3; color: #fff; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .template-page .tpl-chat-line,
  .template-page .tpl-chat-buttons span.is-pressed {
    animation: none;
  }
}
@media (max-width: 850px) {
  .template-page .tpl-chat-wrap {
    padding: 18px 0 0 12px;
  }
  .template-page .tpl-chat-wrap::before {
    inset: 0 12px 24px 0;
  }
  .template-page .tpl-chat-feed {
    max-height: 360px;
  }
}
