/* Slack Caps. Every class is prefixed cc-slack-caps- and lives in the component's shadow root (CC4).
   Values match the live /ai-agents/slack cards. Type inherits Die Grotesk from the page; the example
   thread uses Slack's own font stack, like the Slack demo above it. No external fonts or requests (CC5). */

:host {
  display: block;
}

.cc-slack-caps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  font-family: inherit;
  letter-spacing: inherit;
  color: var(--surface, #121212);
  text-align: left;
  line-height: 1.5;
}

.cc-slack-caps-grid *,
.cc-slack-caps-grid *::before,
.cc-slack-caps-grid *::after {
  box-sizing: border-box;
}

.cc-slack-caps-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--white, #fff);
  border: 1px solid var(--color--neutral--400, #dfdfdf);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cc-slack-caps-card:hover {
  background-color: #f5f6ff;
}

/* Front: plate + line art */
.cc-slack-caps-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 188px;
  overflow: hidden;
  border-bottom: 1px solid var(--color--neutral--400, #dfdfdf);
  background-color: var(--color--brand--blueprint-1, #dbe1ff);
}

.cc-slack-caps-plate {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cc-slack-caps-art {
  position: relative;
  display: block;
  flex: none;
  width: 389px;
  max-width: 100%;
  height: 188px;
}

.cc-slack-caps-d {
  fill: none;
  stroke: var(--surface--surface-brand, #5b0eff);
  stroke-width: 1;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

/* Draw-in. "is-armed" is only added by the script, to cards still below the fold, so the art is fully
   drawn when the script doesn't run. "is-in" is added when the card scrolls into view. */
.cc-slack-caps-is-armed .cc-slack-caps-d {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.cc-slack-caps-is-armed .cc-slack-caps-f {
  opacity: 0;
}

.cc-slack-caps-is-armed.cc-slack-caps-is-in .cc-slack-caps-d {
  animation: cc-slack-caps-draw 0.7s cubic-bezier(0.3, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--col, 0) * 220ms + var(--i, 0) * 45ms);
}

.cc-slack-caps-is-armed.cc-slack-caps-is-in .cc-slack-caps-f {
  animation: cc-slack-caps-fade 0.35s ease forwards;
  animation-delay: calc(var(--col, 0) * 220ms + var(--i, 0) * 45ms + 0.3s);
}

@keyframes cc-slack-caps-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes cc-slack-caps-fade {
  to {
    opacity: 1;
  }
}

/* Back: example Slack thread, over the plate */
.cc-slack-caps-back {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  background-color: #fff;
  font-family: Slack-Lato, Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

.cc-slack-caps-is-flipped .cc-slack-caps-back {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s;
}

.cc-slack-caps-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.cc-slack-caps-msg > div {
  min-width: 0;
}

.cc-slack-caps-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
}

.cc-slack-caps-bot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #5b0eff;
  border: 1px solid #5b0eff;
  color: #fff;
}

.cc-slack-caps-bot svg {
  width: 72%;
  height: 72%;
}

.cc-slack-caps-who {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #1d1c1d;
  font-size: 13px;
  font-weight: 600;
}

.cc-slack-caps-app {
  padding: 0 3px;
  border-radius: 2px;
  background-color: #ececec;
  color: #616061;
  font-size: 8px;
  font-weight: 600;
}

.cc-slack-caps-text {
  margin: 2px 0 0;
  color: #1d1c1d;
  font-size: 13px;
  line-height: 1.45;
}

.cc-slack-caps-text b {
  font-weight: 700;
}

.cc-slack-caps-mention {
  padding: 0 2px;
  border-radius: 3px;
  background-color: #e8f5fa;
  color: #1264a3;
}

/* Copy under the plate */
.cc-slack-caps-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding: 24px 28px 28px;
}

.cc-slack-caps-title {
  margin: 0 0 8px;
  color: var(--surface, #121212);
  font-family: inherit;
  font-size: 22px;
  line-height: 30px;
  font-weight: 400;
}

.cc-slack-caps-body {
  margin: 0;
  color: var(--color--neutral--600, #484848);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
}

.cc-slack-caps-toggle {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--surface--surface-brand, #5b0eff);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: inherit;
  cursor: pointer;
}

.cc-slack-caps-toggle:focus-visible {
  outline: 2px solid var(--surface--surface-brand, #5b0eff);
  outline-offset: 4px;
}

@media (max-width: 991px) {
  .cc-slack-caps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .cc-slack-caps-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Reduced motion: no draw-in, no slide. The flip still works as an instant swap. */
@media (prefers-reduced-motion: reduce) {
  .cc-slack-caps-is-armed .cc-slack-caps-d {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }
  .cc-slack-caps-is-armed .cc-slack-caps-f {
    opacity: 1;
    animation: none;
  }
  .cc-slack-caps-card,
  .cc-slack-caps-back,
  .cc-slack-caps-is-flipped .cc-slack-caps-back {
    transition: none;
    transform: none;
  }
}

