/* AI assistants: the homepage section (#ai-assistants) and its popup card
   ([data-ai-popup]), plus the extras on ai-assistants.html. Everything else on
   that page reuses the guide, process, FAQ and contact-section styles. */

/* Homepage section */
.ai-home__grid {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
}

.ai-home__card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 24px 22px 26px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--cream);
  box-shadow: var(--shadow-small);
}

.ai-home__card:nth-child(2) {
  box-shadow: 4px 4px 0 var(--coral);
}

.ai-home__card:nth-child(4) {
  box-shadow: 4px 4px 0 var(--lime);
}

.ai-home__card h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.15;
}

.ai-home__card p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.ai-home__icon,
.ai-assistant-card__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  color: var(--ink);
}

.ai-home__icon svg,
.ai-assistant-card__icon svg {
  width: 22px;
  height: 22px;
}

.ai-home__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  margin-top: 34px;
}

.ai-home__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1080px) {
  .ai-home__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .ai-home__grid {
    grid-template-columns: 1fr;
  }
}

/* ai-assistants.html: five assistant cards, the fifth across the full width */
.ai-assistant-card__icon {
  margin-bottom: 18px;
  border-color: var(--cream);
}

.ai-assistants__grid .guide-work-card:nth-child(3) {
  box-shadow: 6px 6px 0 var(--sand);
}

.ai-assistants__grid .ai-assistant-card--other {
  grid-column: 1 / -1;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.ai-assistant-card--other .ai-assistant-card__icon {
  background: var(--lime);
}

.ai-assistant-card--other > p:not(.guide-work-type) {
  max-width: 760px;
  margin-bottom: 22px;
}

@media (max-width: 680px) {
  .ai-assistants__grid {
    grid-template-columns: 1fr;
  }
}

/* Homepage popup card */
.ai-popup {
  position: fixed;
  z-index: 2900;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: max(20px, env(safe-area-inset-left));
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 40px));
  padding: 20px 22px 22px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--coral);
  color: var(--cream);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.ai-popup[hidden] {
  display: none;
}

.ai-popup.is-visible {
  opacity: 1;
  transform: none;
}

.ai-popup__eyebrow {
  margin: 0;
  color: var(--lime);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.ai-popup__title {
  margin: 0;
  padding-right: 28px;
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.15;
}

.ai-popup__text {
  margin: 0 0 6px;
  color: #dce2ed;
  font-size: 0.86rem;
}

.ai-popup__button {
  justify-self: start;
}

.ai-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.ai-popup__close:hover {
  background: rgb(255 250 241 / 12%);
}

.ai-popup__close:focus-visible,
.ai-popup__button:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}

/* Phones: under the sticky header, so it never sits on the chat button or the
   cookie banner at the bottom of the screen. */
@media (max-width: 760px) {
  .ai-popup {
    top: var(--ai-popup-top, 78px);
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
    padding: 16px 18px 18px;
    transform: translateY(-14px);
  }

  .ai-popup__title {
    font-size: 1.15rem;
  }

  /* Keep it to a title and a button, so it covers as little as possible. */
  .ai-popup__text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-popup {
    transform: none;
    transition: none;
  }
}

@media print {
  .ai-popup {
    display: none;
  }
}
