/*
 * Ask LexForge — shared widget styles for the five marketing pages.
 *
 * The panel keeps its dark surface while the pages around it are paper, so it
 * sets its own light ink rather than inheriting the page's dark body text.
 * Moved here from home-redesign.css when the widget stopped being homepage-only.
 */

.home-chat {
  position: fixed;
  right: 28px;
  bottom: 100px;
  z-index: 45;
  display: flex;
  width: 372px;
  height: min(600px, calc(100vh - 140px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(236, 229, 216, .18);
  border-radius: 8px;
  background: var(--mkt-raised);
  color: var(--mkt-ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
  opacity: 1;
  transform: none;
  transform-origin: bottom right;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}

.home-chat[hidden] {
  display: none;
}

.home-chat.is-leaving {
  opacity: 0;
  transform: translateY(8px) scale(.97);
  pointer-events: none;
}

@starting-style {
  .home-chat:not([hidden]) {
    opacity: 0;
    transform: translateY(8px) scale(.97);
  }
}

.home-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(236, 229, 216, .1);
}

.home-chat-header > div {
  display: flex;
  flex-direction: column;
}

.home-chat-header strong {
  font-family: "Newsreader", Georgia, serif;
  font-size: 18px;
  font-weight: 500;
}

.home-chat-header span {
  color: rgba(236, 229, 216, .68);
  font-size: 11px;
}

.home-chat-header button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: rgba(236, 229, 216, .62);
  font-size: 22px;
  cursor: pointer;
}

.home-chat-transcript {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.home-chat-message {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
}

.home-chat-message.is-assistant {
  align-self: flex-start;
  background: rgba(236, 229, 216, .08);
}

.home-chat-message.is-user {
  align-self: flex-end;
  background: var(--mkt-accent);
  color: var(--mkt-bg);
}

.home-chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 12px;
}

.home-chat-starters button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(236, 229, 216, .16);
  border-radius: 99px;
  background: transparent;
  color: rgba(236, 229, 216, .74);
  font-size: 11px;
  cursor: pointer;
}

.home-chat-starters button:hover,
.home-chat-starters button:focus-visible {
  border-color: var(--mkt-accent);
  color: var(--mkt-ink);
}

.home-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 16px 8px;
  border-top: 1px solid rgba(236, 229, 216, .1);
}

.home-chat-form input {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(236, 229, 216, .18);
  border-radius: 3px;
  background: var(--mkt-bg);
  color: var(--mkt-ink);
}

.home-chat-form button {
  padding: 10px 16px;
  border: 0;
  border-radius: 3px;
  background: var(--mkt-accent);
  color: var(--mkt-bg);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.home-chat-status {
  color: rgba(236, 229, 216, .66);
  font-size: 11px;
}

.home-chat-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 46;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mkt-accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: transform .15s var(--ease-out), background-color .15s ease;
}

body.has-cookie-consent .home-chat,
body.has-cookie-consent .home-chat-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .home-chat-launcher:hover {
    background: var(--mkt-accent-hover);
    transform: scale(1.07);
  }
}

/* -------------------------------------------------------- answer extras */

.ask-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  max-width: 84%;
}

.ask-link {
  padding: 6px 11px;
  border: 1px solid rgba(201, 168, 106, .45);
  border-radius: 3px;
  color: var(--mkt-accent);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}

.ask-link:hover,
.ask-link:focus-visible {
  border-color: var(--mkt-accent);
  background: rgba(201, 168, 106, .12);
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  align-self: flex-start;
  max-width: 96%;
}

.ask-chips-label {
  width: 100%;
  color: rgba(236, 229, 216, .5);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ask-chip {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(236, 229, 216, .16);
  border-radius: 99px;
  background: transparent;
  color: rgba(236, 229, 216, .78);
  font-size: 11.5px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.ask-chip:hover,
.ask-chip:focus-visible {
  border-color: var(--mkt-accent);
  color: var(--mkt-ink);
}

.ask-chip.is-browse {
  border-color: rgba(201, 168, 106, .45);
  color: var(--mkt-accent);
  font-weight: 600;
}

/* ------------------------------------------------------------- browsing */

.ask-browse {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: stretch;
  padding: 4px 0;
}

.ask-browse-group {
  border: 1px solid rgba(236, 229, 216, .12);
  border-radius: 4px;
  background: rgba(236, 229, 216, .04);
}

.ask-browse-group summary {
  padding: 9px 11px;
  color: rgba(236, 229, 216, .82);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ask-browse-list {
  display: flex;
  flex-direction: column;
  padding: 0 6px 6px;
}

.ask-browse-item {
  padding: 8px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: rgba(236, 229, 216, .74);
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.ask-browse-item:hover,
.ask-browse-item:focus-visible {
  background: rgba(201, 168, 106, .14);
  color: var(--mkt-ink);
}

/* ---------------------------------------------------------- suggestions */

.ask-suggestions {
  display: flex;
  max-height: 168px;
  flex-direction: column;
  padding: 6px;
  border-top: 1px solid rgba(236, 229, 216, .1);
  background: rgba(236, 229, 216, .04);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ask-suggestions[hidden] {
  display: none;
}

.ask-suggestion {
  padding: 8px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: rgba(236, 229, 216, .78);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.ask-suggestion:hover,
.ask-suggestion:focus-visible {
  background: rgba(201, 168, 106, .16);
  color: var(--mkt-ink);
}

/* --------------------------------------------------------------- footer */

.home-chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 12px;
}

.ask-browse-button {
  padding: 5px 10px;
  border: 1px solid rgba(236, 229, 216, .18);
  border-radius: 99px;
  background: transparent;
  color: rgba(236, 229, 216, .74);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.ask-browse-button:hover,
.ask-browse-button:focus-visible {
  border-color: var(--mkt-accent);
  color: var(--mkt-ink);
}

/* ------------------------------------------------------------- a11y/motion */

.home-chat :focus-visible {
  outline: 2px solid var(--mkt-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .home-chat,
  .home-chat.is-leaving {
    transform: none !important;
    transition: none !important;
  }

  .home-chat-launcher {
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .home-chat {
    right: 12px;
    left: 12px;
    width: auto;
    height: min(560px, calc(100vh - 120px));
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .home-chat-launcher {
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
}
