/* Dankon Watch v66: Telegram publication card generator. */

.editor-footer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.telegram-card-open-button {
  color: #f0c8ca;
  border-color: rgba(232, 59, 63, 0.38);
  background: rgba(232, 59, 63, 0.08);
}

.telegram-card-open-button:hover,
.telegram-card-open-button:focus-visible {
  color: #fff;
  border-color: rgba(232, 59, 63, 0.65);
  background: rgba(232, 59, 63, 0.16);
}

.telegram-card-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
  color: #f7f7fa;
  background: rgba(5, 6, 9, 0.84);
  backdrop-filter: blur(10px);
}

.telegram-card-dialog {
  width: min(100%, 720px);
  max-height: calc(100dvh - 44px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #393c46;
  border-radius: 22px;
  background: #191b22;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.telegram-card-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid #343741;
}

.telegram-card-head span {
  display: block;
  margin-bottom: 4px;
  color: #9c9faa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.telegram-card-head h2 {
  margin: 0;
  color: #fff;
  font-size: 21px;
  line-height: 1.2;
}

.telegram-card-close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid #424550;
  border-radius: 11px;
  color: #c7c9d0;
  background: #22242c;
  font: 300 29px/1 Arial, sans-serif;
  cursor: pointer;
}

.telegram-card-close:hover,
.telegram-card-close:focus-visible {
  color: #fff;
  border-color: #616571;
  outline: 0;
}

.telegram-card-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding: 20px;
}

.telegram-card-preview-shell {
  position: relative;
  width: min(100%, 472px);
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #393c46;
  border-radius: 16px;
  background:
    radial-gradient(circle at 15% 15%, rgba(232, 59, 63, 0.18), transparent 44%),
    #101116;
}

.telegram-card-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #0b0c10;
}

.telegram-card-loading,
.telegram-card-error {
  width: min(82%, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  text-align: center;
}

.telegram-card-loading[hidden],
.telegram-card-error[hidden],
.telegram-card-preview[hidden],
.telegram-card-actions[hidden],
.telegram-card-share[hidden] {
  display: none !important;
}

.telegram-card-loading strong,
.telegram-card-error strong {
  font-size: 15px;
}

.telegram-card-loading small,
.telegram-card-error span {
  color: #9296a2;
  font-size: 12px;
  line-height: 1.5;
}

.telegram-card-loader {
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-top-color: #e83b3f;
  border-radius: 50%;
  animation: telegram-card-spin 0.8s linear infinite;
}

.telegram-card-error button {
  min-height: 38px;
  margin-top: 8px;
  padding: 0 18px;
  border: 1px solid rgba(232, 59, 63, 0.55);
  border-radius: 9px;
  color: #fff;
  background: rgba(232, 59, 63, 0.16);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.telegram-card-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid #343741;
  background: #191b22;
}

.telegram-card-actions button {
  min-height: 43px;
  justify-content: center;
}

.telegram-card-copy.is-success {
  color: #bfeaca;
  border-color: rgba(78, 191, 112, 0.5);
  background: rgba(78, 191, 112, 0.12);
}

@keyframes telegram-card-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 700px) {
  .editor-footer-tools {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-footer-tools button {
    width: 100%;
    justify-content: center;
  }

  .telegram-card-backdrop {
    align-items: end;
    padding: 0;
  }

  .telegram-card-dialog {
    width: 100%;
    max-height: 100dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .telegram-card-head {
    padding: 15px 16px;
  }

  .telegram-card-head h2 {
    font-size: 19px;
  }

  .telegram-card-body {
    padding: 14px;
  }

  .telegram-card-preview-shell {
    width: min(100%, 390px);
  }

  .telegram-card-actions {
    grid-template-columns: 1fr;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .editor-footer-tools {
    grid-template-columns: 1fr;
  }

  .telegram-card-preview-shell {
    width: min(100%, 330px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .telegram-card-loader {
    animation: none;
    border-color: rgba(232, 59, 63, 0.55);
  }
}
