/* Assist Caps. Everything is prefixed cc-assist-caps- and lives in the component's shadow root.
   Colors use the site's variables with the same values as fallbacks. Type inherits Die Grotesk from the page. */

:host {
  display: block;
}

.cc-assist-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;
}

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

.cc-assist-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-assist-caps-card:hover {
  background-color: #f5f6ff; /* tint of Mist, same as the Slack Agent cards */
}

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

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

.cc-assist-caps-art {
  position: relative;
  display: block;
  width: 389px;
  max-width: 100%;
  height: 188px;
  margin: 0 auto;
}

.cc-assist-caps-d {
  fill: none;
  stroke: var(--surface--surface-brand, #5b0eff);
  stroke-width: 1;
}

.cc-assist-caps-f {
  fill: var(--surface--surface-brand, #5b0eff);
  stroke: none;
  font-family: "Geist Mono", "Geistmono Variablefont Wght", ui-monospace, monospace;
}

/* Draw-in. "cc-assist-caps-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. "cc-assist-caps-is-in" is added when the card scrolls into view. */
.cc-assist-caps-card.cc-assist-caps-is-armed .cc-assist-caps-d {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

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

.cc-assist-caps-card.cc-assist-caps-is-armed.cc-assist-caps-is-in .cc-assist-caps-d {
  animation: cc-assist-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-assist-caps-card.cc-assist-caps-is-armed.cc-assist-caps-is-in .cc-assist-caps-f {
  animation: cc-assist-caps-fade 0.35s ease forwards;
  animation-delay: calc(var(--col, 0) * 220ms + var(--i, 0) * 45ms + 0.3s);
}

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

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

/* Back: example conversation, over the plate */
.cc-assist-caps-back {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  background-color: var(--white, #fff);
  font-family: "IBM Plex Sans", system-ui, sans-serif; /* product UI font, as in the Assist Demo */
  letter-spacing: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

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

.cc-assist-caps-ask {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #f6f6f6;
  color: #121212;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
}

.cc-assist-caps-reply {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px;
}

.cc-assist-caps-agent {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #121212;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}

.cc-assist-caps-agent svg {
  flex: none;
  color: var(--surface--surface-brand, #5b0eff);
}

.cc-assist-caps-answer {
  margin: 0;
  color: #121212;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
}

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

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

.cc-assist-caps-body {
  margin: 0;
  color: var(--color--neutral--600, #484848);
  font-size: 16px;
  line-height: 24px;
  font-weight: 300;
}

.cc-assist-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: 22px;
  font-weight: 500;
  letter-spacing: inherit;
  cursor: pointer;
}

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

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

@media (max-width: 767px) {
  .cc-assist-caps-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cc-assist-caps-title {
    font-size: 20px;
    line-height: 26px;
  }
}

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

